2015-03-14 08:24:59 +11:00
|
|
|
import xbmcaddon
|
|
|
|
import xbmcplugin
|
|
|
|
import xbmc
|
|
|
|
import xbmcgui
|
2015-05-04 01:39:12 +10:00
|
|
|
import xbmcvfs
|
2015-05-05 21:27:45 +10:00
|
|
|
import os, sys
|
|
|
|
|
2015-03-14 08:24:59 +11:00
|
|
|
|
2015-03-26 04:37:21 +11:00
|
|
|
addonSettings = xbmcaddon.Addon(id='plugin.video.emby')
|
2015-03-14 08:24:59 +11:00
|
|
|
cwd = addonSettings.getAddonInfo('path')
|
|
|
|
BASE_RESOURCE_PATH = xbmc.translatePath( os.path.join( cwd, 'resources', 'lib' ) )
|
|
|
|
sys.path.append(BASE_RESOURCE_PATH)
|
|
|
|
|
2015-05-04 01:39:12 +10:00
|
|
|
|
2015-03-14 08:24:59 +11:00
|
|
|
|
2015-05-05 21:27:45 +10:00
|
|
|
import MainModule as mainModule
|
2015-03-14 08:24:59 +11:00
|
|
|
import Utils as utils
|
2015-05-05 21:27:45 +10:00
|
|
|
|
2015-03-14 08:24:59 +11:00
|
|
|
|
2015-04-03 06:47:06 +11:00
|
|
|
try:
|
2015-05-03 07:40:30 +10:00
|
|
|
params = utils.get_params(sys.argv[2])
|
|
|
|
mode = params['mode']
|
2015-05-05 07:42:21 +10:00
|
|
|
id = params.get('id', None)
|
2015-04-03 06:47:06 +11:00
|
|
|
except:
|
2015-05-03 07:40:30 +10:00
|
|
|
params = {}
|
|
|
|
mode = None
|
|
|
|
|
2015-05-05 21:27:45 +10:00
|
|
|
##### Play items via plugin://plugin.video.emby/ #####
|
|
|
|
if mode == "play":
|
|
|
|
mainModule.doPlayback(id)
|
2015-03-19 04:54:30 +11:00
|
|
|
|
2015-05-05 21:27:45 +10:00
|
|
|
##### DO DATABASE RESET #####
|
2015-05-05 07:40:44 +10:00
|
|
|
elif mode == "reset":
|
|
|
|
utils.reset()
|
|
|
|
|
2015-05-05 21:27:45 +10:00
|
|
|
#### DO RESET AUTH #####
|
2015-05-05 10:03:46 +10:00
|
|
|
elif mode == "resetauth":
|
2015-05-05 21:27:45 +10:00
|
|
|
mainModule.resetAuth()
|
2015-05-05 12:00:53 +10:00
|
|
|
|
2015-05-05 21:27:45 +10:00
|
|
|
##### BROWSE EMBY CHANNELS ROOT #####
|
|
|
|
elif mode == "channels":
|
|
|
|
mainModule.BrowseChannels(id)
|
2015-05-05 09:43:46 +10:00
|
|
|
|
2015-05-05 21:27:45 +10:00
|
|
|
##### BROWSE EMBY CHANNELS FOLDER #####
|
|
|
|
elif mode == "channelsfolder":
|
|
|
|
folderid = params['folderid']
|
|
|
|
mainModule.BrowseChannels(id,folderid)
|
|
|
|
|
|
|
|
##### GET NEXTUP EPISODES FOR TAGNAME #####
|
2015-05-05 09:43:46 +10:00
|
|
|
elif mode == "nextup":
|
|
|
|
limit = int(params['limit'])
|
2015-05-05 21:27:45 +10:00
|
|
|
mainModule.getNextUpEpisodes(id, limit)
|
2015-05-05 08:24:41 +10:00
|
|
|
|
|
|
|
|
2015-05-05 21:27:45 +10:00
|
|
|
##### GET EXTRAFANART FOR LISTITEM #####
|
2015-05-04 01:39:12 +10:00
|
|
|
elif "extrafanart" in sys.argv[0]:
|
2015-05-05 21:27:45 +10:00
|
|
|
mainModule.getExtraFanArt()
|
2015-05-04 01:39:12 +10:00
|
|
|
|
|
|
|
|
2015-05-05 21:27:45 +10:00
|
|
|
##### SHOW ADDON SETTINGS #####
|
2015-05-05 12:53:21 +10:00
|
|
|
else:
|
|
|
|
#open the addon settings if the addon is called directly from video addons
|
|
|
|
try:
|
|
|
|
if "content_type" in sys.argv[2]:
|
|
|
|
xbmc.executebuiltin('Addon.OpenSettings(plugin.video.emby)')
|
|
|
|
except: pass
|
2015-03-14 08:24:59 +11:00
|
|
|
|