Ejemplo n.º 1
0
        public static string ToText(IBasePlaylist playlist)
        {
            string text = "";

            switch (playlist)
            {
            case M3uPlaylist m3u:
                var m3uWriter = new M3uContent();
                text = m3uWriter.ToText(m3u);
                break;

            case PlsPlaylist pls:
                var plsWriter = new PlsContent();
                text = plsWriter.ToText(pls);
                break;

            case WplPlaylist wpl:
                var wplWriter = new WplContent();
                text = wplWriter.ToText(wpl);
                break;

            case ZplPlaylist zpl:
                var zplWriter = new ZplContent();
                text = zplWriter.ToText(zpl);
                break;

            default:
                break;
            }

            return(text);
        }
Ejemplo n.º 2
0
        public static IPlaylistParser <IBasePlaylist> GetPlaylistParser(PlaylistType playlistType)
        {
            IPlaylistParser <IBasePlaylist> playlistParser;

            switch (playlistType)
            {
            case PlaylistType.M3U:
            case PlaylistType.M3U8:
                playlistParser = new M3uContent();
                break;

            case PlaylistType.HLSMaster:
                playlistParser = new HlsMasterContent();
                break;

            case PlaylistType.HlsMedia:
                playlistParser = new HlsMediaContent();
                break;

            case PlaylistType.PLS:
                playlistParser = new PlsContent();
                break;

            case PlaylistType.WPL:
                playlistParser = new WplContent();
                break;

            case PlaylistType.ZPL:
                playlistParser = new ZplContent();
                break;

            default:
                throw new ArgumentException($"Unsupported playlist type: {playlistType}");
            }
            return(playlistParser);
        }