Implement isShortFormContent for StreamExtractor and StreamInfo

This commit is contained in:
chowder 2022-10-18 23:10:17 +01:00
parent 09544ceb23
commit 4cccd33f3d
2 changed files with 24 additions and 0 deletions

View file

@ -554,6 +554,16 @@ public abstract class StreamExtractor extends Extractor {
return Collections.emptyList(); return Collections.emptyList();
} }
/**
* Whether the stream is a short-form content. These are content in the style of TikTok,
* YouTube Shorts, or Instagram Reels videos.
*
* @return whether the stream is a short-form content
*/
public boolean isShortFormContent() throws ParsingException {
return false;
}
public enum Privacy { public enum Privacy {
PUBLIC, PUBLIC,
UNLISTED, UNLISTED,

View file

@ -342,6 +342,11 @@ public class StreamInfo extends Info {
} catch (final Exception e) { } catch (final Exception e) {
streamInfo.addError(e); streamInfo.addError(e);
} }
try {
streamInfo.setShortFormContent(extractor.isShortFormContent());
} catch (final Exception e) {
streamInfo.addError(e);
}
streamInfo.setRelatedItems(ExtractorHelper.getRelatedItemsOrLogError(streamInfo, streamInfo.setRelatedItems(ExtractorHelper.getRelatedItemsOrLogError(streamInfo,
extractor)); extractor));
@ -389,6 +394,7 @@ public class StreamInfo extends Info {
private List<String> tags = new ArrayList<>(); private List<String> tags = new ArrayList<>();
private List<StreamSegment> streamSegments = new ArrayList<>(); private List<StreamSegment> streamSegments = new ArrayList<>();
private List<MetaInfo> metaInfo = new ArrayList<>(); private List<MetaInfo> metaInfo = new ArrayList<>();
private boolean shortFormContent = false;
/** /**
* Preview frames, e.g. for the storyboard / seekbar thumbnail preview * Preview frames, e.g. for the storyboard / seekbar thumbnail preview
@ -724,4 +730,12 @@ public class StreamInfo extends Info {
public List<MetaInfo> getMetaInfo() { public List<MetaInfo> getMetaInfo() {
return this.metaInfo; return this.metaInfo;
} }
public boolean isShortFormContent() {
return shortFormContent;
}
public void setShortFormContent(final boolean isShortFormContent) {
this.shortFormContent = isShortFormContent;
}
} }