Ejemplo n.º 1
0
 def __init__(self):
     if not check():          # Check if there are some faulty combinations present
         sys.exit(1)
     if self.initialise():
         global setting
         global startup
         providers = provider.get_providers()
         # Check for silent background mode
         if startup['silent']:
             setting['background'] = True
             setting['notify'] = False
         # Check for gui mode
         elif startup['mode'] == 'gui':
             setting['background'] = True
             setting['notify'] = False
             setting['files_overwrite'] = True
         dialog_msg('create',
                    line1 = __localize__(32008),
                    background = setting['background'])
         # Check if mediatype is specified
         if startup['mediatype']:
             # Check if dbid is specified
             if startup['dbid']:
                 mediaList = media_unique(startup['mediatype'],startup['dbid'])
                 if startup['mediatype'] == 'movie':
                     self.download_artwork(mediaList, providers['movie_providers'])
                 elif startup['mediatype'] == 'tvshow':
                     self.download_artwork(mediaList, providers['tv_providers'])
                 elif startup['mediatype'] == 'musicvideo':
                     self.download_artwork(mediaList, providers['musicvideo_providers'])
                 if ((not xbmc.abortRequested or not
                      dialog_msg('iscanceled',
                                 background = setting['background'])) and not 
                     (startup['mode'] == 'customgui' or
                     startup['mode'] == 'gui')):
                     self._batch_download(download_list)
             else:
                 # If no medianame specified
                 # 1. Check what media type was specified, 2. Retrieve library list, 3. Enable the correct type, 4. Do the API stuff
                 setting['movie_enable'] = False
                 setting['tvshow_enable'] = False
                 setting['musicvideo_enable'] = False
                 if startup['mediatype'] == 'movie':
                     setting['movie_enable'] = True
                     mediaList = media_listing('movie')
                     self.download_artwork(mediaList, providers['movie_providers'])
                 elif startup['mediatype'] == 'tvshow':
                     setting['tvshow_enable'] = True
                     mediaList = media_listing('tvshow')
                     self.download_artwork(mediaList, providers['tv_providers'])
                 elif startup['mediatype'] == 'musicvideo':
                     setting['musicvideo_enable'] = True
                     mediaList = media_listing('musicvideo')
                     self.download_artwork(mediaList, providers['musicvideo_providers'])
                 if not xbmc.abortRequested or not dialog_msg('iscanceled',
                                                              background = setting['background']):
                     self._batch_download(download_list)
         # No mediatype is specified
         else:
             # activate movie/tvshow/musicvideo for custom run
             if startup['mode'] == 'custom':
                 setting['movie_enable'] = True
                 setting['tvshow_enable'] = True
                 setting['musicvideo_enable'] = True
             # Normal oprations check
             # 1. Check if enable, 2. Get library list, 3. Set mediatype, 4. Do the API stuff
             # Do this for each media type
             if setting['movie_enable'] and not (xbmc.abortRequested or dialog_msg('iscanceled',
                                                                                   background = setting['background'])):
                 startup['mediatype'] = 'movie'
                 mediaList = media_listing(startup['mediatype'])
                 self.download_artwork(mediaList, providers['movie_providers'])
             if setting['tvshow_enable'] and not (xbmc.abortRequested or dialog_msg('iscanceled',
                                                                                    background = setting['background'])):
                 startup['mediatype'] = 'tvshow'
                 mediaList = media_listing(startup['mediatype'])
                 self.download_artwork(mediaList, providers['tv_providers'])
             if setting['musicvideo_enable'] and not (xbmc.abortRequested or dialog_msg('iscanceled',
                                                                                        background = setting['background'])):
                 startup['mediatype'] = 'musicvideo'
                 mediaList = media_listing(startup['mediatype'])
                 self.download_artwork(mediaList, providers['musicvideo_providers'])
             # If not cancelled throw the whole downloadlist into the batch downloader
             if not xbmc.abortRequested:
                 self._batch_download(download_list)
     else:
         log('Initialisation error, script aborting', xbmc.LOGERROR)
     # Make sure that files_overwrite option get's reset after downloading
     __addon__.setSetting(id='files_overwrite', value='false')
     dialog_msg('close',
                background = setting['background'])
     cleanup()
     self.report()
Ejemplo n.º 2
0
 def __init__(self):
     if not check():  # Check if there are some faulty combinations present
         sys.exit(1)
     if self.initialise():
         global setting
         global startup
         providers = provider.get_providers()
         # Check for silent background mode
         if startup['silent']:
             setting['background'] = True
             setting['notify'] = False
         # Check for gui mode
         elif startup['mode'] == 'gui':
             setting['background'] = True
             setting['notify'] = False
             setting['files_overwrite'] = True
         dialog_msg('create',
                    line1=__localize__(32008),
                    background=setting['background'])
         # Check if mediatype is specified
         if startup['mediatype']:
             # Check if dbid is specified
             if startup['dbid']:
                 mediaList = media_unique(startup['mediatype'],
                                          startup['dbid'])
                 if startup['mediatype'] == 'movie':
                     self.download_artwork(mediaList,
                                           providers['movie_providers'])
                 elif startup['mediatype'] == 'tvshow':
                     self.download_artwork(mediaList,
                                           providers['tv_providers'])
                 elif startup['mediatype'] == 'musicvideo':
                     self.download_artwork(
                         mediaList, providers['musicvideo_providers'])
                 if (not dialog_msg('iscanceled',
                                    background=setting['background'])
                         and not (startup['mode'] == 'customgui'
                                  or startup['mode'] == 'gui')):
                     self._batch_download(download_list)
             else:
                 # If no medianame specified
                 # 1. Check what media type was specified, 2. Retrieve library list, 3. Enable the correct type, 4. Do the API stuff
                 setting['movie_enable'] = False
                 setting['tvshow_enable'] = False
                 setting['musicvideo_enable'] = False
                 if startup['mediatype'] == 'movie':
                     setting['movie_enable'] = True
                     mediaList = media_listing('movie')
                     self.download_artwork(mediaList,
                                           providers['movie_providers'])
                 elif startup['mediatype'] == 'tvshow':
                     setting['tvshow_enable'] = True
                     mediaList = media_listing('tvshow')
                     self.download_artwork(mediaList,
                                           providers['tv_providers'])
                 elif startup['mediatype'] == 'musicvideo':
                     setting['musicvideo_enable'] = True
                     mediaList = media_listing('musicvideo')
                     self.download_artwork(
                         mediaList, providers['musicvideo_providers'])
                 if not dialog_msg('iscanceled',
                                   background=setting['background']):
                     self._batch_download(download_list)
         # No mediatype is specified
         else:
             # activate movie/tvshow/musicvideo for custom run
             if startup['mode'] == 'custom':
                 setting['movie_enable'] = True
                 setting['tvshow_enable'] = True
                 setting['musicvideo_enable'] = True
             # Normal oprations check
             # 1. Check if enable, 2. Get library list, 3. Set mediatype, 4. Do the API stuff
             # Do this for each media type
             if setting['movie_enable'] and not dialog_msg('iscanceled',
                                                           background=True):
                 startup['mediatype'] = 'movie'
                 mediaList = media_listing(startup['mediatype'])
                 self.download_artwork(mediaList,
                                       providers['movie_providers'])
             if setting['tvshow_enable'] and not dialog_msg(
                     'iscanceled', background=True):
                 startup['mediatype'] = 'tvshow'
                 mediaList = media_listing(startup['mediatype'])
                 self.download_artwork(mediaList, providers['tv_providers'])
             if setting['musicvideo_enable'] and not dialog_msg(
                     'iscanceled', background=True):
                 startup['mediatype'] = 'musicvideo'
                 mediaList = media_listing(startup['mediatype'])
                 self.download_artwork(mediaList,
                                       providers['musicvideo_providers'])
             # If not cancelled throw the whole downloadlist into the batch downloader
             if not dialog_msg('iscanceled',
                               background=setting['background']):
                 self._batch_download(download_list)
     else:
         log('Initialisation error, script aborting', xbmc.LOGERROR)
     # Make sure that files_overwrite option get's reset after downloading
     __addon__.setSetting(id='files_overwrite', value='false')
     cleanup()
     self.report()
Ejemplo n.º 3
0
artwork = {}
if (addon.getSetting("addclearlogo").lower() == "true"): artwork["clearlogo"] = addon.getSetting("clearlogo")
if (addon.getSetting("addclearart").lower() == "true"): artwork["clearart"] = addon.getSetting("clearart")
if (addon.getSetting("addbanner").lower() == "true"): artwork["banner"] = addon.getSetting("banner")
if (addon.getSetting("adddiscart").lower() == "true"): artwork["discart"] = addon.getSetting("discart")

# EXIT if there is no artwork to add
if ( len(artwork) == 0 ):
	log( "No artwork to add because all settings are false.")
	sys.exit()

p.update(0, str(artwork))
time.sleep(1)

# get list of movies from kodi
mediaList = media_listing("movie") 

itemcount = 0
itemtotal = len(mediaList)

p.update(0, "Parse # of movies: " + str(itemtotal), "Debug: " + addon.getSetting("debug_enabled"))
time.sleep(1) # delays for 1 seconds

locallogo = ""

for item in mediaList:
    itemcount +=1
    p.update(100*itemcount/itemtotal, str(itemcount) + ": " + item['name'] + ", path: " + str(item['path']))
    # create clearlogo filename
    art = create_artwork_dict(item['file'], artwork)
    # at least one type of artwork found locally