|
|
|
@ -1,11 +1,13 @@
|
|
|
|
|
#/usr/bin/env python3
|
|
|
|
|
import io
|
|
|
|
|
import threading
|
|
|
|
|
import time
|
|
|
|
|
|
|
|
|
|
import requests
|
|
|
|
|
import wx
|
|
|
|
|
|
|
|
|
|
from Channel import Channel
|
|
|
|
|
from Utils import get_default_log_url, make_bitmap_from_url
|
|
|
|
|
from Utils import get_default_log_url, make_bitmap_from_url, write_on_bitmap
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ChannelProvider:
|
|
|
|
@ -14,6 +16,11 @@ class ChannelProvider:
|
|
|
|
|
self.m_logo_url = get_default_log_url(providerid)
|
|
|
|
|
self.m_logo: wx.Bitmap = make_bitmap_from_url(self.m_logo_url)
|
|
|
|
|
self.m_channels: list[Channel] = channels
|
|
|
|
|
if len(self.m_channels) > 0:
|
|
|
|
|
self.m_thr = threading.Thread(target=self.make_latest,
|
|
|
|
|
args=(),
|
|
|
|
|
kwargs={})
|
|
|
|
|
self.m_thr.start()
|
|
|
|
|
|
|
|
|
|
def append_channel(self, channel: Channel) -> int:
|
|
|
|
|
self.m_channels.append(channel)
|
|
|
|
@ -29,7 +36,20 @@ class ChannelProvider:
|
|
|
|
|
return self.m_logo
|
|
|
|
|
|
|
|
|
|
def get_name(self) -> str:
|
|
|
|
|
return self.m_id_
|
|
|
|
|
return self.m_id
|
|
|
|
|
|
|
|
|
|
def get_logo_url(self) -> str:
|
|
|
|
|
links: dict = {'ch-svt1'}
|
|
|
|
|
|
|
|
|
|
def make_latest(self) -> None:
|
|
|
|
|
items = list()
|
|
|
|
|
for chan in self.m_channels:
|
|
|
|
|
while chan.wait():
|
|
|
|
|
time.sleep(1)
|
|
|
|
|
items.append(chan.get_latest_item())
|
|
|
|
|
|
|
|
|
|
channel = Channel(self.get_name, None, self.m_logo_url)
|
|
|
|
|
channel.set_items(items)
|
|
|
|
|
temp = self.get_logo_as_bitmap()
|
|
|
|
|
channel.set_logo(write_on_bitmap("Latest videos from all channels",temp))
|
|
|
|
|
self.append_channel(channel)
|
|
|
|
|