Пример #1
0
 def fetch(self, Dir, lvl, whiteFlag, blackFlag):
     limit = getSetting('pagination_limit', asInt=True)
     self.data = None
     query = self.query
     if not query:
         from gui.util import Keyboard
         k = Keyboard('', 'My %s' % self.search_type)
         k.doModal()
         if not k.isConfirmed():
             return False
         query = k.getText()
     query.strip()
     info(self, 'search_type: %s, query: %s' % (self.search_type, query))
     source = self.source
     kwargs = {'query': query,
               'limit': limit,
               }
     if source is not None:
         kwargs['source'] = source
     data = None
     if self.search_type == 'albums':
         data = api.get('/collection/getAlbums', **kwargs)
     elif self.search_type == 'artists':
         data = api.get('/collection/getArtists', **kwargs)
     elif self.search_type == 'tracks':
         data = api.get('/collection/getTracks', **kwargs)
     if data is None:
         return False
     self.data = data
     return True
Пример #2
0
    def gui_create(self):
        name = self.get_parameter("query")
        if not name:
            from gui.util import Keyboard

            kb = Keyboard("", str(lang(41102)))
            kb.doModal()
            name = ""
            if not kb.isConfirmed():
                return False
            name = kb.getText().strip()
        if not name:
            return False
        if not self.create(name):
            notifyH("Qobuz", "Cannot add friend %s" % (name))
            return False
        notifyH("Qobuz", "Friend %s added" % (name))
        return True
Пример #3
0
 def gui_create(self):
     name = self.get_parameter('query')
     if not name:
         from gui.util import Keyboard
         kb = Keyboard('',
                       str(lang(30181)))
         kb.doModal()
         name = ''
         if not kb.isConfirmed():
             return False
         name = kb.getText().strip()
     if not name:
         return False
     if not self.create(name):
         notifyH('Qobuz', 'Cannot add friend %s' % (name))
         return False
     notifyH('Qobuz', 'Friend %s added' % (name))
     return True
Пример #4
0
 def gui_rename(self, playlist_id = None):
     if not playlist_id:
         playlist_id = self.nid
     if not playlist_id:
         warn(self, "Can't rename playlist without id")
         return False
     from gui.util import Keyboard
     data = api.get('/playlist/get', playlist_id=playlist_id)
     if not data:
         warn(self, "Something went wrong while renaming playlist")
         return False
     self.data = data
     currentname = self.get_name()
     k = Keyboard(currentname, lang(30078))
     k.doModal()
     if not k.isConfirmed():
         return False
     newname = k.getText()
     newname = newname.strip()
     if not newname:
         notifyH(dialogHeading, "Don't u call ure child something?", 
                 'icon-error-256')
         return False
     if newname == currentname:
         return True
     res = api.playlist_update(playlist_id=playlist_id, name=newname)
     if not res:
         warn(self, "Cannot rename playlist with name %s" % (newname) )
         return False
     self.delete_cache(playlist_id)
     notifyH(lang(30078), (u"%s: %s") % (lang(39009), currentname))
     executeBuiltin(containerRefresh())
     return True
Пример #5
0
 def fetch(self, Dir, lvl, whiteFlag, blackFlag):
     limit = getSetting('pagination_limit')
     stype = self.search_type
     query = self.get_parameter('query', unQuote=True)
     if not query:
         from gui.util import Keyboard
         k = Keyboard('', stype)
         k.doModal()
         if not k.isConfirmed():
             return False
         query = k.getText()
     query.strip()
     data = api.get('/search/getResults',
                    query=query,
                    type=stype,
                    limit=limit,
                    offset=self.offset)
     if not data:
         warn(self, "Search return no data")
         return False
     if data[stype]['total'] == 0:
         return False
     if not 'items' in data[stype]:
         return False
     self.set_parameter('query', query, quote=True)
     self.data = data
     return True
Пример #6
0
    def fetch(self, Dir, lvl, whiteFlag, blackFlag):
        limit = getSetting('pagination_limit', isInt=True)
        self.data = None
        query = self.query
        if not query:
            from gui.util import Keyboard
            k = Keyboard('', 'My %s' % self.search_type)
            k.doModal()
            if not k.isConfirmed():
                return False
            query = k.getText()
        query.strip()
        info(self, 'search_type: %s, query: %s' % (self.search_type, query))
        source = self.source
        kwargs = {
            'query': query,
            'limit': limit,
        }
        if source is not None:
            kwargs['source'] = source
        data = None
        self.data = data
        if self.search_type == 'albums':
            data = api.get('/collection/getAlbums', **kwargs)
        elif self.search_type == 'artists':
            data = api.get('/collection/getArtists', **kwargs)
        elif self.search_type == 'tracks':
            data = api.get('/collection/getTracks', **kwargs)
#         try:
#             self.data = data['items']
#             return True
#         except Exception as e:
#             warn(self, 'Exception: %s' % e)
        self.data = data
        return False
Пример #7
0
 def fetch(self, Dir, lvl, whiteFlag, blackFlag):
     limit = getSetting('pagination_limit')
     stype = self.search_type
     query = self.get_parameter('query', unQuote=True)
     if not query:
         from gui.util import Keyboard
         k = Keyboard('', stype)
         k.doModal()
         if not k.isConfirmed():
             return False
         query = k.getText()
     query.strip()
     data = api.get('/search/getResults', query=query, type=stype, 
                        limit=limit, offset=self.offset)
     if not data:
         warn(self, "Search return no data")
         return False
     if data[stype]['total'] == 0:
         return False
     if not 'items' in data[stype]:
         return False
     self.set_parameter('query', query, quote=True)
     self.data = data
     return True
Пример #8
0
 def gui_create(self):
     name = self.get_parameter('query')
     if not name:
         from gui.util import Keyboard
         kb = Keyboard('', str(lang(41102)))
         kb.doModal()
         name = ''
         if not kb.isConfirmed():
             return False
         name = kb.getText().strip()
     if not name:
         return False
     if not self.create(name):
         notifyH('Qobuz', 'Cannot add friend %s' % (name))
         return False
     notifyH('Qobuz', 'Friend %s added' % (name))
     return True
Пример #9
0
 def gui_create(self):
     query = self.get_parameter('query', unQuote=True)
     if not query:
         from gui.util import Keyboard
         k = Keyboard('', lang(42000))
         k.doModal()
         if not k.isConfirmed():
             warn(self, 'Creating playlist aborted')
             return None
         query = k.getText()
     ret = self.create(query)
     if not ret:
         warn(self, "Cannot create playlist named '" + query + "'")
         return None
     self.set_as_current(ret['id'])
     self.delete_cache(ret['id'])
     url = self.make_url(nt=Flag.USERPLAYLISTS)
     executeBuiltin(containerUpdate(url))
     return ret['id']