Merge branch 'development'

This commit is contained in:
Alfonso De Cala Bravo 2021-02-23 12:56:51 +01:00
commit 2cc8d5f525
2 changed files with 6 additions and 6 deletions

View file

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

View file

@ -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"