diff --git a/src/lib/Subscription.ts b/src/lib/Subscription.ts index b6d06ca..10bdee6 100644 --- a/src/lib/Subscription.ts +++ b/src/lib/Subscription.ts @@ -74,6 +74,13 @@ export default class Subscription { if (channel.skip === true) return null; return channel.addVideo(video); } + if ( + (identifier.type === "releasedBefore" && video.releaseDate < identifier.check) || + (identifier.type === "releasedAfter" && video.releaseDate > identifier.check) + ) { + if (channel.skip === true) return null; + return channel.addVideo(video); + } // Description is named text on videos, kept description for ease of use for users but have to change it here... const identifierType = identifier.type === "description" ? "text" : identifier.type; diff --git a/src/lib/types.ts b/src/lib/types.ts index f600c72..bfacd61 100644 --- a/src/lib/types.ts +++ b/src/lib/types.ts @@ -5,7 +5,7 @@ import type { BlogPost } from "floatplane/creator"; type ChannelIdentifier = { check: string; - type: keyof BlogPost | "description" | "runtimeLessThan" | "runtimeGreaterThan" | "channelId"; + type: keyof BlogPost | "description" | "runtimeLessThan" | "runtimeGreaterThan" | "channelId" | "releasedBefore" | "releasedAfter"; }; export type ChannelOptions = { title: string; diff --git a/wiki/settings.md b/wiki/settings.md index 6d86aed..b35ec3b 100644 --- a/wiki/settings.md +++ b/wiki/settings.md @@ -241,8 +241,8 @@ A **channel** is made up of a `title`, `skip`, an array of `identifiers` and `co An Identifier contains two entries `check` and `type`.
`check` is the string to look for.
`type` is where in the video returned from the floatplane api to search for the check string. -This can be `description`, `title` etc any property that exists on the video. See [FloatplaneApiDocs/getBlogPost](https://jman012.github.io/FloatplaneAPIDocs/Redoc/redoc-static.html#operation/getBlogPost) for more info... -You can also use `runtimeLessThan` and `runtimeGreaterThan` to only match videos whos runtime is greated or lower than the specified value in seconds. This can be used with a generic skip channel to skip videos with a runtime greater or less than the desired amount.
+This can be `description`, `title` etc any property that exists on the video. See [FloatplaneApiDocs/getBlogPost](https://jman012.github.io/FloatplaneAPIDocs/Redoc/redoc-static.html#operation/getBlogPost) for more info...
+The identifiers `releasedAfter` and `releasedBefore` can also be used to match videos that were released before or after a specified date. You can also use `runtimeLessThan` and `runtimeGreaterThan` to only match videos whos runtime is greated or lower than the specified value in seconds. This can be used with a generic skip channel to skip videos with a runtime greater or less than the desired amount.

For example: @@ -260,6 +260,8 @@ For example: "daysToKeepVideos": 5 } ``` +
+ This is a channel named "Floatplane Exclusive".
Videos that have "FP Exclusive: " in their title will be sorted into this channel.