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()
|
||||
32
openDrive.py
Normal file
32
openDrive.py
Normal file
@@ -0,0 +1,32 @@
|
||||
from platform import system as platform_name
|
||||
from os import system
|
||||
|
||||
|
||||
platforms_dictionary = {
|
||||
"Windows": { #
|
||||
"open" : 'ctypes.windll.WINMM.mciSendStringW(u"open L: type CDAudio alias L_drive", None, 0, None); ctypes.windll.WINMM.mciSendStringW(u"set L_drive door open", None, 0, None)',
|
||||
"close": 'ctypes.windll.WINMM.mciSendStringW(u"open L: type CDAudio alias L_drive", None, 0, None); ctypes.windll.WINMM.mciSendStringW(u"set L_drive door closed", None, 0, None)'
|
||||
},
|
||||
"Darwin": {
|
||||
"open" : 'system("drutil tray open")',
|
||||
"close": 'system("drutil tray closed")'
|
||||
},
|
||||
"Linux": {
|
||||
"open" : 'system("eject cdrom")',
|
||||
"close": 'system("eject -t cdrom")'
|
||||
},
|
||||
"NetBSD": {
|
||||
"open" : 'system("eject cd")',
|
||||
"close": 'system("eject -t cd")'
|
||||
},
|
||||
"FreeBSD": {
|
||||
"open" : 'system("sudo cdcontrol eject")',
|
||||
"close": 'system("sudo cdcontrol close")'
|
||||
}
|
||||
}
|
||||
|
||||
def open():
|
||||
if platform_name() in platforms_dictionary:
|
||||
exec(platforms_dictionary[platform_name()]["open"])
|
||||
else:
|
||||
print("OS not supported")
|
||||
124
preset.json
Normal file
124
preset.json
Normal file
@@ -0,0 +1,124 @@
|
||||
{
|
||||
"PresetList": [
|
||||
{
|
||||
"AlignAVStart": true,
|
||||
"AudioCopyMask": [
|
||||
"copy:aac"
|
||||
],
|
||||
"AudioEncoderFallback": "av_aac",
|
||||
"AudioLanguageList": [],
|
||||
"AudioList": [
|
||||
{
|
||||
"AudioBitrate": 160,
|
||||
"AudioCompressionLevel": -1.0,
|
||||
"AudioDitherMethod": "auto",
|
||||
"AudioEncoder": "av_aac",
|
||||
"AudioMixdown": "stereo",
|
||||
"AudioNormalizeMixLevel": false,
|
||||
"AudioSamplerate": "auto",
|
||||
"AudioTrackDRCSlider": 0.0,
|
||||
"AudioTrackGainSlider": 0.0,
|
||||
"AudioTrackQuality": -1.0,
|
||||
"AudioTrackQualityEnable": false
|
||||
}
|
||||
],
|
||||
"AudioSecondaryEncoderMode": true,
|
||||
"AudioTrackSelectionBehavior": "first",
|
||||
"ChapterMarkers": true,
|
||||
"ChildrenArray": [],
|
||||
"Default": true,
|
||||
"FileFormat": "av_mp4",
|
||||
"Folder": false,
|
||||
"FolderOpen": false,
|
||||
"InlineParameterSets": false,
|
||||
"MetadataPassthru": true,
|
||||
"Mp4iPodCompatible": false,
|
||||
"Optimize": false,
|
||||
"PictureAllowUpscaling": false,
|
||||
"PictureAutoCrop": true,
|
||||
"PictureBottomCrop": 0,
|
||||
"PictureChromaSmoothCustom": "",
|
||||
"PictureChromaSmoothPreset": "off",
|
||||
"PictureChromaSmoothTune": "none",
|
||||
"PictureColorspaceCustom": "",
|
||||
"PictureColorspacePreset": "off",
|
||||
"PictureCombDetectCustom": "",
|
||||
"PictureCombDetectPreset": "default",
|
||||
"PictureCropMode": 0,
|
||||
"PictureDARWidth": 0,
|
||||
"PictureDeblockCustom": "strength=strong:thresh=20:blocksize=8",
|
||||
"PictureDeblockPreset": "off",
|
||||
"PictureDeblockTune": "medium",
|
||||
"PictureDeinterlaceCustom": "",
|
||||
"PictureDeinterlaceFilter": "decomb",
|
||||
"PictureDeinterlacePreset": "default",
|
||||
"PictureDenoiseCustom": "",
|
||||
"PictureDenoiseFilter": "off",
|
||||
"PictureDenoisePreset": "light",
|
||||
"PictureDenoiseTune": "none",
|
||||
"PictureDetelecine": "off",
|
||||
"PictureDetelecineCustom": "",
|
||||
"PictureForceHeight": 0,
|
||||
"PictureForceWidth": 0,
|
||||
"PictureHeight": 1080,
|
||||
"PictureItuPAR": false,
|
||||
"PictureKeepRatio": true,
|
||||
"PictureLeftCrop": 0,
|
||||
"PictureModulus": 2,
|
||||
"PicturePAR": "auto",
|
||||
"PicturePARHeight": 720,
|
||||
"PicturePARWidth": 853,
|
||||
"PicturePadBottom": 0,
|
||||
"PicturePadColor": "black",
|
||||
"PicturePadLeft": 0,
|
||||
"PicturePadMode": "none",
|
||||
"PicturePadRight": 0,
|
||||
"PicturePadTop": 0,
|
||||
"PictureRightCrop": 0,
|
||||
"PictureRotate": "angle=0:hflip=0",
|
||||
"PictureSharpenCustom": "",
|
||||
"PictureSharpenFilter": "off",
|
||||
"PictureSharpenPreset": "medium",
|
||||
"PictureSharpenTune": "none",
|
||||
"PictureTopCrop": 0,
|
||||
"PictureUseMaximumSize": true,
|
||||
"PictureWidth": 1920,
|
||||
"PresetDescription": "H.264 video (up to 1080p30) and AAC stereo audio, in an MP4 container.",
|
||||
"PresetDisabled": false,
|
||||
"PresetName": "Fast 1080p30",
|
||||
"SubtitleAddCC": false,
|
||||
"SubtitleAddForeignAudioSearch": true,
|
||||
"SubtitleAddForeignAudioSubtitle": false,
|
||||
"SubtitleBurnBDSub": false,
|
||||
"SubtitleBurnBehavior": "foreign",
|
||||
"SubtitleBurnDVDSub": false,
|
||||
"SubtitleLanguageList": [],
|
||||
"SubtitleTrackSelectionBehavior": "none",
|
||||
"Type": 0,
|
||||
"UsesPictureFilters": true,
|
||||
"VideoAvgBitrate": 6000,
|
||||
"VideoColorMatrixCodeOverride": 0,
|
||||
"VideoEncoder": "x264",
|
||||
"VideoFramerate": "30",
|
||||
"VideoFramerateMode": "pfr",
|
||||
"VideoGrayScale": false,
|
||||
"VideoHWDecode": 0,
|
||||
"VideoLevel": "4.0",
|
||||
"VideoMultiPass": true,
|
||||
"VideoOptionExtra": "",
|
||||
"VideoPreset": "fast",
|
||||
"VideoProfile": "main",
|
||||
"VideoQSVDecode": false,
|
||||
"VideoQualitySlider": 22.0,
|
||||
"VideoQualityType": 2,
|
||||
"VideoScaler": "swscale",
|
||||
"VideoTune": "",
|
||||
"VideoTurboMultiPass": true,
|
||||
"x264Option": "",
|
||||
"x264UseAdvancedOptions": false
|
||||
}
|
||||
],
|
||||
"VersionMajor": 59,
|
||||
"VersionMicro": 0,
|
||||
"VersionMinor": 0
|
||||
}
|
||||
Reference in New Issue
Block a user