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:
Baruch Odem (Rothkoff) 2021-03-08 21:54:24 +02:00 committed by GitHub
parent 2cc8d5f525
commit 0a72a5e78e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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()