Пример #1
0
 def migrate_old_conf(self, old_conf_path):
     from calibre.utils.config import DynamicConfig
     c = DynamicConfig('scheduler')
     for r in c.get('scheduled_recipes', []):
         try:
             self.add_old_recipe(r)
         except:
             continue
     for k in c.keys():
         if k.startswith('recipe_account_info'):
             try:
                 urn = k.replace('recipe_account_info_', '')
                 if urn.startswith('recipe_'):
                     urn = 'builtin:'+urn[7:]
                 else:
                     urn = 'custom:%d'%int(urn)
                 try:
                     username, password = c[k]
                 except:
                     username = password = ''
                 self.set_account_info(urn, unicode(username),
                         unicode(password))
             except:
                 continue
     del c
     self.write_scheduler_file()
     try:
         os.remove(old_conf_path)
     except:
         pass
Пример #2
0
 def migrate_old_conf(self, old_conf_path):
     from calibre.utils.config import DynamicConfig
     c = DynamicConfig('scheduler')
     for r in c.get('scheduled_recipes', []):
         try:
             self.add_old_recipe(r)
         except:
             continue
     for k in c.keys():
         if k.startswith('recipe_account_info'):
             try:
                 urn = k.replace('recipe_account_info_', '')
                 if urn.startswith('recipe_'):
                     urn = 'builtin:' + urn[7:]
                 else:
                     urn = 'custom:%d' % int(urn)
                 try:
                     username, password = c[k]
                 except:
                     username = password = ''
                 self.set_account_info(urn, unicode(username),
                                       unicode(password))
             except:
                 continue
     del c
     self.write_scheduler_file()
     try:
         os.remove(old_conf_path)
     except:
         pass
Пример #3
0
 def __init__(self, pathtoebook, log=None):
     self.log = log or default_log
     pathtoebook = pathtoebook.strip()
     self.pathtoebook = os.path.abspath(pathtoebook)
     self.config = DynamicConfig(name='iterator')
     ext = os.path.splitext(pathtoebook)[1].replace('.', '').lower()
     ext = re.sub(r'(x{0,1})htm(l{0,1})', 'html', ext)
     self.ebook_ext = ext.replace('original_', '')
Пример #4
0
 def __init__(self, pathtoebook, log=None, copy_bookmarks_to_file=True, use_tdir_in_cache=False):
     BookmarksMixin.__init__(self, copy_bookmarks_to_file=copy_bookmarks_to_file)
     self.use_tdir_in_cache = use_tdir_in_cache
     self.log = log or default_log
     pathtoebook = pathtoebook.strip()
     self.pathtoebook = os.path.abspath(pathtoebook)
     self.config = DynamicConfig(name='iterator')
     ext = os.path.splitext(pathtoebook)[1].replace('.', '').lower()
     ext = re.sub(r'(x{0,1})htm(l{0,1})', 'html', ext)
     self.ebook_ext = ext.replace('original_', '')