Skip to content

Commit

Permalink
Added forceFullSearch setting
Browse files Browse the repository at this point in the history
  • Loading branch information
Inrixia committed Apr 6, 2022
1 parent 740d159 commit 4e4b03a
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/float.ts
Expand Up @@ -18,7 +18,11 @@ const fetchNewVideos = async (subscriptions: Array<Subscription>, videoProcessor
for (const subscription of subscriptions) {
await subscription.deleteOldVideos();
console.log();
await Promise.all(videoProcessor.processVideos(await subscription.fetchNewVideos(settings.floatplane.videosToSearch, settings.extras.stripSubchannelPrefix)));
await Promise.all(
videoProcessor.processVideos(
await subscription.fetchNewVideos(settings.floatplane.videosToSearch, settings.extras.stripSubchannelPrefix, settings.floatplane.forceFullSearch)
)
);
}

if (settings.plex.enabled) {
Expand Down
4 changes: 2 additions & 2 deletions src/lib/Subscription.ts
Expand Up @@ -81,15 +81,15 @@ export default class Subscription {
return this.defaultChannel.addVideo(video);
}

public async fetchNewVideos(videosToSearch = 20, stripSubchannelPrefix: boolean): Promise<Array<Video>> {
public async fetchNewVideos(videosToSearch = 20, stripSubchannelPrefix: boolean, forceFullSearch: boolean): Promise<Array<Video>> {
const coloredTitle = `${this.defaultChannel.consoleColor || '\u001b[38;5;208m'}${this.defaultChannel.title}\u001b[0m`;

const videos = [];

process.stdout.write(`> Fetching latest videos from [${coloredTitle}]... Fetched ${videos.length} videos!`);

for await (const video of fApi.creator.blogPostsIterable(this.creatorId, { type: 'video' })) {
if (video.guid === this.lastSeenVideo.guid) {
if (!forceFullSearch && video.guid === this.lastSeenVideo.guid) {
// If we have found the last seen video, check if its downloaded.
// If it is then break here and return the videos we have found.
// Otherwise continue to fetch new videos up to the videosToSearch limit to ensure partially or non downloaded videos are returned.
Expand Down
1 change: 1 addition & 0 deletions src/lib/defaults.ts
Expand Up @@ -167,6 +167,7 @@ export const defaultSettings: Settings = {
downloadThreads: -1,
floatplane: {
videosToSearch: 5,
forceFullSearch: false,
videoResolution: '1080',
waitForNewVideos: true,
_availableResolutions: defaultResolutions,
Expand Down
1 change: 1 addition & 0 deletions src/lib/types.ts
Expand Up @@ -73,6 +73,7 @@ export type Settings = {
floatplane: {
videoResolution: Resolution;
videosToSearch: number;
forceFullSearch: boolean;
waitForNewVideos: boolean;
_availableResolutions: Resolutions;
downloadEdge: string;
Expand Down
11 changes: 11 additions & 0 deletions wiki/settings.md
Expand Up @@ -39,6 +39,17 @@ Number of videos to search through when looking for undownloaded videos **per su

<br>

**floatplane.forceFullSearch**:<br>
Force the downloader to search the full `videosToSearch` regardless of what has been downloaded. Note: Will not result in downloaded videos being redownloaded.<br>

```json
"floatplane": {
"forceFullSearch": true
}
```

<br>

**floatplane.videoResolution**:<br>
Resolution to download the videos in. See `_availableResolutions` for options.<br>

Expand Down

0 comments on commit 4e4b03a

Please sign in to comment.