def attach_context_menu(self, item, menu): colorCaution = getSetting('item_caution_color') login = getSetting('username') isOwner = True cmd = containerUpdate(self.make_url(nt=Flag.USERPLAYLISTS, id='', mode=Mode.VIEW)) menu.add(path='playlist', pos = 1, label="Playlist", cmd=cmd, mode=Mode.VIEW) if login != self.get_property('owner/name'): isOwner = False if isOwner: url = self.make_url(nt=Flag.PLAYLIST, mode=Mode.VIEW, nm='set_as_current') menu.add(path='playlist/set_as_current', label=lang(39007), cmd=containerUpdate(url)) url = self.make_url(nt=Flag.PLAYLIST, nm='gui_rename') menu.add(path='playlist/rename', label=lang(39009), cmd=runPlugin(url)) else: url = self.make_url(nt=Flag.PLAYLIST, nm='subscribe') menu.add(path='playlist/subscribe', label=lang(39012), cmd=runPlugin(url)) url = self.make_url(nt=Flag.PLAYLIST, nm='gui_remove') menu.add(path='playlist/remove', label=lang(39010), cmd=runPlugin(url), color=colorCaution) ''' Calling base class ''' super(Node_playlist, self).attach_context_menu(item, menu)
def attach_context_menu(self, item, menu): label = self.get_label() url = self.make_url() menu.add(path='friend', label=label, cmd=containerUpdate(url)) url = self.make_url(nt=Flag.FRIEND, nm='gui_create', nid=self.nid) menu.add(path='friend/add', label=lang(30181), cmd=runPlugin(url)) ''' Calling base class ''' super(Node_friends, self).attach_context_menu(item, menu)
def attach_context_menu(self, item, menu): colorWarn = getSetting("item_caution_color") url = self.make_url() menu.add(path="friend", label=self.name, cmd=containerUpdate(url)) cmd = runPlugin(self.make_url(nt=Flag.FRIEND, nm="remove")) menu.add(path="friend/remove", label="Remove", cmd=cmd, color=colorWarn) """ Calling base class """ super(Node_friend, self).attach_context_menu(item, menu)
def attach_context_menu(self, item, menu): colorWarn = getSetting('item_caution_color') url = self.make_url() menu.add(path='friend', label=self.name, cmd=containerUpdate(url)) cmd = runPlugin(self.make_url(nt=Flag.FRIEND, nm="remove")) menu.add(path='friend/remove', label='Remove', cmd=cmd, color=colorWarn) ''' Calling base class ''' super(Node_friend, self).attach_context_menu(item, menu)
def attach_context_menu(self, item, menu): if self.parent and (self.parent.nt & Flag.PLAYLIST == Flag.PLAYLIST): colorCaution = getSetting('item_caution_color') url = self.parent.make_url(nt=Flag.PLAYLIST, id=self.parent.nid, qid=self.get_playlist_track_id(), nm='gui_remove_track', mode=Mode.VIEW) menu.add(path='playlist/remove', label=lang(30075), cmd=runPlugin(url), color=colorCaution) ''' Calling base class ''' super(Node_track, self).attach_context_menu(item, menu)
def attach_context_menu(self, item, menu): """ Note: Url made with make_url must set mode (like mode=Mode.VIEW) else we are copying current mode (for track it's Mode.PLAY ...) """ ''' HOME ''' colorCaution = getSetting('item_caution_color') url = self.make_url(nt=Flag.ROOT, mode=Mode.VIEW, nm='') menu.add(path='qobuz', label="Qobuz", cmd=containerUpdate(url, False), id='', pos=-5) ''' ARTIST ''' if self.nt & (Flag.ALBUM | Flag.TRACK | Flag.ARTIST): artist_id = self.get_artist_id() # if not artist_id: # import pprint # print pprint.pformat(self.data) artist_name = self.get_artist() urlArtist = self.make_url(nt=Flag.ARTIST, nid=artist_id, mode=Mode.VIEW) menu.add(path='artist/all_album', label="%s %s" % (lang(30157), artist_name), cmd=containerUpdate(urlArtist), pos=-10) ''' Similar artist ''' url = self.make_url(nt=Flag.SIMILAR_ARTIST, nid=artist_id, mode=Mode.VIEW) menu.add(path='artist/similar', label=lang(30160), cmd=containerUpdate(url)) ''' FAVORITES ''' wf = self.nt & (~Flag.FAVORITE) if self.parent: wf = wf and self.parent.nt & ~Flag.FAVORITE if wf: ''' ADD TO FAVORITES / TRACKS''' url = self.make_url(nt=Flag.FAVORITE, nm='', mode=Mode.VIEW) menu.add(path='favorites', label="Favorites", cmd=containerUpdate(url, True), pos=-9) url = self.make_url(nt=Flag.FAVORITE, nm='gui_add_tracks', qid=self.nid, qnt=self.nt, mode=Mode.VIEW) menu.add(path='favorites/add_tracks', label=lang(30167) + ' tracks', cmd=runPlugin(url)) ''' ADD TO FAVORITES / Albums''' url = self.make_url(nt=Flag.FAVORITE, nm='gui_add_albums', qid=self.nid, qnt=self.nt, mode=Mode.VIEW) menu.add(path='favorites/add_albums', label=lang(30167) + ' albums', cmd=runPlugin(url)) ''' ADD TO FAVORITES / Artists''' url = self.make_url(nt=Flag.FAVORITE, nm='gui_add_artists', qid=self.nid, qnt=self.nt, mode=Mode.VIEW) menu.add(path='favorites/add_artists', label=lang(30167) + ' artists', cmd=runPlugin(url)) if self.parent and (self.parent.nt & Flag.FAVORITE): url = self.make_url(nt=Flag.FAVORITE, nm='', mode=Mode.VIEW) menu.add(path='favorites', label="Favorites", cmd=containerUpdate(url, True), pos=-9) url = self.make_url(nt=Flag.FAVORITE, nm='gui_remove', qid=self.nid, qnt=self.nt, mode=Mode.VIEW) menu.add(path='favorites/remove', label='Remove %s' % (self.get_label()), cmd=runPlugin(url), color=colorCaution) wf = ~Flag.USERPLAYLISTS # if self.parent: # wf = wf and self.parent.nt & (~Flag.USERPLAYLISTS) if wf: ''' PLAYLIST ''' cmd = containerUpdate(self.make_url(nt=Flag.USERPLAYLISTS, nid='', mode=Mode.VIEW)) menu.add(path='playlist', pos=1, label="Playlist", cmd=cmd, mode=Mode.VIEW) ''' ADD TO CURRENT PLAYLIST ''' cmd = runPlugin(self.make_url(nt=Flag.PLAYLIST, nm='gui_add_to_current', qnt=self.nt, mode=Mode.VIEW, qid=self.nid)) menu.add(path='playlist/add_to_current', label=lang(30161), cmd=cmd) label = self.get_label() try: label = label.encode('utf8', 'replace') except: warn(self, "Cannot set query..." + repr(label)) label = '' label = urllib.quote_plus(label) ''' ADD AS NEW ''' cmd = runPlugin(self.make_url(nt=Flag.PLAYLIST, nm='gui_add_as_new', qnt=self.nt, query=label, mode=Mode.VIEW, qid=self.nid)) menu.add(path='playlist/add_as_new', label=lang(30082), cmd=cmd) # ''' Show playlist ''' # if not (self.nt ^ Flag.USERPLAYLISTS != Flag.USERPLAYLISTS): # cmd = containerUpdate(self.make_url(nt=Flag.USERPLAYLISTS, # id='', mode=Mode.VIEW)) # menu.add(path='playlist/show', # label=lang(30162), cmd=cmd) ''' PLAYLIST / CREATE ''' cFlag = (Flag.PLAYLIST | Flag.USERPLAYLISTS) if self.nt | cFlag == cFlag: cmd = runPlugin(self.make_url(nt=Flag.PLAYLIST, nm="gui_create", mode=Mode.VIEW)) menu.add(path='playlist/create', label=lang(30164), cmd=cmd) ''' VIEW BIG DIR ''' cmd = containerUpdate(self.make_url(mode=Mode.VIEW_BIG_DIR)) menu.add(path='qobuz/big_dir', label=lang(30158), cmd=cmd) ''' SCAN ''' if getSetting('enable_scan_feature', isBool=True): query = urllib.quote_plus(self.make_url(mode=Mode.SCAN)) url = self.make_url(nt=Flag.ROOT, mode=Mode.VIEW, nm='gui_scan', query=query) menu.add(path='qobuz/scan', cmd=runPlugin(url), label='scan') if self.nt & (Flag.ALL & ~Flag.ALBUM & ~Flag.TRACK & ~Flag.PLAYLIST): ''' ERASE CACHE ''' cmd = runPlugin(self.make_url(nt=Flag.ROOT, nm="cache_remove", mode=Mode.VIEW)) menu.add(path='qobuz/erase_cache', label=lang(30117), cmd=cmd, color=colorCaution, pos=10)
def attach_context_menu(self, item, menu): """ Note: Url made with make_url must set mode (like mode=Mode.VIEW) else we are copying current mode (for track it's Mode.PLAY ...) """ ''' HOME ''' colorCaution = getSetting('item_caution_color') url = self.make_url(nt=Flag.ROOT, mode=Mode.VIEW, nm='') menu.add(path='qobuz', label="Qobuz", cmd=containerUpdate(url, False), id='', pos=-5) ''' ARTIST ''' if self.nt & (Flag.ALBUM | Flag.TRACK | Flag.ARTIST): artist_id = self.get_artist_id() # if not artist_id: # import pprint # print pprint.pformat(self.data) artist_name = self.get_artist() urlArtist = self.make_url(nt=Flag.ARTIST, nid=artist_id, mode=Mode.VIEW) menu.add(path='artist/all_album', label="%s %s" % (lang(30157), artist_name), cmd=containerUpdate(urlArtist), pos=-10) ''' Similar artist ''' url = self.make_url(nt=Flag.SIMILAR_ARTIST, nid=artist_id, mode=Mode.VIEW) menu.add(path='artist/similar', label=lang(30160), cmd=containerUpdate(url)) ''' FAVORITES ''' wf = self.nt & (~Flag.FAVORITE) if self.parent: wf = wf and self.parent.nt & ~Flag.FAVORITE if wf: ''' ADD TO FAVORITES / TRACKS''' url = self.make_url(nt=Flag.FAVORITE, nm='', mode=Mode.VIEW) menu.add(path='favorites', label="Favorites", cmd=containerUpdate(url, True), pos=-9) url = self.make_url(nt=Flag.FAVORITE, nm='gui_add_tracks', qid=self.nid, qnt=self.nt, mode=Mode.VIEW) menu.add(path='favorites/add_tracks', label=lang(30167) + ' tracks', cmd=runPlugin(url)) ''' ADD TO FAVORITES / Albums''' url = self.make_url(nt=Flag.FAVORITE, nm='gui_add_albums', qid=self.nid, qnt=self.nt, mode=Mode.VIEW) menu.add(path='favorites/add_albums', label=lang(30167) + ' albums', cmd=runPlugin(url)) ''' ADD TO FAVORITES / Artists''' url = self.make_url(nt=Flag.FAVORITE, nm='gui_add_artists', qid=self.nid, qnt=self.nt, mode=Mode.VIEW) menu.add(path='favorites/add_artists', label=lang(30167) + ' artists', cmd=runPlugin(url)) if self.parent and (self.parent.nt & Flag.FAVORITE): url = self.make_url(nt=Flag.FAVORITE, nm='', mode=Mode.VIEW) menu.add(path='favorites', label="Favorites", cmd=containerUpdate(url, True), pos=-9) url = self.make_url(nt=Flag.FAVORITE, nm='gui_remove', qid=self.nid, qnt=self.nt, mode=Mode.VIEW) menu.add(path='favorites/remove', label='Remove %s' % (self.get_label()), cmd=runPlugin(url), color=colorCaution) wf = ~Flag.USERPLAYLISTS # if self.parent: # wf = wf and self.parent.nt & (~Flag.USERPLAYLISTS) if wf: ''' PLAYLIST ''' cmd = containerUpdate( self.make_url(nt=Flag.USERPLAYLISTS, nid='', mode=Mode.VIEW)) menu.add(path='playlist', pos=1, label="Playlist", cmd=cmd, mode=Mode.VIEW) ''' ADD TO CURRENT PLAYLIST ''' cmd = runPlugin( self.make_url(nt=Flag.PLAYLIST, nm='gui_add_to_current', qnt=self.nt, mode=Mode.VIEW, qid=self.nid)) menu.add(path='playlist/add_to_current', label=lang(30161), cmd=cmd) label = self.get_label() try: label = label.encode('utf8', 'replace') except: warn(self, "Cannot set query..." + repr(label)) label = '' label = urllib.quote_plus(label) ''' ADD AS NEW ''' cmd = runPlugin( self.make_url(nt=Flag.PLAYLIST, nm='gui_add_as_new', qnt=self.nt, query=label, mode=Mode.VIEW, qid=self.nid)) menu.add(path='playlist/add_as_new', label=lang(30082), cmd=cmd) # ''' Show playlist ''' # if not (self.nt ^ Flag.USERPLAYLISTS != Flag.USERPLAYLISTS): # cmd = containerUpdate(self.make_url(nt=Flag.USERPLAYLISTS, # id='', mode=Mode.VIEW)) # menu.add(path='playlist/show', # label=lang(30162), cmd=cmd) ''' PLAYLIST / CREATE ''' cFlag = (Flag.PLAYLIST | Flag.USERPLAYLISTS) if self.nt | cFlag == cFlag: cmd = runPlugin( self.make_url(nt=Flag.PLAYLIST, nm="gui_create", mode=Mode.VIEW)) menu.add(path='playlist/create', label=lang(30164), cmd=cmd) ''' VIEW BIG DIR ''' cmd = containerUpdate(self.make_url(mode=Mode.VIEW_BIG_DIR)) menu.add(path='qobuz/big_dir', label=lang(30158), cmd=cmd) ''' SCAN ''' if getSetting('enable_scan_feature', isBool=True): query = urllib.quote_plus(self.make_url(mode=Mode.SCAN)) url = self.make_url(nt=Flag.ROOT, mode=Mode.VIEW, nm='gui_scan', query=query) menu.add(path='qobuz/scan', cmd=runPlugin(url), label='scan') if self.nt & (Flag.ALL & ~Flag.ALBUM & ~Flag.TRACK & ~Flag.PLAYLIST): ''' ERASE CACHE ''' cmd = runPlugin( self.make_url(nt=Flag.ROOT, nm="cache_remove", mode=Mode.VIEW)) menu.add(path='qobuz/erase_cache', label=lang(30117), cmd=cmd, color=colorCaution, pos=10)