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/ChannelProvider/__init__.py

53 lines
1.4 KiB

#!/usr/bin/env python3
from typing import Union
import requests
import wx
import io
from Items import Item
default_logo = "https://upload.wikimedia.org/wikipedia/commons/"
default_logo += "thumb/f/fd/Cartoon_Hand_Playing_Multiple_Online_Videos.svg/"
default_logo += "480px-Cartoon_Hand_Playing_Multiple_Online_Videos.svg.png"
class ChannelProvider:
def __init__(self,
provider_name: str,
feed: str,
logo_url: str = default_logo) -> None:
self.m_provider_name = provider_name
self.m_feed = feed
self.m_items: Union[list[Item], None] = None
res = requests.get(logo_url)
content = res.content
content_bytes = io.BytesIO(content)
self.m_logo = wx.Image(content_bytes,
type=wx.BITMAP_TYPE_ANY,
index=-1)
def get_logo_as_bitmap(self) -> wx.Bitmap:
"""
[TODO:description]
:rtype wx.Image: [TODO:description]
"""
return wx.Bitmap(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
3 years ago
def wait(self) -> bool:
return False