Exemplo n.º 1
0
        public void AllTests()
        {
            var simple_vod = M3U.Parse(Sample.simple_vod);

            Assert.AreEqual(simple_vod.PlayListType, "VOD");
            Assert.AreEqual(simple_vod.Medias.Last().Duration, 9);

            var format_specs = M3U.Parse(Sample.format_specs);

            Assert.AreEqual(format_specs.Medias.Last().MediaFile, "udp://225.55.55.4:1234");
            Assert.AreEqual(format_specs.Medias.Last().Title.RawTitle, "MTV");

            var sample_paste_bin = M3U.Parse(Sample.sample_paste_bin);

            Assert.AreEqual(sample_paste_bin.Medias.ElementAt(10).Attributes.TvgLogo, "http://greektv.pbworks.com/f/ANT1.png");

            var header_with_parameters = M3U.Parse(Sample.header_with_parameters);

            Assert.AreEqual(header_with_parameters.Attributes.Cache, 500);

            var iptv_sample = M3U.Parse(Sample.iptv_sample);

            Assert.AreEqual(iptv_sample.Medias.ElementAt(2).Attributes.TvgShift, "+1");

            var big_list = M3U.Parse(Sample.big_list);

            Assert.AreEqual(big_list.Medias.Count(), 902);
        }
Exemplo n.º 2
0
 static void Main(string[] args)
 {
     //var customFile = Path.Combine(@"C:\Data\Desktop", "test.m3u");
     //var customM3u = M3U.ParseFromFile(customFile);
     var simpleVodM3u       = M3U.Parse(simpleVod);
     var headerParameterM3u = M3U.Parse(headerParameter);
 }
Exemplo n.º 3
0
        public static List <Source> Deserialize(String playlistText)
        {
            var m3uPLaylist = M3U.Parse(playlistText);

            var result = new List <Source>(m3uPLaylist.Medias.Count());

            foreach (var media in m3uPLaylist.Medias)
            {
                result.Add(new Source
                {
                    Title = media.Title.InnerTitle,
                    Url   = media.MediaFile,
                });
            }

            return(result);
        }
Exemplo n.º 4
0
        public void HeaderWithParametersTest()
        {
            var m3u = M3U.Parse(Sample.header_with_parameters);

            Assert.AreEqual(m3u.Attributes.Cache, 500);
        }