more design

This commit is contained in:
Vova
2024-01-21 17:39:07 +02:00
parent e36554eeab
commit 7d00619d14
9 changed files with 271 additions and 20 deletions
+12 -2
View File
@@ -16,14 +16,17 @@ 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>>();
public IObservable<List<M3UInfo>> AllPrograms => programsSubject;
public IObservable<List<GroupInfo>> GroupsInformation => groupsSubject;
public IObservable<List<ProgramGuide>> ProgramGuideInfo => programGuideSubject;
private ProgramsData()
{
_=Initialize();
Task.Run(() => GetPrograms());
Task.Run(() => GetProgramGuide());
}
private async Task Initialize()
private async Task GetPrograms()
{
string m3uLink = "http://pl.da-tv.vip/a71e77fa/835b3216/tv.m3u";
var programs = await M3UParser.DownloadM3UFromWebAsync(m3uLink);
@@ -35,5 +38,12 @@ namespace TV_Player
.ToList();
groupsSubject.OnNext(groupping);
}
private async Task GetProgramGuide()
{
string guideLink = "http://epg.da-tv.vip/107-light.xml";
var programGuide = await M3UParser.DownloadGuideFromWebAsync(guideLink);
programGuideSubject.OnNext(programGuide);
}
}
}