Esempio n. 1
0
def Radios(sender, user):
    dir = MediaContainer(title2=sender.itemTitle)
    name = None
    if LastFm.IsCurrentUser(user):
        name = "your"
    else:
        userName = LastFm.UserDetails(user)[0]
        name = user + "'s"
        if userName != None:
            name = userName + "'s"

    libraryRadio = "user/%s/library" % user
    dir.Append(
        Function(DirectoryItem(PlayRadio, "Play " + name + " Library Radio"),
                 radioName=libraryRadio))
    lovedRadio = "user/%s/loved" % user
    dir.Append(
        Function(DirectoryItem(PlayRadio,
                               "Play " + name + " Loved Tracks Radio"),
                 radioName=lovedRadio))
    recommendedRadio = "user/%s/recommended" % user
    dir.Append(
        Function(DirectoryItem(PlayRadio,
                               "Play " + name + " Recommendations Radio"),
                 radioName=recommendedRadio))
    neighoursRadio = "user/%s/neighbours" % user
    dir.Append(
        Function(DirectoryItem(PlayRadio,
                               "Play " + name + " Neighbourhood Radio"),
                 radioName=neighoursRadio))
    return dir
Esempio n. 2
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