Skip to content

Commit

Permalink
Check if data exists before executing commands that would fail otherwise
Browse files Browse the repository at this point in the history
  • Loading branch information
maikito26 committed Oct 24, 2015
1 parent c33694b commit 48eaffa
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion addon.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="plugin.video.surveillanceroom" name="Surveillance Room" version="1.0.2" provider-name="Maikito26">
<addon id="plugin.video.surveillanceroom" name="Surveillance Room" version="1.0.3" provider-name="Maikito26">
<requires>
<import addon="xbmc.python" version="2.19.0"/>
<import addon="script.module.requests" version="2.3.0" optional="false"/>
Expand Down
5 changes: 5 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
v1.0.3 (Oct 24 2015)
--------------------
Fixed Issues:
- Further improved utils.py to check if data before executing commands

v1.0.2 (Oct 24 2015)
--------------------
Fixed Issues:
Expand Down
15 changes: 9 additions & 6 deletions resources/lib/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,17 @@ def remove_cached_art(art):
#Get cached image name to remove
db.execute("SELECT cachedurl FROM texture WHERE url = '%s';" %art)
data = db.fetchone()
#log(4, 'Removing Cached Art :: SQL Output: %s' %data[0]) -> Causes an error on first time configuring

file_to_delete = os.path.join(_tbn_path, data[0])
log(4, 'Removing Cached Art :: File to be removed: %s' %file_to_delete)
if data[0]:

log(4, 'Removing Cached Art :: SQL Output: %s' %data[0]) -> Causes an error on first time configuring

file_to_delete = os.path.join(_tbn_path, data[0])
log(4, 'Removing Cached Art :: File to be removed: %s' %file_to_delete)

xbmcvfs.delete(file_to_delete)
db.execute("DELETE FROM texture WHERE url = '%s';" %art)

xbmcvfs.delete(file_to_delete)
db.execute("DELETE FROM texture WHERE url = '%s';" %art)
except lite.Error, e:
print "Error %s:" % e.args[0]
#sys.exit(1)
Expand Down

0 comments on commit 48eaffa

Please sign in to comment.