forked from vially/googlemusic-xbmc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdefault.py
65 lines (43 loc) · 2.01 KB
/
default.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
import sys, utils, xbmc
if (__name__ == "__main__" ):
utils.log(" ARGV: " + repr(sys.argv))
params = utils.paramsToDict(sys.argv[2])
action = params.pop('action','')
if action == 'play_song':
import GoogleMusicPlaySong
GoogleMusicPlaySong.GoogleMusicPlaySong().play(params)
elif action:
import GoogleMusicActions
GoogleMusicActions.GoogleMusicActions().executeAction(action, params)
elif params.get('path'):
import GoogleMusicNavigation
GoogleMusicNavigation.GoogleMusicNavigation().listMenu(params)
elif not params:
import GoogleMusicStorage
storage = GoogleMusicStorage.storage
import GoogleMusicNavigation
navigation = GoogleMusicNavigation.GoogleMusicNavigation()
import GoogleMusicLogin
login = GoogleMusicLogin.GoogleMusicLogin()
addon = utils.addon
# if version changed clear cache
if not addon.getSetting('version') or addon.getSetting('version') != addon.getAddonInfo('version'):
storage.clearCache()
login.clearCookie()
addon.setSetting('version', addon.getAddonInfo('version'))
# check for initing cookies, db and library only on main menu
storage.checkDbInit()
login.checkCredentials()
login.checkCookie()
login.initDevice()
# check if library needs to be loaded
if addon.getSetting('fetched_all_songs') == '0':
xbmc.executebuiltin("XBMC.Notification(%s,%s,5000,%s)" % (utils.plugin, addon.getLocalizedString(30105) ,addon.getAddonInfo('icon')))
utils.log('Loading library')
navigation.api.loadLibrary()
if addon.getSetting('auto_export')=='true' and addon.getSetting('export_path'):
import GoogleMusicActions
GoogleMusicActions.GoogleMusicActions().exportLibrary(addon.getSetting('export_path'))
navigation.listMenu()
else:
utils.log(" ARGV Nothing done.. verify params " + repr(params))