From db8d9e953b2633967073558699b4a91e70a09966 Mon Sep 17 00:00:00 2001 From: Joshua Gang Date: Wed, 20 Jun 2018 16:42:09 -0400 Subject: [PATCH] Added fictionpress regex, updated error message when can't find file in library. If website does not have a regex, then likely can't find previous copies in the calibredb search. --- fanficdownload.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fanficdownload.py b/fanficdownload.py index 9964347..6c9a0b5 100644 --- a/fanficdownload.py +++ b/fanficdownload.py @@ -74,6 +74,7 @@ def touch(fname, times=None): ffnet = re.compile('(fanfiction.net/s/\d*)/?.*') aooo = re.compile('(archiveofourown.org/works/\d*)/?.*') +ficpress = re.compile('(fictionpress.com/s/\d*)/?.*') neutral = re.compile('https?://(.*)') story_name = re.compile('(.*)-.*') @@ -92,6 +93,8 @@ def parse_url(url): url = "www." + ffnet.search(url).group(1) elif aooo.search(url): url = aooo.search(url).group(1) + elif ficpress.search(url): + url = ficpress.search(url).group(1) elif neutral.search(url): url = neutral.search(url).group(1) return url @@ -208,7 +211,7 @@ def downloader(args): "It's been added to library, but not sure what the ID is.", 'WARNING', live) - output += log("Added file to library with id 0", 'GREEN', live) + output += log("Added /Story-file to library with id 0", 'GREEN', live) remove(cur) else: res = check_output(