Commit graph

273 commits

Author SHA1 Message Date
Jesse Bannon
017db953bf
[FEATURE] Automatically handle playlists ordered in reverse (#948)
Playlists have always been a pain-point with ytdl-sub. If an author adds new videos to the end of a playlist, as opposed to the front, it breaks ytdl-sub's intuition of incremental scraping by breaking on the first (oldest) video. This update now makes it possible to handle this in the prebuilt TV Show presets:
- Add each URL variable (`url`, `url2`, ...) into the `download` portion of the subscription twice
- First definition is what we all know and use, simply scrapes first-to-last, then downloads last-to-first
- Second definition does the following:
  - Check to see if a URL is a YouTube playlist URL, if so...
    - Set the field to download, but with modifications to scrape last-to-first, then download first-to-last
  - Otherwise...
    - Set the field to an empty string, which means ytdl-sub will skip it
2024-04-01 04:24:41 -07:00
Jesse Bannon
083db0d9dc
[FEATURE] Simplify TV Show Collection Preset (#953)
Simplifies TV Show Collection presets, drastically. Old version:
```
  rick_a_tv_show_collection:
    preset:
      - "jellyfin_tv_show_collection"
      - "season_by_collection__episode_by_year_month_day_reversed"
      - "collection_season_1"
      - "collection_season_2"
    overrides:
      tv_show_name: "Rick A"
      collection_season_1_url: "https://www.youtube.com/channel/UCuAXFkgsw1L7xaCfnd5JJOw"
      collection_season_1_name: "All Videos"
      collection_season_2_url: "https://www.youtube.com/playlist?list=PLlaN88a7y2_plecYoJxvRFTLHVbIVAOoc"
      collection_season_2_name: "Official Music Videos"
```

New version:
```
  Jellyfin TV Show Collection:
    "~Rick A":
      s01_name: "All Videos"
      s01_url: "https://www.youtube.com/channel/UCuAXFkgsw1L7xaCfnd5JJOw"
      s02_name: "Official Music Videos"
      s02_url: "https://www.youtube.com/playlist?list=PLlaN88a7y2_plecYoJxvRFTLHVbIVAOoc"
```
2024-03-30 22:04:45 -07:00
Jesse Bannon
d5e647554e
[DEV] Fix resolve_once script bug with custom functions (#952)
* [DEV] Fix resolve_once script bug with custom functions

* function name

* fix adding custom functions
2024-03-30 00:53:05 -07:00
Jesse Bannon
82c503c515
[DEV] Update fixtures (#947)
* [DEV] Update fixtures

* bandcamp
2024-03-25 00:25:28 -07:00
Jesse Bannon
0beeeb464d
[FEATURE] Music tag dates (#938)
Adds proper support for setting `date` and `original_date` fields via `music_tag` plugin using a standardized date format.
2024-02-28 13:48:42 -08:00
Jesse Bannon
b3374cb4d5
[DEV] %map_extend scripting function (#906)
* [DEV] `%map_extend` scripting function

* lint
2024-01-19 00:51:44 -08:00
Jesse Bannon
213580ee84
[DEV] Add type-check functions (#905) 2024-01-18 23:24:10 -08:00
Jesse Bannon
f0b3991e3e
[FEATURE] Toggle date_range to break or not (#904)
Adds a the new field `breaking` to the `date_range` plugin, to toggle whether an entry breaks subsequent metadata pulls. This is useful to disable if you are grabbing a playlist that may have videos out of order, but still want to apply a date range to it.
2024-01-18 16:23:02 -08:00
Jesse Bannon
d2e733f2e7
[BACKEND] Only download audio when using audio_extract plugin (#902)
This addition optimizes the `audio_extract` plugin by preemptively telling yt-dlp to discard the video and only download the audio stream
2024-01-18 15:00:17 -08:00
Jesse Bannon
c0ca3c3945
[BACKEND] Remove old format for video_tags, music_tags, download_strategy (#899)
Now that sufficient time has passed, we can formally deprecate the following:
- https://ytdl-sub.readthedocs.io/en/latest/deprecation_notices.html#video-tags
- https://ytdl-sub.readthedocs.io/en/latest/deprecation_notices.html#music-tags
- usage of `download_strategy` (simply remove it if you're getting an error about it)
2024-01-15 00:04:32 -08:00
Jesse Bannon
e3158583ca
[FEATURE] Toggleable plugin field enable for all dict-based plugins (#897)
For key/value-based plugins, add an `enable` field to make it easier for child presets to disable their functionality
2024-01-11 00:40:07 -08:00
Jesse Bannon
2076de3074
[BUGFIX] Smarter subscription validation (#895)
With the right functions, it was possible for subscription validation to raise a false-positive error. This should hopefully resolve that issue and give validation a small performance increase
2024-01-10 18:16:12 -08:00
Jesse Bannon
3b36ffd050
[BUGFIX] Fix source metadata getting fetched when yt-dlp breaks (#889)
Prior PR only got channel metadata for a playlist if it never 'broke' (i.e. MaxDownloads, BreakOnExisting). Will now fetch it regardless.
2024-01-09 19:25:09 -08:00
Jesse Bannon
c29cca2b3d
[FEATURE] YouTube playlists to fetch playlist uploader's poster + fanart (#887)
Implements https://github.com/jmbannon/ytdl-sub/issues/756

TV Show presets whose URL is a playlist will try to get the playlist uploader's poster and fanart.
2024-01-08 22:51:42 -08:00
Jesse Bannon
78cdcce464
[FEATURE] Add --dl-override to pass dl arg overrides to all subscriptions (#882)
With both `--match` and `--dl-override`, it is now possible to more easily experiment with subscriptions without needing to create a separate file.

For example, suppose you are changing some values in your subscription "Rick A" and want to test them out. You can now run:
```
ytdl-sub sub --dry-run --match Rick --dl-override '--ytdl-options.max_downloads 3'
```
This will
1. Dry-run
2. Only run for the subscription "Rick A"
3. Apply setting max_downloads to 3
2024-01-08 15:19:01 -08:00
Jesse Bannon
9382be5c42
[FEATURE] --match flag to only run subset of subscriptions (#881)
Implements https://github.com/jmbannon/ytdl-sub/issues/880
and maybe fixes https://github.com/jmbannon/ytdl-sub/issues/827

Can now do `ytdl-sub sub --match SubA SubB` or `ytdl-sub sub --match SubA --match SubB`, which will only run subscriptions that contain `SubA` or `SubB` in their names
2024-01-08 13:37:07 -08:00
Jesse Bannon
d80a63631a
[BACKEND] String split scripting function (#877) 2024-01-07 00:13:32 -08:00
Jesse Bannon
ba71abc466
[BACKEND] Optional default in %array_at scripting function (#879)
As title
2024-01-06 23:47:09 -08:00
Jesse Bannon
dc74c6a52a
[BACKEND] elif scripting function (#876)
As titled
2024-01-05 17:48:59 -08:00
Jesse Bannon
b3d298b664
[DOCS] Advanced scripting usage, rename Overrides to Static (#866) 2024-01-01 00:01:46 -08:00
Jesse Bannon
735da8b647
[BUGFIX] Actually fix subscription_name with periods in it (#861)
Prior PR did not actually work - this actually fixes the bug (https://github.com/jmbannon/ytdl-sub/issues/844) where subscription names would drop periods from them, i.e. Mr. Beast would have the name  Beast.

POTENTIAL BREAKING CHANGE
If you have a subscription with a period in its name prior to this fix, this change will make it so your download archive is not found since it uses the subscription name in the download archive file path. To fix, simply change the download archive JSON's name to have the actual subscription name, and not the dropped-period one.
2023-12-29 15:41:33 -08:00
Jesse Bannon
189e897888
[FEATURE] subscription_map value (#859)
To be used later for advanced presets. For subscriptions in the form of (+ as prefix)

```
   + Subscription Name:
     Music Videos:
       - "https://url1.com/..."
     Concerts:
       - "https://url2.com/..."
```

Stores all the contents under the subscription name into the override variable
``subscription_map`` as a Map value. The above example is stored as:

```
   {
     "Music Videos": [
       "https://url1.com/..."
     ],
     "Concerts: [
       "https://url2.com/..."
     ]
   }
```

Advanced scripting is needed to dissect this Map variable into a usable preset
2023-12-29 08:55:12 -08:00
Jesse Bannon
731d4e444c
[DOCS] Tooling to auto-generate custom sphinx docs (#849)
Tooling + updating docs
2023-12-28 22:39:59 -08:00
Jesse Bannon
65bb5c0a85
[BUGFIX] Fix periods not working in subscription names (#857)
Fixes the bug (#844) where subscription names would drop periods from them, i.e. Mr. Beast would have the name  Beast.

POTENTIAL BREAKING CHANGE
If you have a subscription with a period in its name prior to this fix, this change will make it so your download archive is not found since it uses the subscription name in the download archive file path. To fix, simply change the download archive JSON's name to have the actual subscription name, and not the dropped-period one.
2023-12-27 11:06:39 -08:00
Jesse Bannon
1375a0fbe3
[BACKEND] Remove subscription __value__ (#856)
Removes the deprecated `__value__` field in the subscriptions file (different from `__preset__` which is NOT deprecated). This was very short-lived, and most likely not used.
2023-12-27 10:49:39 -08:00
Jesse Bannon
02d51d6aec
[BACKEND] Make sibling metadata optional to compute (#855)
Partial fix to https://github.com/jmbannon/ytdl-sub/issues/853
Makes computing sibling metadata optional, defaulted to False. This prevents excessive memory usage when scraping large channels
2023-12-26 11:57:03 -08:00
Jesse Bannon
873ecc0147
[BUGFIX] Fix recursion limit when applying large reduce functions (#851)
Python would think a recursive error occurred, but in reality, the stack got too large due to poor optimization when executing array reduce functions. Thanks Melissa from Discord for the bug report!
2023-12-20 23:46:17 -08:00
Jesse Bannon
308c76a8f2
[FEATURE] Filter plugins, regex helper script functions (#848)
Adds generic `filter_include` and `filter_exclude` plugins in anticipation for function script usage. Will detail it more with official docs at a later time!
2023-12-20 09:52:12 -08:00
Jesse Bannon
5d1fd0d7c6
[BACKEND] Validate override variable names (#845)
Validate as early as possible whether override names are invalid, to prevent confusing downstream errors
2023-12-18 17:11:25 -08:00
Jesse Bannon
e92b1cd12a
[BACKEND][HUGE] Function Support in variable syntax (#838)
A complete gutting of the internals of ytdl-sub to support functions in our variable syntax, in addition to being able to access a yt-dlp entry's .info.json fields using functions. Functionally, ytdl-sub should still look and behave the same from a user-perspective.

With so many lines of code changed (+8927, -2708), no doubt there will be new issues. Please make a GH issue or reach out on Discord if your config/subscriptions break in any way/shape/form.

Details on how to use function support will come soon in the form of proper documentation in our readthedocs.
2023-12-18 16:08:15 -08:00
Jesse Bannon
4d9a30779c
[BUGFIX] Use proper extractor key for download archive (#840)
For less popular sites, ytdl-sub's custom download archive was not working. This was because we weren't using the right extraction key (though it still worked for YouTube, Bandcamp, Soundcloud, and others). This bugfix should now exactly match yt-dlp's and never be a problem again.

Huge thanks to @Svagtlys for root-causing this 🤝
2023-12-14 17:04:03 -08:00
Jesse Bannon
544af2207b
[FEATURE] Add output_options.keep_max_files to limit number of downloads per subscription (#820)
Adds a new mechanism to limit subscriptions' number of videos to an explicit number (only supported date ranges prior to this).

Example usage:
```
output_options:
  keep_max_files: 10
```
will only keep 10 videos at max.

In addition:
- `keep_max_files` is bundled into the `Only Recent` preset and can be used via setting the `only_recent_max_files` override variable (see examples or README for usage).
- Changed the `date_range` variable name to `only_recent_date_range` for more clarity.  Usage of `date_range` will continue to work.
2023-11-17 09:01:21 -08:00
Jesse Bannon
52d1a5887e
[DEV] String validators to allow ints, floats, bools (#810) 2023-11-16 23:50:51 -08:00
Jesse Bannon
6123e35c64
[DEV] Test-case for subscription with existing download archive (#819) 2023-11-16 23:37:24 -08:00
Jesse Bannon
9b8aa827ba
[BACKEND] Upgrade yt-dlp to 2023.11.14 (#815) 2023-11-14 19:23:35 -08:00
Jesse Bannon
395691f2b9
[FEATURE] Create output_directory_nfo_tags on first entry instead of last (#809) 2023-11-05 23:10:29 -08:00
Jesse Bannon
e257210e4a
[BACKEND] Shared multi-url helper preset, can now disable grabbing poster/fanart (#807) 2023-11-05 16:51:17 -08:00
Jesse Bannon
f1a2187a17
[FEATURE] Add throttle_protection plugin (#799)
Provides options to make ytdl-sub look more 'human-like' to protect from throttling. For range-based values, a random number will be chosen within the range to avoid sleeps looking scripted.

Usage:
```
    throttle_protection:
      sleep_per_download_s:
        min: 2.2
        max: 10.8
      sleep_per_subscription_s:
        min: 9.0
        max: 14.1
      max_downloads_per_subscription:
        min: 10
        max: 36
      subscription_download_probability: 1.0
```
2023-11-05 08:23:12 -08:00
Jesse Bannon
19eee28f4a
[DOCKER] New default config/subscription in Docker (#798)
The default subscription file in the docker container now matches the one in the repo's README
2023-11-03 17:14:38 -07:00
Jesse Bannon
f8868add5f
[DEV] Test prebuilt presets packaged (#792) 2023-11-02 12:00:22 -07:00
Jesse Bannon
5fb5a18abc
[FEATURE] TV Show prebuilt presets that require no config (#788)
Introduces 3 new presets + 1 helper preset to download TV show-based subscriptions without the need of a config

```
Plex TV Show by Date
Jellyfin TV Show by Date
Kodi TV Show by Date
```
and
```
Only Recent
```

Example usage can be found in https://github.com/jmbannon/ytdl-sub/blob/master/examples/tv_show_subscriptions.yaml
2023-11-01 22:39:32 -07:00
Jesse Bannon
9f408d2196
[FEATURE] Extend subscription syntax (#790)
Extends the subscription.yaml syntax at the cost of introducing a breaking change.

# New Syntax
## Mix-n-match presets and indent variables
```
# Can mix/match presets and indent override variables.
# Uses presets TV Show, Only Recent and assigns Kids, TV-Y to subscription_indent_1 and _2
TV Show | = Kids | = TV-Y | Only Recent:
  "Jake Trains": "https://..."
```

## Subscriptions with list-value support
```
TV Show | = Kids | = TV-Y | Only Recent:
  "Jake Trains":
    - "https://url.1..."  # Assigns to subscription_value and subscription_value_1
    - "https://url.2..."  # Assigns to subscription_value_2
```

## Subscriptions with override-keys support
```
TV Show | = Kids | = TV-Y | Only Recent:
  "~Jake Trains":  # the ~ means "all keys underneath get assigned as override variables"
    url: "https://url.1..."  # Assigns to url
    url2: "https://url.2..."  # Assigns to url2
```

# Breaking Changes
In the TV show subscriptions example (https://github.com/jmbannon/ytdl-sub/blob/master/examples/tv_show_subscriptions.yaml), it had
```
TV Show Full Archive:
  # Sets "Kids" for genre, "TV-Y" for content rating
  = Kids | TV-Y:
    "Jake Trains": "https://www.youtube.com/@JakeTrains"
    "Kids Toys Play": "https://www.youtube.com/@KidsToysPlayChannel"
```
This must be changed to
```
TV Show Full Archive:
  # Sets "Kids" for genre, "TV-Y" for content rating
  = Kids | = TV-Y:  # Each indent variable assignment must have an = before it
    "Jake Trains": "https://www.youtube.com/@JakeTrains"
    "Kids Toys Play": "https://www.youtube.com/@KidsToysPlayChannel"
```
2023-11-01 20:24:06 -07:00
Jesse Bannon
056b111be6
[FEATURE] Prebuilt Music Videos (#787)
Creates standardized prebuilt presets for music videos. Preset names are:

```
"Kodi Music Videos"
"Jellyfin Music Videos"
"Plex Music Videos"
```

Usage can be found in the `examples/` directory
2023-10-28 00:12:22 -07:00
Jesse Bannon
4789035821
[BACKEND] Default overrides for indent variables (#785)
For music presets, adds `track_genre_default` as an override variable (defaults to Unset)

For TV show presets, adds `tv_show_genre_default` and `tv_show_content_rating_default`, which default to 'ytdl-sub' and 'TV-14'
2023-10-25 12:37:49 -07:00
Jesse Bannon
11be119261
[BUGFIX] Do not set music_directory in prebuilt presets (#783)
New music prebuilt presets had set `music_directory`, which is bad practice since it's not visible to the user which directory it would use. This forces `music_directory` to be set either in the user's config or subscription file
2023-10-25 11:36:51 -07:00
Jesse Bannon
852347dc7e
[BUGFIX] Have __preset__ override nested preset keys (#784)
With the new preset nesting support, `__preset__` would have lower precedence which isn't ideal since it's meant to serve as a 'apply to all presets in this file'. Now the order of priority is:

`inherited presets (top-to-bottom) -> preset itself -> nested subscription presets -> __preset__ -> subscription values`
2023-10-25 11:35:52 -07:00
Jesse Bannon
d810291e7c
[BUGFIX] Write music multi-tags correctly (#782)
Music multi-tags (artists, albumartists, etc) were not writing correctly. Fix it by explicitly checking to see if the tag is multi or not in the codebase.
2023-10-25 10:37:24 -07:00
Jesse Bannon
ff857c84af
[FEATURE] Prebuilt music presets (#780)
Adds the following prebuilt presets:
```
"Single"
"SoundCloud Discography"
"YouTube Releases"
"YouTube Full Albums"
"Bandcamp"
```

which require no config.yaml to use. Usage examples can be found in the `/examples` directory
2023-10-24 09:23:05 -07:00
Jesse Bannon
83ecd19c77
[FEATURE] Process all subscriptions even if one or more error (#771)
Closes GH Issue #766, partially closes #520

Prior to this release, no other subscriptions would download if a subscription before it had an error. Now, subscriptions will continue to download even if one has an error, and will be reported in the output summary.
2023-10-21 12:25:38 -07:00
Jesse Bannon
1cb70e4520
[DEV] Refactor entrypoint file (#765) 2023-10-18 23:33:25 -07:00