Example #1
0
 def inbox(self, args):
     inbox = Model.from_object(self.server.inbox())
     label_tpl = '%s (%d)'
     self.create_inbox_menu(label_tpl, self.add_on.getLocalizedString(30035), Paths.INBOX_PLAYLISTS, count = len(inbox.playlists))
     self.create_inbox_menu(label_tpl, self.add_on.getLocalizedString(30036), Paths.INBOX_ARTISTS, count = len(inbox.artists))
     self.create_inbox_menu(label_tpl, self.add_on.getLocalizedString(30037), Paths.INBOX_ALBUMS, count = len(inbox.albums))
     self.create_inbox_menu(label_tpl, self.add_on.getLocalizedString(30038), Paths.INBOX_TRACKS, count = len(inbox.tracks))
     self.ui_helper.end_directory()
Example #2
0
 def search(self, args, path):        
     if args.identifier == '':
         query = self.ui_helper.keyboardText()
     else:
         query = args.identifier
     if query is not None and query is not '':
         tracks_model = Model.from_object(self.server.search(Page(args.start, args.offset, args.max_items, query)))
         self.ui_helper.create_list_of_tracks(Model.from_object_list(tracks_model.tracks), Page.from_obj(tracks_model.page), path)
     self.ui_helper.end_directory()
Example #3
0
    def execute(self):
        function = self.route_config.get(self.path)
        args_str = self.args.get('args')
        args = {}
        if args_str != None:
            args = json.loads(args_str)
        if function == None:
            raise Exception(
                "Incorrect router config. No function provided for path = " +
                self.path)

        if self.context != None:
            self.execute_path_function(function, Model.from_object(args),
                                       self.path)
        else:
            function(args)
Example #4
0
 def get_playlist(self, args, path):
     tracks_model = Model.from_object(self.server.playlist_tracks(args))
     self.ui_helper.create_list_of_tracks(Model.from_object_list(tracks_model.tracks), Page.from_obj(tracks_model.page), path)        
     self.ui_helper.end_directory()
Example #5
0
 def inbox_tracks(self, args):
     inbox = Model.from_object(self.server.inbox())
     self.ui_helper.create_list_of_tracks(Model.from_object_list(inbox.tracks))
     self.ui_helper.end_directory()
Example #6
0
 def inbox_playlists(self, args):
     inbox = Model.from_object(self.server.inbox())
     self.ui_helper.create_list_of_playlists(Model.from_object_list(inbox.playlists), show_owner = True)
     self.ui_helper.end_directory()