diff --git a/controllers/video_handler.py b/controllers/video_handler.py index 90a34cc..9c0594f 100644 --- a/controllers/video_handler.py +++ b/controllers/video_handler.py @@ -1,3 +1,5 @@ +import cv2 +import os import ffmpeg from tempfile import NamedTemporaryFile @@ -36,4 +38,352 @@ def get_thumbnail_from_contents(contents: bytes, output_file: str = None): with NamedTemporaryFile("rb+", suffix=".heic") as inp_file: inp_file.write(contents) contents = get_thumbnail_from_mov(inp_file, output_file) - return contents \ No newline at end of file + return contents + +def create_caml(video_path: str, output_file: str): + cam = cv2.VideoCapture(video_path) + assets_path = os.path.join(output_file, "assets") + try: + # creating a folder named data + if not os.path.exists(assets_path): + os.makedirs(assets_path) + # if not created then raise error + except OSError: + print ('Error: Creating directory of data') + + # frame + currentframe = 0 + width = int(cam.get(cv2.CAP_PROP_FRAME_WIDTH)) + height = int(cam.get(cv2.CAP_PROP_FRAME_HEIGHT)) + + with open(os.path.join(output_file, "main.caml"), "w") as caml: + # write caml header + fps = cam.get(cv2.CAP_PROP_FPS) + frame_count = int(cam.get(cv2.CAP_PROP_FRAME_COUNT)) + duration = frame_count / fps + caml.write(f""" + + + + +""") + + # Release all space and windows once done + cam.release() + cv2.destroyAllWindows() + + # Write the other caml + with open(os.path.join(output_file, "index.xml"), "w") as index: + index.write(f""" + + + + assetManifest + assetManifest.caml + documentHeight + {height} + documentResizesToView + + documentWidth + {width} + dynamicGuidesEnabled + + geometryFlipped + + guidesEnabled + + interactiveMouseEventsEnabled + + interactiveShowsCursor + + interactiveTouchEventsEnabled + + loopEnd + 0.0 + loopStart + 0.0 + loopingEnabled + + multitouchDisablesMouse + + multitouchEnabled + + presentationMouseEventsEnabled + + presentationShowsCursor + + presentationTouchEventsEnabled + + rootDocument + main.caml + savesWindowFrame + + scalesToFitInPlayer + + showsTouches + + snappingEnabled + + timelineMarkers + [(null)] + touchesColor + 1 1 0 0.8 + unitsInPixelsInPlayer + + + +""") \ No newline at end of file diff --git a/files/posterboard/VideoCAML/com.apple.posterkit.provider.descriptor.identifier b/files/posterboard/VideoCAML/com.apple.posterkit.provider.descriptor.identifier new file mode 100644 index 0000000..5018e06 --- /dev/null +++ b/files/posterboard/VideoCAML/com.apple.posterkit.provider.descriptor.identifier @@ -0,0 +1 @@ +9183 \ No newline at end of file diff --git a/files/posterboard/VideoCAML/com.apple.posterkit.role.identifier b/files/posterboard/VideoCAML/com.apple.posterkit.role.identifier new file mode 100644 index 0000000..b92284b --- /dev/null +++ b/files/posterboard/VideoCAML/com.apple.posterkit.role.identifier @@ -0,0 +1 @@ +PRPosterRoleLockScreen \ No newline at end of file diff --git a/files/posterboard/VideoCAML/providerInfo.plist b/files/posterboard/VideoCAML/providerInfo.plist new file mode 100644 index 0000000..81447ad Binary files /dev/null and b/files/posterboard/VideoCAML/providerInfo.plist differ diff --git a/files/posterboard/VideoCAML/versions/1/SNAPSHOT_GALLERY-dC(b[{{0, 0}, {393, 852}}]-s[3.000000]-o[1]-ui[1]-ax[0]-s[0])-cP(36eb0c56074f4bb66b76944a2fbdf84b0e8a1f0e51e39413b563fc3ed5db6b0a).atx b/files/posterboard/VideoCAML/versions/1/SNAPSHOT_GALLERY-dC(b[{{0, 0}, {393, 852}}]-s[3.000000]-o[1]-ui[1]-ax[0]-s[0])-cP(36eb0c56074f4bb66b76944a2fbdf84b0e8a1f0e51e39413b563fc3ed5db6b0a).atx new file mode 100644 index 0000000..826d80b Binary files /dev/null and b/files/posterboard/VideoCAML/versions/1/SNAPSHOT_GALLERY-dC(b[{{0, 0}, {393, 852}}]-s[3.000000]-o[1]-ui[1]-ax[0]-s[0])-cP(36eb0c56074f4bb66b76944a2fbdf84b0e8a1f0e51e39413b563fc3ed5db6b0a).atx differ diff --git a/files/posterboard/VideoCAML/versions/1/SNAPSHOT_GALLERY-dC(b[{{0, 0}, {393, 852}}]-s[3.000000]-o[1]-ui[2]-ax[0]-s[0])-cP(36eb0c56074f4bb66b76944a2fbdf84b0e8a1f0e51e39413b563fc3ed5db6b0a).atx b/files/posterboard/VideoCAML/versions/1/SNAPSHOT_GALLERY-dC(b[{{0, 0}, {393, 852}}]-s[3.000000]-o[1]-ui[2]-ax[0]-s[0])-cP(36eb0c56074f4bb66b76944a2fbdf84b0e8a1f0e51e39413b563fc3ed5db6b0a).atx new file mode 100644 index 0000000..d2b002a Binary files /dev/null and b/files/posterboard/VideoCAML/versions/1/SNAPSHOT_GALLERY-dC(b[{{0, 0}, {393, 852}}]-s[3.000000]-o[1]-ui[2]-ax[0]-s[0])-cP(36eb0c56074f4bb66b76944a2fbdf84b0e8a1f0e51e39413b563fc3ed5db6b0a).atx differ diff --git a/files/posterboard/VideoCAML/versions/1/contents/9183.Custom-810w-1080h@2x~ipad.wallpaper/9183.Custom_Background-810w-1080h@2x~ipad.ca/index.xml b/files/posterboard/VideoCAML/versions/1/contents/9183.Custom-810w-1080h@2x~ipad.wallpaper/9183.Custom_Background-810w-1080h@2x~ipad.ca/index.xml new file mode 100644 index 0000000..5fa23a9 --- /dev/null +++ b/files/posterboard/VideoCAML/versions/1/contents/9183.Custom-810w-1080h@2x~ipad.wallpaper/9183.Custom_Background-810w-1080h@2x~ipad.ca/index.xml @@ -0,0 +1,58 @@ + + + + + assetManifest + assetManifest.caml + documentHeight + 3176 + documentResizesToView + + documentWidth + 3176 + dynamicGuidesEnabled + + geometryFlipped + + guidesEnabled + + interactiveMouseEventsEnabled + + interactiveShowsCursor + + interactiveTouchEventsEnabled + + loopEnd + 0.0 + loopStart + 0.0 + loopingEnabled + + multitouchDisablesMouse + + multitouchEnabled + + presentationMouseEventsEnabled + + presentationShowsCursor + + presentationTouchEventsEnabled + + rootDocument + main.caml + savesWindowFrame + + scalesToFitInPlayer + + showsTouches + + snappingEnabled + + timelineMarkers + [(null)] + touchesColor + 1 1 0 0.8 + unitsInPixelsInPlayer + + + diff --git a/files/posterboard/VideoCAML/versions/1/contents/9183.Custom-810w-1080h@2x~ipad.wallpaper/9183.Custom_Background-810w-1080h@2x~ipad.ca/main.caml b/files/posterboard/VideoCAML/versions/1/contents/9183.Custom-810w-1080h@2x~ipad.wallpaper/9183.Custom_Background-810w-1080h@2x~ipad.ca/main.caml new file mode 100644 index 0000000..eff7d7d --- /dev/null +++ b/files/posterboard/VideoCAML/versions/1/contents/9183.Custom-810w-1080h@2x~ipad.wallpaper/9183.Custom_Background-810w-1080h@2x~ipad.ca/main.caml @@ -0,0 +1,480 @@ + + + + + diff --git a/files/posterboard/VideoCAML/versions/1/contents/9183.Custom-810w-1080h@2x~ipad.wallpaper/9183.Custom_Floating-810w-1080h@2x~ipad.ca/assetManifest.caml b/files/posterboard/VideoCAML/versions/1/contents/9183.Custom-810w-1080h@2x~ipad.wallpaper/9183.Custom_Floating-810w-1080h@2x~ipad.ca/assetManifest.caml new file mode 100644 index 0000000..0c1203c --- /dev/null +++ b/files/posterboard/VideoCAML/versions/1/contents/9183.Custom-810w-1080h@2x~ipad.wallpaper/9183.Custom_Floating-810w-1080h@2x~ipad.ca/assetManifest.caml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/files/posterboard/VideoCAML/versions/1/contents/9183.Custom-810w-1080h@2x~ipad.wallpaper/Wallpaper.plist b/files/posterboard/VideoCAML/versions/1/contents/9183.Custom-810w-1080h@2x~ipad.wallpaper/Wallpaper.plist new file mode 100644 index 0000000..54f1f1b --- /dev/null +++ b/files/posterboard/VideoCAML/versions/1/contents/9183.Custom-810w-1080h@2x~ipad.wallpaper/Wallpaper.plist @@ -0,0 +1,46 @@ + + + + + appearanceAware + + assets + + lockAndHome + + default + + backgroundAnimationFileName + 9183.Custom_Background-810w-1080h@2x~ipad.ca + floatingAnimationFileNameKey + 9183.Custom_Floating-810w-1080h@2x~ipad.ca + identifier + 9183 + name + Chip + type + LayeredAnimation + + + + contentVersion + 2.01 + family + Chip + identifier + 9183 + logicalScreenClass + 810w-1080h@2x~ipad + name + Chip + preferredProminentColor + + dark + #00000 + default + #FFFFFF + + version + 1 + + diff --git a/files/posterboard/VideoCAML/versions/1/contents/com.apple.posterkit.provider.contents.userInfo b/files/posterboard/VideoCAML/versions/1/contents/com.apple.posterkit.provider.contents.userInfo new file mode 100644 index 0000000..f94f23a --- /dev/null +++ b/files/posterboard/VideoCAML/versions/1/contents/com.apple.posterkit.provider.contents.userInfo @@ -0,0 +1,14 @@ + + + + + posterEnvironmentOverrides + + e30= + + wallpaperRepresentingFileName + 9183.Custom-810w-1080h@2x~ipad.wallpaper + wallpaperRepresentingIdentifier + 9999 + + diff --git a/gui/main_window.py b/gui/main_window.py index d4b0a3a..05ece30 100644 --- a/gui/main_window.py +++ b/gui/main_window.py @@ -172,6 +172,7 @@ class MainWindow(QtWidgets.QMainWindow): self.ui.chooseThumbBtn.clicked.connect(self.on_chooseThumbBtn_clicked) self.ui.chooseVideoBtn.clicked.connect(self.on_chooseVideoBtn_clicked) self.ui.clearSuggestedBtn.clicked.connect(self.on_clearSuggestedBtn_clicked) + self.ui.caVideoChk.toggled.connect(self.on_caVideoChk_toggled) self.ui.findPBBtn.clicked.connect(self.on_findPBBtn_clicked) self.ui.pbHelpBtn.clicked.connect(self.on_pbHelpBtn_clicked) @@ -1005,6 +1006,8 @@ class MainWindow(QtWidgets.QMainWindow): tweaks["PosterBoard"].resetType = 2 self.ui.pbActionLbl.setText("! Clearing Suggested Photos") self.ui.pbActionLbl.show() + def on_caVideoChk_toggled(self, checked: bool): + tweaks["PosterBoard"].loop_video = checked def on_findPBBtn_clicked(self): webbrowser.open_new_tab("https://cowabun.ga/wallpapers") diff --git a/qt/mainwindow.ui b/qt/mainwindow.ui index a3f6667..4db3808 100644 --- a/qt/mainwindow.ui +++ b/qt/mainwindow.ui @@ -4275,9 +4275,21 @@ To work properly, also disable the daemon using the toggle above. 0 - 30 + 20 + + + 16777215 + 25 + + + + QToolButton { + min-height: 25px; + border-radius: 5px; +} + 0 @@ -4309,14 +4321,14 @@ To work properly, also disable the daemon using the toggle above. 0 - 35 + 25 Tendies - + :/icon/file-earmark-zip.svg:/icon/file-earmark-zip.svg @@ -4332,11 +4344,17 @@ To work properly, also disable the daemon using the toggle above. + + + 0 + 25 + + Live - + :/icon/photo.svg:/icon/photo.svg @@ -4381,6 +4399,13 @@ To work properly, also disable the daemon using the toggle above. 0 + + + + None + + + @@ -4406,7 +4431,7 @@ To work properly, also disable the daemon using the toggle above. Import Files (.tendies) - + :/icon/import.svg:/icon/import.svg @@ -4422,13 +4447,6 @@ To work properly, also disable the daemon using the toggle above. - - - - None - - - @@ -4487,7 +4505,7 @@ To work properly, also disable the daemon using the toggle above. Clear Collections Wallpapers - + :/icon/arrow.clockwise.svg:/icon/arrow.clockwise.svg @@ -4506,7 +4524,7 @@ Warning: This will remove all of your wallpapers and will restrict you from addi Remove All Wallpapers - + :/icon/arrow.clockwise.svg:/icon/arrow.clockwise.svg @@ -4569,7 +4587,7 @@ Warning: This will remove all of your wallpapers and will restrict you from addi Clear Suggested Photos - + :/icon/arrow.clockwise.svg:/icon/arrow.clockwise.svg @@ -4592,6 +4610,13 @@ Warning: This will remove all of your wallpapers and will restrict you from addi + + + + Loop (use CoreAnimation method) + + + diff --git a/qt/mainwindow_ui.py b/qt/mainwindow_ui.py index 10bba44..747eb6c 100644 --- a/qt/mainwindow_ui.py +++ b/qt/mainwindow_ui.py @@ -2250,7 +2250,12 @@ class Ui_Nugget(object): sizePolicy5.setVerticalStretch(0) sizePolicy5.setHeightForWidth(self.pbPagePicker.sizePolicy().hasHeightForWidth()) self.pbPagePicker.setSizePolicy(sizePolicy5) - self.pbPagePicker.setMinimumSize(QSize(0, 30)) + self.pbPagePicker.setMinimumSize(QSize(0, 20)) + self.pbPagePicker.setMaximumSize(QSize(16777215, 25)) + self.pbPagePicker.setStyleSheet(u"QToolButton {\n" +" min-height: 25px;\n" +" border-radius: 5px;\n" +"}") self.horizontalLayout_14 = QHBoxLayout(self.pbPagePicker) self.horizontalLayout_14.setObjectName(u"horizontalLayout_14") self.horizontalLayout_14.setContentsMargins(-1, 0, -1, 0) @@ -2265,7 +2270,7 @@ class Ui_Nugget(object): sizePolicy6.setVerticalStretch(0) sizePolicy6.setHeightForWidth(self.tendiesPageBtn.sizePolicy().hasHeightForWidth()) self.tendiesPageBtn.setSizePolicy(sizePolicy6) - self.tendiesPageBtn.setMinimumSize(QSize(0, 35)) + self.tendiesPageBtn.setMinimumSize(QSize(0, 25)) icon22 = QIcon() icon22.addFile(u":/icon/file-earmark-zip.svg", QSize(), QIcon.Mode.Normal, QIcon.State.Off) self.tendiesPageBtn.setIcon(icon22) @@ -2277,6 +2282,7 @@ class Ui_Nugget(object): self.videoPageBtn = QToolButton(self.pbPagePicker) self.videoPageBtn.setObjectName(u"videoPageBtn") + self.videoPageBtn.setMinimumSize(QSize(0, 25)) icon23 = QIcon() icon23.addFile(u":/icon/photo.svg", QSize(), QIcon.Mode.Normal, QIcon.State.Off) self.videoPageBtn.setIcon(icon23) @@ -2303,6 +2309,11 @@ class Ui_Nugget(object): self.horizontalLayout_12 = QHBoxLayout() self.horizontalLayout_12.setObjectName(u"horizontalLayout_12") self.horizontalLayout_12.setContentsMargins(-1, -1, -1, 0) + self.pbActionLbl = QLabel(self.pbTendiesPage) + self.pbActionLbl.setObjectName(u"pbActionLbl") + + self.horizontalLayout_12.addWidget(self.pbActionLbl) + self.horizontalSpacer_18 = QSpacerItem(40, 20, QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Minimum) self.horizontalLayout_12.addItem(self.horizontalSpacer_18) @@ -2321,11 +2332,6 @@ class Ui_Nugget(object): self.verticalLayout_38.addLayout(self.horizontalLayout_12) - self.pbActionLbl = QLabel(self.pbTendiesPage) - self.pbActionLbl.setObjectName(u"pbActionLbl") - - self.verticalLayout_38.addWidget(self.pbActionLbl) - self.line_27 = QFrame(self.pbTendiesPage) self.line_27.setObjectName(u"line_27") self.line_27.setStyleSheet(u"QFrame {\n" @@ -2418,6 +2424,11 @@ class Ui_Nugget(object): self.verticalLayout_39.addLayout(self.horizontalLayout_30) + self.caVideoChk = QCheckBox(self.pbVideoPage) + self.caVideoChk.setObjectName(u"caVideoChk") + + self.verticalLayout_39.addWidget(self.caVideoChk) + self.verticalSpacer_22 = QSpacerItem(20, 40, QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Expanding) self.verticalLayout_39.addItem(self.verticalSpacer_22) @@ -3782,11 +3793,11 @@ class Ui_Nugget(object): self.pbHelpBtn.setText(QCoreApplication.translate("Nugget", u"...", None)) self.tendiesPageBtn.setText(QCoreApplication.translate("Nugget", u" Tendies", None)) self.videoPageBtn.setText(QCoreApplication.translate("Nugget", u" Live", None)) + self.pbActionLbl.setText(QCoreApplication.translate("Nugget", u"None", None)) #if QT_CONFIG(tooltip) self.importTendiesBtn.setToolTip(QCoreApplication.translate("Nugget", u"Select a wallpaper file with the .tendies extension.", None)) #endif // QT_CONFIG(tooltip) self.importTendiesBtn.setText(QCoreApplication.translate("Nugget", u" Import Files (.tendies)", None)) - self.pbActionLbl.setText(QCoreApplication.translate("Nugget", u"None", None)) #if QT_CONFIG(tooltip) self.deleteAllDescriptorsBtn.setToolTip(QCoreApplication.translate("Nugget", u"Clears all the wallpapers in the Collections section so that you can import more.", None)) #endif // QT_CONFIG(tooltip) @@ -3802,6 +3813,7 @@ class Ui_Nugget(object): self.chooseThumbBtn.setText(QCoreApplication.translate("Nugget", u"Choose Thumbnail (.HEIC)", None)) self.chooseVideoBtn.setText(QCoreApplication.translate("Nugget", u"Choose Video (.MOV)", None)) self.clearSuggestedBtn.setText(QCoreApplication.translate("Nugget", u" Clear Suggested Photos", None)) + self.caVideoChk.setText(QCoreApplication.translate("Nugget", u"Loop (use CoreAnimation method)", None)) self.advancedOptionsLbl.setText(QCoreApplication.translate("Nugget", u"Risky Options", None)) self.label_17.setText(QCoreApplication.translate("Nugget", u"Disclaimer:\n" "\n" diff --git a/qt/ui_mainwindow.py b/qt/ui_mainwindow.py index 2e88e08..fca72ae 100644 --- a/qt/ui_mainwindow.py +++ b/qt/ui_mainwindow.py @@ -2250,7 +2250,12 @@ class Ui_Nugget(object): sizePolicy5.setVerticalStretch(0) sizePolicy5.setHeightForWidth(self.pbPagePicker.sizePolicy().hasHeightForWidth()) self.pbPagePicker.setSizePolicy(sizePolicy5) - self.pbPagePicker.setMinimumSize(QSize(0, 30)) + self.pbPagePicker.setMinimumSize(QSize(0, 20)) + self.pbPagePicker.setMaximumSize(QSize(16777215, 25)) + self.pbPagePicker.setStyleSheet(u"QToolButton {\n" +" min-height: 25px;\n" +" border-radius: 5px;\n" +"}") self.horizontalLayout_14 = QHBoxLayout(self.pbPagePicker) self.horizontalLayout_14.setObjectName(u"horizontalLayout_14") self.horizontalLayout_14.setContentsMargins(-1, 0, -1, 0) @@ -2265,7 +2270,7 @@ class Ui_Nugget(object): sizePolicy6.setVerticalStretch(0) sizePolicy6.setHeightForWidth(self.tendiesPageBtn.sizePolicy().hasHeightForWidth()) self.tendiesPageBtn.setSizePolicy(sizePolicy6) - self.tendiesPageBtn.setMinimumSize(QSize(0, 35)) + self.tendiesPageBtn.setMinimumSize(QSize(0, 25)) icon22 = QIcon() icon22.addFile(u":/icon/file-earmark-zip.svg", QSize(), QIcon.Normal, QIcon.Off) self.tendiesPageBtn.setIcon(icon22) @@ -2277,6 +2282,7 @@ class Ui_Nugget(object): self.videoPageBtn = QToolButton(self.pbPagePicker) self.videoPageBtn.setObjectName(u"videoPageBtn") + self.videoPageBtn.setMinimumSize(QSize(0, 25)) icon23 = QIcon() icon23.addFile(u":/icon/photo.svg", QSize(), QIcon.Normal, QIcon.Off) self.videoPageBtn.setIcon(icon23) @@ -2303,6 +2309,11 @@ class Ui_Nugget(object): self.horizontalLayout_12 = QHBoxLayout() self.horizontalLayout_12.setObjectName(u"horizontalLayout_12") self.horizontalLayout_12.setContentsMargins(-1, -1, -1, 0) + self.pbActionLbl = QLabel(self.pbTendiesPage) + self.pbActionLbl.setObjectName(u"pbActionLbl") + + self.horizontalLayout_12.addWidget(self.pbActionLbl) + self.horizontalSpacer_18 = QSpacerItem(40, 20, QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Minimum) self.horizontalLayout_12.addItem(self.horizontalSpacer_18) @@ -2321,11 +2332,6 @@ class Ui_Nugget(object): self.verticalLayout_38.addLayout(self.horizontalLayout_12) - self.pbActionLbl = QLabel(self.pbTendiesPage) - self.pbActionLbl.setObjectName(u"pbActionLbl") - - self.verticalLayout_38.addWidget(self.pbActionLbl) - self.line_27 = QFrame(self.pbTendiesPage) self.line_27.setObjectName(u"line_27") self.line_27.setStyleSheet(u"QFrame {\n" @@ -2418,6 +2424,11 @@ class Ui_Nugget(object): self.verticalLayout_39.addLayout(self.horizontalLayout_30) + self.caVideoChk = QCheckBox(self.pbVideoPage) + self.caVideoChk.setObjectName(u"caVideoChk") + + self.verticalLayout_39.addWidget(self.caVideoChk) + self.verticalSpacer_22 = QSpacerItem(20, 40, QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Expanding) self.verticalLayout_39.addItem(self.verticalSpacer_22) @@ -3782,11 +3793,11 @@ class Ui_Nugget(object): self.pbHelpBtn.setText(QCoreApplication.translate("Nugget", u"...", None)) self.tendiesPageBtn.setText(QCoreApplication.translate("Nugget", u" Tendies", None)) self.videoPageBtn.setText(QCoreApplication.translate("Nugget", u" Live", None)) + self.pbActionLbl.setText(QCoreApplication.translate("Nugget", u"None", None)) #if QT_CONFIG(tooltip) self.importTendiesBtn.setToolTip(QCoreApplication.translate("Nugget", u"Select a wallpaper file with the .tendies extension.", None)) #endif // QT_CONFIG(tooltip) self.importTendiesBtn.setText(QCoreApplication.translate("Nugget", u" Import Files (.tendies)", None)) - self.pbActionLbl.setText(QCoreApplication.translate("Nugget", u"None", None)) #if QT_CONFIG(tooltip) self.deleteAllDescriptorsBtn.setToolTip(QCoreApplication.translate("Nugget", u"Clears all the wallpapers in the Collections section so that you can import more.", None)) #endif // QT_CONFIG(tooltip) @@ -3802,6 +3813,7 @@ class Ui_Nugget(object): self.chooseThumbBtn.setText(QCoreApplication.translate("Nugget", u"Choose Thumbnail (.HEIC)", None)) self.chooseVideoBtn.setText(QCoreApplication.translate("Nugget", u"Choose Video (.MOV)", None)) self.clearSuggestedBtn.setText(QCoreApplication.translate("Nugget", u" Clear Suggested Photos", None)) + self.caVideoChk.setText(QCoreApplication.translate("Nugget", u"Loop (use CoreAnimation method)", None)) self.advancedOptionsLbl.setText(QCoreApplication.translate("Nugget", u"Risky Options", None)) self.label_17.setText(QCoreApplication.translate("Nugget", u"Disclaimer:\n" "\n" diff --git a/tweaks/posterboard_tweak.py b/tweaks/posterboard_tweak.py index 20a25dc..7db0913 100644 --- a/tweaks/posterboard_tweak.py +++ b/tweaks/posterboard_tweak.py @@ -66,6 +66,7 @@ class PosterboardTweak(Tweak): self.tendies: list[TendieFile] = [] self.videoThumbnail = None self.videoFile = None + self.loop_video = False self.bundle_id = "com.apple.PosterBoard" self.resetting = False self.resetType = 0 # 0 for descriptor, 1 for prb, 2 for suggested photos @@ -166,7 +167,7 @@ class PosterboardTweak(Tweak): self.recursive_add(files_to_restore, os.path.join(curr_path, folder), isAdding=False) def create_live_photo_files(self, output_dir: str): - if self.videoFile != None: + if self.videoFile != None and not self.loop_video: source_dir = get_bundle_files("files/posterboard/1F20C883-EA98-4CCE-9923-0C9A01359721") video_output_dir = os.path.join(output_dir, "video-descriptor/1F20C883-EA98-4CCE-9923-0C9A01359721") copytree(source_dir, video_output_dir, dirs_exist_ok=True) @@ -201,6 +202,16 @@ class PosterboardTweak(Tweak): with open(os.path.join(contents_path, file), "wb") as overriding: overriding.write(thumb_contents) del thumb_contents + + def create_video_loop_files(self, output_dir: str): + print(f"file: {self.videoFile}, looping: {self.loop_video}") + if self.videoFile and self.loop_video: + 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_Floating-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) @@ -227,12 +238,13 @@ class PosterboardTweak(Tweak): domain=f"AppDomain-{self.bundle_id}" )) return - elif (self.tendies == None or len(self.tendies) == 0) and (self.videoThumbnail == None or self.videoThumbnail == None): + elif (self.tendies == None or len(self.tendies) == 0) and (self.videoFile == None): return if os.name == "nt" and windows_path_fix: # try to get past directory name limit on windows output_dir = "\\\\?\\" + output_dir self.create_live_photo_files(output_dir) + self.create_video_loop_files(output_dir) for tendie in self.tendies: zip_output = os.path.join(output_dir, str(uuid.uuid4())) os.makedirs(zip_output)