MiniGlome / Archive.org-Downloader

Python3 script to download archive.org books in PDF format
896 stars 118 forks source link

preserve unique identifier of download item #26

Open doyle52 opened 2 years ago

doyle52 commented 2 years ago

Sometimes multiple variants of the same book are available and it might be desirable to download all of them for comparison purposes, in order to choose the best quality version.

Unfortunately, the download folder's unique name is normally renamed into the long book title. As it often happens to be the very same title for each unique variant, downloading multiple variants results in overwriting each other.

It is much more preferable to retain the unique identifier for each download variant, especially since it also enables to later clearly identify the original download source.

To ensure this, following modification does the trick:

--- archive-org-downloader.py    2021-10-21 08:35:41.589757183 +0200
+++ myarchive-org-downloader.py  2021-12-07 06:51:12.078410887 +0200
@@ -197,7 +197,7 @@
                session = loan(session, book_id)
                title, links = get_book_infos(session, url)

-               directory = os.path.join(os.getcwd(), title)
+               directory = os.path.join(os.getcwd(), book_id)
                if not os.path.isdir(directory):
                        os.makedirs(directory)