2015-03-14 08:24:59 +11:00
|
|
|
import xbmcaddon
|
|
|
|
import xbmcplugin
|
|
|
|
import xbmc
|
|
|
|
import xbmcgui
|
|
|
|
import os
|
|
|
|
import threading
|
|
|
|
import json
|
|
|
|
import urllib
|
|
|
|
|
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-03 07:40:30 +10:00
|
|
|
WINDOW = xbmcgui.Window(10000)
|
2015-03-14 08:24:59 +11:00
|
|
|
|
|
|
|
import Utils as utils
|
|
|
|
from PlaybackUtils import PlaybackUtils
|
2015-05-03 07:40:30 +10:00
|
|
|
from DownloadUtils import DownloadUtils
|
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']
|
|
|
|
id = params['id']
|
2015-04-03 06:47:06 +11:00
|
|
|
except:
|
2015-05-03 07:40:30 +10:00
|
|
|
params = {}
|
|
|
|
mode = None
|
|
|
|
|
|
|
|
if mode == "play":
|
|
|
|
# Play items via plugin://plugin.video.emby/
|
|
|
|
url = "{server}/mediabrowser/Users/{UserId}/Items/%s?format=json&ImageTypeLimit=1" % id
|
|
|
|
result = DownloadUtils().downloadUrl(url)
|
|
|
|
item = PlaybackUtils().PLAY(result, setup="default")
|
2015-03-19 04:54:30 +11:00
|
|
|
|
2015-04-03 06:47:06 +11:00
|
|
|
elif sys.argv[1] == "reset":
|
|
|
|
utils.reset()
|
2015-03-19 04:54:30 +11:00
|
|
|
else:
|
2015-03-26 04:37:21 +11:00
|
|
|
xbmc.executebuiltin('Addon.OpenSettings(plugin.video.emby)')
|
2015-03-14 08:24:59 +11:00
|
|
|
|