Improves handling of cover images
All checks were successful
KnarCraft/FFmpegConvert/pipeline/head This commit looks good
All checks were successful
KnarCraft/FFmpegConvert/pipeline/head This commit looks good
This commit is contained in:
parent
c0249c3b3a
commit
2145bfb8ea
@ -57,6 +57,11 @@ public class ConfigKey<T> {
|
|||||||
*/
|
*/
|
||||||
public static final ConfigKey<Boolean> DE_INTERLACE_VIDEO = createKey("de-interlace-video", Boolean.class, false);
|
public static final ConfigKey<Boolean> DE_INTERLACE_VIDEO = createKey("de-interlace-video", Boolean.class, false);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The configuration key for whether to copy attached cover images
|
||||||
|
*/
|
||||||
|
public static final ConfigKey<Boolean> COPY_ATTACHED_IMAGES = createKey("copy-attached-images", Boolean.class, false);
|
||||||
|
|
||||||
private final String configKey;
|
private final String configKey;
|
||||||
private final T defaultValue;
|
private final T defaultValue;
|
||||||
private final Class<T> type;
|
private final Class<T> type;
|
||||||
|
@ -22,6 +22,7 @@ public class Configuration {
|
|||||||
private List<String> animeSubtitleLanguages;
|
private List<String> animeSubtitleLanguages;
|
||||||
private MinimalSubtitlePreference minimalSubtitlePreference;
|
private MinimalSubtitlePreference minimalSubtitlePreference;
|
||||||
private boolean deInterlaceVideo;
|
private boolean deInterlaceVideo;
|
||||||
|
private boolean copyAttachedImages;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates and loads a new configuration
|
* Instantiates and loads a new configuration
|
||||||
@ -55,6 +56,7 @@ public class Configuration {
|
|||||||
animeAudioLanguages = ConfigHelper.asStringList(configHandler.getValue(ConfigKey.AUDIO_LANGUAGES_ANIME));
|
animeAudioLanguages = ConfigHelper.asStringList(configHandler.getValue(ConfigKey.AUDIO_LANGUAGES_ANIME));
|
||||||
animeSubtitleLanguages = ConfigHelper.asStringList(configHandler.getValue(ConfigKey.SUBTITLE_LANGUAGES_ANIME));
|
animeSubtitleLanguages = ConfigHelper.asStringList(configHandler.getValue(ConfigKey.SUBTITLE_LANGUAGES_ANIME));
|
||||||
deInterlaceVideo = ConfigHelper.asBoolean(configHandler.getValue(ConfigKey.DE_INTERLACE_VIDEO));
|
deInterlaceVideo = ConfigHelper.asBoolean(configHandler.getValue(ConfigKey.DE_INTERLACE_VIDEO));
|
||||||
|
copyAttachedImages = ConfigHelper.asBoolean(configHandler.getValue(ConfigKey.COPY_ATTACHED_IMAGES));
|
||||||
try {
|
try {
|
||||||
minimalSubtitlePreference = MinimalSubtitlePreference.valueOf(String.valueOf(configHandler.getValue(
|
minimalSubtitlePreference = MinimalSubtitlePreference.valueOf(String.valueOf(configHandler.getValue(
|
||||||
ConfigKey.MINIMAL_SUBTITLE_PREFERENCE)));
|
ConfigKey.MINIMAL_SUBTITLE_PREFERENCE)));
|
||||||
@ -158,4 +160,15 @@ public class Configuration {
|
|||||||
return this.deInterlaceVideo;
|
return this.deInterlaceVideo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets whether attached images should be copied
|
||||||
|
*
|
||||||
|
* <p>FFMpeg sometimes throws errors when including attached images.</p>
|
||||||
|
*
|
||||||
|
* @return <p>True if attached images should be copied</p>
|
||||||
|
*/
|
||||||
|
public boolean copyAttachedImages() {
|
||||||
|
return this.copyAttachedImages;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package net.knarcraft.ffmpegconverter.utility;
|
package net.knarcraft.ffmpegconverter.utility;
|
||||||
|
|
||||||
|
import net.knarcraft.ffmpegconverter.FFMpegConvert;
|
||||||
import net.knarcraft.ffmpegconverter.container.FFMpegCommand;
|
import net.knarcraft.ffmpegconverter.container.FFMpegCommand;
|
||||||
import net.knarcraft.ffmpegconverter.container.ProcessResult;
|
import net.knarcraft.ffmpegconverter.container.ProcessResult;
|
||||||
import net.knarcraft.ffmpegconverter.container.StreamProbeResult;
|
import net.knarcraft.ffmpegconverter.container.StreamProbeResult;
|
||||||
@ -313,7 +314,11 @@ public final class FFMpegHelper {
|
|||||||
case AUDIO -> parsedStreams.add(new AudioStream(streamInfo, 0, relativeAudioIndex++));
|
case AUDIO -> parsedStreams.add(new AudioStream(streamInfo, 0, relativeAudioIndex++));
|
||||||
case SUBTITLE -> parsedStreams.add(new SubtitleStream(streamInfo, 0, relativeSubtitleIndex++));
|
case SUBTITLE -> parsedStreams.add(new SubtitleStream(streamInfo, 0, relativeSubtitleIndex++));
|
||||||
case OTHER -> parsedStreams.add(new OtherStream(streamInfo, 0, false));
|
case OTHER -> parsedStreams.add(new OtherStream(streamInfo, 0, false));
|
||||||
case COVER_IMAGE -> parsedStreams.add(new OtherStream(streamInfo, 0, true));
|
case COVER_IMAGE -> {
|
||||||
|
if (FFMpegConvert.getConfiguration().copyAttachedImages()) {
|
||||||
|
parsedStreams.add(new OtherStream(streamInfo, 0, true));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return parsedStreams;
|
return parsedStreams;
|
||||||
|
@ -36,4 +36,5 @@ wav
|
|||||||
wma
|
wma
|
||||||
wv
|
wv
|
||||||
webm
|
webm
|
||||||
8svx
|
8svx
|
||||||
|
mka
|
@ -17,4 +17,6 @@ subtitle-languages-anime=eng,*
|
|||||||
# The preference for minimal subtitles, AKA Signs & Songs (REQUIRE/PREFER/NO_PREFERENCE/AVOID/REJECT)
|
# The preference for minimal subtitles, AKA Signs & Songs (REQUIRE/PREFER/NO_PREFERENCE/AVOID/REJECT)
|
||||||
minimal-subtitle-preference=AVOID
|
minimal-subtitle-preference=AVOID
|
||||||
# The preference for whether video streams should be de-interlaced. It is recommended to only enable this when you notice that a video file is interlaced.
|
# The preference for whether video streams should be de-interlaced. It is recommended to only enable this when you notice that a video file is interlaced.
|
||||||
de-interlace-video=false
|
de-interlace-video=false
|
||||||
|
# Whether to copy attached cover images. FFMpeg sometimes throws errors when including attached images.
|
||||||
|
copy-attached-images=false
|
Loading…
Reference in New Issue
Block a user