def load_data(file, format='pickle', compress=False): if format == 'pickle': try: data = vfs.read_file(file, mode='b') if compress: data = zlib.decompress(data) return unpickle(data) except Exception, e: return None
def check_mp3(): vfs = VFSClass() #mod = vfs.read_file('special://home/addons/script.a.xxxstream/resources/mod.txt') # for use on standard script mod = vfs.read_file( 'special://xbmc/addons/script.a.xxxstream/resources/mod.txt' ) # for use on built in script on Android and Windows Application xbmc.log(mod) T(1) link = openURL(URL).replace('\n', '').replace('\r', '').replace('\t', '') match = re.compile( 'name="adultmp3".+?ersion="(.+?)".+?rl="(.+?)"').findall(link) if len(match) > 0: for version, url in match: if version > INSTALLED: install_mp3(version, url) else: xbmc.log("KOBRA XXX MP3 DOWNLOAD: No new mp3 avaliable.") else: xbmc.log("KOBRA XXX MP3 DOWNLOAD: Unable to grab mp3.", xbmc.LOGDEBUG)
data = zlib.compress(data) vfs.write_file(file, data) def load_data(file, format='pickle', compress=False): if format == 'pickle': try: data = vfs.read_file(file, mode='b') if compress: data = zlib.decompress(data) return unpickle(data) except Exception, e: return None else: try: data = vfs.read_file(file) if compress: data = zlib.decompress(data) return json.loads() except Exception, e: return None try: HANDLE_ID = int(sys.argv[1]) ADDON_URL = sys.argv[0] PLUGIN_URL = sys.argv[0] + sys.argv[2] except: HANDLE_ID = -1 ADDON_URL = 'plugin://%s' % addon.getAddonInfo('name') PLUGIN_URL = 'plugin://%s' % addon.getAddonInfo('name')
data = zlib.compress(data) vfs.write_file(file, data) def load_data(file, format='pickle', compress=False): if format == 'pickle': try: data = vfs.read_file(file, mode='b') if compress: data = zlib.decompress(data) return unpickle(data) except Exception, e: return None else: try: data = vfs.read_file(file) if compress: data = zlib.decompress(data) return json.loads(data) except Exception, e: log(e) return None mode = 'main' args = {} __dispatcher = {} __kargs = {} addon = xbmcaddon.Addon() __get_setting = addon.getSetting