forked from nickrout/script.ebooks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeletedb.py
31 lines (24 loc) · 990 Bytes
/
deletedb.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# -*- coding: utf-8 -*-
import xbmc
import xbmcaddon
import xbmcvfs
import xbmcgui
# Import the common settings
from resources.lib.settings import log
from resources.lib.settings import os_path_join
ADDON = xbmcaddon.Addon(id='script.ebooks')
#########################
# Main
#########################
if __name__ == '__main__':
log("EBookDeleteDb: Delete book database called (version %s)" % ADDON.getAddonInfo('version'))
configPath = xbmc.translatePath(ADDON.getAddonInfo('profile'))
databasefile = os_path_join(configPath, "ebooks_database.db")
log("EBookDeleteDb: Database file location = %s" % databasefile)
# If the database file exists, delete it
if xbmcvfs.exists(databasefile):
xbmcvfs.delete(databasefile)
log("EBookDeleteDb: Removed database: %s" % databasefile)
else:
log("EBookDeleteDb: No database exists: %s" % databasefile)
xbmcgui.Dialog().ok(ADDON.getLocalizedString(32001), ADDON.getLocalizedString(32014))