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.
53 lines
1.4 KiB
53 lines
1.4 KiB
3 years ago
|
#!/usr/bin/env python3
|
||
|
|
||
|
from typing import Union
|
||
|
|
||
3 years ago
|
import requests
|
||
|
import wx
|
||
|
import io
|
||
|
|
||
3 years ago
|
from Items import Item
|
||
|
|
||
3 years ago
|
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"
|
||
|
|
||
3 years ago
|
|
||
3 years ago
|
class Channel:
|
||
3 years ago
|
def __init__(self,
|
||
|
provider_name: str,
|
||
|
feed: str,
|
||
|
logo_url: str = default_logo) -> None:
|
||
3 years ago
|
self.m_provider_name = provider_name
|
||
|
self.m_feed = feed
|
||
3 years ago
|
self.m_items: Union[list[Item], None] = None
|
||
3 years ago
|
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)
|
||
3 years ago
|
|
||
|
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
|