def test_create_directory(self, tmpdir): expect_path = True global folder_path folder_path = os.path.join(str(tmpdir), "filter_this_folder") internals.filter_path(folder_path) is_path = os.path.isdir(folder_path) assert is_path == expect_path
def test_remove_temp_files(self, directory_fixture): expect_file = False file_path = os.path.join(directory_fixture, "pesky_file.temp") open(file_path, "a") internals.filter_path(directory_fixture) is_file = os.path.isfile(file_path) assert is_file == expect_file
def test_remove_temp_files(self, tmpdir): expect_file = False file_path = os.path.join(folder_path, "pesky_file.temp") open(file_path, "a") internals.filter_path(folder_path) is_file = os.path.isfile(file_path) assert is_file == expect_file
def download(): arguments = arg(song_url=[ '--song', 'https://open.spotify.com/track/2DGa7iaidT5s0qnINlwMjJ' ]) const.args = arguments internals.filter_path(const.args.folder) try: match_args() sys.exit(0) except KeyboardInterrupt as e: sys.exit(3)
def get_track(): const.args = handle.get_arguments() internals.filter_path(const.args.folder) youtube_tools.set_api_key() try: if const.args.song: for track in const.args.song: track_dl = downloader.Downloader(raw_song=track) track_dl.download_single() except KeyboardInterrupt as e: print("Exception occured in method 'get_track':", e) return False return True
def main(): const.args = handle.get_arguments() if const.args.version: print("spotdl {version}".format(version=__version__)) sys.exit() internals.filter_path(const.args.folder) youtube_tools.set_api_key() logzero.setup_default_logger(formatter=const._formatter, level=const.args.log_level) log.debug("Python version: {}".format(sys.version)) log.debug("Platform: {}".format(platform.platform())) log.debug(pprint.pformat(const.args.__dict__)) try: if const.args.song: download_single(raw_song=const.args.song) elif const.args.list: if const.args.write_m3u: youtube_tools.generate_m3u(track_file=const.args.list) else: download_list( tracks_file=const.args.list, skip_file=const.args.skip, write_successful_file=const.args.write_successful, ) elif const.args.playlist: spotify_tools.write_playlist(playlist_url=const.args.playlist) elif const.args.album: spotify_tools.write_album(album_url=const.args.album) elif const.args.all_albums: spotify_tools.write_all_albums_from_artist( artist_url=const.args.all_albums) elif const.args.username: spotify_tools.write_user_playlist(username=const.args.username) # actually we don't necessarily need this, but yeah... # explicit is better than implicit! sys.exit(0) except KeyboardInterrupt as e: log.exception(e) sys.exit(3)
def main(): const.args = handle.get_arguments() internals.filter_path(const.args.folder) youtube_tools.set_api_key() logzero.setup_default_logger(formatter=const._formatter, level=const.args.log_level) try: match_args() # actually we don't necessarily need this, but yeah... # explicit is better than implicit! sys.exit(0) except KeyboardInterrupt as e: log.exception(e) sys.exit(3)
def main_func_caller(): # Todo try new implementation internals.filter_path(const.args.folder) youtube_tools.set_api_key() logzero.setup_default_logger(formatter=const._formatter, level=const.args.log_level) try: operation, text_file, tracks_url = match_args() if operation is not 'list': list_downloader(operation, text_file, tracks_url) # I don't need this type of exception, I'll remove another time except Exception as e: print(e) operation = False log.exception(e) sys.exit(3)
def main(): const.args = handle.get_arguments() if const.args.version: print('spotdl {version}'.format(version=__version__)) sys.exit() internals.filter_path(const.args.folder) youtube_tools.set_api_key() const.log = const.logzero.setup_logger(formatter=const._formatter, level=const.args.log_level) global log log = const.log log.debug('Python version: {}'.format(sys.version)) log.debug('Platform: {}'.format(platform.platform())) log.debug(pprint.pformat(const.args.__dict__)) try: if const.args.song: download_single(raw_song=const.args.song) elif const.args.list: download_list(text_file=const.args.list) elif const.args.playlist: spotify_tools.write_playlist(playlist_url=const.args.playlist) elif const.args.album: spotify_tools.write_album(album_url=const.args.album) elif const.args.username: spotify_tools.write_user_playlist(username=const.args.username) # actually we don't necessarily need this, but yeah... # explicit is better than implicit! sys.exit(0) except KeyboardInterrupt as e: log.exception(e) sys.exit(3)
def test_create_directory(self, directory_fixture): expect_path = True internals.filter_path(directory_fixture) is_path = os.path.isdir(directory_fixture) assert is_path == expect_path