コード例 #1
0
def GetArtistMenu(id, title, thumb, **params):
    oc = ObjectContainer(title2=unicode(L("Artist") + " " + title))

    response1 = service.get_albums(artists=id, limit=1, offset=0,
                                         year__gte=common.get_start_music_year(),
                                         year__lte=common.get_end_music_year())
    count1 = int(response1['meta']['total_count'])

    if count1 > 0:
        oc.add(DirectoryObject(
            key=Callback(albums.HandleAlbums, title=unicode(L('Albums')) + " " + title, artists=id),
            title=unicode(L('Albums') + ' (' + str(count1) + ')'),
            thumb=thumb
        ))

    response2 = service.get_tracks(artists=id, limit=1, offset=0,
                                         year__gte=common.get_start_music_year(),
                                         year__lte=common.get_end_music_year())
    count2 = int(response2['meta']['total_count'])

    if count2 > 0:
        oc.add(DirectoryObject(
            key=Callback(audio_tracks.HandleAudioTracks, name=L('Audio Tracks') + " " + title, thumb=thumb, artists=id),
            title=unicode(L('Audio Tracks') + ' (' + response2['meta']['total_count'] + ')'),
            thumb=thumb
        ))

    music_queue.append_controls(oc, name=title, artists=id, thumb=thumb)

    return oc
コード例 #2
0
ファイル: albums.py プロジェクト: shvets/music-plex-plugin
def HandleAlbums(title, page=1, **params):
    oc = ObjectContainer(title2=unicode(L(title)))

    page = int(page)
    limit = common.get_elements_per_page()
    offset = (page - 1) * limit

    response = service.get_albums(limit=limit,
                                  offset=offset,
                                  year__gte=common.get_start_music_year(),
                                  year__lte=common.get_end_music_year(),
                                  **params)

    oc.title2 = unicode(L(title)) + ' (' + str(
        response['meta']['total_count']) + ')'

    for media in BuildAlbumsList(response['objects']):
        oc.add(media)

    oc.add(
        InputDirectoryObject(key=Callback(SearchMusicAlbums,
                                          title=unicode(L("Albums Search")),
                                          page=page),
                             title=unicode(L("Albums Search")),
                             thumb=R(SEARCH_ICON)))

    common.add_pagination_to_response(response, page)
    pagination.append_controls(oc,
                               response,
                               callback=HandleAlbums,
                               title=title,
                               page=page,
                               **params)

    return oc
コード例 #3
0
ファイル: albums.py プロジェクト: shvets/music-plex-plugin
def HandleAlbums(title, page=1, **params):
    oc = ObjectContainer(title2=unicode(L(title)))

    page = int(page)
    limit = common.get_elements_per_page()
    offset = (page-1)*limit

    response = service.get_albums(limit=limit, offset=offset,
                                        year__gte=common.get_start_music_year(),
                                        year__lte=common.get_end_music_year(),
                                        **params)

    oc.title2 = unicode(L(title)) + ' (' + str(response['meta']['total_count']) + ')'

    for media in BuildAlbumsList(response['objects']):
        oc.add(media)

    oc.add(InputDirectoryObject(
            key=Callback(SearchMusicAlbums, title=unicode(L("Albums Search")), page=page),
            title=unicode(L("Albums Search")),
            thumb=R(SEARCH_ICON)
    ))

    common.add_pagination_to_response(response, page)
    pagination.append_controls(oc, response, callback=HandleAlbums, title=title, page=page, **params)

    return oc
コード例 #4
0
ファイル: albums.py プロジェクト: shvets/music-plex-plugin
def HandleDoubleAlbum(name, thumb, **params):
    oc = ObjectContainer(title2=unicode(name))

    response = service.get_albums(limit=common.get_elements_per_page(),
                                        year__gte=common.get_start_music_year(),
                                        year__lte=common.get_end_music_year(),
                                        **params)

    for media in response['objects']:
        id = media['id']
        title = media['title']
        thumb = media['thumbnail']

        key = Callback(audio_tracks.HandleAudioTracks, album=id, name=title, thumb=thumb)
        oc.add(DirectoryObject(key=key, title=unicode(title), thumb=thumb))

    music_queue.append_controls(oc, name=name, thumb=thumb, **params)

    return oc
コード例 #5
0
ファイル: albums.py プロジェクト: shvets/music-plex-plugin
def HandleDoubleAlbum(name, thumb, **params):
    oc = ObjectContainer(title2=unicode(name))

    response = service.get_albums(limit=common.get_elements_per_page(),
                                  year__gte=common.get_start_music_year(),
                                  year__lte=common.get_end_music_year(),
                                  **params)

    for media in response['objects']:
        id = media['id']
        title = media['title']
        thumb = media['thumbnail']

        key = Callback(audio_tracks.HandleAudioTracks,
                       album=id,
                       name=title,
                       thumb=thumb)
        oc.add(DirectoryObject(key=key, title=unicode(title), thumb=thumb))

    music_queue.append_controls(oc, name=name, thumb=thumb, **params)

    return oc