maddox / itunes-api

🎵 A simple server providing a RESTful service for controlling iTunes
MIT License
199 stars 45 forks source link

[Feature request] Apple Music Subscription playlist #18

Closed loretoparisi closed 8 years ago

loretoparisi commented 8 years ago

With iTunes 12.4 Apple has introduced new playlists from Apple Music subscription playlist - more details here:

subscription playlist n [inh. playlist > item] : a subscription playlist from Apple Music
elements
contains file tracks, URL tracks.

Is possible to add support for it?

maddox commented 8 years ago

Exactly what kind of support were you thinking? Subscribed playlists have always worked just like user created playlists.

loretoparisi commented 8 years ago

@maddox ok maybe I'm wrong how it works then

var GetPlaylists = function() {

    var itunes = Application('iTunes');

    var status = {};
    status.playlists = {};

    var radioTunerPlaylists = itunes.radioTunerPlaylists();
    var userPlaylists = itunes.userPlaylists();
    var subscriptionPlaylists = itunes.subscriptionPlaylists();
    var libraryPlaylists = itunes.playlists();

    for(var idx=0;idx<userPlaylists.length;idx++){
      var pl=userPlaylists[idx];
      var sTracks = pl.fileTracks();
      if(!sTracks) sTracks = [];
      console.log( "Playlist " + pl.name() + " streaming tracks " + sTracks.length );
    }

    status.playlists.radio = radioTunerPlaylists.map(function(item,index) { return { name : item.name(), count : item.tracks().length } });
    status.playlists.subscription = subscriptionPlaylists.map(function(item,index) { return { name : item.name(), count : item.URLTracks().length } });
    status.playlists.user = userPlaylists.map(function(item,index) { return { name : item.name(), count : item.tracks().length } });   return status;

  }

I have like

{
    "playlists": {
        "radio": [],
        "subscription": [],
        "user": [
            {
                "name": "Libreria",
                "count": 11836
            },
            {
                "name": "Musica",
                "count": 11825
            },
            {
                "name": "Videoclip",
                "count": 2
            }
        ]
    }
}

So I do not see any tracks for itunes.subscriptionPlaylists() Btw, If I add a AppleMusic playlist in user playlist, I can see it as part of itunes.userPlaylists().