Inrixia / Floatplane-Downloader

Project for automatically organizing and downloading Floatplane videos for plex.
https://monitor.spookelton.net/public-dashboards/db0aec66747b4950b01b128916eb737e
GNU Affero General Public License v3.0
152 stars 41 forks source link

Help with downloading videos based on title. #189

Closed Catsrules closed 5 months ago

Catsrules commented 5 months ago

I am guessing this is just a simple error on my part but I can't not figure out how to filter videos based on the title.

This is for Level1Techs. They have a few series of videos that are all mixed in to their channel that I would like filter based on title and download under the series.

For example the have a monthly podcast, the title of it is "The Level1Techs Bonus Podcast: January 2024" I was released on the 31st.

I am trying to get the video to download under the "The Level1 Podcast" I have setup a keyword as "Podcast" and listed the type as title but it doesn't grab it.

Currently nothing gets downloaded using my filters. Any ideas what I am doing wrong?

Thanks

Attached is the section of settings.json that I am working on.

        "5d48c7be5fa46b731f1d5885": {
            "creatorId": "5d48c7be5fa46b731f1d5885",
            "plan": "Basic",
            "skip": false,
            "channels": [
                {
                    "title": "Level1Techs",
                    "skip": true,
                    "isChannel": "(post) => isChannel(post, '63fe42c409e691e4e36de943')"
                },
                {
                    "title": "Level 099",
                    "skip": false,
                    "identifiers": [
                        {
                            "check": "099 ",
                            "type": "title"
                        }
                    ],
                    "daysToKeepVideos": -1
                },
                {
                    "title": "The Level1 Podcast",
                    "skip": false,
                    "identifiers": [
                        {
                            "check": "Podcast",
                            "type": "title"
                        }
                    ],
                    "daysToKeepVideos": -1
                },
                {
                    "title": "The Level1 Show",
                    "skip": false,
                    "identifiers": [
                        {
                            "check": "Level1 Show",
                            "type": "title"
                        },
                        {
                            "check": "Level 1 Show: ",
                            "type": "title"
                        }
                    ],
                    "daysToKeepVideos": 120
                }
            ]
        }
Inrixia commented 5 months ago

Ah, yea sorry the format for matching had changed on the dev branch if you look at the first matcher.

You should use the format that one uses (the wiki hasn't been updated yet) where the isChannel property is a function which returns true if the video belongs to that channel.

If you need help with example code I will try and update the wiki properly tomorrow with examples of how to use the new format.

Inrixia commented 5 months ago

For example:

(post) => post.title.startsWith("caseSensitiveText")
Catsrules commented 5 months ago

Oh dang your fast on responding :)

So would the new format go under the identifiers? Something like this?

                {
                    "title": "The Level1 Podcast",
                    "skip": false,
                    "identifiers":  "(post) => post.title.startsWith('Podcast')",
                    "daysToKeepVideos": -1
                },
Inrixia commented 5 months ago

Nope, identifiers is no longer used. Have a look at the default channel for the new schema

Catsrules commented 5 months ago

Thanks for your help. I believe I got it mostly working.

One thing I couldn't get working is "The Level1 Podcast" channel couldn't find the videos using the term "podcast"

"isChannel": "(post) => post.title?.toLowerCase().includes('podcast')"

This is the title of one of the videos "The Level1Techs Bonus Podcast: January 2024"

I also tried "podcast:" that didn't work either.

I ended up changing it to "bonus"

"isChannel": "(post) => post.title?.toLowerCase().includes('bonus')"

And that worked. Very weird

But end the end this is the code the worked. (I haven't tested the Level 099 as they haven't made on of those in a very long time.)

        "5d48c7be5fa46b731f1d5885": {
            "creatorId": "5d48c7be5fa46b731f1d5885",
            "plan": "Basic",
            "skip": false,
            "channels": [
                {
                    "title": "Level1Techs",
                    "skip": true,
                    "isChannel": "(post) => isChannel(post, '63fe42c409e691e4e36de943')"
                },
                {
                    "title": "Level 099",
                    "skip": false,
                    "isChannel": "(post) => post.title?.toLowerCase().includes('099')"
                },
                {
                    "title": "The Level1 Podcast",
                    "skip": false,
                    "isChannel": "(post) => post.title?.toLowerCase().includes('bonus')"
                },
                {
                    "title": "The Level1 Show",
                    "skip": false,
                    "isChannel": "(post) => post.title?.toLowerCase().includes('level1 show')",
                    "daysToKeepVideos": 120
                }
            ]
        }
Inrixia commented 5 months ago

Hmm that is weird that the podcast keyword didn't work. One thing I should note, I'm not 100% sure if this has changed recently but afik custom channels should always be put at the top of the array.

Afik they are evaluated top to bottom with a first come first serve. Though considering what you gave works perhaps it's bottom to top, might be worth testing to see if that solves the podcasts thing.

Catsrules commented 5 months ago

Is this true even when the default channel is set to skip?

So your saying if I have a video with a title that contains multiple keyboards, it would only be sorted into one of the custom channels and not both channels?

For example if a title was "Level 099 bonus video". '099' and 'bonus' are both keywords in two different custom channels. You are thinking the video would get added to the Level 099 channel as that is before the "The Level1 Podcast in the array?

Inrixia commented 5 months ago

This is the code that handles it. If a channel is set to skip then it just continues down the list, I didn't notice you had the default set to skip, a better approach (if you wanted to still grab videos that didn't match into your custom channels would be to have it at the bottom and enabled)

A video can only be matched to a single channel after which point the search is stopped.

https://github.com/Inrixia/Floatplane-Downloader/blob/dev/src%2Flib%2FSubscription.ts#L100-L136

Catsrules commented 5 months ago

Thanks for the information, that is good to know I may want to do some rearranging on my arrays in that case.