Пример #1
0
 async def on_select(self, meta):
     """ Clear the search """
     meta.session['search'] = ""
     back_item = BackItem()
     back_item.id = [meta.selected_id][:-1] + ['0']
     self.id = [meta.selected_id][:-1] + ['1']
     self.parent_menu.items = [back_item, self]
     return await super().on_select(meta)
Пример #2
0
    async def generate_menu_items(self, meta):
        """
        Generate album items from search according to user input
        """
        if meta.user_input and os.getenv("ROFI_RETV") == "2":
            meta.session['search'] = meta.user_input

        items = [
            BackItem(),
            SearchItem(),
        ]
        albums = await spotify.async_search(
            meta.session['search'],
            type='album',
        ) if meta.session.get('search') else {
            'items': []
        }

        for album in albums['items']:
            items.append(
                DynamicNestedMenu(text=album['name'],
                                  sub_menu_type=TrackMenu.from_album,
                                  album=album))

        return items
Пример #3
0
    async def generate_menu_items(self, meta):
        """ Generate track items from search according to user input """

        await self.update_popup_meta(meta)

        if meta.user_input and os.getenv("ROFI_RETV") == "2":
            meta.session['search'] = meta.user_input
        elif meta:
            pass

        items = [
            BackItem(),
            SearchItem(),
        ]
        tracks = await spotify.async_search(
            meta.session['search'],
            ) \
            if meta.session['search'] else {'items':[]}

        for track in tracks['items']:
            items.append(
                TrackItem(
                    track=track,
                    offset=None,
                    text=track['name'],
                ))
        return items
Пример #4
0
    async def generate_menu_items(self, meta):

        await self.update_popup_meta(meta)

        self.tracks = await spotify.get_recently_played()
        track_items = []
        for track in self.tracks:
            track_items.append(
                TrackItem(track=track,
                          offset=track['offset'],
                          text=track['name']))
        return [BackItem()] + track_items
Пример #5
0
    async def generate_menu_items(self, meta):
        """
        Generate a list of selected album items
        """
        items = [BackItem()]
        for album in self.albums['items']:
            items.append(
                DynamicNestedMenu(
                    text=album['name'],
                    sub_menu_type=TrackMenu.from_album,
                    album=album,
                )
            )

        return items
Пример #6
0
    async def generate_menu_items(self, meta):

        await self.update_popup_meta(meta)

        saved_tracks = await spotify.async_all_saved_tracks()
        self.tracks = [item['track'] for item in saved_tracks['items']]
        track_items = []
        for track in self.tracks:    
            track_items.append(
                TrackItem(
                    track=track,
                    # No offset is given for saved tracks 
                    offset=None, 
                    text=track['name']
                )
            )
        return [BackItem()] + track_items
Пример #7
0
    async def generate_menu_items(self, meta):

        if meta.user_input and os.getenv("ROFI_RETV") == "2":
            meta.session['search'] = meta.user_input

        items = [BackItem(), SearchItem()]
        artists = await spotify.async_search(
            meta.session['search'],
            type='artist',
        ) if meta.session.get('search') else {
            'items': []
        }

        for artist in artists['items']:
            items.append(
                DynamicNestedMenu(
                    text=artist['name'],
                    sub_menu_type=ArtistPage,
                    artist=artist,
                ))
        return items
Пример #8
0
    async def generate_menu_items(self, meta):

        if meta.user_input and os.getenv("ROFI_RETV") == "2":
            meta.session['search'] = meta.user_input

        items = [BackItem(), SearchItem()]
        playlists = await spotify.async_search(
            meta.session['search'],
            type='playlist',
        ) if meta.session.get('search') else {
            'items': []
        }

        for playlist in playlists['items']:
            items.append(
                DynamicNestedMenu(
                    sub_menu_type=TrackMenu.from_playlist,
                    playlist=playlist,
                    text=playlist['name'],
                ))

        return items