Fixed uploads, again
This commit is contained in:
3
main.py
3
main.py
@@ -2,7 +2,6 @@ import openDrive
|
|||||||
import time
|
import time
|
||||||
import os
|
import os
|
||||||
from imdb import Cinemagoer
|
from imdb import Cinemagoer
|
||||||
import uploadresults
|
|
||||||
from dotenv import load_dotenv
|
from dotenv import load_dotenv
|
||||||
|
|
||||||
load_dotenv()
|
load_dotenv()
|
||||||
@@ -24,7 +23,7 @@ def ripDvd(driveName):
|
|||||||
movieName = driveName
|
movieName = driveName
|
||||||
os.system('HandBrakeCLI -i /dev/sr0 -o output/"' + movieName + '.mp4" --preset-import-file preset.json')
|
os.system('HandBrakeCLI -i /dev/sr0 -o output/"' + movieName + '.mp4" --preset-import-file preset.json')
|
||||||
print("- Movie has been ripped, will now procede to upload file")
|
print("- Movie has been ripped, will now procede to upload file")
|
||||||
uploadresults.upload()
|
os.system("python3 uploadresults.py")
|
||||||
print("- Movie has been uploaded")
|
print("- Movie has been uploaded")
|
||||||
|
|
||||||
def waitForDvd():
|
def waitForDvd():
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ import paramiko
|
|||||||
import os
|
import os
|
||||||
from dotenv import load_dotenv
|
from dotenv import load_dotenv
|
||||||
|
|
||||||
def upload():
|
|
||||||
load_dotenv()
|
load_dotenv()
|
||||||
|
|
||||||
hostname = os.getenv('SFTP_HOST')
|
hostname = os.getenv('SFTP_HOST')
|
||||||
port = int(os.getenv('SFTP_PORT'))
|
port = int(os.getenv('SFTP_PORT'))
|
||||||
username = os.getenv('SFTP_USERNAME')
|
username = os.getenv('SFTP_USERNAME')
|
||||||
@@ -27,9 +27,10 @@ def upload():
|
|||||||
|
|
||||||
# Download each file
|
# Download each file
|
||||||
sftp.put(local_filepath, remote_filepath)
|
sftp.put(local_filepath, remote_filepath)
|
||||||
print(f"- Uploaded: {local_filepath} to {remote_filepath}")
|
print(f"Uploaded: {local_filepath} to {remote_filepath}")
|
||||||
|
|
||||||
# Close the SFTP session and SSH connection
|
# Close the SFTP session and SSH connection
|
||||||
sftp.close()
|
sftp.close()
|
||||||
ssh_client.close()
|
ssh_client.close()
|
||||||
|
print("All files downloaded and connections closed.")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user