add option to use the foreground for ca videos

This commit is contained in:
leminlimez
2025-03-31 14:29:36 -04:00
parent 9810fd6eaf
commit c88d80f3df
6 changed files with 74 additions and 41 deletions

View File

@@ -67,6 +67,7 @@ class PosterboardTweak(Tweak):
self.videoFile = None
self.loop_video = False
self.reverse_video = False
self.use_foreground = False
self.bundle_id = "com.apple.PosterBoard"
self.resetting = False
self.resetType = 0 # 0 for descriptor, 1 for prb, 2 for suggested photos
@@ -211,7 +212,14 @@ class PosterboardTweak(Tweak):
source_dir = get_bundle_files("files/posterboard/VideoCAML")
video_output_dir = os.path.join(output_dir, "descriptor/VideoCAML")
copytree(source_dir, video_output_dir, dirs_exist_ok=True)
contents_path = os.path.join(video_output_dir, "versions/1/contents/9183.Custom-810w-1080h@2x~ipad.wallpaper/9183.Custom_Background-810w-1080h@2x~ipad.ca")
contents_path = os.path.join(video_output_dir, "versions/1/contents/9183.Custom-810w-1080h@2x~ipad.wallpaper")
if self.use_foreground:
# rename the foreground layer to background
bg_path = os.path.join(contents_path, "9183.Custom_Background-810w-1080h@2x~ipad.ca")
contents_path = os.path.join(contents_path, "9183.Custom_Floating-810w-1080h@2x~ipad.ca")
os.rename(contents_path, bg_path)
else:
contents_path = os.path.join(contents_path, "9183.Custom_Background-810w-1080h@2x~ipad.ca")
print(f"path at {contents_path}, creating caml")
video_handler.create_caml(video_path=self.videoFile, output_file=contents_path, auto_reverses=self.reverse_video, update_label=update_label)