示例#1
0
 def destination(self) -> Path:
     """
     The destination Path for the target based on its metadata and user
     preferences.
     """
     if self.directory:
         dir_head = format(self.metadata, str(self.directory))
         dir_head = str_sanitize(dir_head)
         dir_head = Path(dir_head)
     else:
         dir_head = self.source.parent
     file_path = format(self.metadata, self._formatting)
     file_path = str_sanitize(file_path)
     file_path = Path(file_path)
     dir_tail, filename = path.split(file_path)
     directory = Path(dir_head, dir_tail)
     if self._settings.scene:
         filename = str_scenify(filename)
     if self._settings.lower:
         filename = filename.lower()
     return Path(directory, filename).resolve()
示例#2
0
文件: target.py 项目: jonas2k/mnamer
 def destination(self) -> Path:
     """
     The destination Path for the target based on its metadata and user
     preferences.
     """
     if self.directory:
         dir_head_ = format(self.metadata, str(self.directory))
         dir_head_ = str_sanitize(dir_head_)
         dir_head = Path(dir_head_)
     else:
         dir_head = self.source.parent
     file_path = format(self.metadata,
                        self._settings.formatting_for(self.metadata.media))
     dir_tail, filename = path.split(Path(file_path))
     filename = filename_replace(filename, self._settings.replace_after)
     if self._settings.scene:
         filename = str_scenify(filename)
     if self._settings.lower:
         filename = filename.lower()
     filename = str_sanitize(filename)
     directory = Path(dir_head, dir_tail)
     return Path(directory, filename)