def add_context_menu(self, track, play_url, li):
     browse_album_url = Router.url_for(Paths.ALBUM_TRACKS, Model(album = track.album_uri))
     browse_artist_url = Router.url_for(Paths.ARTIST_ALBUMS_FOR_TRACK, Model(track = track.uri))
     
     li.addContextMenuItems([(self.add_on.getLocalizedString(30032), UiHelper.RUN_PLUGIN_SCRIPT % play_url), 
                             (self.add_on.getLocalizedString(30031), UiHelper.UPDATE_CONTAINER_SCRIPT % browse_album_url), 
                             (self.add_on.getLocalizedString(30030), UiHelper.UPDATE_CONTAINER_SCRIPT % browse_artist_url)])       
Beispiel #2
0
 def get_playlist_url(self, playlist):
     if playlist.is_folder:
         return Router.url_for(Paths.FOLDER_PLAYLISTS,
                               Model(folder_id=playlist.folder_id))
     else:
         return Router.url_for(
             Paths.GET_PLAYLIST,
             self.settings.initial_page_for_pagination(playlist.uri))
    def main_menu(self, args):
        self.ui_helper.create_folder_item(self.add_on.getLocalizedString(30025), Router.url_for(Paths.INBOX))
        self.ui_helper.create_folder_item(self.add_on.getLocalizedString(30026), Router.url_for(Paths.SEARCH, self.settings.initial_page_for_search()))
        self.ui_helper.create_folder_item(self.add_on.getLocalizedString(30027), Router.url_for(Paths.STARRED, self.settings.initial_page_for_pagination()))
        self.ui_helper.create_folder_item(self.add_on.getLocalizedString(30028), Router.url_for(Paths.PLAYLISTS))
#         self.ui_helper.create_folder_item('Stop server', Router.url_for(Paths.STOP_SESSION))
#         self.ui_helper.create_folder_item('Is running?', Router.url_for(Paths.HAS_ACTIVE_SESSION))
      
        self.ui_helper.end_directory()
Beispiel #4
0
    def main_menu(self, args):
        self.start_session()
                
        self.ui_helper.create_folder_item(self.add_on.getLocalizedString(30025), Router.url_for(Paths.INBOX))
        self.ui_helper.create_folder_item(self.add_on.getLocalizedString(30026), Router.url_for(Paths.SEARCH, self.settings.initial_page_for_search()))
        self.ui_helper.create_folder_item(self.add_on.getLocalizedString(30027), Router.url_for(Paths.STARRED, self.settings.initial_page_for_pagination()))
        self.ui_helper.create_folder_item(self.add_on.getLocalizedString(30028), Router.url_for(Paths.PLAYLISTS))
#         self.ui_helper.create_folder_item('Stop server', Router.url_for(Paths.STOP_SESSION))
#         self.ui_helper.create_folder_item('Is running?', Router.url_for(Paths.HAS_ACTIVE_SESSION))
      
        self.ui_helper.end_directory()
Beispiel #5
0
    def add_context_menu(self, track, play_url, li):
        browse_album_url = Router.url_for(Paths.ALBUM_TRACKS,
                                          Model(album=track.album_uri))
        browse_artist_url = Router.url_for(Paths.ARTIST_ALBUMS_FOR_TRACK,
                                           Model(track=track.uri))

        li.addContextMenuItems([
            (self.add_on.getLocalizedString(30032),
             UiHelper.RUN_PLUGIN_SCRIPT % play_url),
            (self.add_on.getLocalizedString(30031),
             UiHelper.UPDATE_CONTAINER_SCRIPT % browse_album_url),
            (self.add_on.getLocalizedString(30030),
             UiHelper.UPDATE_CONTAINER_SCRIPT % browse_artist_url)
        ])
Beispiel #6
0
    def create_list_of_albums(self, albums):
        xbmcplugin.setContent(self.addon_handle, UiHelper.CONTENT_ALBUMS)

        for album in albums:
            url = Router.url_for(Paths.ALBUM_TRACKS, Model(album=album.uri))
            self.create_folder_item('%s [%s]' % (album.name, album.year), url,
                                    album.image)
Beispiel #7
0
 def __init__(self, ui_helper, settings):
     self.addon_handle = int(sys.argv[1])    
     self.add_on = xbmcaddon.Addon(GlobalSettings.ADD_ON_ID)    
     self.ui_helper = ui_helper
     self.settings = settings
     self.create_server_proxy()  
     
     router_config = {None : self.main_menu, 
                      Paths.INBOX: self.inbox,
                      Paths.INBOX_ALBUMS: self.inbox_albums,
                      Paths.INBOX_ARTISTS: self.inbox_artists,
                      Paths.INBOX_PLAYLISTS: self.inbox_playlists,
                      Paths.INBOX_TRACKS: self.inbox_tracks,
                      Paths.STARRED : self.starred, 
                      Paths.SEARCH : self.search, 
                      Paths.PLAYLISTS : self.play_lists_menu,                         
                      Paths.GET_PLAYLIST : self.get_playlist,
                      Paths.FOLDER_PLAYLISTS : self.folder_playlists,
                      Paths.ALBUM_TRACKS : self.album_tracks,
                      Paths.ARTIST_ALBUMS : self.artist_albums,
                      Paths.ARTIST_ALBUMS_FOR_TRACK : self.artist_albums_for_track,
                      Paths.START_SESSION: self.start_session,
                      Paths.STOP_SESSION: self.stop_session,
                      Paths.HAS_ACTIVE_SESSION: self.has_active_session,                         
                      }
     Router(router_config, self)
 def create_list_of_tracks(self, tracks, page = Page(), path = None):
     xbmcplugin.setContent(self.addon_handle, UiHelper.CONTENT_SONGS)
     xbmcplugin.addSortMethod(self.addon_handle, xbmcplugin.SORT_METHOD_TRACKNUM)
     xbmcplugin.addSortMethod(self.addon_handle, xbmcplugin.SORT_METHOD_ARTIST)
     xbmcplugin.addSortMethod(self.addon_handle, xbmcplugin.SORT_METHOD_TITLE)
     xbmcplugin.addSortMethod(self.addon_handle, xbmcplugin.SORT_METHOD_ALBUM)
             
     self.create_track_list_items(tracks, page)
     
     if page.has_next():
         self.create_folder_item(self.add_on.getLocalizedString(30029), Router.url_for(path, page.next()))
Beispiel #9
0
    def create_list_of_tracks(self, tracks, page=Page(), path=None):
        xbmcplugin.setContent(self.addon_handle, UiHelper.CONTENT_SONGS)
        xbmcplugin.addSortMethod(self.addon_handle,
                                 xbmcplugin.SORT_METHOD_TRACKNUM)
        xbmcplugin.addSortMethod(self.addon_handle,
                                 xbmcplugin.SORT_METHOD_ARTIST)
        xbmcplugin.addSortMethod(self.addon_handle,
                                 xbmcplugin.SORT_METHOD_TITLE)
        xbmcplugin.addSortMethod(self.addon_handle,
                                 xbmcplugin.SORT_METHOD_ALBUM)

        self.create_track_list_items(tracks, page)

        if page.has_next():
            self.create_folder_item(self.add_on.getLocalizedString(30029),
                                    Router.url_for(path, page.next()))
Beispiel #10
0
    def create_list_of_artists(self, artists):
        xbmcplugin.setContent(self.addon_handle, UiHelper.CONTENT_ARTISTS)

        for artist in artists:
            url = Router.url_for(Paths.ARTIST_ALBUMS, Model(artist=artist.uri))
            self.create_folder_item('%s' % (artist.name), url)
Beispiel #11
0
 def create_inbox_menu(self, name_tpl, label, path, count):
     if count > 0:
         self.ui_helper.create_folder_item(name_tpl % (label, count), Router.url_for(path))
Beispiel #12
0
 def create_list_of_albums(self, albums):
     xbmcplugin.setContent(self.addon_handle, UiHelper.CONTENT_ALBUMS)
     
     for album in albums:
         url = Router.url_for(Paths.ALBUM_TRACKS, Model(album = album.uri))
         self.create_folder_item('%s [%s]' % (album.name, album.year), url, album.image)
Beispiel #13
0
 def get_playlist_url(self, playlist):
     if playlist.is_folder:
         return Router.url_for(Paths.FOLDER_PLAYLISTS, Model(folder_id = playlist.folder_id))
     else: 
         return Router.url_for(Paths.GET_PLAYLIST, self.settings.initial_page_for_pagination(playlist.uri))         
Beispiel #14
0
 def create_list_of_artists(self, artists):
     xbmcplugin.setContent(self.addon_handle, UiHelper.CONTENT_ARTISTS)
     
     for artist in artists:
         url = Router.url_for(Paths.ARTIST_ALBUMS, Model(artist = artist.uri))
         self.create_folder_item('%s' % (artist.name), url)