Added existing project
This commit is contained in:
44
main.py
Normal file
44
main.py
Normal file
@@ -0,0 +1,44 @@
|
||||
import openDrive
|
||||
import time
|
||||
import os
|
||||
from imdb import Cinemagoer
|
||||
|
||||
|
||||
DVD_DEVICE = "/dev/sr0"
|
||||
|
||||
def ripDvd(driveName):
|
||||
print("- DVD has been detected")
|
||||
print("- Searching IMDB for " + driveName)
|
||||
ia = Cinemagoer()
|
||||
try:
|
||||
movie = ia.get_movie(ia.search_movie(driveName)[0].getID())
|
||||
movieName = movie['title'] + " (" + str(movie["year"]) + ")"
|
||||
print("- Movie has been identified as " + movieName)
|
||||
print("- Movie has been found, will now procede to ripping DVD")
|
||||
except IndexError:
|
||||
print("- Movie could not be found, will use name " + driveName)
|
||||
print("- Will now procede to ripping DVD")
|
||||
movieName = driveName
|
||||
os.system('HandBrakeCLI -i /dev/sr0 -o "' + movieName + '.mp4" --preset-import-file preset.json')
|
||||
|
||||
def waitForDvd():
|
||||
print("- Insert a DVD into drive")
|
||||
time.sleep(3)
|
||||
dvdfound = False
|
||||
while (dvdfound == False):
|
||||
fh = open ("/etc/mtab", "r")
|
||||
for i in fh:
|
||||
if i.split(" ", 1)[0] == DVD_DEVICE:
|
||||
dvdfound = True
|
||||
driveName = i.split(" ", 1)[1].split("/")[-1].split(" ")[0]
|
||||
ripDvd(driveName)
|
||||
fh.close()
|
||||
time.sleep(1)
|
||||
|
||||
print("-----------------------------------------------")
|
||||
print("- Auto DVD Ripper -")
|
||||
print("-----------------------------------------------")
|
||||
input("-------- Press enter to open dvd drive --------\n-----------------------------------------------\n")
|
||||
openDrive.open()
|
||||
|
||||
waitForDvd()
|
||||
Reference in New Issue
Block a user