예제 #1
0
 def get_save_path(self, base_path, image_name, image: ImageItem):
     project_dir = base_path
     if image.meta['search_keyword']:
         project_dir = os.path.join(image.meta['search_keyword'])
     if image.meta['has_many']:
         project_dir = os.path.join(
             project_dir,
             safe_file_name(image.meta['title']),
         )
     else:
         splited = image_name.split(".")
         name, ext = ".".join(splited[:-1]), splited[-1]
         image_name = safe_file_name(image.meta['title'] + name + "." + ext)
     if not os.path.exists(project_dir):
         os.makedirs(project_dir, exist_ok=True)
     return os.path.join(project_dir, image_name)
예제 #2
0
 def safe_search_keyword(self):
     return safe_file_name(self._params["material"][0])
예제 #3
0
 def dir_name(self):
     if self._search_keyword is not None:
         return safe_file_name(self._search_keyword)
     else:
         return ""