Esempio n. 1
0
 def _update_view_albums(self, genre_id, is_compilation=False):
     view = AlbumsView(genre_id, is_compilation)
     self._stack.add(view)
     view.show()
     start_new_thread(view.populate, ())
     self._stack.set_visible_child(view)
     self._stack.clean_old_views(view)
Esempio n. 2
0
 def _update_view_albums(self, genre_id, is_compilation=False):
     """
         Update current view with albums view
         @param genre id as int
         @param is compilation as bool
     """
     view = AlbumsView(genre_id, is_compilation)
     self._stack.add(view)
     view.show()
     start_new_thread(view.populate, ())
     self._stack.set_visible_child(view)
     self._stack.clean_old_views(view)
Esempio n. 3
0
    def __update_view_albums(self, genre_ids, artist_ids):
        """
            Update current view with albums view
            @param genre ids as [int]
            @param is compilation as bool
        """
        def load():
            items = []
            is_compilation = artist_ids and artist_ids[0] == Type.COMPILATIONS
            if genre_ids and genre_ids[0] == Type.ALL:
                if is_compilation or\
                        Lp().settings.get_value("show-compilations"):
                    items = Lp().albums.get_compilation_ids()
                if not is_compilation:
                    items += Lp().albums.get_ids()
            elif genre_ids and genre_ids[0] == Type.POPULARS:
                items = Lp().albums.get_rated()
                count = 100 - len(items)
                for album in Lp().albums.get_populars(count):
                    if album not in items:
                        items.append(album)
            elif genre_ids and genre_ids[0] == Type.LOVED:
                items = Lp().albums.get_loves()
            elif genre_ids and genre_ids[0] == Type.RECENTS:
                items = Lp().albums.get_recents()
            elif genre_ids and genre_ids[0] == Type.RANDOMS:
                items = Lp().albums.get_randoms()
            elif genre_ids and genre_ids[0] in [Type.SPOTIFY,
                                                Type.LASTFM]:
                items = Lp().tracks.get_charts_ids(genre_ids)
            elif genre_ids and genre_ids[0] == Type.ITUNES:
                items = Lp().albums.get_charts_ids(genre_ids)
            elif artist_ids and artist_ids[0] == Type.CHARTS:
                items = Lp().albums.get_charts_ids(genre_ids)
            else:
                if is_compilation or\
                        Lp().settings.get_value("show-compilations"):
                    items = Lp().albums.get_compilation_ids(genre_ids)
                if not is_compilation:
                    items += Lp().albums.get_ids([], genre_ids)
            return items

        # Spotify albums contains only one tracks, show playlist view
        if genre_ids and genre_ids[0] in [Type.SPOTIFY,
                                          Type.LASTFM]:
            from lollypop.view_playlists import PlaylistsView
            view = PlaylistsView(genre_ids)
            loader = Loader(target=load, view=view)
            loader.start()
        else:
            from lollypop.view_albums import AlbumsView
            self.__stop_current_view()
            view = AlbumsView(genre_ids, artist_ids)
            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)
Esempio n. 4
0
    def __update_view_albums(self, genre_ids, artist_ids):
        """
            Update current view with albums view
            @param genre ids as [int]
            @param is compilation as bool
        """
        def load():
            items = []
            is_compilation = artist_ids and artist_ids[0] == Type.COMPILATIONS
            if genre_ids and genre_ids[0] == Type.ALL:
                if is_compilation or\
                        Lp().settings.get_value("show-compilations"):
                    items = Lp().albums.get_compilation_ids()
                if not is_compilation:
                    items += Lp().albums.get_ids()
            elif genre_ids and genre_ids[0] == Type.POPULARS:
                items = Lp().albums.get_rated()
                count = 100 - len(items)
                for album in Lp().albums.get_populars(count):
                    if album not in items:
                        items.append(album)
            elif genre_ids and genre_ids[0] == Type.LOVED:
                items = Lp().albums.get_loves()
            elif genre_ids and genre_ids[0] == Type.RECENTS:
                items = Lp().albums.get_recents()
            elif genre_ids and genre_ids[0] == Type.NEVER:
                items = Lp().albums.get_never_listened_to()
            elif genre_ids and genre_ids[0] == Type.RANDOMS:
                items = Lp().albums.get_randoms()
            else:
                if is_compilation or\
                        Lp().settings.get_value("show-compilations"):
                    items = Lp().albums.get_compilation_ids(genre_ids)
                if not is_compilation:
                    items += Lp().albums.get_ids([], genre_ids)
            return items

        from lollypop.view_albums import AlbumsView
        self.__stop_current_view()
        view = AlbumsView(genre_ids, artist_ids)
        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)
Esempio n. 5
0
    def _update_view_albums(self, genre_ids, is_compilation=False):
        """
            Update current view with albums view
            @param genre ids as [int]
            @param is compilation as bool
        """
        def load():
            albums = []
            if genre_ids and genre_ids[0] == Type.ALL:
                if is_compilation:
                    albums = Lp().albums.get_compilations()
                else:
                    if Lp().settings.get_value('show-compilations'):
                        albums = Lp().albums.get_compilations()
                    albums += Lp().albums.get_ids()
            elif genre_ids and genre_ids[0] == Type.POPULARS:
                albums = Lp().albums.get_populars()
            elif genre_ids and genre_ids[0] == Type.RECENTS:
                albums = Lp().albums.get_recents()
            elif genre_ids and genre_ids[0] == Type.RANDOMS:
                albums = Lp().albums.get_randoms()
            elif is_compilation:
                albums = Lp().albums.get_compilations(genre_ids)
            else:
                if Lp().settings.get_value('show-compilations'):
                    albums = Lp().albums.get_compilations(genre_ids)
                albums += Lp().albums.get_ids([], genre_ids)
            return albums

        artist_ids = []
        if is_compilation:
            artist_ids.append(Type.COMPILATIONS)
        view = AlbumsView(genre_ids, artist_ids)
        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)
Esempio n. 6
0
    def _update_view_albums(self, genre_ids, is_compilation=False):
        """
            Update current view with albums view
            @param genre ids as [int]
            @param is compilation as bool
        """
        def load():
            albums = []
            if genre_ids and genre_ids[0] == Type.ALL:
                if is_compilation:
                    albums = Lp().albums.get_compilations()
                else:
                    if Lp().settings.get_value('show-compilations'):
                        albums = Lp().albums.get_compilations()
                    albums += Lp().albums.get_ids()
            elif genre_ids and genre_ids[0] == Type.POPULARS:
                albums = Lp().albums.get_populars()
            elif genre_ids and genre_ids[0] == Type.RECENTS:
                albums = Lp().albums.get_recents()
            elif genre_ids and genre_ids[0] == Type.RANDOMS:
                albums = Lp().albums.get_randoms()
            elif is_compilation:
                albums = Lp().albums.get_compilations(genre_ids)
            else:
                if Lp().settings.get_value('show-compilations'):
                    albums = Lp().albums.get_compilations(genre_ids)
                albums += Lp().albums.get_ids([], genre_ids)
            return albums

        artist_ids = []
        if is_compilation:
            artist_ids.append(Type.COMPILATIONS)
        view = AlbumsView(genre_ids, artist_ids)
        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)
Esempio n. 7
0
    def _update_view_albums(self, genre_id, is_compilation=False):
        """
            Update current view with albums view
            @param genre id as int
            @param is compilation as bool
        """

        def load():
            sql = Lp.db.get_cursor()
            albums = []
            if genre_id == Type.ALL:
                if is_compilation:
                    albums = Lp.albums.get_compilations(None, sql)
                else:
                    if Lp.settings.get_value("show-compilations"):
                        albums = Lp.albums.get_compilations(None, sql)
                    albums += Lp.albums.get_ids(None, None, sql)
            elif genre_id == Type.POPULARS:
                albums = Lp.albums.get_populars(sql)
            elif genre_id == Type.RECENTS:
                albums = Lp.albums.get_recents(sql)
            elif genre_id == Type.RANDOMS:
                albums = Lp.albums.get_randoms(sql)
            elif is_compilation:
                albums = Lp.albums.get_compilations(genre_id, sql)
            else:
                if Lp.settings.get_value("show-compilations"):
                    albums = Lp.albums.get_compilations(genre_id, sql)
                albums += Lp.albums.get_ids(None, genre_id, sql)
            sql.close()
            return albums

        view = AlbumsView(genre_id, is_compilation)
        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)
Esempio n. 8
0
    def _update_view_albums(self, genre_id, is_compilation=False):
        """
            Update current view with albums view
            @param genre id as int
            @param is compilation as bool
        """
        def load():
            albums = []
            if genre_id == Type.ALL:
                if is_compilation:
                    albums = Lp().albums.get_compilations(None)
                else:
                    if Lp().settings.get_value('show-compilations'):
                        albums = Lp().albums.get_compilations(None)
                    albums += Lp().albums.get_ids(None, None)
            elif genre_id == Type.POPULARS:
                albums = Lp().albums.get_populars()
            elif genre_id == Type.RECENTS:
                albums = Lp().albums.get_recents()
            elif genre_id == Type.RANDOMS:
                albums = Lp().albums.get_randoms()
            elif is_compilation:
                albums = Lp().albums.get_compilations(genre_id)
            else:
                if Lp().settings.get_value('show-compilations'):
                    albums = Lp().albums.get_compilations(genre_id)
                albums += Lp().albums.get_ids(None, genre_id)
            return albums

        view = AlbumsView(genre_id, is_compilation)
        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)