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

Request: local_settings.py example #1

Closed
tchan09 opened this issue Dec 17, 2020 · 11 comments
Closed

Request: local_settings.py example #1

tchan09 opened this issue Dec 17, 2020 · 11 comments

Comments

@tchan09
Copy link

tchan09 commented Dec 17, 2020

Thanks for putting this together!

Is there an example of how local_settings.py can be used to override the default settings?

Specifically I'm interested in providing additional parameters to youtube-dl (eg. subtitles) via the YOUTUBE_DEFAULTS attribute.

@meeb
Copy link
Owner

meeb commented Dec 17, 2020

If you're running it non-containerised, you can just hack in YOUTUBE_DEFAULTS in your local_settings.py to be whatever you want. If you want to run it in a container I'll probably need to add some sensible limitation on how to modify the YOUTUBE_DEFAULTS settings. What in particular did you want to change with the defaults?

@tchan09
Copy link
Author

tchan09 commented Dec 18, 2020

I'm running it through a container so I guess I'll just make a copy of local_settings.py and mount it into /app/tubesync/ for now. No worries.

I'd like to add parameters to grab subtitles where available, ie.:

  • --write-sub
  • --sub-lang 'English,en,eng,en-US'
  • --sub-format 'srt'

@tchan09 tchan09 closed this as completed Dec 18, 2020
@meeb
Copy link
Owner

meeb commented Dec 18, 2020

Ah OK. I'll look at adding some sensible sub-related flags. Note, those are command line arguments you're using and TubeSync uses embedded youtube-dl. You'll need to add options from this list not --args:

https://github.com/ytdl-org/youtube-dl/blob/3e4cedf9e8cd3157df2457df7274d0c842421945/youtube_dl/YoutubeDL.py#L137-L312

@csjoh
Copy link

csjoh commented Oct 29, 2021

Ah OK. I'll look at adding some sensible sub-related flags. Note, those are command line arguments you're using and TubeSync uses embedded youtube-dl. You'll need to add options from this list not --args:

https://github.com/ytdl-org/youtube-dl/blob/3e4cedf9e8cd3157df2457df7274d0c842421945/youtube_dl/YoutubeDL.py#L137-L312

What would the format look like in the file?

I tried this, but it didn't work:

writesubtitles: True
subtitlesformat: "srt"
writeautomaticsub: True
subtitleslangs: "English,en,eng,en-GB,en-US,nb-NO,pl-PL"

The path to the config folder is already exported through docker, so I restarted the container to see if it worked, but no. TubeSync still downloads videos, but not subtitles.

@meeb
Copy link
Owner

meeb commented Oct 29, 2021

The config file you would need to edit is not stored in the config directory, it's in the Django project directory in the container. Where are you attempting to save those parameters?

@csjoh
Copy link

csjoh commented Oct 29, 2021

The config file you would need to edit is not stored in the config directory, it's in the Django project directory in the container. Where are you attempting to save those parameters?

I tried putting them into local_settings.py in the config directory. I changed the file contents based on https://github.com/meeb/tubesync/blob/main/tubesync/tubesync/local_settings.py.example to this:

YOUTUBE_DEFAULTS = {
    'writesubtitles': True,
    'subtitlesformat': 'srt',
    'writeautomaticsub': True,
    'subtitleslangs': 'English,en,eng,en-GB,en-US,nb-NO,pl-PL',
}

but that didn't work either.

I'm running TubeSync as a docker container on unRAID, if that matters at all (from my understanding, it shouldn't).

@meeb
Copy link
Owner

meeb commented Oct 29, 2021

That won't work, the local_settings.py file is built in the container it's currently not overwrite-able by just dropping a filed named the same into the config directory.

@csjoh
Copy link

csjoh commented Oct 29, 2021

Gotcha. Can I specify YOUTUBE_DEFAULTS as an environment variable and pass that in with the values above and override it that way?

@meeb
Copy link
Owner

meeb commented Oct 29, 2021

No, not at the moment. Passing an array of values in as a string in an env var is messy at best. If this gets implemented it'll be a proper option somewhere rather than letting people hack in custom API flags. The reason this is a bit slow is in testing I couldn't get subtitle downloading to reliably work at all and was until recently blocked entirely by the lack of support for embedding metadata into MKV containers.

@csjoh
Copy link

csjoh commented Oct 29, 2021

I see. As an interim solution I wouldn't mind passing the env variable, but I fully understand you wanting to do it properly if it is to be done. Temporary solutions often tend to become permanent...

Personally, I don't mind having the subtitle file separate from the video file. Embedded is of course very nice, but sometimes I need to manually edit the subtitles to satisfy my OCD, especially with autosubs that have really messed up timings. Having the subs separate from the video saves me a lot of work since I then don't have to extract the subtitles from the MKV, edit/sync/whatever and then merge them back together.

@meeb
Copy link
Owner

meeb commented Oct 29, 2021

OK, thanks for the feedback. I'll see if there's any sensible hacks that can be stuffed in in the interim.

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

3 participants