# * original Trigger Kodi Scan code by pkscout import argparse, datetime, os, random, shutil, sqlite3, sys, time, xmltodict from ConfigParser import * from resources.common.xlogger import Logger from resources.common.url import URL from resources.common.fileops import readFile, writeFile, deleteFile, renameFile, checkPath from resources.common.transforms import replaceWords if sys.version_info >= (2, 7): import json as _json else: import simplejson as _json p_folderpath, p_filename = os.path.split( os.path.realpath(__file__) ) lw = Logger( logfile = os.path.join( p_folderpath, 'data', 'logfile.log' ) ) JSONURL = URL( 'json', headers={'content-type':'application/json'} ) try: import data.settings as settings except ImportError: err_str = 'no settings file found at %s' % os.path.join ( p_folderpath, 'data', 'settings.py' ) lw.log( [err_str, 'script stopped'] ) sys.exit( err_str ) try: settings.xbmcuser settings.xbmcpass settings.xbmcuri settings.xbmcport settings.video_exts settings.thumb_exts
# * Credits: # * # * v.0.1.0 # * original VCGenCMD to SpeedFan Log code by pkscout import atexit, datetime, os, random, sys, time import data.config as config from resources.common.xlogger import Logger from resources.common.fileops import deleteFile, writeFile from resources.common.transforms import replaceWords p_folderpath, p_filename = os.path.split(os.path.realpath(__file__)) lw = Logger(logfile=os.path.join(p_folderpath, 'data', 'logfile.log'), numbackups=config.Get('logbackups'), logdebug=str(config.Get('debug'))) def _deletePID(): success, loglines = deleteFile(pidfile) lw.log(loglines) pid = str(os.getpid()) pidfile = os.path.join(p_folderpath, 'data', 'create.pid') atexit.register(_deletePID) class Main: def __init__(self): self._setPID() self._init_vars()
# * original exautomation code by Kyle Johnson import atexit, argparse, os, pathlib, random, re, sys, time import resources.config as config from resources.common.xlogger import Logger from resources.common.fileops import checkPath, deleteFile, renameFile, writeFile from resources.common.remotesites import _parse_items import resources.connections, resources.transforms if sys.version_info < (3, 0): from ConfigParser import * else: from configparser import * p_folderpath, p_filename = os.path.split( os.path.realpath(__file__) ) checkPath( os.path.join( p_folderpath, 'data', 'logs', '' ) ) lw = Logger( logfile=os.path.join( p_folderpath, 'data', 'logs', 'logfile.log' ), logconfig='timed', numbackups=config.Get( 'logbackups' ), logdebug=str( config.Get( 'debug' ) ) ) connection_modules = {} for module in resources.connections.__all__: full_plugin = 'resources.connections.' + module __import__( full_plugin ) imp_plugin = sys.modules[ full_plugin ] lw.log( ['loaded plugin ' + module] ) connection_modules[module] = imp_plugin transform_modules = {} for module in resources.transforms.__all__: full_plugin = 'resources.transforms.' + module __import__( full_plugin ) imp_plugin = sys.modules[ full_plugin ] lw.log( ['loaded plugin ' + module] ) transform_modules[module] = imp_plugin
from threading import Thread from resources.common.xlogger import Logger from resources.common.fix_utf8 import smartUTF8 from resources.common.fileops import popenWithTimeout ### get addon info and set globals addon = xbmcaddon.Addon() addonname = addon.getAddonInfo( 'id' ) addonversion = addon.getAddonInfo( 'version' ) addonpath = addon.getAddonInfo( 'path' ).decode( 'utf-8' ) addonicon = xbmc.translatePath( '%s/icon.png' % addonpath ) language = addon.getLocalizedString preamble = '[SpeedFan Info]' logdebug = addon.getSetting( 'logging' ) lw = Logger( preamble = preamble, logdebug = logdebug ) #global used to tell the worker thread the status of the window windowopen = True #capture a couple of actions to close the window ACTION_PREVIOUS_MENU = 10 ACTION_BACK = 92 def updateWindow( name, w ): #this is the worker thread that updates the window information every w seconds #this strange looping exists because I didn't want to sleep the thread for very long #as time.sleep() keeps user input from being acted upon delay = addon.getSetting( 'update_delay' )
import os, subprocess, sys, xbmc, xbmcaddon, xbmcvfs import resources.lib.oauth2 as _oauth import resources.lib.oauth2.clients.smtp as _smtp from resources.common.fileops import deleteFile from resources.common.xlogger import Logger __addon__ = xbmcaddon.Addon() __addonname__ = __addon__.getAddonInfo('id') __addonversion__ = __addon__.getAddonInfo('version') __addonpath__ = __addon__.getAddonInfo('path').decode('utf-8') __addonicon__ = xbmc.translatePath('%s/icon.png' % __addonpath__ ) __language__ = __addon__.getLocalizedString __preamble__ = '[Check Analog Recorder]' __logdebug__ = __addon__.getSetting( "logging" ) lw = Logger( preamble=__preamble__, logdebug=__logdebug__ ) class Main: def __init__( self ): self._get_settings() self._init_vars() self._check_analog() def _check_analog( self ): folders, recordings = xbmcvfs.listdir( self.RECORDINGPATH ) if not any(".ts" in s for s in recordings): lw.log( ['no test recording found, servo needs to be triggered'], xbmc.LOGNOTICE ) self._trigger_servo() if self.SENDEMAIL == 'true': self._send_email( [] )
from threading import Thread from resources.common.xlogger import Logger from resources.common.fix_utf8 import smartUTF8 from resources.common.fileops import popenWithTimeout ### get addon info and set globals addon = xbmcaddon.Addon() addonname = addon.getAddonInfo('id') addonversion = addon.getAddonInfo('version') addonpath = addon.getAddonInfo('path').decode('utf-8') addonicon = xbmc.translatePath('%s/icon.png' % addonpath) language = addon.getLocalizedString preamble = '[SpeedFan Info]' logdebug = addon.getSetting('logging') lw = Logger(preamble=preamble, logdebug=logdebug) #global used to tell the worker thread the status of the window windowopen = True #capture a couple of actions to close the window ACTION_PREVIOUS_MENU = 10 ACTION_BACK = 92 def updateWindow(name, w): #this is the worker thread that updates the window information every w seconds #this strange looping exists because I didn't want to sleep the thread for very long #as time.sleep() keeps user input from being acted upon delay = addon.getSetting('update_delay') while windowopen and (not xbmc.abortRequested):
import json as _json else: import simplejson as _json import resources.lib.oauth2 as _oauth import resources.lib.oauth2.clients.smtp as _smtp from resources.common.url import URL from resources.common.xlogger import Logger __addon__ = xbmcaddon.Addon() __addonname__ = __addon__.getAddonInfo('id') __addonversion__ = __addon__.getAddonInfo('version') __addonpath__ = __addon__.getAddonInfo('path').decode('utf-8') __addonicon__ = xbmc.translatePath('%s/icon.png' % __addonpath__ ) __language__ = __addon__.getLocalizedString lw = Logger( '[ArgusTV Helper]' ) ArgusTV = URL( 'json', {'content-type': 'application/json'} ) class Main: def __init__( self ): self._get_settings() self._init_vars() if self.CLEANUPMISSING == 'true': self._cleanup_missing() if self.CHECKANALOG == 'true': self._check_analog() def _cleanup_missing( self ): url = self.ARGUSTVCONTROL + '/RecordingGroups/0/1' success, loglines, schedules = ArgusTV.Get( url )
from resources.common.fix_utf8 import smartUTF8 from resources.common.xlogger import Logger from resources.common.fileops import checkPath, writeFile from resources.common.transforms import itemHash addon = xbmcaddon.Addon() addonname = addon.getAddonInfo('id') addonversion = addon.getAddonInfo('version') addonpath = addon.getAddonInfo('path').decode('utf-8') addonicon = xbmc.translatePath('%s/icon.png' % addonpath ) language = addon.getLocalizedString preamble = '[Artist Slideshow Helper]' logdebug = addon.getSetting( "logging" ) lw = Logger( preamble=preamble, logdebug=logdebug ) class Main: def __init__( self ): self._init_vars() self._get_settings() self._make_dirs() if self.HASHLIST == 'false' and self.MIGRATE == 'false': command = 'XBMC.Notification(%s, %s, %s, %s)' % (smartUTF8(language(30350)), smartUTF8(language(30351)), 5000, smartUTF8(addonicon)) xbmc.executebuiltin(command) return if self.HASHLIST == 'true' and self.HASHLISTFOLDER: self._generate_hashlist() elif self.HASHLIST == 'true' and not self.HASHLISTFOLDER: command = 'XBMC.Notification(%s, %s, %s, %s)' % (smartUTF8(language(30340)), smartUTF8(language(30341)), 5000, smartUTF8(addonicon))
from resources.common.fileops import checkPath, writeFile, readFile, deleteFile from resources.common.url import URL from resources.common.transforms import getImageType, itemHash, itemHashwithPath from resources.common.xlogger import Logger import resources.plugins addon = xbmcaddon.Addon() addonname = addon.getAddonInfo('id') addonversion = addon.getAddonInfo('version') addonpath = addon.getAddonInfo('path').decode('utf-8') addonicon = xbmc.translatePath('%s/icon.png' % addonpath ) language = addon.getLocalizedString preamble = '[Artist Slideshow]' logdebug = addon.getSetting( "logging" ) lw = Logger( preamble=preamble, logdebug=logdebug ) JSONURL = URL( 'json' ) txtURL = URL( 'text' ) imgURL = URL( 'binary' ) # this section imports all the scraper plugins, initializes, and sorts them def _get_plugin_settings( preamble, module, description ): if module == 'local': return 'true', 0 try: active = addon.getSetting( preamble + module ) except ValueError: active = 'false' except Exception, e: lw.log( ['unexpected error while parsing %s setting for %s' % (description, module), e] ) active = 'false'