mirror of
https://github.com/alfem/telegram-download-daemon.git
synced 2025-03-01 16:43:06 +08:00
use shutil.move to support Docker Volumes
close #42 Reference: https://stackoverflow.com/questions/42392600/oserror-errno-18-invalid-cross-device-link
This commit is contained in:
parent
2cc8d5f525
commit
0a72a5e78e
1 changed files with 3 additions and 2 deletions
|
@ -3,7 +3,8 @@
|
||||||
# Author: Alfonso E.M. <alfonso@el-magnifico.org>
|
# Author: Alfonso E.M. <alfonso@el-magnifico.org>
|
||||||
# You need to install telethon (and cryptg to speed up downloads)
|
# You need to install telethon (and cryptg to speed up downloads)
|
||||||
|
|
||||||
from os import getenv, rename
|
from os import getenv
|
||||||
|
from shutil import move
|
||||||
import subprocess
|
import subprocess
|
||||||
import math
|
import math
|
||||||
|
|
||||||
|
@ -191,7 +192,7 @@ with TelegramClient(getSession(), api_id, api_hash,
|
||||||
|
|
||||||
await client.download_media(event.message, "{0}/{1}.{2}".format(tempFolder,filename,TELEGRAM_DAEMON_TEMP_SUFFIX), progress_callback = download_callback)
|
await client.download_media(event.message, "{0}/{1}.{2}".format(tempFolder,filename,TELEGRAM_DAEMON_TEMP_SUFFIX), progress_callback = download_callback)
|
||||||
set_progress(filename, message, 100, 100)
|
set_progress(filename, message, 100, 100)
|
||||||
rename("{0}/{1}.{2}".format(tempFolder,filename,TELEGRAM_DAEMON_TEMP_SUFFIX), "{0}/{1}".format(downloadFolder,filename))
|
move("{0}/{1}.{2}".format(tempFolder,filename,TELEGRAM_DAEMON_TEMP_SUFFIX), "{0}/{1}".format(downloadFolder,filename))
|
||||||
await log_reply(message, "{0} ready".format(filename))
|
await log_reply(message, "{0} ready".format(filename))
|
||||||
|
|
||||||
queue.task_done()
|
queue.task_done()
|
||||||
|
|
Loading…
Reference in a new issue