]> jfr.im git - yt-dlp.git/commitdiff
[sponskrub] Run before embedding thumbnail
authorpukkandan <redacted>
Thu, 1 Apr 2021 08:43:24 +0000 (14:13 +0530)
committerpukkandan <redacted>
Thu, 1 Apr 2021 08:43:24 +0000 (14:13 +0530)
Workaround for https://github.com/faissaloo/SponSkrub/issues/29
Closes https://github.com/yt-dlp/yt-dlp/issues/204

yt_dlp/__init__.py

index c58362698eb2e82773c6b81ab4574fccf30a63eb..bf728e6139dcb2f77e63e13199204dfe1d81e315 100644 (file)
@@ -368,15 +368,9 @@ def report_conflict(arg1, arg2):
     # this was the old behaviour if only --all-sub was given.
     if opts.allsubtitles and not opts.writeautomaticsub:
         opts.writesubtitles = True
     # this was the old behaviour if only --all-sub was given.
     if opts.allsubtitles and not opts.writeautomaticsub:
         opts.writesubtitles = True
-    if opts.embedthumbnail:
-        already_have_thumbnail = opts.writethumbnail or opts.write_all_thumbnails
-        postprocessors.append({
-            'key': 'EmbedThumbnail',
-            'already_have_thumbnail': already_have_thumbnail
-        })
-        if not already_have_thumbnail:
-            opts.writethumbnail = True
-    # This should be below most ffmpeg PP because it may cut parts out from the video
+    # This should be above EmbedThumbnail since sponskrub removes the thumbnail attachment
+    # but must be below EmbedSubtitle and FFmpegMetadata
+    # See https://github.com/yt-dlp/yt-dlp/issues/204 , https://github.com/faissaloo/SponSkrub/issues/29
     # If opts.sponskrub is None, sponskrub is used, but it silently fails if the executable can't be found
     if opts.sponskrub is not False:
         postprocessors.append({
     # If opts.sponskrub is None, sponskrub is used, but it silently fails if the executable can't be found
     if opts.sponskrub is not False:
         postprocessors.append({
@@ -387,6 +381,14 @@ def report_conflict(arg1, arg2):
             'force': opts.sponskrub_force,
             'ignoreerror': opts.sponskrub is None,
         })
             'force': opts.sponskrub_force,
             'ignoreerror': opts.sponskrub is None,
         })
+    if opts.embedthumbnail:
+        already_have_thumbnail = opts.writethumbnail or opts.write_all_thumbnails
+        postprocessors.append({
+            'key': 'EmbedThumbnail',
+            'already_have_thumbnail': already_have_thumbnail
+        })
+        if not already_have_thumbnail:
+            opts.writethumbnail = True
     if opts.split_chapters:
         postprocessors.append({'key': 'FFmpegSplitChapters'})
     # XAttrMetadataPP should be run after post-processors that may change file contents
     if opts.split_chapters:
         postprocessors.append({'key': 'FFmpegSplitChapters'})
     # XAttrMetadataPP should be run after post-processors that may change file contents