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

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