Exemplo n.º 1
0
def ArtistDirectory(sender, artist):
    dir = MediaContainer(title2=sender.itemTitle)
    radioTitle = "Play " + artist[0] + " Radio"
    if LastFm.IsSubscriber():
        radioName = "artist/%s/similarartists" % String.Quote(artist[0], True)
        dir.Append(
            Function(DirectoryItem(PlayRadio, radioTitle, thumb=artist[1]),
                     radioName=radioName))
    dir.Append(
        Function(DirectoryItem(SimilarArtists,
                               title="Similar Artists",
                               thumb=artist[1]),
                 artist=artist))
    dir.Append(
        Function(DirectoryItem(Videos,
                               title="Videos",
                               thumb=artist[1],
                               summary=None),
                 artist=artist))
    dir.Append(
        Function(DirectoryItem(ArtistTracks,
                               title="Tracks",
                               thumb=artist[1],
                               summary=None),
                 artist=artist))
    dir.Append(
        Function(DirectoryItem(ArtistAlbums,
                               title="Albums",
                               thumb=artist[1],
                               summary=None),
                 artist=artist))
    return dir
Exemplo n.º 2
0
def Category(sender, tag):
    dir = MediaContainer(title2=sender.itemTitle)
    radioTitle = "Play " + tag[0].capitalize() + " Radio"
    if LastFm.IsSubscriber():
        radioName = "globaltags/%s" % String.Quote(tag[0], True)
        dir.Append(
            Function(DirectoryItem(PlayRadio, radioTitle),
                     radioName=radioName))

    dir.Append(Function(DirectoryItem(TagTopArtists, "Top Artists"), tag=tag))
    dir.Append(Function(DirectoryItem(TagTopAlbums, "Top Albums"), tag=tag))
    dir.Append(Function(DirectoryItem(TagTopTracks, "Top Tracks"), tag=tag))
    dir.Append(Function(DirectoryItem(SimilarTags, "Similar Tags"), tag=tag))
    return dir
Exemplo n.º 3
0
def Library(sender, user):
    dir = MediaContainer(title2=sender.itemTitle)
    if LastFm.IsSubscriber():
        title = None
        if LastFm.IsCurrentUser(user):
            title = "Play your Library"
        else:
            userName = LastFm.UserDetails(user)[0]
            title = "Play " + user + "'s Library"
            if userName != None:
                title = "Play " + userName + "'s Library"
        radioName = "user/%s/library" % user
        dir.Append(
            Function(DirectoryItem(PlayRadio, title), radioName=radioName))
    dir.Append(Function(DirectoryItem(LibraryAlbums, "Albums"), user=user))
    dir.Append(Function(DirectoryItem(LibraryArtists, "Artists"), user=user))
    dir.Append(Function(DirectoryItem(LibraryTracks, "Tracks"), user=user))
    return dir
Exemplo n.º 4
0
def MainMenu():
    dir = MediaContainer(mediaType='music', noCache=True)
    if LastFm.IsAuthenticated():
        user = LastFm.CurrentUser()
        if LastFm.IsSubscriber():
            dir.Append(Function(DirectoryItem(Radios, "Radios"), user=user))
        dir.Append(Function(DirectoryItem(Library, "Library"), user=user))
        dir.Append(
            Function(DirectoryItem(RecentTracks, "Recent Tracks"), user=user))
        dir.Append(
            Function(DirectoryItem(LovedTracks, "Loved Tracks"), user=user))
        dir.Append(
            Function(DirectoryItem(RecommendedArtists, "Recommended Artists")))
        dir.Append(Function(DirectoryItem(Friends, "Friends"), user=user))
        dir.Append(Function(DirectoryItem(Neighbours, "Neighbours"),
                            user=user))

        dir.Append(Function(DirectoryItem(GlobalTopTags, "Top Tags")))

        dir.Append(
            Function(
                InputDirectoryItem(SearchTagsResults,
                                   title="Search Tags ...",
                                   prompt="Search Tags",
                                   thumb=S('Search'))))
        dir.Append(
            Function(
                InputDirectoryItem(SearchArtistsResults,
                                   title="Search Artists ...",
                                   prompt="Search Artists",
                                   thumb=S('Search'))))
        dir.Append(
            Function(
                InputDirectoryItem(SearchAlbumsResults,
                                   title="Search Albums ...",
                                   prompt="Search Albums",
                                   thumb=S('Search'))))
    dir.Append(PrefsItem(L("Preferences ..."), thumb=R('icon-prefs.png')))
    return dir