Beispiel #1
0
def handle_albums(results):
    albums = ItemList(content_type="albums")
    if not results.get('album'):
        return albums
    local_desc = 'strDescription' + xbmc.getLanguage(xbmc.ISO_639_1).upper()
    for item in results['album']:
        desc = ""
        if local_desc in item and item[local_desc]:
            desc = item.get(local_desc, "")
        elif item.get('strDescriptionEN'):
            desc = item['strDescriptionEN']
        elif item.get('strDescription'):
            desc = item['strDescription']
        if item.get('strReview'):
            desc += "[CR][CR][B]%s:[/B][CR][CR]%s" % (addon.LANG(185),
                                                      item['strReview'])
        album = AudioItem(label=item['strAlbum'], path="")
        album.set_infos({
            'artist': item['strArtist'],
            'album': item['strAlbum'],
            'mediatype': "album",
            'genre': item['strGenre'],
            'year': item['intYearReleased']
        })
        album.set_properties({
            'mbid': item['strMusicBrainzID'],
            'id': item['idAlbum'],
            'audiodb_id': item['idAlbum'],
            'album_description': desc,
            'album_mood': item['strMood'],
            'album_style': item['strStyle'],
            'speed': item['strSpeed'],
            'album_Theme': item['strTheme'],
            'type': item['strReleaseFormat'],
            'loved': item['intLoved'],
            'location': item['strLocation'],
            'itunes_id': item['strItunesID'],
            'amazon_id': item['strAmazonID'],
            'sales': item['intSales']
        })
        album.set_artwork({
            'thumb': item['strAlbumThumb'],
            'spine': item['strAlbumSpine'],
            'cdart': item['strAlbumCDart'],
            'thumbback': item['strAlbumThumbBack']
        })
        albums.append(album)
    return local_db.compare_album_with_library(albums)
Beispiel #2
0
def handle_tracks(results):
    tracks = ItemList(content_type="songs")
    if not results.get('track'):
        return tracks
    for item in results['track']:
        youtube_id = utils.extract_youtube_id(item.get('strMusicVid', ''))
        track = AudioItem(label=item['strTrack'],
                          path="%syoutubevideo&&id=%s" % (PLUGIN_BASE, youtube_id))
        track.set_infos({'title': item['strTrack'],
                         'album': item['strAlbum'],
                         'artist': item['strArtist'],
                         'mediatype': "song"})
        track.set_properties({'mbid': item['strMusicBrainzID']})
        track.set_artwork({'thumb': "http://i.ytimg.com/vi/%s/0.jpg" % youtube_id})
        tracks.append(track)
    return tracks
def handle_albums(results):
    albums = ItemList(content_type="albums")
    if not results.get('album'):
        return albums
    local_desc = 'strDescription' + xbmc.getLanguage(xbmc.ISO_639_1).upper()
    for item in results['album']:
        desc = ""
        if local_desc in item and item[local_desc]:
            desc = item.get(local_desc, "")
        elif item.get('strDescriptionEN'):
            desc = item['strDescriptionEN']
        elif item.get('strDescription'):
            desc = item['strDescription']
        if item.get('strReview'):
            desc += "[CR][CR][B]%s:[/B][CR][CR]%s" % (addon.LANG(185), item['strReview'])
        album = AudioItem(label=item['strAlbum'],
                          path="")
        album.set_infos({'artist': item['strArtist'],
                         'album': item['strAlbum'],
                         'mediatype': "album",
                         'genre': item['strGenre'],
                         'year': item['intYearReleased']})
        album.set_properties({'mbid': item['strMusicBrainzID'],
                              'id': item['idAlbum'],
                              'audiodb_id': item['idAlbum'],
                              'album_description': desc,
                              'album_mood': item['strMood'],
                              'album_style': item['strStyle'],
                              'speed': item['strSpeed'],
                              'album_Theme': item['strTheme'],
                              'type': item['strReleaseFormat'],
                              'loved': item['intLoved'],
                              'location': item['strLocation'],
                              'itunes_id': item['strItunesID'],
                              'amazon_id': item['strAmazonID'],
                              'sales': item['intSales']})
        album.set_artwork({'thumb': item['strAlbumThumb'],
                           'spine': item['strAlbumSpine'],
                           'cdart': item['strAlbumCDart'],
                           'thumbback': item['strAlbumThumbBack']})
        albums.append(album)
    return local_db.compare_album_with_library(albums)