caleb531 / play-song

An Alfred workflow for quickly and easily playing music in the Apple Music app
MIT License
109 stars 9 forks source link

Play song in current playlist, and continue through the playlist #33

Closed garyking closed 9 years ago

garyking commented 9 years ago

If I'm playing a playlist in iTunes, is it possible to use this workflow to play a specific song from this playlist, and once that song is done, then cede control back to iTunes and continue playing the playlist like normal?

Because right now, this workflow creates a new playlist with just the song that I chose, therefore playing it indefinitely.

caleb531 commented 9 years ago

I can see how such a feature could be potentially implemented, however I need to carefully consider the design first. In other words, I will consider your feature request, though I make no promises.

garyking commented 9 years ago

Thanks. If it helps, this workflow does the trick, but it hasn't been updated in two years and lacks almost all the features that your workflow has, except it is able to play from the current playlist.

caleb531 commented 9 years ago

@GaryKing, would you find it acceptable if I were to implement this feature such that holding down the Option key when selecting a result would do the following?

  1. Stop playback of the workflow playlist
  2. Immediately play the selected song/album/artist/etc.
  3. Play the next song in the workflow playlist (the one after the interrupted song)

As I said, implementing this behavior should be rather straightforward. @Tyilo, I would appreciate any input you have to offer on this proposed feature.

garyking commented 9 years ago

That wouldn't work for me, personally.

How I usually listen to my music is:

  1. In Alfred, iTunes browser -> select a playlist (such as instrumental music) and play it.
  2. I want to jump to a specific song in that playlist, so I open Alfred and type play <song name>, which only selects from songs in the currently playing playlist, and once that song is done, iTunes simply continues from the same playlist.

With your suggestion, based on my understanding of your phrase "workflow playlist" (meaning the playlist created by your workflow in iTunes, with the name "Alfred playlist" or something similar, if I recall), this would first require I use the workflow to create the playlist. But in fact, I use my own playlists because they are all Smart Playlists with very specific criteria that I set, so of course I'd definitely prefer using them if possible.

My preferred method would essentially be the same as manually opening iTunes, typing in the search bar, and selecting a song, which would play that song immediately, then continue from the same playlist. And it's definitely something I actually do quite frequently, about once an hour, usually to immediately play a song to pump myself up while I code.

caleb531 commented 9 years ago

Hmm, that sounds to me a rather specific use case, and therefore isn't something I would adopt as a general feature of the workflow.

Caleb

garyking commented 9 years ago

Okay that's unfortunate. I don't think it's too specific. It basically boils down to:

  1. Play a playlist in iTunes.
  2. Want to play a specific song from that playlist, so open Alfred -> Type play <song name>, then when the song is done, continue playing that playlist.
tyilo commented 9 years ago

This would basically be the same thing as selecting the song you want to play and clicking "Play Next". Unfortunately I don't think there is an easy way of adding songs to iTunes own queue using AppleScript.

The way we do it now we would have to determine all the songs that would be played after the song chosen and create a new playlist with the song you want to play and then add all the other songs in the current playlist to the new one. Then we would play the new playlist.

@GaryKing Say you were playing this playlist, were song2 is the current song:

song1
song2 <---
song3
song4
song5

You then want to play song4. I see 2 possible outcomes in the which songs is played:

1.

song1
song2
song4
song3
song4
song5

2.

song1
song2
song4
song5

Which of these were you thinking of? Or were you thinking of something different?

garyking commented 9 years ago

Based on your explanation, I think option 2 is the one I was thinking of.

But like I said, this has definitely been done before, because I'm currently using a workflow that does this, in my second post. When I choose a song to play, it doesn't add it to Up Next. It plays the song immediately, then it continues playing the playlist like before. The AppleScript they use is actually quite simple:

on run argv
    set itunes_item to item 1 in argv

    tell application "iTunes" to set playlist_list to the name of every user playlist

    if playlist_list does not contain itunes_item then
        tell application "iTunes" to play (first track of current playlist whose database ID is itunes_item)
    else
        tell application "iTunes" to play playlist itunes_item
    end if

end run
robcalcroft commented 8 years ago

I would like this functionality too