Jump to content

Spotifious: a natural Spotify controller for Alfred


Recommended Posts

Spotifious
a natural Spotify controller for Alfred
 
hero_shot.png
So, you’ve heard of Spotifious, eh? A natural Spotify controller for Alfred? Searchs Spotify, controls your music, generally rocks?
 
It’s built off a lot of other people’s work— PHPFunk and David Ferguson especially— and tries to match the functionality of Alfred’s integrated iTunes player. It’s not perfect, but it does the job. And I think it’s pretty cool.
 
Features
 
A quick rundown of its coolness:
 
A controller, not a workflow
Spotifious just feels fun to use, like a real plugin for Alfred, not a workflow. It can do in-depth, playlist-scouring searches and gives you useful information even if something goes wrong.

Not unlike the iTunes Mini Player.

 
Alfred-like
Spotifious is also especially Alfred-like. Just start typing to scour Spotify’s servers for music. Browse through artists and albums and playlists like nobody’s business and drill down through Queen’s huge anthologies with a snappy context-based search.
 
Smart
Spotifious uses Packal to make sure you always have the latest version. It gives you a heads-up about what’s going on with Spotify the moment you start it. And don’t worry about errors— we’ll handle those.
 
 
Download & Install
Latest version: v0.13.9 | Latest dev build: v0.13.9
 
Detailed instructions available on the plugin site.

  • Download this repository. (Source)
  • Open dist/spotifious.alfredworkflow by double-clicking it or dragging it into Alfred.
  • Bind the hotkey to ^⌘⏎.
  • Activate the plugin with your new hotkey, and follow the short (three step) setup process.
  • Continue on with your merry day.

How to Use
So let's assume you've downloaded and installed the workflow. Now what?

  • Press ^⌘⏎

Good! You should briefly see a loading entry, then the main menu:

loading.png
main_menu.png

You can action the song title (press ⏎) to play or pause the song, action the album or artist to search for that album or artist, or just start typing to search for cool music.

compilation.png

Once you’ve searched for something, you can continue to browse albums and arists through Spotifious. Actioning an artist will bring up a list of their albums, and actioning an album will bring up the track list.
 
Note: You can always leave a menu and go back just by pressing ⌫.

 
Development & Acknowledgements

A lot of people helped out on this:

  • vdesabou and I trade ideas a ton
  • PHPfunk and his PHP Alfred workflow inspired much of OhAlfred
  • David Ferguson helped with some iffy Alfred glitches
  • a slightly modified version of Entypo icon font face for icons.
  • and many other people mentioned in the code.

Thanks to everyone who helped, and thanks to everyone who uses my work! Oh, and thanks for reading this whole README. I hope you enjoy Spotifious!

This is a personal project. I host it on Github. It is MIT licensed, except for the icons, which are owned by Spotify and Entypo. Be cool.
 
Another download link for your convenience: latest (source)

Edited by citelao
version bump
Link to comment

Version History

  • v0.13.9: Fix crash on certain versions of PHP
  • v0.13.7: Make it work again
  • v0.13.5: Add Desktop Spotify check; play search items using a hotkey
  • v0.13.4: Return to semver; fix icon and playlist caching bugs
  • v0.13.3.2: Fix environment bug
  • v0.13.3.1: Fix playlist cache bug
  • v0.13.3: Playlists and speed and Spotify API updates
  • v0.13.2.1: Fix an install bug from the last update
  • v0.13.2: More Alfred 3 compatibility, but also some maintenance

  • v0.13.1: Compatible with Alfred 3
  • v0.13: Compatible with Spotify 1.0
  • v0.12: Compatible with Alfred Remote
  • v0.11.2: location opt-out, install tutorial, and better icons
  • v0.11.1: fixed response freezing
  • v0.11: new API, hotkeys, and notifications
  • v0.10: Location-based filtering
  • v0.9.4: actually implemented the aforementioned changes.
  • v0.9.3: more compatibility changes for PHP v5.3
  • v0.9.2: Compatibility with PHP v5.3
  • v0.9.1: Fixed no track playing bug.
  • v0.9: Added error reporting and context-based searching; restructrued app.
  • v0.81: Switched play/pause icons 
  • v0.8: Added new icons; set them as default
  • v0.7: General clean-up; added artist- and album-specific menus
  • v0.61: Hotfix UTF-8 support
  • v0.6: Added Alleyoop support
  • v0.5: Added a menu system
  • v0.1: Inital search system
Edited by citelao
new version :)
Link to comment

I like the idea but it's really slow, even by Spotify's standard. It is also not really accurate with some artists. 

This is just a opinion based on comparing it with PHPFunks workflow. I also think that his workflow is too big with features, but it is faster and more accurate than yours.

Link to comment

My workflow makes three API calls versus PHPFunk's one call. I'm considering including a narrowing option but once I clean up the code for version 0.7 it should run a little bit faster. 

 

Most of the slowness is on Alfred's end, though— I can't asynchronously load images or add results so everything has to be done before— and the problems with accuracy have to do with execution lag on Alfred's part as well.

 

I'd appreciate a DM telling me what artists are innaccurate, as I might be able to weight things a little to give better results. Let me know!

Link to comment

My workflow makes three API calls versus PHPFunk's one call. I'm considering including a narrowing option but once I clean up the code for version 0.7 it should run a little bit faster. 

 

Most of the slowness is on Alfred's end, though— I can't asynchronously load images or add results so everything has to be done before— and the problems with accuracy have to do with execution lag on Alfred's part as well.

 

I'd appreciate a DM telling me what artists are innaccurate, as I might be able to weight things a little to give better results. Let me know!

 

Alfred shouldn't be creating any sort of lag or delay. If there is a delay, it would more than likely be caused by delay in the scripts ability to produce results for Alfred.

Link to comment

Alfred shouldn't be creating any sort of lag or delay. If there is a delay, it would more than likely be caused by delay in the scripts ability to produce results for Alfred.

 

I agree; the delay is due to the slowness of the search.

 

However, if I trigger an API search with Alfred (for Spotifious, more than three characters as an argument), Alfred completes the search before starting a new one. So if I type `Death Cab for Cutie`, Alfred will search Spotify for `Dea` before repeating the search for `Death Cab for Cutie`. 

 

I'm not sure if this is the lag RBenschop was referring to, but if it is, it is partly Alfred's fault. I think some people were asking that Alfred only submit a search when the user stops typing— this is the exact use-case.

Link to comment

i have a "to listen to later" playlist with albums suggested by friends that i sometimes listen, then STAR the ones I like and REMOVE all the songs i already heard a couple of times.

 

i tried to modify a cocoalibspotify sample app to star the current track+remove from a playlist or just remove it and skip to the next track, with some stupid limitations, like that it has to be the first playlist (at the top) and has to be called "testPlaylist" until now. and because it uses cocoalibspotify you obviously need a premium account. (stores username/mail and credential(not pw!) in a plist in your library after first login, spotify says that's fine, so you don't really "see" anything of the app exept the login window at 1st launch)

 

to just star the current track without modifying a playlist, the only limitation is that you need to have a premium account

 

i don't have time anymore and no motivation to finish this thing, so if someone wants to do this, just copy this sloppy, ugly code : https://github.com/bzzbzzz/SpotifyClientSavedForLaterPlaylistControls
alfred workflow: https://www.dropbox.com/s/uap4cqne8nbopu9/Spotify%20SavedForLaterPlaylist%20alpha.alfredworkflow

Edited by fxv
Link to comment

Hi citelao, great work, like it a lot :)

 

I have a feature request: After searching for sth and hitting return, having the focus on Spotify is a nobrainer, I like that.

 

But when I just play/pause a track, I don't need the focus switching to Spotify afterwards, that kinda defeats the purpose, in my view.

 

Just my tow cents :)

Link to comment

Hi Citelao,

 

I was so fan of your workflow that I created a different version (but not aimed to replace yours), with a different approach. See here Spotify Mini Player

I've used a lot of your code, so thank you :-) . I've also "kinda" integrated your workflow in mine, so that if the user want to search in the complete Spotify catalog (instead of his playlists only), he can call yours directly from my workflow. I hope you don't mind. As I said, these 2 workflows are complementary, and I am using both all the time :-)

 

Let me know what you think of it

Cheers

Link to comment

Hi Citelao,

 

I was so fan of your workflow that I created a different version (but not aimed to replace yours), with a different approach. See here Spotify Mini Player

I've used a lot of your code, so thank you :-) . I've also "kinda" integrated your workflow in mine, so that if the user want to search in the complete Spotify catalog (instead of his playlists only), he can call yours directly from my workflow. I hope you don't mind. As I said, these 2 workflows are complementary, and I am using both all the time :-)

 

Let me know what you think of it

Cheers

 

That's really awesome! I've been working on my own menu system as well— it's almost done.

 

The local cache is an excellent idea, I've seen a lot of clamor for something like it. I'd love to try and roll the two together eventually.

Link to comment
  • 1 month later...

Version 0.8 released!

 

I like the idea but it's really slow, even by Spotify's standard. It is also not really accurate with some artists. 

This is just a opinion based on comparing it with PHPFunks workflow. I also think that his workflow is too big with features, but it is faster and more accurate than yours.

 

It should fix your issue because it no longer loads album art by default.

Link to comment

90% of the time I'm using this to toggle play/pause, but it appears this option is only available after the (now quicker) api load. Could that functionality be immediately available? Could it communicate directly to the Spotify app, or does it rely on the api?

Link to comment

90% of the time I'm using this to toggle play/pause, but it appears this option is only available after the (now quicker) api load. Could that functionality be immediately available? Could it communicate directly to the Spotify app, or does it rely on the api?

 

I actually have a couple options for this one. Currently it relies on completely local Applescript queries (the "Harnessing the API" text is default for the entire workflow and I cannot modify it based on context) to pull song info.

 

However, someone has already forked my code and done some modifications that I kinda like— typing `n` (next), `p` (previous), `t` (track), or `s` (stop) immediately shows a specific control for use.

 

Alternatively, I can include separate hotkeys that you can bind to whatever you want for next, play/pause, previous, etc.

 

Finally, I can make typing `c` show a control panel with filterable content, so `cn` would immediately display `Next` as the first item.

 

Which do you like best? I don't think altering the main menu is a good idea because those queries basically make the workflow unique.

Link to comment

If it takes a half second to load before any controls are available, I guess I'll just have to live with it (sarcasm, great work thus far). It would just be nice to hit the hotkey to bring it up, and then immediately hit Enter to toggle play/pause, rather than visually watching and waiting for the menu to appear.

 

Now that I look at it, I think you have the play/pause icons reversed. Play and pause icons usually represent what you want to happen after selected, not the current state of the player.

 

"n" and "p" controls are a good addition.

 

As for separate hotkeys, you mean something like shift+command+return (or whatever user choice) could bypass the menu and directly toggle play/pause? Shift+command+right arrow for next, left arrow for previous. That sounds pretty cool. I think I'd lean toward this.

Link to comment
  • 3 weeks later...

Now that I'm thinking of these hotkeys and arrow keys, arrow up and arrow down for thumbs up and thumbs down would by nice too.

 

I'm going to work on a hotkey + control center approach. You'll be able to choose hotkeys for previous and next track in Alfred's settings but will also be able to access the commands by typing `c` + command or just the command (`cn` or `n` for next track).

 

Unfortunately, I cannot create a workflow for thumbs up/down, as Spotify does not have an accessible app for use with AppleScript. If there are workarounds, I'm game, though.

 

Oh, and BTW, I'll switch out the icons  :D.

 

Is there a way to make it play an entire album? When I open an album it shows all the tracks and when I action a track, it just plays that track and then stops.

 

Not without a lot of work. Spotify has very poor AppleScript support so I am extremely limited in what I can do. If you want it, though, I can implement a local-queue option that basically creates it's own queue outside of Spotify (ie in a text file read by Spotifious) and queues the songs manually. Would be tricky and buggy, though.

 

If you really want thumbs up/down and queueing, I urge you to bug Spotify about it. Not only will better AppleScript support help me, but it will also help other developers create awesome Spotify apps.

Link to comment

 

Not without a lot of work. Spotify has very poor AppleScript support so I am extremely limited in what I can do. If you want it, though, I can implement a local-queue option that basically creates it's own queue outside of Spotify (ie in a text file read by Spotifious) and queues the songs manually. Would be tricky and buggy, though.

 

If you really want thumbs up/down and queueing, I urge you to bug Spotify about it. Not only will better AppleScript support help me, but it will also help other developers create awesome Spotify apps.

 

For my workflow, I ended up using my own Spotify App which I can call using applescript. Using the Spotify App API, we can do almost what we want. I'm using it to play albums, artists, add songs to a playlist, star track, etc.. The only downside is that the user needs to register for a dev account. It's not a big deal because it's free and it takes a minute though..

 

If you want to use the spotify app in your workflow, the code is all yours :-) (https://github.com/vdesabou/alfred-spotify-mini-player/tree/master/spotify-app-miniplayer)

 

 

Very nice update BTW, the speed improvement is awesome. I really think our two workflows combined are the perfect match!

 

Cheers

Link to comment
  • 3 months later...

Not without a lot of work. Spotify has very poor AppleScript support so I am extremely limited in what I can do. If you want it, though, I can implement a local-queue option that basically creates it's own queue outside of Spotify (ie in a text file read by Spotifious) and queues the songs manually. Would be tricky and buggy, though.

 

I'm no expert, but you can easily play the entire album via Applescript by using play track and the Spotify URI of the album:

 

tell application "Spotify"

   play track "spotify:album:1BQKW8puOR4ZPEgFwd5eI7"

end tell

 

Edit: In fact, you can play any Spotify URI using play track no matter if it's an artist, album, playlist or track.

Edited by zenona
Link to comment

I'm no expert, but you can easily play the entire album via Applescript by using play track and the Spotify URI of the album:

 

tell application "Spotify"

   play track "spotify:album:1BQKW8puOR4ZPEgFwd5eI7"

end tell

 

Edit: In fact, you can play any Spotify URI using play track no matter if it's an artist, album, playlist or track.

 

Wow— that is really helpful, as well as [the additional applescript command -- edit] "in context"— I can play any song from any album and have the correct context show up.

 

I'm trying to bring a lot of new things to Spotifious that I've been delaying for a while. I should have more news soon.

Edited by citelao
Link to comment
  • 2 weeks later...

Absolutely fantastic. I love this. No need to install any special client or sign up for a Spotify dev account. 

 

Just wondering – is it currently possible to select playlists, or will this be a feature in the future?

 

Thanks!

 

It is not possible to select playlists.

 

The overhead of selecting playlists is substantial. Vdesabou's awesome Spotify player keeps a cache of all your playlists so you can browse them, but doesn't update playlist contents on the fly. I don't want to implement such feature unless I could guarantee it would work perfectly.

 

The next version of mine will be able to queue songs, and (possibly) play playlists from Spotify URIs... we'll see.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...