Add back size so it works on x11 too
This commit is contained in:
parent
67589b5def
commit
c2502162a8
1 changed files with 20 additions and 11 deletions
25
src/main.py
25
src/main.py
|
@ -12,8 +12,9 @@ from youtubesearchpython import ChannelsSearch
|
||||||
|
|
||||||
from Channel import SVT, YouTube
|
from Channel import SVT, YouTube
|
||||||
from ChannelProvider import ChannelProvider
|
from ChannelProvider import ChannelProvider
|
||||||
from Utils import (get_default_logo, get_subscriptions, import_from_newpipe, make_bitmap_from_file, make_sized_button,
|
from Utils import (get_default_logo, get_subscriptions, import_from_newpipe,
|
||||||
resolve_youtube_link, make_bitmap_from_url)
|
make_bitmap_from_file, make_bitmap_from_url,
|
||||||
|
make_sized_button, resolve_youtube_link)
|
||||||
|
|
||||||
WIDTH = int(720 / 2)
|
WIDTH = int(720 / 2)
|
||||||
HEIGHT = int(1440 / 2)
|
HEIGHT = int(1440 / 2)
|
||||||
|
@ -63,10 +64,15 @@ class Cast(wx.Frame):
|
||||||
def search_callback(event, text: wx.TextCtrl) -> None:
|
def search_callback(event, text: wx.TextCtrl) -> None:
|
||||||
reply = text.GetLineText(0)
|
reply = text.GetLineText(0)
|
||||||
text.Clear()
|
text.Clear()
|
||||||
channels_search = ChannelsSearch(reply,
|
channels_search = ChannelsSearch(
|
||||||
limit=1).result()['result'][0] #type: ignore
|
reply, limit=1).result()['result'][0] #type: ignore
|
||||||
if 'id' in channels_search:
|
if 'id' in channels_search:
|
||||||
found_channel = YouTube.YouTube(channels_search['id'], channels_search['title'], logo=make_bitmap_from_url('https:' + channels_search['thumbnails'][0]['url'], size=wx.Size(68,100))) #type: ignore
|
found_channel = YouTube.YouTube(
|
||||||
|
channels_search['id'],
|
||||||
|
channels_search['title'],
|
||||||
|
logo=make_bitmap_from_url(
|
||||||
|
'https:' + channels_search['thumbnails'][0]['url'],
|
||||||
|
size=wx.Size(68, 100))) #type: ignore
|
||||||
self.m_selected_provider.append_channel(found_channel)
|
self.m_selected_provider.append_channel(found_channel)
|
||||||
|
|
||||||
text: wx.TextCtrl = wx.TextCtrl(self.m_panel, size=(WIDTH, BTN_HEIGHT))
|
text: wx.TextCtrl = wx.TextCtrl(self.m_panel, size=(WIDTH, BTN_HEIGHT))
|
||||||
|
@ -134,14 +140,14 @@ class Cast(wx.Frame):
|
||||||
inner_sizer.Add(chromecast_button, FLAGS)
|
inner_sizer.Add(chromecast_button, FLAGS)
|
||||||
elif self.m_selected_chromecast:
|
elif self.m_selected_chromecast:
|
||||||
|
|
||||||
|
|
||||||
chromecast_button = wx.Button(self.m_panel,
|
chromecast_button = wx.Button(self.m_panel,
|
||||||
-1,
|
-1,
|
||||||
"Stop Cast",
|
"Stop Cast",
|
||||||
size=(WIDTH / 4, BTN_HEIGHT))
|
size=(WIDTH / 4, BTN_HEIGHT))
|
||||||
chromecast_button.Bind(
|
chromecast_button.Bind(
|
||||||
wx.EVT_BUTTON,
|
wx.EVT_BUTTON,
|
||||||
lambda event, muri=uri, cindex=channel_index: self.stop_callback(event, muri, cindex),
|
lambda event, muri=uri, cindex=channel_index: self.
|
||||||
|
stop_callback(event, muri, cindex),
|
||||||
)
|
)
|
||||||
inner_sizer.Add(chromecast_button, FLAGS)
|
inner_sizer.Add(chromecast_button, FLAGS)
|
||||||
|
|
||||||
|
@ -182,7 +188,9 @@ class Cast(wx.Frame):
|
||||||
logo = make_bitmap_from_file(channel[2])
|
logo = make_bitmap_from_file(channel[2])
|
||||||
channels.append(YouTube.YouTube(channel[0], channel[1], logo))
|
channels.append(YouTube.YouTube(channel[0], channel[1], logo))
|
||||||
else:
|
else:
|
||||||
logo = make_bitmap_from_url('https://yt3.ggpht.com/ytc/AKedOLQ5L9xUSDxB2j6V3VC8L_HEwiKeHM21CgbSUyqe=s88-c-k-c0x00ffffff-no-rj')
|
logo = make_bitmap_from_url(
|
||||||
|
'https://yt3.ggpht.com/ytc/AKedOLQ5L9xUSDxB2j6V3VC8L_HEwiKeHM21CgbSUyqe=s88-c-k-c0x00ffffff-no-rj'
|
||||||
|
)
|
||||||
channels.append(
|
channels.append(
|
||||||
YouTube.YouTube("UCs6A_0Jm21SIvpdKyg9Gmxw", "Pine 64", logo))
|
YouTube.YouTube("UCs6A_0Jm21SIvpdKyg9Gmxw", "Pine 64", logo))
|
||||||
|
|
||||||
|
@ -385,6 +393,7 @@ class Cast(wx.Frame):
|
||||||
if not self.m_selected_chromecast:
|
if not self.m_selected_chromecast:
|
||||||
self.m_control = wx.media.MediaCtrl(
|
self.m_control = wx.media.MediaCtrl(
|
||||||
self.m_panel,
|
self.m_panel,
|
||||||
|
size=(WIDTH,HEIGHT/2),
|
||||||
szBackend=wx.media.MEDIABACKEND_GSTREAMER,
|
szBackend=wx.media.MEDIABACKEND_GSTREAMER,
|
||||||
)
|
)
|
||||||
self.m_sizer.Add(self.m_control, FLAGS)
|
self.m_sizer.Add(self.m_control, FLAGS)
|
||||||
|
|
Loading…
Add table
Reference in a new issue