def autostart():
        xbmcaddon.Addon().setSetting(id="files_overwrite", value='false')
        settings = _settings()
        settings._get_general()
        addondir = xbmc.translatePath( utils.__addon__.getAddonInfo('profile') )
        tempdir = os.path.join(addondir, 'temp')
        service_runtime  = str(settings.service_runtime + ':00')
        log('Service - Run at startup: %s'%settings.service_startup, xbmc.LOGNOTICE)        
        log('Service - Delayed startup: %s minutes'%settings.service_startupdelay, xbmc.LOGNOTICE)   
        log('Service - Run as service: %s'%settings.service_enable, xbmc.LOGNOTICE)
        log('Service - Time: %s'%service_runtime, xbmc.LOGNOTICE)
        if xbmcvfs.exists(tempdir):
            xbmcvfs.rmdir(tempdir)
            log('Removing temp folder from previous run.')
        if settings.service_startup:
            if settings.service_startupdelay != '--':
                xbmc.executebuiltin('XBMC.AlarmClock(ArtworkDownloader,XBMC.RunScript(script.artwork.downloader,silent=true),00:%s:00,silent)' %settings.service_startupdelay) 
            else:
                xbmc.executebuiltin('XBMC.AlarmClock(ArtworkDownloader,XBMC.RunScript(script.artwork.downloader,silent=true),00:00:20,silent)') 
        if settings.service_enable:
            while (not xbmc.abortRequested):
                xbmc.sleep(5000)
                if not(time.strftime('%H:%M') == service_runtime):
                    pass
                else:
                    if not xbmcvfs.exists(tempdir):
                        log('Time is %s:%s, Scheduled run starting' % (time.strftime('%H'), time.strftime('%M')))
                        xbmc.executebuiltin('XBMC.RunScript(script.artwork.downloader,silent=true)')
                    else:
                        log('Addon already running, scheduled run aborted', xbmc.LOGNOTICE)
 def initial_vars(self):
     providers = provider.get_providers()
     self.settings = _settings()
     self.filters = apply_filters()
     self.movie_providers = providers['movie_providers']
     self.tv_providers = providers['tv_providers']
     self.musicvideo_providers = providers['musicvideo_providers']
     self.download_counter = {}
     self.download_counter['Total Artwork'] = 0
     self.reportdata = '[B]Artwork Downloader:[/B]'
     self.mediatype = ''
     self.medianame = ''
     self.mediapath = ''
     self.mode = ''
     self.silent = ''
     self.gui_selected_type = ''
     self.failed_items = []
     self.download_list = []
     self._download_art_succes = False
Exemple #3
0
 def initial_vars(self):
     providers = provider.get_providers()
     self.settings = _settings()
     self.filters = apply_filters()
     self.movie_providers = providers['movie_providers']
     self.tv_providers = providers['tv_providers']
     self.musicvideo_providers = providers['musicvideo_providers']
     self.download_counter = {}
     self.download_counter['Total Artwork'] = 0
     self.reportdata = '[B]Artwork Downloader:[/B]'
     self.mediatype = ''
     self.medianame = ''
     self.mediapath = ''
     self.mode = ''
     self.silent = ''
     self.gui_selected_type = ''
     self.failed_items = []
     self.download_list = []
     self._download_art_succes = False
Exemple #4
0
def autostart():
    xbmcaddon.Addon().setSetting(id="files_overwrite", value='false')
    settings = _settings()
    settings._get_general()
    addondir = xbmc.translatePath(utils.__addon__.getAddonInfo('profile'))
    tempdir = os.path.join(addondir, 'temp')
    service_runtime = str(settings.service_runtime + ':00')
    log('Service - Run at startup: %s' % settings.service_startup,
        xbmc.LOGNOTICE)
    log(
        'Service - Delayed startup: %s minutes' %
        settings.service_startupdelay, xbmc.LOGNOTICE)
    log('Service - Run as service: %s' % settings.service_enable,
        xbmc.LOGNOTICE)
    log('Service - Time: %s' % service_runtime, xbmc.LOGNOTICE)
    if xbmcvfs.exists(tempdir):
        xbmcvfs.rmdir(tempdir)
        log('Removing temp folder from previous run.')
    if settings.service_startup:
        if settings.service_startupdelay != '--':
            xbmc.executebuiltin(
                'XBMC.AlarmClock(ArtworkDownloader,XBMC.RunScript(script.artwork.downloader,silent=true),00:%s:00,silent)'
                % settings.service_startupdelay)
        else:
            xbmc.executebuiltin(
                'XBMC.AlarmClock(ArtworkDownloader,XBMC.RunScript(script.artwork.downloader,silent=true),00:00:20,silent)'
            )
    if settings.service_enable:
        while (not xbmc.abortRequested):
            xbmc.sleep(5000)
            if not (time.strftime('%H:%M') == service_runtime):
                pass
            else:
                if not xbmcvfs.exists(tempdir):
                    log('Time is %s:%s, Scheduled run starting' %
                        (time.strftime('%H'), time.strftime('%M')))
                    xbmc.executebuiltin(
                        'XBMC.RunScript(script.artwork.downloader,silent=true)'
                    )
                else:
                    log('Addon already running, scheduled run aborted',
                        xbmc.LOGNOTICE)
Exemple #5
0
    def __init__(self):
        """Initialise needed directories/vars for fileops"""

        log("Setting up fileops")
        self.settings = _settings()
        self.settings._get_general()
        self._exists = lambda path: xbmcvfs.exists(path)
        self._rmdir = lambda path: xbmcvfs.rmdir(path)
        self._mkdir = lambda path: xbmcvfs.mkdir(path)
        self._delete = lambda path: xbmcvfs.delete(path)

        self.downloadcount = 0
        addondir = xbmc.translatePath(utils.__addon__.getAddonInfo('profile'))
        self.tempdir = os.path.join(addondir, 'temp')
        if not self._exists(self.tempdir):
            if not self._exists(addondir):
                if not self._mkdir(addondir):
                    raise CreateDirectoryError(addondir)
            if not self._mkdir(self.tempdir):
                raise CreateDirectoryError(self.tempdir)
    def __init__(self):

        """Initialise needed directories/vars for fileops"""

        log("Setting up fileops")
        self.settings = _settings()
        self.settings._get_general()
        self._exists = lambda path: xbmcvfs.exists(path)
        self._rmdir = lambda path: xbmcvfs.rmdir(path)
        self._mkdir = lambda path: xbmcvfs.mkdir(path)
        self._delete = lambda path: xbmcvfs.delete(path)

        self.downloadcount = 0
        addondir = xbmc.translatePath( utils.__addon__.getAddonInfo('profile') )
        self.tempdir = os.path.join(addondir, 'temp')
        if not self._exists(self.tempdir):
            if not self._exists(addondir):
                if not self._mkdir(addondir):
                    raise CreateDirectoryError(addondir)
            if not self._mkdir(self.tempdir):
                raise CreateDirectoryError(self.tempdir)
def autostart():
        xbmcaddon.Addon().setSetting(id="files_overwrite", value='false')
        settings = _settings()
        settings._get_general()
        tempdir = os.path.join(__addondir__, 'temp')
        service_runtime  = str(settings.service_runtime + ':00')
        log('## Service - Run at startup: %s'%settings.service_startup, xbmc.LOGNOTICE)        
        log('## Service - Delayed startup: %s minutes'%settings.service_startupdelay, xbmc.LOGNOTICE)   
        log('## Service - Run as service: %s'%settings.service_enable, xbmc.LOGNOTICE)
        log('## Service - Time: %s'%service_runtime, xbmc.LOGNOTICE)
        log("##########........................")
        # Check if tempdir exists and remove it
        if xbmcvfs.exists(tempdir):
            xbmcvfs.rmdir(tempdir)
            log('Removing temp folder from previous aborted run.')
            xbmc.sleep(5000)
        # Run script when enabled and check on existence of tempdir.
        # This because it is possible that script was running even when we previously deleted it.
        # Could happen when switching profiles and service gets triggered again
        if settings.service_startup and not xbmcvfs.exists(tempdir):
            xbmc.executebuiltin('XBMC.AlarmClock(ArtworkDownloader,XBMC.RunScript(script.artwork.downloader,silent=true),00:%s:15,silent)' %settings.service_startupdelay) 
        if settings.service_enable:
            while (not xbmc.abortRequested):
                xbmc.sleep(5000)
                if not(time.strftime('%H:%M') == service_runtime):
                    pass
                else:
                    if not xbmcvfs.exists(tempdir):
                        log('Time is %s:%s, Scheduled run starting' % (time.strftime('%H'), time.strftime('%M')))
                        xbmc.executebuiltin('XBMC.RunScript(script.artwork.downloader,silent=true)')
                        # Because we now use the commoncache module the script is run so fast it is possible it is started twice
                        # within the one minute window. So keep looping until it goes out of that window
                        while (not xbmc.abortRequested and time.strftime('%H:%M') == service_runtime):
                            xbmc.sleep(5000)
                    else:
                        log('Addon already running, scheduled run aborted', xbmc.LOGNOTICE)
Exemple #8
0
 def __init__(self):
     self.settings = _settings()
     self.settings._get_limit()
 def __init__(self):
     self.settings = _settings()
     self.settings._get_limit()