|
|
|
#!/usr/bin/env python3
|
|
|
|
|
|
|
|
import io
|
|
|
|
from typing import Union
|
|
|
|
|
|
|
|
import requests
|
|
|
|
import wx
|
|
|
|
|
|
|
|
from Items import Item
|
|
|
|
from Utils import get_default_log_url, make_bitmap_from_url
|
|
|
|
|
|
|
|
|
|
|
|
class Channel:
|
|
|
|
def __init__(self,
|
|
|
|
provider_name: str,
|
|
|
|
feed: str,
|
|
|
|
logo_url: str = '') -> None:
|
|
|
|
if not logo_url:
|
|
|
|
logo_url = get_default_logo_url()
|
|
|
|
self.m_logo_url = logo_url
|
|
|
|
self.m_logo = make_bitmap_from_url(self.m_logo_url)
|
|
|
|
self.m_provider_name = provider_name
|
|
|
|
self.m_feed = feed
|
|
|
|
self.m_items: Union[list[Item], None] = None
|
|
|
|
|
|
|
|
def get_logo_as_bitmap(self) -> wx.Bitmap:
|
|
|
|
return self.m_logo
|
|
|
|
|
|
|
|
def get_feed(self) -> str:
|
|
|
|
return self.m_feed
|
|
|
|
|
|
|
|
def get_items(self) -> Union[list[Item], None]:
|
|
|
|
return self.m_items
|
|
|
|
|
|
|
|
def get_provider_name(self) -> str:
|
|
|
|
return self.m_provider_name
|
|
|
|
|
|
|
|
def parse_feed(self) -> Union[list[Item], None]:
|
|
|
|
pass
|
|
|
|
|
|
|
|
def wait(self) -> bool:
|
|
|
|
return False
|