DVDs working

This commit is contained in:
Neale Pickett 2022-08-25 10:17:25 -06:00
parent ede1fd22be
commit a559e92d3e
1 changed files with 7 additions and 10 deletions

View File

@ -42,9 +42,8 @@ def scan(state, device):
if title in ('No', 'unknown'): if title in ('No', 'unknown'):
title = lsdvd["provider_id"] title = lsdvd["provider_id"]
if title == "$PACKAGE_STRING": if title == "$PACKAGE_STRING":
title = "DVD"
now = time.strftime(r"%Y-%m-%dT%H:%M:%S") now = time.strftime(r"%Y-%m-%dT%H:%M:%S")
title = "%s %s" % (title, now) title = "DVD %s" % (title, now)
# Go through all the tracks, looking for the largest referenced sector. # Go through all the tracks, looking for the largest referenced sector.
max_sector = 0 max_sector = 0
@ -66,7 +65,7 @@ def scan(state, device):
collection = [] collection = []
for track in tracks: for track in tracks:
if track["length"] / max_length > 0.80: if track["length"] / max_length > 0.80:
collection = collect(track) collection = collect(collection, track)
if (max_length < 20 * MINUTE) and (len(collection) < len(track) * 0.6): if (max_length < 20 * MINUTE) and (len(collection) < len(track) * 0.6):
collection = tracks collection = tracks
@ -118,7 +117,7 @@ def encode(state, directory):
"nice", "nice",
"HandBrakeCLI", "HandBrakeCLI",
"--json", "--json",
"--input", "%s/VIDEO_TS" % directory, "--input", "%s/%s/VIDEO_TS" % (directory, state["title"]),
"--output", tmppath, "--output", tmppath,
"--title", str(track), "--title", str(track),
"--native-language", "eng", "--native-language", "eng",
@ -144,8 +143,7 @@ def encode(state, directory):
m = progressRe.search(line) m = progressRe.search(line)
if m: if m:
progress = float(m[1]) progress = float(m[1])
complete = (finished_length + progress*length) / total_length yield (finished_length + progress*length) / total_length
state["complete"] = complete
finished_length += length finished_length += length
os.rename( os.rename(
@ -156,8 +154,7 @@ def encode(state, directory):
def clean(state, directory): def clean(state, directory):
pass os.removedirs(directory)
if __name__ == "__main__": if __name__ == "__main__":
import pprint import pprint