Skip to content

Commit

Permalink
Merge pull request #168 from mattkdoggie/dev
Browse files Browse the repository at this point in the history
Add identifiers for if a video was released before or after a specified time
  • Loading branch information
Inrixia authored Apr 20, 2023
2 parents feb1da8 + bb51e15 commit 0d1f455
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
7 changes: 7 additions & 0 deletions src/lib/Subscription.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 4 additions & 2 deletions wiki/settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.<br>
`check` is the string to look for.<br>
`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.<br>
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...<br>
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.<br>
<br>

For example:
Expand All @@ -260,6 +260,8 @@ For example:
"daysToKeepVideos": 5
}
```
<br>


This is a channel named "Floatplane Exclusive".<br>
Videos that have "FP Exclusive: " in their title will be sorted into this channel.<br>
Expand Down

0 comments on commit 0d1f455

Please sign in to comment.