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

playlist, etc., need to be designed with a .config #20

Open
iconoclasthero opened this issue Mar 30, 2024 · 1 comment
Open

playlist, etc., need to be designed with a .config #20

iconoclasthero opened this issue Mar 30, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@iconoclasthero
Copy link

So I ran this on my laptop and Kellerman has mpd install the default mpd.conf with permissions:

$ lla /etc/mpd.conf
.rw-r----- 13,631 mpd mpd  6 Mar 23:48 /etc/mpd.conf

so the script fails out of the box for almost everyone who hasn't gone through and done the server- or system-level (i.e., /etc/ file permissions or group permissions, e.g., .rw-rw---- 13,631 mpd media 6 Mar 23:48 /etc/mpd.conf)...

Incidentally, this is one of the main things I was warning about on my repo in the NB at the beginning of the README.md...the other was modifying the permissions and the group settings on the logs and probably how mpd is running so that the user can modify the logs.

I started keeping my config files in ~/.config and i think that's a reasonable place for a .config or, more probably a series of .config files depending on how it's set up. I think that it would make sense for there to be a user-editable .config file that stores some of the key things that are being grabbed from the /etc/mpd.conf like the password, the log and music dir locations, etc.

let's come up with some ideas on how to execute that?

@bonelifer
Copy link
Owner

bonelifer commented Mar 31, 2024

Making an update-mpd-extended-cfg.py. It will be called by install.sh during install. It can also be used later to update the MPD settings from the mpd.conf to the mpd-extended.cfg. This config file will be used by mpdignore and the scripts in this project. Thus the default mpd-extended.cfg will only have the MPD section. Project/script specific python files will add the MPDIGNORE or MPD-SCRIPTS sections as needed. Seems like the cleanest way, that won't confuse users that aren't using both.

Workflow for update-mpd-extended-cfg.py

  1. Check MPD Installation: The script checks if MPD (Music Player Daemon) is installed on the system.

  2. Search for mpd.conf: It looks for the mpd.conf file in default locations such as /etc/mpd.conf, ~/.mpd/mpd.conf, and ~/.config/mpd/mpd.conf.

  3. Prompt for mpd.conf Path: If the script doesn't find mpd.conf in the default locations, it prompts the user with a yes/no confirmation to manually enter the path to the mpd.conf file.

    • If the user chooses "Yes," they will be prompted to enter the path to the mpd.conf file.

    • If the user chooses "No," the script exits gracefully.

  4. Extract Configuration Values: The script extracts relevant configuration values from mpd.conf, including music_directory, playlist_directory, log_file, port, and password.

  5. Update mpd-extended.cfg: It updates the mpd-extended.cfg file located at ~/.config/mpd/mpd-extended.cfg with the extracted configuration values. If any value is missing or cannot be extracted, appropriate warnings are displayed.

  6. Completion Message: Once the update is completed, a message is displayed indicating successful completion.

  7. Manual Intervention: If the script encounters errors or cannot find mpd.conf, it prompts the user for manual intervention, allowing them to enter the correct path if they select yes. If they select no, then the script exits gracefully as they cannot provide the required information.

  8. Run Again for Updates: Users can run the script again in the future to update mpd-extended.cfg if any changes are made to mpd.conf.

python3 update-mpd-extended-cfg.py


python3 update-mpd-extended-cfg.py /path/to/mpd.conf

@bonelifer bonelifer added the bug Something isn't working label Mar 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants