示例#1
0
 def download_file(self,
                   url: str,
                   dst: str = None,
                   callback: callable = None) -> bool:
     if not dst:
         name = basename(remove_file_query_params(url))
         dst = path_join(get_temp_path(), name)
     return self._download_one_file_helper(url, dst, callback)
示例#2
0
 def prepare_cookies(self):
     _storage = storage('.passwords.json')
     if not is_file(_storage):
         copy(path_join(root_path(), 'manga_py', '.passwords.json.dist'),
              _storage)
     file = open(_storage, 'r').read()
     data = self.json.loads(file).get('hentai_chan_me', {})
     cookies = self._login(**data)
     for i in cookies:
         self._storage['cookies'][i] = cookies[i]
示例#3
0
 def loop_chapters(self):
     arc_name = self.get_archive_name()
     arc = self._archive_type()
     path = path_join(dirname(self.get_archive_path()), arc_name + '.%s' % arc)
     url = self.chapter
     temp_path = get_temp_path('{:0>2}_{}-temp_arc.zip'.format(
         self._storage['current_chapter'],
         arc_name
     ))
     self.save_file(url, temp_path)
     rename(temp_path, path)
示例#4
0
 def get_arc_path(self):
     path = self.get_archive_name()
     name = dirname(self.get_archive_path())
     arc = self._archive_type()
     return path_join(path, name + '.%s' % arc)
示例#5
0
 def test_root_path(self):
     self.assertEqual(path.realpath(fs.path_join(root_path, '..')),
                      fs.root_path())