|
|
|
@ -9,7 +9,9 @@ import wx
|
|
|
|
|
|
|
|
|
|
from Channel import Channel
|
|
|
|
|
from Items import Item
|
|
|
|
|
from Utils import (add_video, get_all_svt_programs, get_svt_id, get_svt_thumbnail, hash_string, make_bitmap_from_url,
|
|
|
|
|
from Utils import (add_video, get_all_svt_categories, get_all_svt_programs,
|
|
|
|
|
get_svt_category, get_svt_id, get_svt_thumb_from_id_changed,
|
|
|
|
|
get_svt_thumbnail, hash_string, make_bitmap_from_url,
|
|
|
|
|
resolve_svt_channel, video_exists)
|
|
|
|
|
|
|
|
|
|
default_rss_url = 'http://www.svtplay.se/rss.xml'
|
|
|
|
@ -31,6 +33,9 @@ class SVT(Channel):
|
|
|
|
|
thumbnail: wx.Bitmap = wx.Bitmap()
|
|
|
|
|
published_parsed: datetime = datetime.now()
|
|
|
|
|
video_id = str()
|
|
|
|
|
categories: dict = dict()
|
|
|
|
|
for category in get_all_svt_categories():
|
|
|
|
|
categories[category['id']] = category
|
|
|
|
|
|
|
|
|
|
if self.m_id == 'feed':
|
|
|
|
|
feed = feedparser.parse(self.get_feed())
|
|
|
|
@ -80,17 +85,47 @@ class SVT(Channel):
|
|
|
|
|
swe_only = "no"
|
|
|
|
|
if entry['item']['restrictions']['onlyAvailableInSweden']:
|
|
|
|
|
swe_only = 'yes'
|
|
|
|
|
description = "{}\nOnly available in Sweden:{}\nType of program:{}".format(title, swe_only, type)
|
|
|
|
|
description = "{}\nOnly available in Sweden:{}\nType of program:{}".format(
|
|
|
|
|
title, swe_only, type)
|
|
|
|
|
if not resolved_link:
|
|
|
|
|
continue
|
|
|
|
|
thumbnail = make_bitmap_from_url(
|
|
|
|
|
thumbnail_link, wx.Size(int(self.m_screen_width), 150))
|
|
|
|
|
item = Item(description,
|
|
|
|
|
resolved_link,
|
|
|
|
|
self.m_provider_name,
|
|
|
|
|
published_parsed,
|
|
|
|
|
thumbnail,
|
|
|
|
|
title,
|
|
|
|
|
sort_key=entry['selection_name'])
|
|
|
|
|
self.m_items.append(item)
|
|
|
|
|
add_video(video_id, self.m_id, self.m_provider_name,
|
|
|
|
|
description, resolved_link, published_parsed,
|
|
|
|
|
thumbnail, title, 0)
|
|
|
|
|
elif self.m_id in categories.keys():
|
|
|
|
|
entries = get_svt_category(self.m_id)
|
|
|
|
|
for entry in entries:
|
|
|
|
|
elem = entry["item"]
|
|
|
|
|
svt_id = elem["videoSvtId"]
|
|
|
|
|
resolved_link = self.resolve_link(svt_id)
|
|
|
|
|
if not resolved_link:
|
|
|
|
|
continue
|
|
|
|
|
title = str(entry['heading'])
|
|
|
|
|
description = str(entry["description"])
|
|
|
|
|
published_parsed = datetime.now()
|
|
|
|
|
thumbnail_link = get_svt_thumb_from_id_changed(
|
|
|
|
|
elem['images']["wide"]["id"],
|
|
|
|
|
elem['images']["wide"]["changed"],
|
|
|
|
|
size=self.m_screen_width)
|
|
|
|
|
thumbnail = make_bitmap_from_url(
|
|
|
|
|
thumbnail_link, wx.Size(int(self.m_screen_width), 150))
|
|
|
|
|
item = Item(description, resolved_link, self.m_provider_name,
|
|
|
|
|
published_parsed, thumbnail, title, sort_key = entry['selection_name'])
|
|
|
|
|
published_parsed, thumbnail, title)
|
|
|
|
|
self.m_items.append(item)
|
|
|
|
|
add_video(video_id, self.m_id, self.m_provider_name,
|
|
|
|
|
description, resolved_link, published_parsed,
|
|
|
|
|
thumbnail, title, 0)
|
|
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
chan_dict = resolve_svt_channel(self.m_id)
|
|
|
|
|
resolved_link = self.resolve_link(self.m_id)
|
|
|
|
|