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

[feature-request] - option to generate NFO and other metadata about the downloaded file #361

Open
IlmariKu opened this issue Jun 15, 2024 · 10 comments

Comments

@IlmariKu
Copy link

I'm using Jellyfin to organize my media and when I'm using Yle-dl to watch the content, Jellyfin is not recognizing the video files or doesn't know anything other about them, than the filename. Areena does contain descriptions and lot of other info that would be needed to fill the .nfo-file.

NFO-files are just xml in a specific format, saved next to the file.

Can or could yle-dl be adapted to save the description, name of the film and other metadata present in the movie page? I see there is an option for the metadata-json, so some info is already gathered there.

@IlmariKu
Copy link
Author

I was thinking I could do make a PR about this myself, but was raising it as a question / idea to see if anyone's got something to say about it.

@aajanki
Copy link
Owner

aajanki commented Jun 15, 2024

Sounds like a nice feature! I'm happy to review a PR if you want to implement this.

There should be a command line flag for enabling/disabling the creation of NFO files for those who do not use them.

@DarrenPIngram
Copy link

There should be a command line flag for enabling/disabling the creation of NFO files for those who do not use them.
May I say as a user that the default should be OFF and it not fired either if the flag for NFO creation is not set, e.g yle-dl $url just downloads the material as it does today!

@IlmariKu
Copy link
Author

IlmariKu commented Jun 16, 2024

Yep, definitely only an optional command-line flag, never the default, since additional operations are performed.

I'll create the feature at some timescale over the summer and send a PR over. If anyone wants to collaborate on it, let me know!

@IlmariKu
Copy link
Author

What should the flag be called? I was thinking, for Jellyfin / Kodi-usage, the feature should:

  1. Create a folder (because metadata requires multiple files)
  2. Create the .nfo-file and grab the cover-image
  3. Extract subs from the stream (JF doesn't work well with MKV-embedded subs). This should probably be a standalone command as well.

Should it be multiple flags, like --folderize(?), --create-nfo, --extract-subs, --extract-cover or just singular --with-metadata / --jellyfin, which would do all of those ops at once?

@aajanki
Copy link
Owner

aajanki commented Jun 19, 2024

For the user it would be easiest to have a single command line flag that enables everything. It could be called --output-metadata-nfo or something like that. Preferable not --jellyfin because NFO files would be usable with other software, too.

Is it necessary or a common practice to create a separate folder? Isn't it enough if the base filename is the same for the video, NFO and other files (e.g. kummeli_S01E01.mkv, kummeli_S01E01.nfo, kummeli_S01E01.srt)? Then different episodes or programs could be stored to the same folder.

@IlmariKu
Copy link
Author

It's fine to not have a folder and for a playlist, that could be better, but individual movies stored under same root would benefit from it. I'll think about it when I'll start implementing this one day.

@DarrenPIngram
Copy link

It's fine to not have a folder and for a playlist, that could be better, but individual movies stored under same root would benefit from it. I'll think about it when I'll start implementing this one day.

Maybe two commands with one making a folder if that is really needed? --makenfo --makenfofolder or whatever?

But then maybe you get the whole ache of "how should the NFO be formatted, what fields go where, can I add X and so on..."

For that, there's scripting and sed ? :)

For me personally I cannot recall when I last used a nfo file or consulted one. I usually nuke on sight, but we are all different.

@aajanki
Copy link
Owner

aajanki commented Jun 21, 2024

Folder creation doesn't necessarily need a new command line argument. It is already possible with the existing --output-template argument, although the syntax is a bit verbose.

yle-dl --output-template '${series}_${episode}/${series_separator}${title}: ${episode_separator}${timestamp}'

This will save the video in a folder named with the series name and the episode number. The file name will consist of the series name, title, episode number and timestamp (the default output filename for yle-dl).

It's possible to enable this permanently in ~/.config/yledl.conf instead of having to type it out every time.

@grimnight
Copy link

I'm currently using this script. It is still work in progress, but after stumbling on this issue I had an idea to use jinja2 or minijinja for nfo file type template.

What I hope to be able to get is some of the following information in json format:

  • episode duration
  • tags on the page (e.g. drama)
  • release date (possibly also removal date for another script)
  • links to images
  • list of links to individual episodes from series page (would be nice to get images for individual episodes)

I can already get some of this information from metadata or by using extractjson, but it would be nice to get it all with one command.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants