Applescript to start iTunes radio "station"?

Discussion in 'Mac Programming' started by Honza1, Apr 23, 2014.

  1. Honza1, Apr 23, 2014
    Last edited by a moderator: Apr 24, 2014

    Honza1 macrumors member

    Joined:
    Nov 30, 2013
    Location:
    US
    #1
    Hello,

    for few days now I am banging my head on trying to create script to start iTunes radio station. Not URL station, but one of those new iTunes radio stations which one can find in Music under tab "Radio". I created my own "station" and want to start it from other program.

    Those "native" iTunes radio stations seem to look like playlists, here is what I get when I ask iTunes for information:
    ******
    Code:
    tell application "iTunes"
    	get name of current track
    		--> "Name of currently payed track iTunes selected"
    	get name of current playlist
    		--> "Name of my radio station"
    end tell
    ******
    But when I try to set the playlist and play first track, I get error:
    
    tell application "iTunes" to play (first track of playlist "Name of my radio station")
    *****
    	play track 1 of playlist "Name of my radio station"
    		--> error number -1700
    Result:
    error "iTunes got an error: Can’t make some data into the expected type." number -1700 to item
    *****
    Dictionary was not much help. It's like this relatively new component of iTunes is not yet supported by Applescript?

    Anyone ideas anyone?

    Thanks
     
  2. kryten2 macrumors 6502a

    Joined:
    Mar 17, 2012
    Location:
    Belgium
    #2
    What's the result of class of current track?

    Code:
    tell application "iTunes"
    	class of current track
    end tell
     
  3. Honza1, Apr 24, 2014
    Last edited by a moderator: Apr 24, 2014

    Honza1 thread starter macrumors member

    Joined:
    Nov 30, 2013
    Location:
    US
    #3
    Here is the result:

    Code:
    tell application "iTunes"
    	get class of current track
    		--> file track
    end tell
    Result:
    file track
    Any suggestions? Thanks...
     
  4. Partron22 macrumors 68000

    Partron22

    Joined:
    Apr 13, 2011
    Location:
    Yes
    #4
    Similar things have happened in the past. I did a bit of Applescript futzing w the radio station playlists, and came up empty. They don't seem to be enumerable or have visible properties.
     
  5. obycode macrumors newbie

    Joined:
    Aug 28, 2014
    #5
    I take it you were never able to solve this? I have been trying everything I can think of just to resume playing an iTunes Radio station but have not had any luck either.
     
  6. yalag macrumors 65816

    Joined:
    Nov 18, 2007
    #6
    Anyone find a solution to this? The closest I can do is open the url of the radio station in apple script but that leaves an annoying safari window open
     
  7. Red Menace macrumors 6502

    Joined:
    May 29, 2011
    Location:
    Littleton, Colorado, USA
    #7
    What version are you using? A ways back there was an issue if the playlist just had a single radio station in it, but that seems to have been corrected (at least as of v12.4). What I did for earlier versions was to just add a sound file to the playlist after the radio station entry (it doesn't have to be enabled).
     
  8. yalag macrumors 65816

    Joined:
    Nov 18, 2007
    #8
    How do you even add radio stations to playlists?
     
  9. Red Menace macrumors 6502

    Joined:
    May 29, 2011
    Location:
    Littleton, Colorado, USA
    #9
    Drag or use the contextual menu - the same as any other song file.
     
  10. yalag macrumors 65816

    Joined:
    Nov 18, 2007
    #10
    You can't drag or right click a radio station in apple music
     
  11. Red Menace macrumors 6502

    Joined:
    May 29, 2011
    Location:
    Littleton, Colorado, USA
    #11
    Sure you can - just add it to your library and you can treat it like any other song file.
     
  12. yalag macrumors 65816

    Joined:
    Nov 18, 2007
    #12
    The only menu you get from the station is "share station". There are no other options. You can't even add it to your library
     
  13. Red Menace macrumors 6502

    Joined:
    May 29, 2011
    Location:
    Littleton, Colorado, USA
    #13
    I'm not sure what you are talking about - the current flavor of iTunes is more interested in selling you a stream subscription from the store, but I am referring to a radio station added to iTunes as in the original topic posted 2 years ago.
     
  14. yalag macrumors 65816

    Joined:
    Nov 18, 2007
    #14
    I'm talking about radio stations from Apple Music.
     
  15. Red Menace macrumors 6502

    Joined:
    May 29, 2011
    Location:
    Littleton, Colorado, USA
    #15
    Sorry, I am referring to radio stations added to iTunes, as in the original post.
     

Share This Page