You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
cast/Channel/__init__.py

52 lines
1.2 KiB

#!/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
def get_latest_item(self) -> Item:
return self.m_items[0]
def set_items(self, items: list[Item]) -> None:
self.m_items = items
def set_logo(self, logo: wx.Bitmap) -> None:
self.m_logo = logo