예제 #1
0
파일: default.py 프로젝트: camster1/RTOTV
 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()
예제 #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 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()