mirror of
https://github.com/alfem/telegram-download-daemon.git
synced 2024-09-20 14:56:06 +08:00
Merge branch 'development'
This commit is contained in:
commit
2cc8d5f525
|
@ -3,7 +3,7 @@ from telethon.sessions import StringSession
|
|||
|
||||
TELEGRAM_DAEMON_SESSION_PATH = getenv("TELEGRAM_DAEMON_SESSION_PATH")
|
||||
sessionName = "DownloadDaemon"
|
||||
stringSessionFilename = f"{sessionName}.session"
|
||||
stringSessionFilename = "{0}.session".format(sessionName)
|
||||
|
||||
|
||||
def _getStringSessionIfExists():
|
||||
|
@ -12,7 +12,7 @@ def _getStringSessionIfExists():
|
|||
if path.isfile(sessionPath):
|
||||
with open(sessionPath, 'r') as file:
|
||||
session = file.read()
|
||||
print(f"Session loaded from {sessionPath}")
|
||||
print("Session loaded from {0}".format(sessionPath))
|
||||
return session
|
||||
return None
|
||||
|
||||
|
@ -30,4 +30,4 @@ def saveSession(session):
|
|||
stringSessionFilename)
|
||||
with open(sessionPath, 'w') as file:
|
||||
file.write(StringSession.save(session))
|
||||
print(f"Session saved in {sessionPath}")
|
||||
print("Session saved in {0}".format(sessionPath))
|
||||
|
|
|
@ -21,7 +21,7 @@ import argparse
|
|||
import asyncio
|
||||
|
||||
|
||||
TDD_VERSION="1.2"
|
||||
TDD_VERSION="1.3"
|
||||
|
||||
TELEGRAM_DAEMON_API_ID = getenv("TELEGRAM_DAEMON_API_ID")
|
||||
TELEGRAM_DAEMON_API_HASH = getenv("TELEGRAM_DAEMON_API_HASH")
|
||||
|
@ -148,7 +148,7 @@ with TelegramClient(getSession(), api_id, api_hash,
|
|||
output = "Unknown command"
|
||||
|
||||
if command == "list":
|
||||
output = subprocess.run(["ls -l "+downloadFolder], shell=True, stdout=subprocess.PIPE,stderr=subprocess.STDOUT,encoding="utf-8").stdout
|
||||
output = subprocess.run(["ls -l "+downloadFolder], shell=True, stdout=subprocess.PIPE,stderr=subprocess.STDOUT).stdout.decode('utf-8')
|
||||
elif command == "status":
|
||||
try:
|
||||
output = "".join([ "{0}: {1}\n".format(key,value) for (key, value) in in_progress.items()])
|
||||
|
@ -160,7 +160,7 @@ with TelegramClient(getSession(), api_id, api_hash,
|
|||
output = "Some error occured while checking the status. Retry."
|
||||
elif command == "clean":
|
||||
output = "Cleaning "+tempFolder+"\n"
|
||||
output+=subprocess.run(["rm "+tempFolder+"/*."+TELEGRAM_DAEMON_TEMP_SUFFIX], shell=True, stdout=subprocess.PIPE,stderr=subprocess.STDOUT,encoding="utf-8").stdout
|
||||
output+=subprocess.run(["rm "+tempFolder+"/*."+TELEGRAM_DAEMON_TEMP_SUFFIX], shell=True, stdout=subprocess.PIPE,stderr=subprocess.STDOUT).stdout
|
||||
else:
|
||||
output = "Available commands: list, status, clean"
|
||||
|
||||
|
|
Loading…
Reference in a new issue