示例#1
0
        public PlayList GetPlaylist(PlayListType nPlayList)
        {
            switch (nPlayList)
            {
            case PlayListType.PLAYLIST_TVSERIES: return(_tvseriesPlayList);

            default:
                _emptyPlayList.Clear();
                return(_emptyPlayList);
            }
        }
示例#2
0
        public bool Load(PlayList incomingPlaylist, string playlistFileName)
        {
            if (playlistFileName == null)
            {
                return(false);
            }

            playlist = incomingPlaylist;
            playlist.Clear();

            XmlDocument doc = new XmlDocument();

            try
            {
                doc.Load(playlistFileName);
            }
            catch (XmlException e)
            {
                MPTVSeriesLog.Write(string.Format("Cannot Load Playlist file: {0}", playlistFileName));
                MPTVSeriesLog.Write(e.Message);
                return(false);
            }

            try
            {
                playlist.Name = Path.GetFileName(playlistFileName);
                basePath      = Path.GetDirectoryName(Path.GetFullPath(playlistFileName));

                XmlNodeList nodeList = doc.DocumentElement.SelectNodes("/Playlist/Episode");
                if (nodeList == null)
                {
                    return(false);
                }

                foreach (XmlNode node in nodeList)
                {
                    if (!AddItem(node.SelectSingleNode("ID").InnerText))
                    {
                        return(false);
                    }
                }
            }
            catch (Exception ex)
            {
                MPTVSeriesLog.Write(string.Format("exception loading playlist {0} err:{1} stack:{2}", playlistFileName, ex.Message, ex.StackTrace));
                return(false);
            }
            return(true);
        }