EPG: EIT alle 60s auf Background-Thread - kein UI-Block
This commit is contained in:
parent
6249c6d149
commit
6e10f0b979
1 changed files with 19 additions and 3 deletions
|
|
@ -66,12 +66,28 @@ public partial class MainWindow : Window
|
|||
_epgTimer = new DispatcherTimer { Interval = TimeSpan.FromMilliseconds(500) };
|
||||
_epgTimer.Tick += EpgTimer_Tick;
|
||||
|
||||
// Jede 60s: XMLTV Jetzt/Danach refreshen
|
||||
// Jede 60s: XMLTV Jetzt/Danach refreshen + EIT neu lesen
|
||||
_epgRefreshTimer = new DispatcherTimer { Interval = TimeSpan.FromSeconds(60) };
|
||||
_epgRefreshTimer.Tick += (_, _) =>
|
||||
{
|
||||
if (_currentChannel != null)
|
||||
UpdateNextFromEpgService(_currentChannel);
|
||||
if (_currentChannel == null) return;
|
||||
// EIT auf Background-Thread lesen damit UI nicht blockiert
|
||||
if (_currentChannel.Source == ChannelSource.FritzBox && _currentMedia != null)
|
||||
{
|
||||
var media = _currentMedia;
|
||||
Task.Run(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
var nowPlaying = media.Meta(MetadataType.NowPlaying) ?? "";
|
||||
var showName = media.Meta(MetadataType.ShowName) ?? "";
|
||||
if (!string.IsNullOrWhiteSpace(nowPlaying) || !string.IsNullOrWhiteSpace(showName))
|
||||
Dispatcher.BeginInvoke(() => UpdateEpgFromMedia(media));
|
||||
}
|
||||
catch { }
|
||||
});
|
||||
}
|
||||
UpdateNextFromEpgService(_currentChannel);
|
||||
};
|
||||
_epgRefreshTimer.Start();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue