def _update_view_playlists(self, playlist_id): """ Update current view with playlist view @param playlist id as int """ view = None if playlist_id is not None: name = self._list_two.get_value(playlist_id) view = PlaylistView(playlist_id, name, self._stack) else: view = PlaylistsManageView(-1, None, False, self._stack.get_allocated_width()/2) if view: view.show() self._stack.add(view) self._stack.set_visible_child(view) # Management or user playlist if playlist_id is None or playlist_id >= 0 or\ playlist_id == Type.LOVED: start_new_thread(view.populate, ()) else: tracks = [] if playlist_id == Lp.player.get_user_playlist_id(): for track in Lp.player.get_user_playlist(): tracks.append(track.id) elif playlist_id == Type.POPULARS: tracks = Lp.tracks.get_populars() elif playlist_id == Type.RECENTS: tracks = Lp.tracks.get_recently_listened_to() elif playlist_id == Type.NEVER: tracks = Lp.tracks.get_never_listened_to() elif playlist_id == Type.RANDOMS: tracks = Lp.tracks.get_randoms() start_new_thread(view.populate_tracks, (tracks,)) self._stack.clean_old_views(view)
def _update_view_playlists(self, playlist_id): view = None if playlist_id is not None: for (p_id, p_str) in Objects.playlists.get(): if p_id == playlist_id: view = PlaylistView(p_str, self._stack) break else: view = PlaylistManageView(-1, None, False, self._stack.get_allocated_width() / 2) if view: view.show() self._stack.add(view) self._stack.set_visible_child(view) start_new_thread(view.populate, ()) self._stack.clean_old_views(view)
def _update_view_playlists(self, playlist_id): view = None if playlist_id is not None: for (p_id, p_str) in Objects.playlists.get(): if p_id == playlist_id: view = PlaylistView(p_str, self._stack) break else: view = PlaylistManageView(-1, None, False, self._stack.get_allocated_width()/2) if view: view.show() self._stack.add(view) self._stack.set_visible_child(view) start_new_thread(view.populate, ()) self._stack.clean_old_views(view)
def _update_view_playlists(self, playlist_id): """ Update current view with playlist view @param playlist id as int """ def load(): sql = Lp.db.get_cursor() if playlist_id == Lp.player.get_user_playlist_id(): tracks = [t.id for t in Lp.player.get_user_playlist()] elif playlist_id == Type.POPULARS: tracks = Lp.tracks.get_populars(sql) elif playlist_id == Type.RECENTS: tracks = Lp.tracks.get_recently_listened_to(sql) elif playlist_id == Type.NEVER: tracks = Lp.tracks.get_never_listened_to(sql) elif playlist_id == Type.RANDOMS: tracks = Lp.tracks.get_randoms(sql) else: tracks = Lp.playlists.get_tracks_id(name, sql) sql.close() return tracks view = None if playlist_id is not None: name = self._list_two.get_value(playlist_id) view = PlaylistView(playlist_id, name, self._stack) else: view = PlaylistsManageView(-1, None, False) if view: # Management or user playlist if playlist_id is None: view.populate() else: loader = Loader(target=load, view=view) loader.start() view.show() self._stack.add(view) self._stack.set_visible_child(view) self._stack.clean_old_views(view)
def _update_view_playlists(self, playlist_id): """ Update current view with playlist view @param playlist id as int """ def load(): sql = Lp.db.get_cursor() if playlist_id == Lp.player.get_user_playlist_id(): tracks = [t.id for t in Lp.player.get_user_playlist()] elif playlist_id == Type.POPULARS: tracks = Lp.tracks.get_populars(sql) elif playlist_id == Type.RECENTS: tracks = Lp.tracks.get_recently_listened_to(sql) elif playlist_id == Type.NEVER: tracks = Lp.tracks.get_never_listened_to(sql) elif playlist_id == Type.RANDOMS: tracks = Lp.tracks.get_randoms(sql) sql.close() return tracks view = None if playlist_id is not None: name = self._list_two.get_value(playlist_id) view = PlaylistView(playlist_id, name, self._stack) else: view = PlaylistsManageView(-1, None, False, self._stack.get_allocated_width()/2) if view: # Management or user playlist if playlist_id is None or playlist_id >= 0 or\ playlist_id == Type.LOVED: view.populate() else: loader = Loader(target=load, view=view) loader.start() view.show() self._stack.add(view) self._stack.set_visible_child(view) self._stack.clean_old_views(view)
def _update_view_playlists(self, playlist_id): """ Update current view with playlist view @param playlist id as int """ def load(): if playlist_id == Lp().player.get_user_playlist_id(): tracks = [t.id for t in Lp().player.get_user_playlist()] elif playlist_id == Type.POPULARS: tracks = Lp().tracks.get_populars() elif playlist_id == Type.RECENTS: tracks = Lp().tracks.get_recently_listened_to() elif playlist_id == Type.NEVER: tracks = Lp().tracks.get_never_listened_to() elif playlist_id == Type.RANDOMS: tracks = Lp().tracks.get_randoms() else: tracks = Lp().playlists.get_tracks_ids(playlist_id) return tracks view = None if playlist_id is not None: view = PlaylistView(playlist_id) else: view = PlaylistsManageView(Type.NONE, None, False) if view: # Management or user playlist if playlist_id is None: view.populate() else: loader = Loader(target=load, view=view) loader.start() view.show() self._stack.add(view) self._stack.set_visible_child(view) self._stack.clean_old_views(view)