Minor bugfix

master
joshua 7 years ago
parent 1621c4372d
commit d4f0580b49

@ -114,7 +114,7 @@ def main(user, password, server, label, inout_file, path ):
log("\tExporting file") log("\tExporting file")
res = check_output('calibredb export {} --dont-save-cover --dont-write-opf --single-dir --to-dir "{}" {}'.format(storyId, loc, path), shell=True, stdin=PIPE, stderr=STDOUT) res = check_output('calibredb export {} --dont-save-cover --dont-write-opf --single-dir --to-dir "{}" {}'.format(storyId, loc, path), shell=True, stdin=PIPE, stderr=STDOUT)
cur = get_files(loc, ".epub", True)[0] cur = get_files(loc, ".epub", True)[0]
loggin.info('\tDownloading with fanficfare, updating file "{}"'.format(cur)) log('\tDownloading with fanficfare, updating file "{}"'.format(cur))
moving="" moving=""
except: except:
#story is not in calibre #story is not in calibre

@ -14,7 +14,6 @@ from notifications import Notification
from optparse import OptionParser from optparse import OptionParser
from ConfigParser import ConfigParser from ConfigParser import ConfigParser
import sqlite3
def enable_notifications(options): def enable_notifications(options):
@ -55,6 +54,8 @@ def main(options):
regex = re.compile("Added (?:.*/)?(.*)-.* to library with id \d*") regex = re.compile("Added (?:.*/)?(.*)-.* to library with id \d*")
searcher = regex.search searcher = regex.search
stripper = False stripper = False
if options.pushbullet:
from pushbullet import Pushbullet
for line in buf.readlines(): for line in buf.readlines():
r = searcher(line) r = searcher(line)
if r: if r:
@ -63,6 +64,7 @@ def main(options):
for notify in enable_notifications(options): for notify in enable_notifications(options):
notify.send_notification("New Fanfiction Download", story) notify.send_notification("New Fanfiction Download", story)
if stripper and options.tag: if stripper and options.tag:
import sqlite3
with sqlite3.connect(join(options.library_path, "metadata.db")) as conn: with sqlite3.connect(join(options.library_path, "metadata.db")) as conn:
c = conn.cursor() c = conn.cursor()
c.execute("delete from books_tags_link where id in (select id from books_tags_link where tag in (select id from tags where name like '%Last Update%'));") c.execute("delete from books_tags_link where id in (select id from books_tags_link where tag in (select id from tags where name like '%Last Update%'));")
@ -110,7 +112,5 @@ if __name__ == "__main__":
raise ValueError("Can't use a pushbullet device without key") raise ValueError("Can't use a pushbullet device without key")
if options.tag and not options.library: if options.tag and not options.library:
raise ValueError("Can't strip tags from calibre library without a library location.") raise ValueError("Can't strip tags from calibre library without a library location.")
if options.pushbullet:
from pushbullet import Pushbullet
main(options) main(options)

Loading…
Cancel
Save