parse list from another source, make file guide

This commit is contained in:
2024-09-24 19:57:07 +03:00
parent af83f6c696
commit ff78d7a062
3 changed files with 100 additions and 46 deletions
+2 -2
View File
@@ -116,11 +116,11 @@ namespace TV_Player
TopPanelTitle = _currentProgram.Name;
SourceUrlChangedEvent?.Invoke(_currentProgram.Url);
_programGuideDisposable = TVPlayerViewModel.Instance.PlaylistData.ProgramGuideInfo.Subscribe(x =>
_programGuideDisposable = TVPlayerViewModel.Instance.PlaylistData.ProgramGuideInfo.Subscribe(async x =>
{
try
{
_currentGuide = x.FirstOrDefault(p => p.Id == _currentProgram.TvgID);
_currentGuide = await TVPlayerViewModel.Instance.PlaylistData.GetGuideByProgram(_currentProgram.TvgID);
UpdateScreenInfo();
+12 -17
View File
@@ -1,4 +1,5 @@
using System.Reactive.Subjects;
using System.Reactive;
using System.Reactive.Subjects;
namespace TV_Player
{
@@ -6,11 +7,11 @@ namespace TV_Player
{
private readonly ReplaySubject<List<M3UInfo>> programsSubject = new ReplaySubject<List<M3UInfo>>();
private readonly ReplaySubject<List<GroupInfo>> groupsSubject = new ReplaySubject<List<GroupInfo>>();
private readonly ReplaySubject<List<ProgramGuide>> programGuideSubject = new ReplaySubject<List<ProgramGuide>>();
private readonly ReplaySubject<Unit> programGuideSubject = new ReplaySubject<Unit>();
public IObservable<List<M3UInfo>> AllPrograms => programsSubject;
public IObservable<List<GroupInfo>> GroupsInformation => groupsSubject;
public IObservable<List<ProgramGuide>> ProgramGuideInfo => programGuideSubject;
public IObservable<Unit> ProgramGuideInfo => programGuideSubject;
public ProgramsData()
{
}
@@ -20,17 +21,6 @@ namespace TV_Player
//string m3uLink = "http://pl.da-tv.vip/a71e77fa/835b3216/tv.m3u";
var result = await M3UParser.DownloadM3UFromWebAsync(m3uLink);
// For how hardcoded add custom channel
result.programList.Add(new M3UInfo()
{
GroupTitle = "Познавательные",
Name = "Discovery science",
Logo = "http://ip.viks.tv/posts/2018-11/1543603622_discovery_science.png",
Number = Convert.ToString(result.programList.Count+1),
Url= "https://s2.viks.tv/571/index.m3u8?k=1715093638p791i991i86i78S9b9c0d8fefdcO74ff3ed2f4710c95b07"
});;
programsSubject.OnNext(result.programList);
var groupping = result.programList.GroupBy(item => item.GroupTitle)
@@ -41,11 +31,16 @@ namespace TV_Player
await Task.Run(() => GetProgramGuide(result.programGuide));
}
public Task<ProgramGuide> GetGuideByProgram(string channelID)
{
return M3UParser.ParseEpg(channelID);
}
private async Task GetProgramGuide(string guideLink)
{
//string guideLink = "http://epg.da-tv.vip/107-light.xml";
var programGuide = await M3UParser.DownloadGuideFromWebAsync(guideLink);
programGuideSubject.OnNext(programGuide);
//guideLink = "http://epg.da-tv.vip/107-light.xml";
await M3UParser.DownloadGuideFromWebAsync(guideLink);
programGuideSubject.OnNext(Unit.Default);
}
internal void GetData(string playlistURL)