def music_add_artist_to_library(artist_name): import math library_folder = setup_library( plugin.get_setting(SETTING_MUSIC_LIBRARY_FOLDER, unicode)) album_results = lastfm.get_artist_top_albums(artist_name) total_albums = len(album_results) index = 0 pDialog = xbmcgui.DialogProgress() pDialog.create( '[COLOR yellow]chappaai[/COLOR]', _("{0} {1} {2}").format(_("Adding"), artist_name, _("to library"))) for album in album_results["album"]: album_name = to_utf8(album["name"]) percent_done = int(math.floor((float(index) / total_albums) * 100)) pDialog.update( percent_done, _("{0} {1} - {2} {3}").format(_("Adding"), artist_name, album_name, _("to library"))) track_results = lastfm.get_album_info(artist_name, album_name) for track in track_results["tracks"]["track"]: if pDialog.iscanceled(): pDialog.update(0) return track_name = to_utf8(track["name"]) add_music_to_library(library_folder, artist_name, album_name, track_name) index += 1 pDialog.update(0) scan_library(type="music")
def music_add_album_to_library(artist_name, album_name): library_folder = setup_library(plugin.get_setting(SETTING_MUSIC_LIBRARY_FOLDER)) results = lastfm.get_album_info(artist_name, album_name) for track in results["tracks"]["track"]: track_name = to_utf8(track["name"]) add_music_to_library(library_folder, artist_name, album_name, track_name) scan_library(type="music")
def music_add_album_to_library(artist_name, album_name): library_folder = setup_library(plugin.get_setting(SETTING_MUSIC_LIBRARY_FOLDER, unicode)) results = lastfm.get_album_info(artist_name, album_name) for track in results["tracks"]["track"]: track_name = to_utf8(track["name"]) add_music_to_library(library_folder, artist_name, album_name, track_name) scan_library(type="music")
def music_add_artist_to_library(artist_name): import math library_folder = setup_library(plugin.get_setting(SETTING_MUSIC_LIBRARY_FOLDER)) album_results = lastfm.get_artist_top_albums(artist_name) total_albums = len(album_results) index = 0 pDialog = xbmcgui.DialogProgress() pDialog.create( "[COLOR ff0084ff]M[/COLOR]etalli[COLOR ff0084ff]Q[/COLOR]", _("{0} {1} {2}").format(_("Adding"), artist_name, _("to library")), ) for album in album_results["album"]: album_name = to_utf8(album["name"]) percent_done = int(math.floor((float(index) / total_albums) * 100)) pDialog.update( percent_done, _("{0} {1} - {2} {3}").format(_("Adding"), artist_name, album_name, _("to library")) ) track_results = lastfm.get_album_info(artist_name, album_name) for track in track_results["tracks"]["track"]: if pDialog.iscanceled(): pDialog.update(0) return track_name = to_utf8(track["name"]) add_music_to_library(library_folder, artist_name, album_name, track_name) index += 1 pDialog.update(0) scan_library(type="music")
def music_add_to_library(artist_name, track_name, album_name): if album_name == "None": album_name = lastfm.get_track_info(artist_name, track_name)["album"]["title"] library_folder = setup_library(plugin.get_setting(SETTING_MUSIC_LIBRARY_FOLDER)) add_music_to_library(library_folder, artist_name, album_name, track_name) scan_library(type="music")
def music_add_to_library(artist_name, track_name, album_name): if album_name == "None": album_name = lastfm.get_track_info(artist_name, track_name)["album"]["title"] library_folder = setup_library(plugin.get_setting(SETTING_MUSIC_LIBRARY_FOLDER, unicode)) add_music_to_library(library_folder, artist_name, album_name, track_name) scan_library(type="music")