Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to implement scripting functions #985

Open
alan-cugler opened this issue May 12, 2024 · 2 comments
Open

How to implement scripting functions #985

alan-cugler opened this issue May 12, 2024 · 2 comments
Labels
question Further information is requested

Comments

@alan-cugler
Copy link

alan-cugler commented May 12, 2024

Hello, I am looking to take a youtube playlist and use the date to break things up into seasons and episodes. I see its suggested to use year as season and months or days as episodes. This works but I would like to make a python script to make standard seasons and episodes that are derived from those dates and cross referenced with the info.json file that is saved with other videos downloaded from the playlist for when the playlist gets updated the program can determine what the latest video should be labeled for season and episode.

example:
video: 2000, 01, 10 --> season: Season 01, Episode 01
video: 2000, 03, 12 --> season: Season 01, Episode 02
video: 2001, 01, 22 --> season: Season 02, Episode 01

I am just not sure how to mark to use a custom python script in the yaml file for dynamically determining a variable.

I use the salt program for managing infrastructure. This is written in python and uses yaml just as this project does. When using that program they use jinja2 for dynamically filling variables and you can reference python scripts to run in that jinja. I see scripting docs for this project were developed, but I wasnt able to translate them into a working example yet.

@jmbannon
Copy link
Owner

ytdl-sub scripting does not support arbitrary python. It's a simple custom-built language solely for variable manipulation: https://ytdl-sub.readthedocs.io/en/latest/config_reference/scripting/index.html

You could have a python script that runs after ytdl-sub to do post processing

@jmbannon
Copy link
Owner

With your desired example, it'd be hard to achieve solely in ytdl-sub since it requires a bit of state (year to index, ep indexing per year).

The ytdl-sub date presets try to be as stateless as possible to be able to download any slice of time with deterministic season/ep numbers. I highly recommend using those to save some headache

@jmbannon jmbannon added the question Further information is requested label May 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants