Commit graph

477 commits

Author SHA1 Message Date
Paul Lietar 7632fa4712 Merge pull request #93 from serprex/master
Replace time with std::time
2016-07-31 17:40:37 -07:00
Alain Boyer 82af7a3d71 Specify suggested_latency from device info.
- Update portaudio dependency.
- Pass default_high_output_latency to ensure robust playback.
- This is the same behavior as when previously using Stream::open_default().
2016-07-23 01:39:41 +03:00
Demur Rumed 674146f52a Replace time with std::time 2016-07-17 03:25:29 +00:00
Paul Lietar 1396f9729a Allow specifying an output device. 2016-07-06 10:54:46 +01:00
Paul Lietar 4cca541339 Remove the need for a application key. 2016-07-06 08:37:41 +01:00
Paul Lietar b25585a41b Use a pure rust mDNS responder instead of relying on Avahi / dns-sd.
Fixes #33, #70
2016-07-06 02:36:01 +01:00
Paul Lietar decce02373 Be a bit less verbose 2016-07-06 02:29:50 +01:00
Paul Lietar 24471eef9b Use serde for json serialization. 2016-07-06 02:29:38 +01:00
Paul Lietar e688914082 Fix some unused import warnings. 2016-07-06 01:36:46 +01:00
Paul Lietar 4d277e5b75 stream: refactor into a reactor pattern. 2016-05-09 12:22:51 +01:00
Paul Lietar ed14c3469b track: Use a linear map to store files by format. 2016-05-04 10:03:46 +01:00
Paul Lietar c76b7b472f Workaround weird parsing bug 2016-05-04 09:56:23 +01:00
Paul Lietar dde613e0a0 player: skip unavailable tracks rather than crash
Fixes #74
2016-05-04 09:11:27 +01:00
Paul Lietar a42752af2f Update dependencies. 2016-04-24 15:40:05 +01:00
Paul Lietar f50fca02ae player: Add seek_at command for precise seeking 2016-04-24 14:48:15 +01:00
Paul Lietar 8c0a37357d Fix static app key with syntex 2016-04-24 14:47:52 +01:00
Paul Lietar a36325a46a Add a main helper to make it easier to use librespot. 2016-04-24 13:29:26 +01:00
Paul Lietar edb8a6a766 Cleanup authentication logic 2016-04-24 12:15:53 +01:00
Paul Lietar c47a1b7ec9 Remove support for password in environment variable.
This is less useful now that saved credentials work.
2016-04-24 09:56:05 +01:00
Paul Lietar f8cd09e5be Use is_err rather than pattern matching. 2016-04-24 09:54:56 +01:00
Paul Lietar 8bbed4c162 Remove unused eprintln macro and hex dump function. 2016-04-24 09:50:55 +01:00
Marcus Thiesen b0ea636179 Replace some more println with log 2016-04-23 13:35:00 +02:00
Tor Arne Vestbø e08ed545ee Use log crate instead of println
Allows more granular control over what gets logged to the console.
2016-04-23 13:35:00 +02:00
Paul Lietar b8b0f9c36e Fix seconds to milliseconds conversion in vorbis_time_tell_ms. 2016-04-23 00:09:19 +01:00
Marcus Thiesen 11e62d56d8 Use usize for pointer size 2016-03-21 10:13:28 +01:00
Marcus Thiesen 5ca2c35dbc Pulseaudio backend 2016-03-21 09:39:58 +01:00
Paul Lietar 968a39a131 Make audio backend configurable at run time. 2016-03-20 16:16:20 +00:00
Paul Lietar e6dd77fc02 Add missing file from previous commit. 2016-03-20 14:00:59 +00:00
Paul Lietar 01fa099cda Reenable Facebook authentication. 2016-03-20 13:55:20 +00:00
Paul Lietar b051bfcc5b Disable Facebook authentication for now.
It got broken when moving to the authentication subdirectory.
2016-03-17 03:45:57 +00:00
Paul Lietar 230c891df0 Print librespot version on startup. 2016-03-17 03:31:57 +00:00
Paul Lietar 0770f6ce61 Move authentication to a different directory, and make discover use hyper. 2016-03-17 03:28:28 +00:00
Paul Lietar 85903a0da5 Split cache handling to separate module.
Use it for audio keys and album covers as well.
2016-03-16 04:20:42 +00:00
Paul Lietar a7559787df facebook: Use a random, OS-assigned port instead of hardcoded 8001. 2016-03-16 00:38:05 +00:00
Paul Lietar 4b4bc2f4e1 Add Facebook based login. 2016-03-16 00:05:05 +00:00
Paul Lietar 4d712efb48 Support downloading Album Covers. 2016-03-15 00:14:30 +00:00
Paul Lietar aa1d466e92 Support building with the application key statically included in the binary. 2016-03-14 23:41:51 +00:00
Paul Lietar a5453de572 Make cache directory optional.
If the -c argument is omitted, librespot will run without a cache, and
download tracks overtime they are played.
2016-03-14 22:57:00 +00:00
Yugo Amaryl 5f5356333d Fix build by removing extra parenthesis 2016-03-14 06:00:06 +00:00
Paul Lietar 0973469120 Forgot to add some files in previous commit. 2016-03-14 00:50:42 +00:00
Paul Lietar 9274a6bfb3 Refactor audio output to make it more modular.
This makes the player less hard coded to portaudio, and easier to
experiment with different backends.
2016-03-14 00:49:21 +00:00
Paul Lietar 4b73f83c5e Save reusable credentials to disk.
After the first login, credentials may be omitted from the command line
and the stored ones will be used instead.
2016-03-13 22:35:09 +00:00
Paul Lietar 39af43728a Refactor authentication to separate protocol and token generation. 2016-03-13 20:45:31 +00:00
Paul Lietar 25bd38fd13 Resolve access point when connecting and pick a random one.
Spotify’s apresolve will return the best AP based on the user’s location.
2016-03-13 20:03:09 +00:00
Paul Lietar 60db12ee9e Add missing semicolon.
Somehow syntex allows this, so it was missed in the previous commit.
2016-03-13 15:23:56 +00:00
Paul Lietar ac5b34927f Support using tremor instead of libvorbis for audio decoding.
Tremor is a fixed point / integer only Vorbis decoder.
This should improve playback performances on embedded platforms lacking
hardware floating point support.
2016-03-13 15:15:15 +00:00
Paul Lietar d27c4ca752 Support building with rust stable, using syntex. 2016-03-07 18:22:41 +00:00
Paul Lietar de357e63c9 player: Update the position on pause/play events. 2016-02-24 00:36:19 +00:00
Paul Lietar c3c258dfaf Bump protobuf-macros version and use the simpler string literal syntax 2016-02-22 05:48:58 +00:00
Paul Lietar c700315b30 Fix a deadlock between SpircManager and Player.
The player was invoking its observers with the state locked, and the
SpircManager’s registered observer would try to lock it again.

Instead, the observers are invoked with a cloned state, and the SpircManager
avoids locking the state again.
2016-02-22 05:41:37 +00:00
Paul Lietar 95d1dfd774 Make recipient of SpircManager methods non-mut.
SpircManager has interior mutability using a Mutex. There’s no need to
make it’s methods take a mut reference.
2016-02-19 00:03:08 +00:00
Simon Persson 3ccb2e2a10 Clean up before merging. 2016-02-19 00:02:41 +01:00
Simon Persson c98ff9bd54 Make SpricManager cloneable to simplify for clients. 2016-02-17 20:53:25 +01:00
Simon Persson 906241b92e Export the current queue. 2016-02-17 20:53:25 +01:00
Simon Persson 8e0325c297 Add function for sending load comand. 2016-02-17 20:53:25 +01:00
Simon Persson 5e3404137f Add support for replacing tracks. Make a builder out of send_cmd. 2016-02-17 20:53:21 +01:00
Simon Persson 08cb429a0c Add functions for sending commands to other clients. 2016-02-17 20:45:01 +01:00
Simon Persson 677173d01b Export devices. 2016-02-17 20:45:01 +01:00
Simon Persson 5a19d38270 Refactor notify/notify_with_player_state. 2016-02-17 20:45:01 +01:00
Simon Persson 958d0c74d4 Maintain list of connected devices. 2016-02-17 20:44:54 +01:00
Paul Lietar 526c54702b Set the default volume to 100%, and add a fast path to volume control. 2016-02-05 20:54:47 +00:00
Paul Lietar 93640465dc Import librespot_protocol as protocol. 2016-01-27 10:40:00 +00:00
Paul Lietar 327bb8477e Move Session::connect to authentication.rs 2016-01-26 23:02:17 +00:00
Paul Lietar 7a1db5f5a9 Encapsulate the session data and configuration. 2016-01-26 22:34:57 +00:00
Paul Lietar 9747bbc470 Add link API. 2016-01-26 22:25:13 +00:00
Paul Lietar f822031ce3 Expose some more metadata. 2016-01-26 22:24:36 +00:00
Paul Lietar 8fed885595 Reorganize the spirc/player interaction.
Updates are now sent through a callback mechanism rather than a channel.
2016-01-20 15:52:50 +00:00
Paul Lietar 463ce97661 Remove the SpircDelegate abstraction 2016-01-20 14:11:49 +00:00
Paul Lietar 303121032d Store the volume as a u16 2016-01-20 13:55:36 +00:00
Paul Lietar c5ed04f70d Merge remote-tracking branch 'realtwister/queue' 2016-01-20 13:51:35 +00:00
Paul Lietar ac0d597e75 Ignore files which don’t have an id.
Fixes #42
2016-01-20 10:37:57 +00:00
Erik 6f962089fd added queue functionality and created load_tracks 2016-01-16 02:15:24 +01:00
Erik 4310162b88 Fixed the multiple volume vars and the calculation is a bit simplified. 2016-01-15 01:12:08 +01:00
Erik 5788da8ddc Oops, left a debug still standing.. 2016-01-14 13:13:57 +01:00
Erik 17a5bb122a Added Volume in a fishy manner by modulating stream, could maybe be optimized. 2016-01-14 13:12:01 +01:00
Erik 3c8d709ff1 Added: Next and Previous track
Bug resolved: opening a list with "dissallowed tracks" is now possible
2016-01-14 04:27:34 +01:00
Paul Lietar 7401fde7fc Update dependencies 2016-01-13 00:17:05 +00:00
Paul Lietar fd6b805bfd Fix some clippy warnings. 2016-01-02 16:48:44 +01:00
Paul Lietar 90eeed3f80 rustfmt 2016-01-02 16:20:35 +01:00
Paul Lietar 5464647164 Ignore messages from unknown channels.
It occasionally happens that messages on a channel are received before
the subscription confirmation, which would cause a panic when looking
for the subscription.

Changed to simply ignore those.
2016-01-02 15:51:05 +01:00
Paul Lietar 2c2ff16986 discovery: Truncate the AES key to 128
The computed key is 20 bytes long (SHA1 checksum), but it used for AES128.
The last 4 bytes should therefore be dropped.
2016-01-02 13:30:01 +01:00
Paul Lietar f8956166ea Add option to specify bitrate. 2016-01-02 03:30:24 +01:00
Paul Lietar 47c6d60b12 Merge branch 'env-password' of https://github.com/herrernst/librespot into master 2016-01-02 02:53:20 +01:00
Paul Lietar e35da9c90a Use discovery if username and password are not provided. 2016-01-02 02:30:03 +01:00
Paul Lietar 38351c9a87 Make dns-sd optional 2016-01-02 02:28:54 +01:00
Paul Lietar bead9daf78 Add zeroconf based authentication. 2016-01-02 00:27:08 +01:00
Paul Lietar 4806f3e85a mercury: Register subscription for all channel aliases
When subscribing to a channel, we may actually end up subscribed to other
alias channels. We must track these as well in order to redirect received
messages properly.
2016-01-02 00:02:22 +01:00
herrernst 7f8e85f90b try reading password from env variable first, so it doesn't appear in process listing 2015-12-31 11:55:56 +01:00
Jaime Rodriguez e321379501 Use canonical username when subscribing to spirc.
Uses canonical username that APWelcome message
contains once authenticated instead of username 
provided by user. SpircManager now accesses it via
its Session field. 

Fixes #15
2015-12-30 20:11:46 +01:00
Paul Lietar 525b27df98 Fix formula for the number of chunks.
It was rounding to the nearest boundary as opposed to rounding up. This
caused the last chunk to not always be downloaded.
2015-12-30 12:42:47 +01:00
Paul Lietar 654a403459 Improve handling of missing audio keys by failing the future rather than crashing. 2015-12-29 23:12:02 +01:00
Paul Lietar 8c2aa28d43 Use the correct country when checking for track availability. 2015-12-29 13:13:26 +01:00
Paul Lietar 22d586e473 Block player thread when nothing is playing. 2015-12-28 18:45:13 +01:00
Paul Lietar 17d4534260 Play an alternative track if selected one is not available. 2015-12-28 17:47:59 +01:00
Paul Lietar 4f518fc445 Get track availability and alternatives 2015-12-28 17:47:32 +01:00
Paul Lietar 5db141066a Use eventual’s futures in metadata instead of rolling our own.
For now the object cache has been removed. It may be added back later.
2015-12-28 16:53:54 +01:00
Paul Lietar 0ebe8b9e82 Fox subscription URL for spirc.
For some reason the old URL doesn’t work in new clients.
Can’t remember where it came from.
2015-12-28 01:41:29 +01:00
Paul Lietar 09e180b0e2 Remove deprecation warnings. 2015-12-28 01:29:53 +01:00
Paul Lietar 5cbd53fef2 Update dependencies, use git version of eventual. 2015-12-22 18:05:13 +01:00
Lawrence Jones 85c1925f8d Fixes compilation errors 2015-12-18 19:59:10 +00:00
Paul Lietar fe56604037 Replace GMP by num’s Bignum implementation.
This is awfully slow in debug builds, but simplifies the build process a
lot.
2015-10-20 11:23:41 +01:00
Paul Lietar 10cc523cfd Update to rust nightly 2015-10-20 11:22:08 +01:00
Paul Lietar 1399ea7c32 Remove unused subsystem module. 2015-09-01 16:53:09 +02:00
Paul Lietar 267ccbe65e Fix build on latest rust. 2015-09-01 13:20:37 +02:00
Simon Persson ef1c86df18 Make command line argument parsing more robust. 2015-07-20 16:31:59 +00:00
Paul Lietar 1d76658fdf Support playing multiple tracks in a row 2015-07-09 23:09:40 +01:00
Paul Lietar 506f3e624e Don’t crash on end of track. 2015-07-09 22:35:24 +01:00
Paul Lietar 94503e351b Remove busy waiting in SpircManager. 2015-07-09 22:04:19 +01:00
Paul Lietar 1264394838 Add a SpircDelegate abstraction. 2015-07-09 21:08:14 +01:00
Paul Lietar cdd939e88e Clean up main.rs 2015-07-09 20:08:56 +01:00
Tor Arne Vestbø 22e367214e Move SPIRC into librespot so it can be re-used by other applications 2015-07-08 23:01:15 +02:00
Tor Arne Vestbø cbd414853f Move librespot into lib.rs and let main.rs be the test binary 2015-07-08 23:01:14 +02:00
Paul Lietar e452abce43 Cache audio files to disk. 2015-07-07 22:40:31 +01:00
Paul Lietar 9ae452e22d Keep audio files cached in ram. 2015-07-03 02:23:49 +02:00
Paul Lietar 28a7db26be cache audio keys in memory 2015-07-02 23:05:47 +02:00
Paul Lietar 4fd0b37e2b Initial Spotify Connect receiver.
Supports basic play/pause. Only a single track for now.
2015-07-02 21:42:49 +02:00
Paul Lietar 2a2f227bef Refactor the whole architecture.
Use less threads, makes it much simpler to reason about.
2015-07-02 19:24:25 +02:00
Paul Lietar c1ce87dbbd spirc: Keep track of player status 2015-07-02 13:54:34 +02:00
Paul Lietar df11960946 spirc: Don’t hardcode stuff 2015-07-02 01:27:19 +02:00
Paul Lietar 45491925de Answer to basic Spirc requests. 2015-07-02 00:40:38 +02:00
Paul Lietar 7897070bb7 Add initial Spirc support. 2015-07-01 22:21:22 +02:00
Paul Lietar addc1fce22 Update protocol files. 2015-07-01 20:18:00 +02:00
Paul Lietar caf78992fb Merge AudioFile and AudioFileReader 2015-06-24 01:41:39 +01:00
Paul Lietar 4835d25370 add audio seeking support 2015-06-23 18:34:48 +01:00
Paul Lietar 7ffe996652 Lots of stuff 2015-06-23 15:38:29 +01:00
Paul Liétar 1ad62e6f18 First working version of protocol handshake.
Key exchange and authentication is functional.
Protocol definition has been moved to separate crate to speed up build time.
Various cleanups. Take login info from command line, rather than hardcoded.
2015-05-09 11:16:43 +01:00
Paul Liétar a993b60ffa Initial commit. 2015-04-25 21:32:07 +01:00