def test_cacheFunction_should_call_funct(self): temp_funct = Mock() temp_funct.return_value = "mock_return" cache = StorageServer.StorageServer("Mock", 1) result = cache.cacheFunction(temp_funct, "mock_args") print repr(temp_funct.call_args_list) temp_funct.assert_called_with('mock_args') assert (result == "mock_return")
import re import sys import storageserverdummy as StorageServer import xbmcaddon from resources.lib import joerogan from resources.lib import utils ### get addon info addon_id = 'plugin.video.joeroganexperience' __addon__ = xbmcaddon.Addon(id=addon_id) __addonid__ = __addon__.getAddonInfo('id') __addonidint__ = int(sys.argv[1]) # initialise cache object to speed up plugin operation cache = StorageServer.StorageServer(__addonid__ + '-pages', 1) class Main: def __init__(self): # parse script arguments params = utils.getParams() # Check if the url param exists try: vidSrc = urllib.unquote_plus(params["source"]) utils.log('Video Source Found: %s' % vidSrc) vidID = urllib.unquote_plus(params["id"])
try: import StorageServer except: import storageserverdummy as StorageServer import time import xbmcplugin, xbmcgui, xbmcaddon PLUGIN_NAME = 'uzg' PLUGIN_ID = 'plugin.video.uzg' uzg = Uzg() _url = sys.argv[0] _handle = int(sys.argv[1]) _cache = StorageServer.StorageServer( PLUGIN_ID, 24) # (Your plugin name, Cache time in hours) _addon = xbmcaddon.Addon() # het in elkaar klussen van een url welke weer gebruikt word bij router def get_url(**kwargs): return '{0}?{1}'.format(_url, urlencode(kwargs)) def setMediaView(): # juiste skin selecteren alleen voor confluence maar die gebruikik prive nog steeds try: kodiVersion = xbmc.getInfoLabel('System.BuildVersion').split()[0] kodiVersion = kodiVersion.split('.')[0] skinTheme = xbmc.getSkinDir().lower() if 'onfluence' in skinTheme:
# Fall back to Python 2's urllib2 from urllib import urlencode from urlparse import parse_qs try: import StorageServer except: import storageserverdummy as StorageServer PLUGIN_NAME = 'hanssettings' PLUGIN_ID = 'plugin.video.hanssettings' _hanssettings = resources.lib.hanssettings.HansSettings() _url = sys.argv[0] _handle = int(sys.argv[1]) # (Your plugin name, Cache time in hours) _cache = StorageServer.StorageServer(PLUGIN_ID, 24) _addon = xbmcaddon.Addon() # In deze file heb ik alle logica van kodi zitten. # hier worden alle files ook gecached, want dat is een kodi addon. def get_url(**kwargs): """ Create a URL for calling the plugin recursively from the given set of keyword arguments. :param kwargs: "argument=value" pairs :type kwargs: dict :return: plugin call URL :rtype: str """ return '{0}?{1}'.format(_url, urlencode(kwargs))
import xbmcgui import xbmcplugin import storageserverdummy as StorageServer from elementtree import ElementTree as ET ### get addon info addon_id = 'plugin.video.joeroganexperience' __addon__ = xbmcaddon.Addon(id=addon_id) __addonid__ = __addon__.getAddonInfo('id') __addonidint__ = int(sys.argv[1]) __addondir__ = xbmc.translatePath(__addon__.getAddonInfo('path')) # initialise cache object to speed up plugin operation cache = StorageServer.StorageServer(__addonid__ + '-ustreamvideos', 96) def getParams(): """Parse and return the arguments passed to the addon in a usable form Returns: param -- A dictionary containing the parameters which have been passed to the addon""" # initialise empty list to store params param = [] # store params as string paramstring = sys.argv[2] # check if params were provided if len(paramstring) >= 2:
import urllib2 import unicodedata import tempfile import json import zipfile import uuid import zlib import shutil import storageserverdummy as StorageServer __version__ = 16 # Module version __scriptname__ = "subtitles.downloader.script" __language__ = "he" store = StorageServer.StorageServer(__scriptname__, int(24 * 364 / 2)) # 6 months regexHelper = re.compile('\W+', re.UNICODE) # =============================================================================== # Private utility functions # =============================================================================== def normalizeString(str): return unicodedata.normalize('NFKD', unicode(unicode(str, 'utf-8'))).encode( 'utf-8', 'ignore') def clean_title(item): title = os.path.splitext(os.path.basename(item["title"])) tvshow = os.path.splitext(os.path.basename(item["tvshow"]))
def test_sqlSet(self): cache = StorageServer.StorageServer("Mock", 1) result = cache.unlock("name") assert (result == False)
def test_getMulti(self): cache = StorageServer.StorageServer("Mock", 1) result = cache.getMulti("name", "data") assert (result == "")
def test_set_data(self): cache = StorageServer.StorageServer("Mock", 1) result = cache.set("name", "data") assert (result == "")
scraper = "" navigation = "" downloader = "" storage = "" player = "" common = "" utils = "" if (__name__ == "__main__"): if dbg: print plugin + " ARGV: " + repr(sys.argv) else: print plugin import storageserverdummy as StorageServer cache = StorageServer.StorageServer("BlipTV") import CommonFunctions as common common.plugin = plugin import BlipTVUtils as utils utils = utils.BlipTVUtils() import BlipTVStorage as storage storage = storage.BlipTVStorage() import BlipTVPlayer as player player = player.BlipTVPlayer() import BlipTVScraper as scraper scraper = scraper.BlipTVScraper() import BlipTVNavigation as navigation navigation = navigation.BlipTVNavigation() if (not settings.getSetting("firstrun")):