Merge remote-tracking branch 'origin/multiprocess'
authorOliver Matthews <ojm@codersoffortune.net>
Fri, 21 Feb 2020 10:35:24 +0000 (10:35 +0000)
committerOliver Matthews <ojm@codersoffortune.net>
Fri, 21 Feb 2020 10:35:24 +0000 (10:35 +0000)
1  2 
thingy_grabber.py

@@@ -183,21 -227,23 +227,24 @@@ class Thing
          #import code
          #code.interact(local=dict(globals(), **locals()))
          try:
-           self.title = slugify(soup.find_all('h1')[0].text.strip())
+             self.title = slugify(soup.find_all('h1')[0].text.strip())
          except IndexError:
-           logging.warning("No title found for thing {}".format(self.thing_id))
-           self.title = self.thing_id
+             logging.warning(
+                 "No title found for thing {}".format(self.thing_id))
+             self.title = self.thing_id
  
          if req.status_code == 404:
-           logging.warning("404 for thing {} - DMCA or invalid number?".format(self.thing_id))
-           return
+             logging.warning(
+                 "404 for thing {} - DMCA or invalid number?".format(self.thing_id))
+             return
  
          if req.status_code > 299:
-           logging.warning("bad status code {}  for thing {} - try again later?".format(req.status_code, self.thing_id))
-           return
+             logging.warning(
+                 "bad status code {}  for thing {} - try again later?".format(req.status_code, self.thing_id))
+             return
  
 -        self.download_dir = os.path.join(base_dir, self.title)
 +        self.old_download_dir = os.path.join(base_dir, self.title)
 +        self.download_dir = os.path.join(base_dir, "{} - {}".format(self.thing_id, self.title))
  
          logging.debug("Parsing {} ({})".format(self.thing_id, self.title))