Create cache dir

main
Micke Nordin 2 years ago
parent e794b336ee
commit 9857816402

@ -2,6 +2,7 @@
import sys import sys
import threading import threading
import time import time
import os
from typing import Callable from typing import Callable
import pychromecast import pychromecast
@ -13,7 +14,7 @@ from vlc import Instance
from Channel import SVT from Channel import SVT
from ChannelProvider import ChannelProvider from ChannelProvider import ChannelProvider
from Utils import (get_all_svt_categories, make_bitmap_from_file, from Utils import (get_all_svt_categories, make_bitmap_from_file,
make_sized_button) make_sized_button, BASEPATH)
WIDTH = int(720 / 2) WIDTH = int(720 / 2)
HEIGHT = int(1440 / 2) HEIGHT = int(1440 / 2)
@ -43,6 +44,9 @@ class Cast(wx.Frame):
url = kw['url'] url = kw['url']
del kw['url'] del kw['url']
super().__init__(*args, **kw) super().__init__(*args, **kw)
if not os.path.isdir(BASEPATH):
os.mkdir(BASEPATH)
self.m_selected_chromecast = None self.m_selected_chromecast = None
self.SetSizeHints(WIDTH, HEIGHT, maxW=WIDTH) self.SetSizeHints(WIDTH, HEIGHT, maxW=WIDTH)
self.m_style = self.GetWindowStyle() self.m_style = self.GetWindowStyle()

@ -106,8 +106,14 @@ class SVT(Channel):
entries = get_svt_category(self.m_id) entries = get_svt_category(self.m_id)
for entry in entries: for entry in entries:
elem = entry["item"] elem = entry["item"]
imgformat = "wide"
if not "wide" in elem["images"].keys():
if "cleanWide" in elem["images"].keys():
imgformat = "cleanWide"
else:
continue
url = elem["urls"]["svtplay"] url = elem["urls"]["svtplay"]
video_id = hash_string(url.split('/')[1]) video_id = hash_string(url)
svt_id = elem["videoSvtId"] svt_id = elem["videoSvtId"]
resolved_link = self.resolve_link(svt_id) resolved_link = self.resolve_link(svt_id)
if not resolved_link: if not resolved_link:
@ -116,8 +122,8 @@ class SVT(Channel):
description = str(entry["description"]) description = str(entry["description"])
published_parsed = datetime.now() published_parsed = datetime.now()
thumbnail_link = get_svt_thumb_from_id_changed( thumbnail_link = get_svt_thumb_from_id_changed(
elem['images']["wide"]["id"], elem['images'][imgformat]["id"],
elem['images']["wide"]["changed"], elem['images'][imgformat]["changed"],
size=self.m_screen_width) size=self.m_screen_width)
thumbnail = make_bitmap_from_url( thumbnail = make_bitmap_from_url(
thumbnail_link, wx.Size(int(self.m_screen_width), 150), video_id) thumbnail_link, wx.Size(int(self.m_screen_width), 150), video_id)

Loading…
Cancel
Save