def get_songs(self): app = App() app.collection_importer = LastFmLibraryTracks app.collection_importer_params = { 'api_key': config['lastfm']['api_key'], 'api_secret': config['lastfm']['api_secret'], 'username': self.data['username'], 'limit': int(self.data['limit']) or None } return list(app.collection())
source = args.source # dest = args.dest limit = args.limit resume = args.resume if source == "loved": app.collection_importer = LastFmLovedTracks elif source == "library": app.collection_importer = LastFmLibraryTracks else: print("Set --source=loved|library") raise Exception("Invalid argument: source. Should be loved|library") app.collection_importer_params = { 'api_key': config['lastfm']['api_key'], 'api_secret': config['lastfm']['api_secret'], 'username': config['lastfm']['username'], 'limit': int(limit or 0) or None, 'resume': resume } # if dest == "grooveshark": # app.collection_exporter = GrooveSharkTracks # app.collection_exporter_params = { # 'api_key': config['grooveshark']['api_key'], # 'api_secret': config['grooveshark']['api_secret'], # 'username': config['grooveshark']['username'], # 'password': config['grooveshark']['password'], # 'limit': None # } # else: app.collection_exporter = ExFmTracks
args = parser.parse_args() source = args.source dest= args.dest limit = args.limit if source == "loved": app.collection_importer = LastFmLovedTracks elif source == "library": app.collection_importer = LastFmLibraryTracks else: print("Set --source=loved|library") raise Exception("Invalid argument: source. Should be loved|library") app.collection_importer_params = { 'api_key': config['lastfm']['api_key'], 'api_secret': config['lastfm']['api_secret'], 'username': config['lastfm']['username'], 'limit': None } if limit is not None: try: app.collection_importer_params['limit'] = int(limit) except Exception as e: print("invalid limit:", e) if dest == "grooveshark": app.collection_exporter = GrooveSharkTracks app.collection_exporter_params = { 'api_key': config['grooveshark']['api_key'], 'api_secret': config['grooveshark']['api_secret'], 'username': config['grooveshark']['username'],