Beispiel #1
0
	def _make_dirs(self, folder_name):
		folder_files = []
		append = folder_files.append
		dirs, files =  list_dirs(folder_name)
		for i in dirs: append((i, 'folder'))
		for i in files: append((i, 'file'))
		return folder_files
 def run(self):
     logger('FEN', 'Clear Subtitles Service Starting')
     subtitle_path = translate_path('special://temp/')
     files = kodi_utils.list_dirs(subtitle_path)[1]
     for i in files:
         try:
             if i.startswith('FENSubs_'):
                 kodi_utils.delete_file(os.path.join(subtitle_path, i))
             if i.endswith('.nfo'):
                 kodi_utils.delete_file(os.path.join(subtitle_path, i))
         except:
             pass
     return logger('FEN', 'Clear Subtitles Service Finished')
Beispiel #3
0
    def browser_image(self, folder_path, return_items=False):
        def builder():
            for item in files:
                try:
                    listitem = make_listitem()
                    image_url = os.path.join(folder_path, item)
                    try:
                        thumb_url = [i for i in thumbs if i == item][0]
                        thumb_url = os.path.join(thumbs_path, thumb_url)
                    except:
                        thumb_url = os.path.join(folder_path, item)
                    listitem.setProperty('tikiskins.thumb', thumb_url)
                    listitem.setProperty('tikiskins.path', image_url)
                    listitem.setProperty('tikiskins.name', item)
                    listitem.setProperty('tikiskins.delete', 'true')
                    listitem.setProperty('tikiskins.folder_path', folder_path)
                    listitem.setProperty('tikiskins.action', image_action)
                    yield listitem
                except:
                    pass

        files = list_dirs(folder_path)[1]
        files.sort()
        thumbs_path = os.path.join(folder_path, '.thumbs')
        thumbs = list_dirs(thumbs_path)[1]
        thumbs.sort()
        all_images_json = json.dumps([(os.path.join(folder_path, i), i)
                                      for i in files])
        image_action = json.dumps({
            'mode': 'slideshow_image',
            'all_images': all_images_json,
            'page_no': 'final_page'
        })
        self.list_items = list(builder())
        self.next_page_params = {}
        if return_items:
            return self.list_items
Beispiel #4
0
def scraper_names(folder):
    providerList = []
    append = providerList.append
    source_folder_location = 'special://home/addons/script.module.fenomscrapers/lib/fenomscrapers/sources_fenomscrapers/%s'
    sourceSubFolders = ('hosters', 'torrents')
    if folder != 'all':
        sourceSubFolders = [i for i in sourceSubFolders if i == folder]
    for item in sourceSubFolders:
        files = kodi_utils.list_dirs(
            kodi_utils.translate_path(source_folder_location % item))[1]
        for m in files:
            module_name = m.split('.')[0]
            if module_name == '__init__': continue
            append(module_name)
    return providerList
Beispiel #5
0
 def import_info():
     files = kodi_utils.list_dirs(
         kodi_utils.translate_path(
             'special://home/addons/plugin.video.fen/resources/lib/scrapers'
         ))[1]
     for item in files:
         try:
             module_name = item.split('.')[0]
             if module_name in ('__init__', 'external', 'folders'): continue
             if module_name not in active_sources: continue
             if prescrape and not check_prescrape_sources(module_name):
                 continue
             module = manual_function_import('scrapers.%s' % module_name,
                                             'source')
             yield ('internal', module, module_name)
         except:
             pass