def _on_press_open_browser(self): ''' Private function to call with threading, to prevent gui blocking ''' p = show_popup("Opening web browser...\nPlease wait.") p.open() c = DalyinskiClient() c.command(b'fbro') p.dismiss()
def on_press_fullscreen(self): c = DalyinskiClient() c.command(b'fullscreen') if not app.in_fullscreen: app.in_fullscreen = True else: app.in_fullscreen = False
def _get_thumbnails(self, client_cmd): # print(f">>>>>>>>>>> Client cmd: {client_cmd}") # TODO: maybe use a decorator for checking if the server is up, so that it can be reused c = DalyinskiClient() self.pf = show_popup("Fetching videos... \nPlease wait.") self.pf.open() video_thumb_urls = c.recv_thumb_list(client_cmd) Logger.debug(f"dalYinskiApp: video_thumb_urls {video_thumb_urls}") self.video_urls(video_thumb_urls) # cache video lists if client_cmd == b'getthumbnails': app.home_yt_vids = video_thumb_urls app.home_yt_vids_have = True elif client_cmd == b'getplaylistthumbnails' and app.last_btn_pressed == "watchlater": app.watch_later_vids = video_thumb_urls app.watch_later_vids_have = True elif client_cmd == b'getplaylistthumbnails': print(f"LST BTN {app.last_btn_pressed}") print("CACHING VDS!!!") app.plstname_dict[app.last_plstname] = video_thumb_urls elif client_cmd == b'getsubscriptionhumbnails': app.subscriptions_vids = video_thumb_urls app.subscriptions_vids_have = True self.pf.dismiss()
def _get_playlists(self): c = DalyinskiClient() p = show_popup("Fetching playlists... \nPlease wait.") p.open() app.usr_playlists = c.recv_playlists(b'getplaylists') # a list of tuples of playlist name and link app.usr_playlists_have = True Logger.debug(f"dalYinskiApp: Got list of playlists: {app.usr_playlists}") for plst in app.usr_playlists: self.scroll_view_plst.add_widget(PlstBtn(str(plst[1]), text=str(plst[0]))) # plst[1] is playlist link (sent to the constructor in order to open it), plst[0] is playlist name p.dismiss()
def _on_press_find_server(self): ''' If the server changed its IP, reset the IP in config file, so the client.py can run the redisovery routine. ''' Logger.info("dalYinskiApp: Resetting IP...") p = show_popup("Finding server IP...\nPlease wait.") p.open() store.put('connection', ip='') c = DalyinskiClient() c.command(b'ping') p.dismiss()
def server_is_running(self): c = DalyinskiClient() # if the server isn't running switch back to start screen if not c.SERVER_RUNNING: p = show_popup("It looks like the server is not running.\nPlease open it.", dismiss=True) p.open() self.screen_mgr.current = 'start_screen' else: pass
def on_press_go_home(self): c = DalyinskiClient() c.command(b'gohome')
def on_press_vol_up(self): c = DalyinskiClient() c.command(b'volup')
def on_press_vol_down(self): c = DalyinskiClient() c.command(b'voldown')
def on_press_rewind(self): c = DalyinskiClient() c.command(b'rewind')
def on_press_subscriptions(self): c = DalyinskiClient() c.command(b'subscriptions')
def on_press_switch_tab(self): c = DalyinskiClient() c.command(b'switchtab')
def on_press_fforward(self): c = DalyinskiClient() c.command(b'fforward')
def _play_video(self, vidurl): ''' Send playvideo command + video url from the video_thumb_urls list which gets passed in the constructor above as vidurl variable so that the server can start video. ''' c = DalyinskiClient() c.command(b'playvideo' + b' ' + bytes(vidurl, 'utf-8'))
def on_press_captions(self): c = DalyinskiClient() c.command(b'captions')
def _select_playlist(self): ''' Send playvideo command + video url from the list which gets passed in the constructor above as vidurl variable so that the server can select that playlist url. ''' c = DalyinskiClient() c.command(b'playvideo' + b' ' + bytes(self.vidurl, 'utf-8'))
def on_press_watch_later(self): c = DalyinskiClient() c.command(b'watchlater')
def on_press_play_next(self): c = DalyinskiClient() c.command(b'playnext')
def on_press_play_pause(self): c = DalyinskiClient() c.command(b'playpause')
def on_press_play_previous(self): c = DalyinskiClient() c.command(b'playprevious')