-
Notifications
You must be signed in to change notification settings - Fork 26
/
service.py
55 lines (40 loc) · 2.61 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
# -*- coding: utf-8 -*-
"""
Venom
"""
import threading
from resources.lib.modules import control, log_utils, trakt
control.execute('RunPlugin(plugin://%s)' % control.get_plugin_url({'action': 'service'}))
traktCredentials = trakt.getTraktCredentialsInfo()
try:
AddonVersion = control.addon('plugin.video.venom').getAddonInfo('version')
RepoVersion = control.addon('repository.venom').getAddonInfo('version')
log_utils.log('################### Venom ######################', log_utils.LOGNOTICE)
log_utils.log('####### CURRENT Venom VERSIONS REPORT ##########', log_utils.LOGNOTICE)
log_utils.log('######### Venom PLUGIN VERSION: %s #########' % str(AddonVersion), log_utils.LOGNOTICE)
log_utils.log('####### Venom REPOSITORY VERSION: %s #######' % str(RepoVersion), log_utils.LOGNOTICE)
log_utils.log('################################################', log_utils.LOGNOTICE)
except:
log_utils.log('############################# Venom ############################', log_utils.LOGNOTICE)
log_utils.log('################# CURRENT Venom VERSIONS REPORT ################', log_utils.LOGNOTICE)
log_utils.log('# ERROR GETTING Venom VERSION - Missing Repo of failed Install #', log_utils.LOGNOTICE)
log_utils.log('################################################################', log_utils.LOGNOTICE)
def syncTraktLibrary():
control.execute('RunPlugin(plugin://%s)' % 'plugin.video.venom/?action=tvshowsToLibrarySilent&url=traktcollection')
control.execute('RunPlugin(plugin://%s)' % 'plugin.video.venom/?action=moviesToLibrarySilent&url=traktcollection')
def syncTraktWatched():
control.execute('RunPlugin(plugin://%s)' % 'plugin.video.venom/?action=cachesyncTVShows')
control.execute('RunPlugin(plugin://%s)' % 'plugin.video.venom/?action=cachesyncMovies')
# if control.setting('trakt.notifications') == 'true':
# control.notification(title = 'default', message = 'Trakt Watched Status Sync Complete', icon='default', time=1, sound=False)
if traktCredentials is True:
syncTraktWatched()
if control.setting('autoTraktOnStart') == 'true':
syncTraktLibrary()
if int(control.setting('schedTraktTime')) > 0:
log_utils.log('###############################################################', log_utils.LOGNOTICE)
log_utils.log('#################### STARTING TRAKT SCHEDULING ################', log_utils.LOGNOTICE)
log_utils.log('#################### SCHEDULED TIME FRAME '+ control.setting('schedTraktTime') + ' HOURS ###############', log_utils.LOGNOTICE)
timeout = 3600 * int(control.setting('schedTraktTime'))
schedTrakt = threading.Timer(timeout, syncTraktLibrary)
schedTrakt.start()