Exemplo n.º 1
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 qobuz.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(30080))
     k.doModal()
     if not k.isConfirmed():
         return False
     newname = k.getText()
     newname = newname.strip()
     if not newname:
         notify_error(dialogHeading, "Don't u call ure child something?")
         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)
     notify_log(lang(30080), (u"%s: %s") % (lang(30165), currentname))
     executeBuiltin(containerRefresh())
     return True
Exemplo n.º 2
0
 def gui_create(self):
     name = self.get_parameter('query')
     if not name:
         from qobuz.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
Exemplo n.º 3
0
 def gui_create(self):
     query = self.get_parameter('query', unQuote=True)
     if not query:
         from qobuz.gui.util import Keyboard
         k = Keyboard('', lang(30182))
         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']
Exemplo n.º 4
0
 def fetch(self, options=None):
     if self.search_type is None:
         return {}
     query = self.get_parameter('query', to='unquote')
     if not query:
         from qobuz.gui.util import Keyboard
         k = Keyboard('', 'My %s' % self.search_type)
         k.doModal()
         if not k.isConfirmed():
             return None
         query = k.getText().strip()
     if query == '':
         return None
     kwargs = {'query': converter.quote(query)}
     if self.source is not None:
         kwargs['source'] = self.source
     logger.info('SEARCH %s', kwargs)
     if self.search_type == 'albums':
         return api.get('/collection/getAlbums', **kwargs)
     elif self.search_type == 'artists':
         return api.get('/collection/getArtists', **kwargs)
     elif self.search_type == 'tracks':
         return api.get('/collection/getTracks', **kwargs)
     return None
Exemplo n.º 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 qobuz.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 'items' not in data[stype]:
         return False
     self.set_parameter('query', query, quote=True)
     self.data = data
     return True
Exemplo n.º 6
0
 def gui_create(self):
     name = self.get_parameter('query')
     if not name:
         from qobuz.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
Exemplo n.º 7
0
 def fetch(self, options=None):
     if self.search_type is None:
         return {}
     query = self.get_parameter('query', to='unquote')
     if query is None:
         from qobuz.gui.util import Keyboard
         k = Keyboard('', self.search_type)
         k.doModal()
         if not k.isConfirmed():
             return None
         query = k.getText().strip()
         if query is None or query == '':
             return None
         self.set_parameter('query', query, quote=True)
     return api.get('/search/getResults',
                    query=query,
                    type=self.search_type,
                    limit=self.limit,
                    offset=self.offset)
Exemplo n.º 8
0
 def fetch(self, options=None):
     if self.search_type is None:
         return {}
     query = self.get_parameter('query', to='unquote')
     if not query:
         from qobuz.gui.util import Keyboard
         k = Keyboard('', 'My %s' % self.search_type)
         k.doModal()
         if not k.isConfirmed():
             return None
         query = k.getText().strip()
     if query == '':
         return None
     kwargs = {'query': converter.quote(query)}
     if self.source is not None:
         kwargs['source'] = self.source
     logger.info('SEARCH %s', kwargs)
     if self.search_type == 'albums':
         return api.get('/collection/getAlbums', **kwargs)
     elif self.search_type == 'artists':
         return api.get('/collection/getArtists', **kwargs)
     elif self.search_type == 'tracks':
         return api.get('/collection/getTracks', **kwargs)
     return None