Example #1
0
    async def get_save_path(
        self,
        file_filter: Optional[str] = None,
        directory: Optional[Path] = None,
        default_file_name: Optional[str] = None,
    ) -> Path:
        if self.value:
            return Path(self.value).expanduser()

        path = await self.api.gui.exec(
            self._show_save_dialog,
            file_filter=file_filter,
            directory=directory,
            file_name=(None if default_file_name is None else
                       sanitize_file_name(default_file_name)),
        )
        if path:
            return path

        raise CommandCanceled
Example #2
0
 def _get_cache_name(self, stream: VideoStream) -> str:
     try:
         size = stream.path.stat().st_size
     except FileNotFoundError:
         size = 0
     return sanitize_file_name(stream.path) + f"-{size}-video-band"