diff options
author | Jackson Taylor <jackson@jacksontaylor.xyz> | 2022-08-07 09:32:37 -0400 |
---|---|---|
committer | Jackson Taylor <jackson@jacksontaylor.xyz> | 2022-08-07 09:32:37 -0400 |
commit | 187e7927ba0b57e449257aa914ad05c5b977d67c (patch) | |
tree | b7b6184a86a8165eae06acfbba0c77f90969a8c3 | |
parent | 399a62c169aa26dc2c7076d1497da82df36cfd9e (diff) |
Save retry file until retryFile flag is used
This way if someone were to have multiple playlists that they wanted to
download, all of the failed urls would get dumped to 1 file. Then they
could retry them all at once.
-rwxr-xr-x | jamos | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -208,9 +208,9 @@ def create_downloader(music_directory, cookies): def save_urls_from_playlist_to_file(filename, urls): try: - f = open(filename, "w") + f = open(filename, "a") for url in urls: - f.writelines(url) + f.writelines(url + '\n') f.close() except Exception as e: print(e) @@ -262,6 +262,14 @@ if __name__ == "__main__": save_urls_from_playlist_to_file( os.path.join(music_directory, "jamos_failed_urls.txt"), failed_urls) + elif args.retryFile: + # Just because we don't have any failed urls in this run, doesn't + # mean that we can get rid of the retry file. We'll only remove it + # if it's been explicitly tried and we have no failed urls. + + # We've successfully downloaded all of the previously failed urls. + # Delete the file + os.remove(args.retryFile) except Exception as ex: print(ex) print("Saving failed urls to file failed! Printing failed urls:") |