Exemple #1
0
        public async Task LoadStreamsFromDatabase()
        {
            Streams?.Clear();
            var streams = await LoadStreams();

            Streams.AddRange(streams);
        }
        /// <summary>
        /// Beendet den Empfang auf allen Quellen.
        /// </summary>
        private void RemoveAll()
        {
            // With cleanup
            try
            {
                // For all
                foreach (var stream in Streams.Values)
                {
                    try
                    {
                        // Just forward
                        stream.Dispose();
                    }
                    catch
                    {
                        // Ignore any error
                    }
                }
            }
            finally
            {
                // Reset list
                Streams.Clear();
            }

            // Shutdown parser, too
            DisableServiceParser();
        }
Exemple #3
0
        public void Dispose()
        {
            foreach (var stream in Streams)
            {
                stream.Value.Dispose();
            }

            Streams.Clear();
            UsageOrder.Clear();
        }
Exemple #4
0
        public override void DownloadAndParseData()
        {
            var data = streamDownloader.Download(DataUrl);

            var match = Regex.Match(data, "https:[^\\s:\"\\?]+\\.m3u8");

            if (match.Success)
            {
                masterUrl = match.Captures[0].Value;
                Streams.Clear();
                ParseStreams(streamDownloader.Download(masterUrl));
            }
        }
Exemple #5
0
        /// <summary>
        /// 结束直播
        /// </summary>
        public void Close()
        {
            evt_quit_.Set();
            th_.Join();

            // 通知nabo平台,停止转播
            SendStop();

            foreach (LivingcastStream s in Streams)
            {
                s.Close();
            }

            Streams.Clear();
        }
Exemple #6
0
 public void Reset()
 {
     _operations.Clear();
     _eventOperations.Clear();
     Streams.Clear();
 }
 public void Dispose()
 {
     Util.DisposeRange(Streams.Values);
     Streams.Clear();
 }
Exemple #8
0
        public virtual void DownloadAndParseData()
        {
            if (string.IsNullOrEmpty(DataUrl))
            {
                return;
            }

            string streamUrl = string.Empty;

            var data = streamDownloader.Download(BaseUrl);

            var    videoIdMatch = Regex.Match(data, @"<video data-video-id=""(.+?)""");
            string videoId      = "";

            if (videoIdMatch.Success)
            {
                videoId = videoIdMatch.Groups[1].Value;
            }


            var titleMatch = Regex.Match(data, @"<title>(.+?)<");

            if (titleMatch.Success)
            {
                Title = titleMatch.Groups[1].Value;
                if (Title.Contains("|"))
                {
                    Title = Title.Substring(0, Title.IndexOf('|') - 1);
                }
            }

            var imageMatch = Regex.Match(data, @"""thumbnailUrl"" content=""(.+?)""");

            if (imageMatch.Success)
            {
                PosterUrl   = imageMatch.Groups[1].Value;
                PosterImage = streamDownloader.DownloadImage(PosterUrl);
            }
            else
            {
                var posterMatch = Regex.Match(data, @"poster=""(.+?)""");
                if (posterMatch.Success)
                {
                    PosterUrl   = posterMatch.Groups[1].Value;
                    PosterImage = streamDownloader.DownloadImage(PosterUrl);
                }
            }

            data = streamDownloader.Download("https://api.svt.se/videoplayer-api/video/" + videoId);

            var programTitleMatch = Regex.Match(data, @"""programTitle"":""(.+?)""");

            if (programTitleMatch.Success)
            {
                ProgramTitle = programTitleMatch.Groups[1].Value;
            }

            var durationMatch = Regex.Match(data, @"""contentDuration"":(\d+)");

            if (durationMatch.Success)
            {
                Duration = int.Parse(durationMatch.Groups[1].Value);
            }

            var match = Regex.Match(data, "https:[^\\s:\"\\?]+master\\.m3u8");

            if (match.Success)
            {
                masterUrl = match.Captures[0].Value;
                Streams.Clear();
                ParseStreams(streamDownloader.Download(masterUrl));
            }
        }
Exemple #9
0
 public void EjectAll()
 {
     _operations.Clear();
     _eventOperations.Clear();
     Streams.Clear();
 }
 /// Clear and destroy an animation stream
 public void Clear(TStream stream)
 {
     Validate();
     Streams.Clear(stream);
 }
Exemple #11
0
 public void Dispose()
 {
     Streams.Clear();
     Events.Clear();
 }