woefe / ytcc

Command line tool to keep track of your favorite playlists on YouTube and many other places.
GNU General Public License v3.0
178 stars 20 forks source link

[Request] Portable configuration #111

Closed pukkandan closed 1 year ago

pukkandan commented 2 years ago

Is your feature request related to a problem? Please describe.

Portable configuration and database

Describe the solution you'd like

ytcc should look for a config file in the same directory as the executable and prioritize it over the other configs. When this "portable" config file is detected, the default db path, download path etc should also be set relative to the executable's path.

I can make a PR for this if needed

woefe commented 1 year ago

What's the usecase? You can override the config lookup path by setting the YTCC_CONFIG env variable or passing ytcc the --conf option.

pukkandan commented 1 year ago

You can override the config lookup path by setting the YTCC_CONFIG env variable or passing ytcc the --conf option.

That is what I am doing now. Since I want don't want to pass --conf each time, I had to create a wrapper script that calls ytcc --conf ... and also explicitly define relative paths for download, db etc.

Built-in support for a portable config would make this much easier. But if you think the current option is good enough, feel free to close the issue

woefe commented 1 year ago

I don't see why we need to change anything in ytcc, because you can emulate a portable config with

export YTCC_CONFIG=.ytcc.conf

If .ytcc.conf does not exist in the current working directory, configuration is read from the usual places. Additionally, you can create "incomplete" config files that override only the settings you want to change for a certain directory.

In your case following might help:

  1. Instead of writing a wrapper, export YTCC_CONFIG=.ytcc.conf in your shellrc or similar.
  2. In directories where you want to override some ytcc settings create configs that override the defaults. E.g.
    [ytcc]
    download_dir = downloads
    db_path = ytcc.db