2015-07-22 04:53:59 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
2015-03-13 21:24:59 +00:00
|
|
|
|
2015-07-22 04:53:59 +00:00
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
from urlparse import parse_qs
|
2015-03-13 21:24:59 +00:00
|
|
|
|
2015-07-22 04:53:59 +00:00
|
|
|
import xbmcaddon
|
|
|
|
import xbmc
|
2015-05-03 15:39:12 +00:00
|
|
|
|
2015-07-22 04:53:59 +00:00
|
|
|
addon_ = xbmcaddon.Addon(id='plugin.video.emby')
|
|
|
|
addon_path = addon_.getAddonInfo('path').decode('utf-8')
|
|
|
|
base_resource_path = xbmc.translatePath(os.path.join(addon_path, 'resources', 'lib')).decode('utf-8')
|
|
|
|
sys.path.append(base_resource_path)
|
2015-03-13 21:24:59 +00:00
|
|
|
|
2015-05-05 20:18:52 +00:00
|
|
|
import Entrypoint as entrypoint
|
2015-05-05 11:27:45 +00:00
|
|
|
|
2015-07-22 04:53:59 +00:00
|
|
|
# Parse parameters
|
|
|
|
base_url = sys.argv[0]
|
|
|
|
addon_handle = int(sys.argv[1])
|
|
|
|
params = parse_qs(sys.argv[2][1:])
|
|
|
|
xbmc.log("Parameter string: %s" % sys.argv[2])
|
2015-03-13 21:24:59 +00:00
|
|
|
|
2015-04-02 19:47:06 +00:00
|
|
|
try:
|
2015-07-22 04:53:59 +00:00
|
|
|
mode = params['mode'][0]
|
2015-05-04 21:42:21 +00:00
|
|
|
id = params.get('id', None)
|
2015-07-22 04:53:59 +00:00
|
|
|
if id:
|
|
|
|
id = id[0]
|
2015-04-02 19:47:06 +00:00
|
|
|
except:
|
2015-05-02 21:40:30 +00:00
|
|
|
params = {}
|
2015-07-22 04:53:59 +00:00
|
|
|
mode = ""
|
2015-05-02 21:40:30 +00:00
|
|
|
|
2015-07-22 04:53:59 +00:00
|
|
|
##### PLAY ITEM VIA plugin://plugin.video.emby/ #####
|
|
|
|
if "play" in mode or "playnow" in mode:
|
2015-05-05 20:18:52 +00:00
|
|
|
entrypoint.doPlayback(id)
|
2015-05-04 21:40:44 +00:00
|
|
|
|
2015-05-05 11:27:45 +00:00
|
|
|
#### DO RESET AUTH #####
|
2015-07-22 04:53:59 +00:00
|
|
|
elif "resetauth" in mode:
|
2015-05-05 20:18:52 +00:00
|
|
|
entrypoint.resetAuth()
|
2015-07-22 04:53:59 +00:00
|
|
|
|
|
|
|
##### DO DATABASE RESET #####
|
|
|
|
elif "reset" in mode:
|
|
|
|
import Utils as utils
|
|
|
|
utils.reset()
|
2015-05-05 02:00:53 +00:00
|
|
|
|
2015-07-22 04:53:59 +00:00
|
|
|
##### ADD/REMOVE USER FROM SESSION #####
|
|
|
|
elif "adduser" in mode:
|
2015-05-06 03:02:36 +00:00
|
|
|
entrypoint.addUser()
|
2015-06-11 05:46:47 +00:00
|
|
|
|
2015-07-22 04:53:59 +00:00
|
|
|
##### SYNC THEME MEDIA #####
|
|
|
|
elif "thememedia" in mode:
|
2015-06-11 05:46:47 +00:00
|
|
|
entrypoint.getThemeMedia()
|
2015-07-22 04:53:59 +00:00
|
|
|
|
|
|
|
##### LAUNCH EMBY USER PREFS #####
|
|
|
|
elif "userprefs" in mode:
|
2015-06-06 11:05:14 +00:00
|
|
|
entrypoint.userPreferences()
|
2015-07-22 04:53:59 +00:00
|
|
|
|
|
|
|
##### OPEN ADDON SETTINGS #####
|
|
|
|
elif "settings" in mode:
|
2015-05-06 22:05:27 +00:00
|
|
|
xbmc.executebuiltin('Addon.OpenSettings(plugin.video.emby)')
|
2015-05-06 03:02:36 +00:00
|
|
|
|
2015-07-22 04:53:59 +00:00
|
|
|
##### MANUALLY SYNC LIBRARY #####
|
|
|
|
elif "manualsync" in mode:
|
2015-05-07 09:36:34 +00:00
|
|
|
from LibrarySync import LibrarySync
|
|
|
|
LibrarySync().FullLibrarySync(True)
|
2015-06-05 22:11:24 +00:00
|
|
|
|
2015-07-22 04:53:59 +00:00
|
|
|
##### CACHE ARTWORK #####
|
|
|
|
elif "texturecache" in mode:
|
2015-06-05 22:11:24 +00:00
|
|
|
from TextureCache import TextureCache
|
|
|
|
TextureCache().FullTextureCacheSync()
|
2015-05-04 23:43:46 +00:00
|
|
|
|
2015-05-05 11:27:45 +00:00
|
|
|
##### BROWSE EMBY CHANNELS FOLDER #####
|
2015-07-22 04:53:59 +00:00
|
|
|
elif "channelsfolder" in mode:
|
|
|
|
folderid = params['folderid'][0]
|
2015-05-05 20:18:52 +00:00
|
|
|
entrypoint.BrowseChannels(id,folderid)
|
2015-05-05 11:27:45 +00:00
|
|
|
|
2015-07-22 04:53:59 +00:00
|
|
|
##### BROWSE EMBY CHANNELS ROOT #####
|
|
|
|
elif "channels" in mode:
|
|
|
|
entrypoint.BrowseChannels(id)
|
|
|
|
|
2015-05-05 11:27:45 +00:00
|
|
|
##### GET NEXTUP EPISODES FOR TAGNAME #####
|
2015-07-22 04:53:59 +00:00
|
|
|
elif "nextup" in mode:
|
|
|
|
limit = params['limit'][0]
|
2015-05-05 20:18:52 +00:00
|
|
|
entrypoint.getNextUpEpisodes(id, limit)
|
2015-05-04 22:24:41 +00:00
|
|
|
|
2015-05-09 01:16:03 +00:00
|
|
|
##### GET INPROGRESS EPISODES FOR TAGNAME #####
|
2015-07-22 04:53:59 +00:00
|
|
|
elif "inprogressepisodes" in mode:
|
|
|
|
limit = params['limit'][0]
|
2015-05-09 01:16:03 +00:00
|
|
|
entrypoint.getInProgressEpisodes(id, limit)
|
|
|
|
|
|
|
|
##### GET RECENT EPISODES FOR TAGNAME #####
|
2015-07-22 04:53:59 +00:00
|
|
|
elif "recentepisodes" in mode:
|
|
|
|
limit = params['limit'][0]
|
2015-05-09 01:16:03 +00:00
|
|
|
entrypoint.getRecentEpisodes(id, limit)
|
2015-05-04 22:24:41 +00:00
|
|
|
|
2015-05-05 11:27:45 +00:00
|
|
|
##### GET EXTRAFANART FOR LISTITEM #####
|
2015-05-03 15:39:12 +00:00
|
|
|
elif "extrafanart" in sys.argv[0]:
|
2015-05-05 20:18:52 +00:00
|
|
|
entrypoint.getExtraFanArt()
|
2015-05-03 15:39:12 +00:00
|
|
|
|
2015-05-06 22:05:27 +00:00
|
|
|
##### SHOW ADDON NODES LISTING #####
|
2015-07-22 04:53:59 +00:00
|
|
|
if not mode:
|
|
|
|
entrypoint.doMainListing()
|