Jump to content

Play Song - Quickly play songs, albums, and more from iTunes


Recommended Posts

Introduction

 

With the introduction of Alfred v2.0, the built-in iTunes mini player is now the only way to interact with my iTunes library in Alfred. However, I would prefer to quickly search for and play songs without entering the mini player first. Therefore, I created Play Song—a workflow designed to make playing songs in iTunes extremely quick and convenient.

 

Download

 

Download Play Song (latest)

 

Usage

 

Play Song enables five keywords which allow you to search for and play songs in your iTunes library.

In order for Play Song to function properly, it requires access to assistive devices. You can enable this for Alfred via the Security & Privacy pane of System Preferences.

 

Playing a song
 
To play an individual song, use the playsong keyword. Songs whose names match your query will populate the list of results. Choosing a song from the list will play that song once.
 
Playing an album
 
To play all songs from a particular album, use the playalbum keyword. Albums whose names match your query will populate the list of results. Choosing an album from the list will play all songs from that album (ordered by track number).
 
Playing an artist
 
To play all songs by a particular artist, use the playartist keyword. Artists whose names match your query will populate the list of results. Choosing a artist from the list will play all songs by that artist (grouped by album).
 
Playing a genre
 
To play all songs within a particular genre, use the playgenre keyword. Genres whose names match your query will populate the list of results. Choosing a genre from the list will play all songs within that genre (grouped by artist).
 
Playing a playlist
 
To play all songs within a particular playlist, use the playplaylist keyword. Non-empty playlists whose names match your query will populate the list of results. Choosing a playlist from the list will play all songs within that playlist (according to playlist order).

 

Support

 

If you have a bug to report or a feature to request, please submit an issue on GitHub.

 

Release Notes

 

Release notes for the workflow are also available on GitHub.

Edited by caleb531
Correcting broken link
Link to comment

This is great! Would it also be possible to search for and play artists and albums? I would love that!

 

Not sure about that. I think with AppleScript, I can only search and play songs, not artists or albums. Either way, I would prefer to have only songs show in the results for the sake of simplicity.

 

-Caleb

Link to comment

When I search for a song, the results are found (and filtered) also by album or artist.

 

Is it possible to separate it?

 

play song "x" - would look for songs named "x" only

play artist "y" - would look for artists named "y" only

play album "z" - would look for albums named "z" only

 

BTW, the best like you said is to have only songs, but I believe also only to search by the song name.

 

It's a great workflow and very useful. Congrats!

Link to comment

When I search for a song, the results are found (and filtered) also by album or artist.

 

Is it possible to separate it?

 

play song "x" - would look for songs named "x" only

play artist "y" - would look for artists named "y" only

play album "z" - would look for albums named "z" only

 

BTW, the best like you said is to have only songs, but I believe also only to search by the song name.

 

It's a great workflow and very useful. Congrats!

 

No, it's really not possible, AFAIK, AppleScript only lets you play a track, not an artist (nor an album, for that matter).

 

-Caleb

Edited by caleb531
Link to comment

Maybe I didn't explain myself very good...

 

What I meant is not to play an artist or album.

 

What is mean is that your search, is filtering also by artist and album name (and not only by song name).

 

So for example when I search for Foo Fighters, it shows me all songs from Foo Fighters (even though they have no "Foo Fighters" in their song name).

 

What I think would be nice is to search *only* the song name for whatever string you put. So if for example, there is no song named Foo Fighters, the previous example would return blank (instead of all songs from the band Foo Fighters).

 

Thanks

Link to comment

Maybe I didn't explain myself very good...

 

What I meant is not to play an artist or album.

 

What is mean is that your search, is filtering also by artist and album name (and not only by song name).

 

So for example when I search for Foo Fighters, it shows me all songs from Foo Fighters (even though they have no "Foo Fighters" in their song name).

 

What I think would be nice is to search *only* the song name for whatever string you put. So if for example, there is no song named Foo Fighters, the previous example would return blank (instead of all songs from the band Foo Fighters).

 

Thanks

I second that. In addition to "play" perhaps there can be "band" and/or "song" keywords, that they will show a list of songs by the artist or the song you're searching for, and the next step would be as with "play", to play it.

Link to comment

Anyone know if it's possible to add songs to "Play Next" or "Up Next" in iTunes. I've been screwing around with it and the only seems to be through GUI scripting (blech). Would love to queue up the next song rather than play immediately.

 

Awesome workflow though! I like it a bit more than the mini-player (no offense Alfred!).

Link to comment

Maybe I didn't explain myself very good...

 

What I meant is not to play an artist or album.

 

What is mean is that your search, is filtering also by artist and album name (and not only by song name).

 

So for example when I search for Foo Fighters, it shows me all songs from Foo Fighters (even though they have no "Foo Fighters" in their song name).

 

What I think would be nice is to search *only* the song name for whatever string you put. So if for example, there is no song named Foo Fighters, the previous example would return blank (instead of all songs from the band Foo Fighters).

 

Thanks

 

Hmm, I'm not sure I like the sound of that. I would prefer to get some results as opposed to no results, as long as the results maintain their relevance (in which case, they usually will). Besides, I would imagine that iTunes orders songs with titles matching the query above songs with artists matching the query (if that makes sense).

 

The goal of the workflow is to make the action of playing an iTunes song as quickly and easily as possible. Therefore, I believe the app should include whichever results are relevant to the search query. Now, I realize that I could make this an option rather than the default behavior, but I would much prefer to preserve the simplicity of the workflow. Given all of the acclaim it has received in the above posts, I believe that it has accomplished its aforementioned goal, and therefore doesn't need any significant additions.

 

I second that. In addition to "play" perhaps there can be "band" and/or "song" keywords, that they will show a list of songs by the artist or the song you're searching for, and the next step would be as with "play", to play it.

 

Again, for the reasons listed above, I don't plan of adding such a feature. Even more so, I wouldn't add such a feature because it would require creating multiple "Filter" scripts, with much of the same codebase and a few minor changes. That solution is not very DRY, if you ask me.

 

-Caleb

Link to comment
  • 3 weeks later...

This addon is awesome! One question though. If you search for an album name is there any way to have results sorted by track number instead of alphabetically?

 

I'm not sure about that. The script internally uses iTunes's search function in AppleScript to find songs matching the given query. Therefore, because iTunes determines the order of its own search results, I cannot sort songs by track number without sacrificing script performance (which is important to me).

 

-Caleb

Edited by caleb531
Link to comment

I'm not sure about that. The script internally uses iTunes's search function in AppleScript to find songs matching the given query. Therefore, because iTunes determines the order of its own search results, I cannot sort songs by track number without sacrificing script performance (which is important to me).

 

-Caleb

That makes sense. Ok well it was worth at least asking. Again it works flawlessly. Thank you!

Link to comment

Great workflow, but it doesn't seem to find all songs / artists / albums.

 

For example, if I search for the album "One For The Road" by Ocean Colour Scene, which is correctly tagged in my library as shown:-

 

NFeJQ0I.png

 

Then the workflow cannot find it, either by artist or album, and reverts back to the fallback searches:-

 

RMtjE9X.png

Edited by judgejohn82
Link to comment

Great workflow, but it doesn't seem to find all songs / artists / albums.

 

For example, if I search for the album "One For The Road" by Ocean Colour Scene, which is correctly tagged in my library as shown:-

 

Then the workflow cannot find it, either by artist or album, and reverts back to the fallback searches:-

 

Okay, I pushed a new version of the plugin with a potential fix. Let me know if it works for you.

 

-Caleb

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...