Beispiel #1
0
    // TODO: need a means to check for a valid construction
    //  either by throwing an exception or by an "isValid" check
    PlayList::PlayList(int playList) throw (PlayListException) : 
      refs(1), iPlayList(playList), pPlayList(NULL)
    {
      // we do not create our own playlist, just using the ones from playlistplayer
      if (iPlayList != PLAYLIST_MUSIC &&
          iPlayList != PLAYLIST_VIDEO)
        throw PlayListException("PlayList does not exist");

      pPlayList = &g_playlistPlayer.GetPlaylist(playList);
      iPlayList = playList;
    }
Beispiel #2
0
    //! @todo need a means to check for a valid construction
    //!  either by throwing an exception or by an "isValid" check
    PlayList::PlayList(int playList) :
      iPlayList(playList), pPlayList(NULL)
    {
      // we do not create our own playlist, just using the ones from playlistplayer
      if (iPlayList != PLAYLIST_MUSIC &&
          iPlayList != PLAYLIST_VIDEO)
        throw PlayListException("PlayList does not exist");

      pPlayList = &CServiceBroker::GetPlaylistPlayer().GetPlaylist(playList);
      iPlayList = playList;
    }
Beispiel #3
0
    XBMCAddon::xbmcgui::ListItem* PlayList::operator [](long i) throw (PlayListException)
    {
      int iPlayListSize = size();

      long pos = i;
      if (pos < 0) pos += iPlayListSize;

      if (pos < 0 || pos >= iPlayListSize)
        throw PlayListException("array out of bound");

      CFileItemPtr ptr((*pPlayList)[pos]);

      return new XBMCAddon::xbmcgui::ListItem(ptr);
    }
Beispiel #4
0
    bool PlayList::load(const char* cFileName) throw (PlayListException)
    {
      CFileItem item(cFileName);
      item.SetPath(cFileName);

      if (item.IsPlayList())
      {
        // load playlist and copy al items to existing playlist

        // load a playlist like .m3u, .pls
        // first get correct factory to load playlist
        std::auto_ptr<CPlayList> pPlayList (CPlayListFactory::Create(item));
        if ( NULL != pPlayList.get())
        {
          // load it
          if (!pPlayList->Load(item.GetPath()))
            //hmmm unable to load playlist?
            return false;

          // clear current playlist
          g_playlistPlayer.ClearPlaylist(this->iPlayList);

          // add each item of the playlist to the playlistplayer
          for (int i=0; i < (int)pPlayList->size(); ++i)
          {
            CFileItemPtr playListItem =(*pPlayList)[i];
            if (playListItem->GetLabel().IsEmpty())
              playListItem->SetLabel(URIUtils::GetFileName(playListItem->GetPath()));

            this->pPlayList->Add(playListItem);
          }
        }
      }
      else
        // filename is not a valid playlist
        throw PlayListException("Not a valid playlist");

      return true;
    }