Manually handle deleting file
This commit is contained in:
parent
8d7cee3e89
commit
47ff9f6110
1 changed files with 2 additions and 1 deletions
|
@ -66,7 +66,7 @@ class AutoResponder(commands.Cog):
|
||||||
else:
|
else:
|
||||||
self.log.info("No HEVC streams found in %s", uri)
|
self.log.info("No HEVC streams found in %s", uri)
|
||||||
return
|
return
|
||||||
with tempfile.NamedTemporaryFile(suffix=".mp4") as tmp:
|
with tempfile.NamedTemporaryFile(suffix=".mp4", delete=False, delete_on_close=False) as tmp:
|
||||||
tmp_path = pathlib.Path(tmp.name)
|
tmp_path = pathlib.Path(tmp.name)
|
||||||
self.log.info("Transcoding %r to %r", uri, tmp_path)
|
self.log.info("Transcoding %r to %r", uri, tmp_path)
|
||||||
args = [
|
args = [
|
||||||
|
@ -119,6 +119,7 @@ class AutoResponder(commands.Cog):
|
||||||
_p,
|
_p,
|
||||||
_p.stat().st_size / 1024 / 1024
|
_p.stat().st_size / 1024 / 1024
|
||||||
)
|
)
|
||||||
|
_p.unlink()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.log.error("Failed to transcode %r: %r", link, e)
|
self.log.error("Failed to transcode %r: %r", link, e)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue