Fixes for SVT
Store SVT videos in db and only parse the feed when needed Also: dont show latest videos for SVT
This commit is contained in:
parent
8fe7f45f62
commit
e97330ca09
2 changed files with 14 additions and 10 deletions
|
@ -27,6 +27,7 @@ class SVT(Channel):
|
|||
self.m_thr = threading.Thread(target=self.parse_feed,
|
||||
args=[svt_id],
|
||||
kwargs={})
|
||||
self.refresh()
|
||||
|
||||
def refresh(self) -> None:
|
||||
self.m_thr.start()
|
||||
|
@ -36,8 +37,6 @@ class SVT(Channel):
|
|||
|
||||
def parse_feed(self, *args, **kwargs) -> None:
|
||||
svt_id = args[0]
|
||||
feed = feedparser.parse(self.get_feed())
|
||||
entries = feed['entries']
|
||||
self.m_items: list[Item] = list()
|
||||
resolved_link = str()
|
||||
description = str()
|
||||
|
@ -48,10 +47,12 @@ class SVT(Channel):
|
|||
video_id = str()
|
||||
|
||||
if svt_id == 'feed':
|
||||
feed = feedparser.parse(self.get_feed())
|
||||
entries = feed['entries']
|
||||
for entry in entries:
|
||||
video_id = hash_string(entry['id'])
|
||||
if video_exists(video_id, svt_id):
|
||||
pass
|
||||
break
|
||||
for link in entry['links']:
|
||||
if str(link['type']).startswith('image/'):
|
||||
thumbnail_link = str(link['href'])
|
||||
|
@ -74,6 +75,11 @@ class SVT(Channel):
|
|||
if resolved_link and thumbnail_link:
|
||||
thumbnail = make_bitmap_from_url(
|
||||
thumbnail_link, wx.Size(self.m_screen_width, 150))
|
||||
item = Item(description, resolved_link, self.m_provider_name,
|
||||
published_parsed, thumbnail, title)
|
||||
self.m_items.append(item)
|
||||
add_video(video_id, svt_id, self.m_provider_name, description,
|
||||
resolved_link, published_parsed, thumbnail, title, 0)
|
||||
|
||||
else:
|
||||
chan_dict = resolve_svt_channel(svt_id)
|
||||
|
@ -83,12 +89,10 @@ class SVT(Channel):
|
|||
description = "Live channel stream"
|
||||
thumbnail = chan_dict['thumbnail']
|
||||
|
||||
if resolved_link:
|
||||
item = Item(description, resolved_link, self.m_provider_name,
|
||||
published_parsed, thumbnail, title)
|
||||
self.m_items.append(item)
|
||||
add_video(video_id, svt_id, self.m_provider_name, description,
|
||||
resolved_link, published_parsed, thumbnail, title, 0)
|
||||
if resolved_link:
|
||||
item = Item(description, resolved_link, self.m_provider_name,
|
||||
published_parsed, thumbnail, title)
|
||||
self.m_items.append(item)
|
||||
|
||||
|
||||
def resolve_link(svt_id: str) -> str:
|
||||
|
|
|
@ -16,7 +16,7 @@ class ChannelProvider:
|
|||
self.m_id = providerid
|
||||
self.m_logo: wx.Bitmap = get_default_logo(providerid)
|
||||
self.m_channels: list[Channel] = channels
|
||||
if len(self.m_channels) > 0:
|
||||
if len(self.m_channels) > 0 and not providerid == 'SVT':
|
||||
self.m_thr = threading.Thread(target=self.make_latest,
|
||||
args=(),
|
||||
kwargs={})
|
||||
|
|
Loading…
Add table
Reference in a new issue