From d690fbe9d4035c3cdd2f31a8a4d975c1c006593b Mon Sep 17 00:00:00 2001 From: Kevin Midboe Date: Thu, 13 Apr 2017 12:30:31 +0200 Subject: [PATCH] Now checks and only sends notif if it managed to save to db. --- classedStray.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/classedStray.py b/classedStray.py index a06e8f6..3dfd13f 100755 --- a/classedStray.py +++ b/classedStray.py @@ -3,7 +3,7 @@ # @Author: KevinMidboe # @Date: 2017-04-05 18:40:11 # @Last Modified by: KevinMidboe -# @Last Modified time: 2017-04-13 11:31:42 +# @Last Modified time: 2017-04-13 12:17:04 import os.path, hashlib, time, glob, sqlite3, re, json, tweepy from functools import reduce from fuzzywuzzy import process @@ -46,8 +46,8 @@ class strayEpisode(object): self.trash = [] self.sortMediaItems() - self.saveToDB() - # self.notifyInsert() + if self.saveToDB(): + self.notifyInsert() def getUniqueID(self): # conn = sqlite3.connect(env.db_path) @@ -129,9 +129,11 @@ class strayEpisode(object): [self._id, self.parent, path, self.showName, self.season, self.episode, video_files, subtitles, trash]) except sqlite3.IntegrityError: print('Episode already registered') + return False conn.commit() conn.close() + return True