-
Notifications
You must be signed in to change notification settings - Fork 9
/
cleanup.py
32 lines (25 loc) · 847 Bytes
/
cleanup.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
32
# -*- coding: utf-8 -*-
import traceback
import xbmc
import xbmcaddon
# Import the common settings
from resources.lib.settings import log
# Load the database interface
from resources.lib.database import ExtrasDB
# Load the cache cleaner
from resources.lib.CacheCleanup import CacheCleanup
ADDON = xbmcaddon.Addon(id='script.videoextras')
#########################
# Main
#########################
if __name__ == '__main__':
log("VideoExtrasCleanup: Cleanup called (version %s)" % ADDON.getAddonInfo('version'))
try:
# Start by removing the database
extrasDb = ExtrasDB()
extrasDb.cleanDatabase()
del extrasDb
# Also tidy up any of the cache files that exist
CacheCleanup.removeAllCachedFiles()
except:
log("VideoExtrasCleanup: %s" % traceback.format_exc(), xbmc.LOGERROR)