def actions(self): """ Menu actions for a video item. @returns: a list of possible actions on this item. """ if not self.possible_players: return [] # DVD actions if self.url.startswith('dvd://') and self.url[-1] == '/': if self.player_rating >= 20: items = [(self.play, _('Play DVD')), (self.dvd_vcd_title_menu, _('DVD title list'))] else: # this player is not able to deal with menus items = [(self.dvd_vcd_title_menu, _('DVD title list')), (self.play, _('Play default track'))] # VCD actions elif self.url == 'vcd://': if self.player_rating >= 20: items = [(self.play, _('Play VCD')), (self.dvd_vcd_title_menu, _('VCD title list'))] else: items = [(self.dvd_vcd_title_menu, _('VCD title list')), (self.play, _('Play default track'))] # youtube elif self.url.startswith('youtube:'): popup = PopupBox('Resolving YouTube video URL....') popup.show() if hasattr(config, 'YOUTUBE_USER'): cmdline = 'youtube-dl -g -u ' + config.YOUTUBE_USER + ' -p ' + config.YOUTUBE_PASSWORD + ' ' else: cmdline = 'youtube-dl -g ' pipe = os.popen(cmdline + self.url[8:]) self.url = pipe.readline() pipe.close() popup.hide() items = [(self.play, _('Play'))] else: items = [(self.play, _('Play'))] items.append((self.show_details, _('Full description'))) if self.network_play: items.append((self.play_max_cache, _('Play with maximum cache'))) items += configure.get_items(self) if self.variants and len(self.variants) > 1: items = [(self.show_variants, _('Show variants'))] + items if self.mode == 'file' and not self.variants and ( not self.image or not self.image.endswith('raw')): items.append((self.create_thumbnail, _('Create Thumbnail'), 'create_thumbnail')) return items
def actions(self): """ Menu actions for a video item. @returns: a list of possible actions on this item. """ if not self.possible_players: return [] # DVD actions if self.url.startswith('dvd://') and self.url[-1] == '/': if self.player_rating >= 20: items = [ (self.play, _('Play DVD')), (self.dvd_vcd_title_menu, _('DVD title list')) ] else: # this player is not able to deal with menus items = [ (self.dvd_vcd_title_menu, _('DVD title list')), (self.play, _('Play default track')) ] # VCD actions elif self.url == 'vcd://': if self.player_rating >= 20: items = [ (self.play, _('Play VCD')), (self.dvd_vcd_title_menu, _('VCD title list')) ] else: items = [ (self.dvd_vcd_title_menu, _('VCD title list')), (self.play, _('Play default track')) ] # youtube elif self.url.startswith('youtube:'): popup=PopupBox('Resolving YouTube video URL....') popup.show() if hasattr(config,'YOUTUBE_USER'): cmdline='youtube-dl -g -u '+config.YOUTUBE_USER+' -p '+config.YOUTUBE_PASSWORD+' ' else: cmdline='youtube-dl -g ' pipe=os.popen(cmdline+self.url[8:]) self.url=pipe.readline() pipe.close() popup.hide() items = [ (self.play, _('Play')) ] else: items = [ (self.play, _('Play')) ] items.append((self.show_details, _('Full description'))) if self.network_play: items.append((self.play_max_cache, _('Play with maximum cache'))) items += configure.get_items(self) if self.variants and len(self.variants) > 1: items = [ (self.show_variants, _('Show variants')) ] + items if self.mode == 'file' and not self.variants and (not self.image or not self.image.endswith('raw')): items.append((self.create_thumbnail, _('Create Thumbnail'), 'create_thumbnail')) return items