def main(): if len(sys.argv) != 4: sys.exit(__doc__) m.auth(sys.argv[2], sys.argv[3]) mpdclient = connect_to_mpd() add_release = partial(add_release_to_playlist, mpdclient) map(add_release, get_releases_in_collection(sys.argv[1]))
def main(): if not len(sys.argv) == 2: sys.exit() user = sys.argv[1] mpd = connect_to_mpd() network = connect_to_lastfm() user = network.get_user(user) tracks = user.get_top_tracks() for index, track in enumerate( tracks ): item = track.item results = mpd.search("musicbrainz_trackid", item.get_mbid()) if len(results) > 0: mpd.add(results[0]["file"]) else: results = mpd.search("artist", item.get_artist(), "title", item.get_title()) if len(results) > 0: mpd.add(results[0]["file"])