This repository has been archived by the owner on May 15, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathservice.py
67 lines (55 loc) · 3.17 KB
/
service.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# -*- coding: utf-8 -*-
#
import xbmc,xbmcaddon,xbmcgui
from utilities import *
from rating import *
from sync_update import *
from notification_service import *
__author__ = "Ralph-Gordon Paul, Adrian Cowan"
__credits__ = ["Ralph-Gordon Paul", "Adrian Cowan", "Justin Nemeth", "Sean Rudford"]
__license__ = "GPL"
__maintainer__ = "Ralph-Gordon Paul"
__email__ = "[email protected]"
__status__ = "Production"
__settings__ = xbmcaddon.Addon( "script.traktutilities" )
__language__ = __settings__.getLocalizedString
Debug("service: " + __settings__.getAddonInfo("id") + " - version: " + __settings__.getAddonInfo("version"))
# starts update/sync
def autostart():
if checkSettings(True):
notificationThread = NotificationService()
notificationThread.start()
autosync_moviecollection = __settings__.getSetting("autosync_moviecollection")
autosync_tvshowcollection = __settings__.getSetting("autosync_tvshowcollection")
autosync_cleanmoviecollection = __settings__.getSetting("autosync_cleanmoviecollection")
autosync_cleantvshowcollection = __settings__.getSetting("autosync_cleantvshowcollection")
autosync_seenmovies = __settings__.getSetting("autosync_seenmovies")
autosync_seentvshows = __settings__.getSetting("autosync_seentvshows")
try:
if autosync_moviecollection == "true":
notification("Trakt Utilities", __language__(1180).encode( "utf-8", "ignore" )) # start movie collection update
updateMovieCollection(True)
if autosync_cleanmoviecollection: cleanMovieCollection(True)
if xbmc.abortRequested: raise SystemExit()
if autosync_tvshowcollection == "true":
notification("Trakt Utilities", __language__(1181).encode( "utf-8", "ignore" )) # start tvshow collection update
updateTVShowCollection(True)
if autosync_cleantvshowcollection: cleanTVShowCollection(True)
if xbmc.abortRequested: raise SystemExit()
if autosync_seenmovies == "true":
Debug("autostart sync seen movies")
notification("Trakt Utilities", __language__(1182).encode( "utf-8", "ignore" )) # start sync seen movies
syncSeenMovies(True)
if xbmc.abortRequested: raise SystemExit()
if autosync_seentvshows == "true":
Debug("autostart sync seen tvshows")
notification("Trakt Utilities", __language__(1183).encode( "utf-8", "ignore" )) # start sync seen tv shows
syncSeenTVShows(True)
if xbmc.abortRequested: raise SystemExit()
if autosync_moviecollection == "true" or autosync_tvshowcollection == "true" or autosync_seenmovies == "true" or autosync_seentvshows == "true":
notification("Trakt Utilities", __language__(1184).encode( "utf-8", "ignore" )) # update / sync done
except SystemExit:
notificationThread.abortRequested = True
Debug("[Service] Auto sync processes aborted due to shutdown request")
notificationThread.join()
autostart()