#!/usr/bin/env python # -*- coding: utf-8 -*- # # Set last.fm tags for track # # $LastChangedDate$ # # Copyright (C) 2007 by Timur Izhbulatov # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published # by the Free Software Foundation; version 2 only. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. import sys from rename_lastfm_tag import get_track_tags, make_xml_rpc_proxy, \ read_credentials, make_challenge_auth def main(): user, password = read_credentials() challenge, auth = make_challenge_auth() artist = None track = None while not artist: artist = raw_input('Artist name: ') while not track: track = raw_input('Track name: ') tags = get_track_tags(artist, track) print 'Current tags for %s - %s:\n%s' % (artist, track, tags) new_tags = raw_input('Enter new tags (comma-separated): ') new_tags = [ t.strip() for t in new_tags.split(',') ] proxy = make_xml_rpc_proxy() proxy.tagTrack(user, challenge, auth, artist, track, new_tags, 'set') if __name__ == '__main__': try: main() except KeyboardInterrupt: sys.exit()