From 8cbb86e5f85714ec8fbfcdadf412a4ff7d7ebfd8 Mon Sep 17 00:00:00 2001 From: Peter Molnar Date: Wed, 20 Sep 2017 11:16:45 +0000 Subject: [PATCH] cleanups and minor bugfixes --- nasg.py | 34 +++++++++++++++++++++------------- offlinecopies.py | 4 ++++ pesos.py | 4 ++-- 3 files changed, 27 insertions(+), 15 deletions(-) diff --git a/nasg.py b/nasg.py index 3a760ac..d932b79 100755 --- a/nasg.py +++ b/nasg.py @@ -16,14 +16,15 @@ import math import asyncio import csv import getpass -import quopri -import base64 -import mimetypes +#import quopri +#import base64 +#import mimetypes +import copy import magic import arrow import wand.image -import similar_text +#import similar_text import frontmatter from slugify import slugify import langdetect @@ -35,9 +36,10 @@ import urllib.parse from webmentiontools.send import WebmentionSend import bleach from emoji import UNICODE_EMOJI -from bs4 import BeautifulSoup -from readability.readability import Document +#from bs4 import BeautifulSoup +#from readability.readability import Document import shared +#import oauth def splitpath(path): parts = [] @@ -899,6 +901,8 @@ class Taxonomy(BaseIter): p = shared.config.get('target', 'builddir') if self.taxonomy: p = os.path.join(p, self.taxonomy) + if not os.path.isdir(p): + os.mkdir(p) return p @@ -906,18 +910,25 @@ class Taxonomy(BaseIter): def myp(self): p = self.basep if self.slug: - return os.path.join(p,self.slug) + p = os.path.join(p,self.slug) + if not os.path.isdir(p): + os.mkdir(p) return p @property def feedp(self): - return os.path.join(self.myp, 'feed') - + p = os.path.join(self.myp, 'feed') + if not os.path.isdir(p): + os.mkdir(p) + return p @property def pagep(self): - return os.path.join(self.myp, 'page') + p = os.path.join(self.myp, 'page') + if not os.path.isdir(p): + os.mkdir(p) + return p @property @@ -1492,19 +1503,16 @@ class Singular(BaseRenderable): l = { 'url': 'https://creativecommons.org/licenses/by/4.0/', 'text': 'CC BY 4.0', - 'description': 'Licensed under Creative Commons Attribution 4.0 International. You are free to share or republish, even if modified, if you link back here and indicate the modifications, even for commercial use.' } elif 'journal' == self.category: l = { 'url': 'https://creativecommons.org/licenses/by-nc/4.0/', 'text': 'CC BY-NC 4.0', - 'description': 'Licensed under Creative Commons Attribution-NonCommercial 4.0 International. You are free to share or republish, even if modified, if you link back here and indicate the modifications, for non commercial use. For commercial use please contact the author.' } else: l = { 'url': 'https://creativecommons.org/licenses/by-nc-nd/4.0/', 'text': 'CC BY-NC-ND 4.0', - 'description': 'Licensed under Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International. You are free to share if you link back here for non commercial use, but you can\'t publish any altered versions of it. For commercial use please contact the author.' } self._licence = l diff --git a/offlinecopies.py b/offlinecopies.py index b67deda..b4e8255 100644 --- a/offlinecopies.py +++ b/offlinecopies.py @@ -37,3 +37,7 @@ for fname, fm in bm.items(): trueurl = shared.find_archiveorgurl(url) w = shared.wget(trueurl, dirname=f) w.archive() + + # this is to skip the failed ones next time + if not os.path.isdir(p): + os.mkdir(p) diff --git a/pesos.py b/pesos.py index e155709..85a989b 100755 --- a/pesos.py +++ b/pesos.py @@ -681,8 +681,8 @@ if __name__ == '__main__': flickr = FlickrFavs() flickr.run() - hn = HNBookmarks() - hn.run() + #hn = HNBookmarks() + #hn.run() fivehpx = FivehpxFavs() fivehpx.run()