fix individual thing grabs
authorOliver Matthews <oliver@codersoffortune.net>
Thu, 10 Sep 2020 15:52:29 +0000 (16:52 +0100)
committerOliver Matthews <oliver@codersoffortune.net>
Thu, 10 Sep 2020 15:52:29 +0000 (16:52 +0100)
README.md
thingy_grabber.py

index a78d8ee..522e243 100644 (file)
--- a/README.md
+++ b/README.md
@@ -29,9 +29,6 @@ optional arguments:
                         API key for thingiverse
 ````
 
-## Warning
-Currently downloading individual things by ID is broken. This should be fixed soon.
-
 ## API KEYs
 Thingy_grabber v0.10.0 accesses thingiverse in a _substantially_ different way to before. The plus side is it should be more reliable, possibly faster and no longer needs selenium or a firefox instance (and so drastically reduces memory overhead). The downside is you are _going_ to have to do something to continue using the app - basically get yourself an API KEY.
 
@@ -127,6 +124,9 @@ python3, requests, py7xr (>=0.8.2)
 - If there is an updated file, the old directory will be moved to `name_timestamp` where `timestamp` is the last upload time of the old files. The code will then copy unchanged files across and download any new ones.
 
 ## Changelog
+* v0.10.3
+  - Handle trailing whitespace in thing names
+  - Fix raw thing grabbing
 * v0.10.2
   - Fixed regression in rest API
 * v0.10.1
index 2dc915a..6ef3b71 100755 (executable)
@@ -48,7 +48,7 @@ RETRY_COUNT = 3
 
 MAX_PATH_LENGTH = 250
 
-VERSION = "0.10.2"
+VERSION = "0.10.3"
 
 TIMESTAMP_FILE = "timestamp.txt"
 
@@ -163,7 +163,7 @@ def slugify(value):
     value = unicodedata.normalize('NFKC', value).lower().strip()
     value = re.sub(r'[\\/<>:?*|"]', '', value)
     value = re.sub(r'\.*$', '', value)
-    return value
+    return value.strip()
 
 
 class Downloader(multiprocessing.Process):
@@ -615,6 +615,7 @@ class Thing:
         logging.debug("Generating download_dir")
         os.mkdir(self.download_dir)
         filelist_file = os.path.join(self.download_dir, "filelist.txt")
+        logging.error("\nd:{}\nf:{}".format(self.download_dir, filelist_file))
         with open(filelist_file, 'w', encoding="utf-8") as fl_handle:
             for fl in self._file_links:
                 fl_handle.write("{},{},{}\n".format(fl.link, fl.name, fl.last_update))