need to get song titles of playlist from web api
#1
I did some research in the web api and found that there are no direct function to get the song titles of current playlist,the function GetPlayListContents() only returns filenames,but for a cue+(one big flac) album,it returns the same filenames,you can't get song title from file name.

I took a look into the /xbmc/lib/libGoAhead/XBMChttp.cpp file and located the xbmcGetPlayListContents() function,looks like it should look for the tag information first,if no tag presents it returns the file name,but some how it is not working properlly.
Hope some one will dig deepper into it.if this function works right,it will surelly benifit the remote control programs development.

for your quick reference,I paste the function here,it is not very long.
Code:
1707    int CXbmcHttp::xbmcGetPlayListContents(int numParas, CStdString paras[])
1708    {
1709      CStdString list="";
1710      int playList;
1711    
1712      if (numParas<1)
1713        playList=g_playlistPlayer.GetCurrentPlaylist();
1714      else
1715        playList=atoi(paras[0]);
1716      CPlayList& thePlayList = g_playlistPlayer.GetPlaylist(playList);
1717      if (thePlayList.size()==0)
1718        list=openTag+"[Empty]" ;
1719      else
1720        if (g_application.IsPlayingAudio())
1721            {
1722              for (int i=0; i< thePlayList.size(); i++) {
1723            const CPlayListItem& item=thePlayList[i];
1724                    const CMusicInfoTag* tagVal=item.GetMusicTag();
1725                if (tagVal && tagVal->GetURL()!="")
1726              list += closeTag+openTag + tagVal->GetURL();
1727                    else
1728              list += closeTag+openTag + item.GetFileName();
1729          }
1730            }
1731            else
1732              for (int i=0; i< thePlayList.size(); i++) {
1733            const CPlayListItem& item=thePlayList[i];
1734            list += closeTag+openTag + item.GetFileName();
1735          }
1736      return SetResponse(list) ;
1737    }
Reply
#2
The filename in either case here (whether it's derived from the tag or the actual playlist item) will always be the same for .cue sheet stuff.

In addition you need the start offset.

Cheers,
Jonathan
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#3
My mistake,the function is not looking for title,it just look for a URL then a file name.
But I see the function xbmcGetCurrentlyPlaying() can fetch the song title and all the tag info properlly even for a cue sheet,though it is just for the current playing song.I am thinking if the same method can be applied to the getplaylist function so the function can look for a title first then a URL then a filename.
the code is as below.
Code:
1421        else if (g_application.IsPlayingAudio())
1422        { // Audio information
1423          tmp.Format("%i",g_playlistPlayer.GetCurrentSong());
1424          output+=closeTag+openTag+"SongNo:"+tmp;  // current item # in playlist
1425          output+=closeTag+openTag+"Type"+tag+":Audio";
1426          const CMusicInfoTag* tagVal=g_infoManager.GetCurrentSongTag();
1427          if (tagVal && !tagVal->GetTitle().IsEmpty())
1428            output+=closeTag+openTag+"Title"+tag+":"+tagVal->GetTitle();
1429          if (tagVal && tagVal->GetTrackNumber())
1430          {
1431            CStdString tmp;
1432            tmp.Format("%i",(int)tagVal->GetTrackNumber());
1433            output+=closeTag+openTag+"Track"+tag+":"+tmp;
1434          }
1435          if (tagVal && !tagVal->GetArtist().IsEmpty())
1436            output+=closeTag+openTag+"Artist"+tag+":"+tagVal->GetArtist();
1437          if (tagVal && !tagVal->GetAlbum().IsEmpty())
1438            output+=closeTag+openTag+"Album"+tag+":"+tagVal->GetAlbum();
Reply
#4
Can you perhaps query the tag anyway based on the URL?

There's the infolabel stuff you may be able to tap into as well.
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply

Logout Mark Read Team Forum Stats Members Help
need to get song titles of playlist from web api0