iTunes Play Next

General discussions about LaunchBar
Post Reply
invictus26
Rank 1
Rank 1
Posts: 28
Joined: Sun Aug 16, 2009 10:39 am

iTunes Play Next

Post by invictus26 » Sun May 08, 2016 1:15 am

Would it be possible to add an option to add a song to "Up Next" in iTunes instead of replacing the current song? It would be great to be able to queue up several songs from LaunchBar.

invictus26
Rank 1
Rank 1
Posts: 28
Joined: Sun Aug 16, 2009 10:39 am

Re: iTunes Play Next

Post by invictus26 » Tue Jul 05, 2016 7:32 pm

That's all true, but you can also manually add a song to play next, after which, it will continue with the previous queue. That's what I would like to do.

invictus26
Rank 1
Rank 1
Posts: 28
Joined: Sun Aug 16, 2009 10:39 am

Re: iTunes Play Next

Post by invictus26 » Thu Jul 07, 2016 8:35 pm

davidsmith36 wrote:To begin with Up Next, upgrade to iTunes 11 and after that view your music library. When you float your mouse over any craftsman, collection, or tune you'll see a little bolt symbol show up. Click on the bolt to uncover a rundown of moves you can make. Selecting Play Next will play that thing (collection, craftsman, or tune) next.


I thought it would be implied by the fact that I posted this in the LaunchBar forum, but I would like to add a song to the up next queue from LaunchBar. I am completely aware of how to do this from within iTunes.

neeklamy
Posts: 9
Joined: Sat Oct 31, 2015 11:33 am

Re: iTunes Play Next

Post by neeklamy » Fri Jul 08, 2016 12:33 pm

invictus26 wrote:I thought it would be implied by …


This is a copy ’n’ paste spammer, “he” isn’t responding to help anyone, just appear vaguely helpful by copying content from elsewhere, and then include a spammy link at the end. It’s been noted before: “It's a spam bot, not a real user.”

Flag as spam, I’d suggest using this reason “The reported message has the only purpose to advertise for a website or another product.”

neeklamy
Posts: 9
Joined: Sat Oct 31, 2015 11:33 am

Re: iTunes Play Next

Post by neeklamy » Fri Jul 08, 2016 1:21 pm

The problem is that all 3rd party access to iTunes has to be made through AppleScript, and then only the actions that developer has made available can be used. Unfortunately for us, there’s no actions to interact with the Up Next queue.*

There’s this slightly mad approach that one developer has created for Alfred, Workflow for iTunes Up Next, it works by making the application appear as a paired device (meant for pairing iOS devices). Maybe it could be converted to work with LaunchBar?

Ideally Apple would add the ability to access and modify the Up Next queue to iTunes scripting library. If you’ve got the time, it might be worth telling Apple through their iTunes Feedback.

*You can see all of the available actions for any application by using Apple’s Script Editor, inside the application, go to the Window → Library – LaunchBar can be scripted this was too.

invictus26
Rank 1
Rank 1
Posts: 28
Joined: Sun Aug 16, 2009 10:39 am

Re: iTunes Play Next

Post by invictus26 » Fri Jul 08, 2016 8:14 pm

Ok, I did some playing around with AppleScript. I'm not sure what LaunchBar does to play a song, but it clears out the up next queue. If I do this instead:

Code: Select all

tell application "iTunes" to play (the first track whose name is "Bohemian Rhapsody")


It will play the correct track (which LaunchBar isn't doing at the moment) but preserves the existing up next queue. Could you switch to this technique instead?

neeklamy
Posts: 9
Joined: Sat Oct 31, 2015 11:33 am

Re: iTunes Play Next

Post by neeklamy » Mon Jul 11, 2016 10:23 am

I think you’ll need to create your own playlist, there’s then the problem of trying remove played tracks. There’s another way to manipulate iTunes, but it’s very brittle, Stack Overflow – Use iTunes' Up Next function…

LaunchBar uses bundled scripts to control iTunes, for example:
/Applications/LaunchBar.app/Contents/Resources/Actions/iTunes - Play Pause.lbaction/Contents/Scripts/default.scpt

Code: Select all

-- Copyright (c) 2006-2016 Objective Development
-- http://www.obdev.at/
-- Version 5

tell application id "com.apple.iTunes"
   if player state is playing then
      pause
   else
      play
   end if
end tell
(They use Apple’s UTI reverse DNS to identify applications.)

Incidentally, Objective Development could possibly simplify that, remove the if conditional.

Code: Select all

playpause v : toggle the playing/paused state of the current track
playpause

Code: Select all

tell application id "com.apple.iTunes"
   playpause
end tell

Without Apple providing the necessary AppleScript actions, we’re really limited as to what we can do. I’m fairly sure there’s no easy answer, but you might find some inspiration over at Doug’s AppleScripts for iTunes.

Failing that, maybe a different media player would do what you’re looking for? Of course, thanks to iTunes’ dominance, there’s not much in the way of competition…

invictus26
Rank 1
Rank 1
Posts: 28
Joined: Sun Aug 16, 2009 10:39 am

Re: iTunes Play Next

Post by invictus26 » Mon Jul 11, 2016 7:51 pm

Sorry, I probably wasn't very clear. When I select a song in LaunchBar and hit enter, the current up next playlist is cleared and the selected song plays.

I've discovered that this action could be replaced with the applescript

Code: Select all

tell application "iTunes" to play (the first track whose name is "Bohemian Rhapsody")
and the up next playlist remains intact.

As far as I can tell, the behavior of hitting enter when a song is selected is not controlled by one of the actions in the LaunchBar package contents, so I'm not able to override it.

So, I'm asking if the default functionality could be changed to the applescript above.

Post Reply