Cannot save/load music paths
Environment & Versions
- System: macOS 15.5 24F74
- Termusic version:
0.10.0 - Rust version: 1.87.0 (17067e9ac 2025-05-09) (Homebrew)
Logs: Not available due to issues with logging functionality described below.
Description of the Problem
I'm encountering several issues related to setting the music directory, especially with paths containing spaces, and with the logging functionality.
Issue 1: Music directory path with spaces not saving via TUI settings
When I try to add the following path to the "Root Music Directory" in the TUI settings (Shift+C), it does not save:
Path: /Volumes/UNNAS/OLD HDD 6TB/musica/Plex Music
I have also tried escaping the spaces: /Volumes/UNNAS/OLD\ HDD\ 6TB/musica/Plex\ Music
Steps to reproduce:
- Open Termusic.
- Press
Shift+cto go to settings. - Navigate to "Root Music Directory".
- Enter the path
/Volumes/UNNAS/OLD HDD 6TB/musica/Plex Music. - Press
Ctrl+sto save. - Re-enter settings (
Shift+c).
Expected behavior: The path should be saved and displayed in the "Root Music Directory" field.
Actual behavior: The path is gone, and the field is empty or reset to its previous value.
Issue 2: Termusic fails to start when music directory with spaces is manually added to server.toml
If I manually edit ~/Library/Application Support/termusic/server.toml to include the path, Termusic fails to start properly.
server.toml configuration:
version = "2"
[com]
port = 50101
address = "::"
[player]
music_dirs = ["/Volumes/UNNAS/OLD HDD 6TB/musica/Plex Music"]
library_scan_depth = 10
loop_mode = "playlist"
volume = 100
speed = 10
gapless = true
use_mediacontrols = true
set_discord_status = false
random_track_quantity = 20
random_album_min_quantity = 5
[player.remember_position]
music = "no"
podcast = "yes"
[player.seek_step]
short_tracks = 5
long_tracks = 30
[podcast]
concurrent_downloads_max = 3
max_download_retries = 3
download_dir = "/Users/else/Music/podcast"
Terminal output and behavior:
When starting termusic with the above configuration:
❯ termusic
Logging to file "/var/folders/vz/wd0r1m8x31z1sp5z_k_wjn800000gn/T/termusic-tui.log"
Server process ID: 47308
^C
Termusic prints the "Server process ID" and then hangs. No TUI appears, and I have to manually stop it with Ctrl+C.
Subsequently, trying to cat the default log file shows it wasn't created or written to:
❯ cat "/var/folders/vz/wd0r1m8x31z1sp5z_k_wjn800000gn/T/termusic-tui.log"
[bat error]: '/var/folders/vz/wd0r1m8x31z1sp5z_k_wjn800000gn/T/termusic-tui.log': No such file or directory (os error 2)
(Note: The [bat error] is from the cat command itself, indicating the log file was not found).
Issue 3: Termusic panics when --log-file argument is used
When I try to specify a log file using the --log-file argument, termusic panics, even if the file exists.
Steps to reproduce:
- Create an empty file:
touch file.log - Run termusic with the log file argument:
termusic --log-file file.log
Terminal output (panic):
❯ touch file.log
❯ termusic --log-file file.log
thread 'main' panicked at /Users/else/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/termusic-0.10.0/src/logger.rs:41:14:
Expected flexi_logger to be able to start: OutputIo(Os { code: 2, kind: NotFound, message: "No such file or directory" })
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
This occurs even though file.log was created in the current directory. The help output for --log-file is:
--log-file <LOG_FILE> Set logging file [env: TM_LOGFILE=] [default: /var/folders/vz/wd0r1m8x31z1sp5z_k_wjn800000gn/T/termusic-tui.log]
These issues make it difficult to configure termusic for music libraries on certain paths and to debug problems using custom log files.
Termusic prints the "Server process ID" and then hangs. No TUI appears, and I have to manually stop it with Ctrl+C.
That is because the TUI is waiting for the server to become responsive (at least normally), the TUI does not pass through logs from the server.
Subsequently, trying to cat the default log file shows it wasn't created or written to:
The logs are currently configured to only be created if there is anything to write to (ie on the first log line, the file will be created).
In this case you would need to look at termusic-server.log instead of -tui.
Also if nothing appears there, try starting with RUST_LOG=info,termusic=trace,termusic_server=trace.
Expected flexi_logger to be able to start: OutputIo(Os { code: 2, kind: NotFound, message: "No such file or directory" })
This sounds weird, to my knowledge flexi_logger does not care if the file already exists or not, if it does not it will be created (including parent directories).
Could you try running with RUST_BACKTRACE=1 to see where in flexi_logger the issue happens so we can report it?
When I try to add the following path to the "Root Music Directory" in the TUI settings (Shift+C), it does not save:
From my testing, it seems to save fine from the TUI config editor (aside from the text not scrolling)
If I manually edit ~/Library/Application Support/termusic/server.toml to include the path, Termusic fails to start properly.
From what i can tell, at least for me, it saved it correctly and starts with it correctly, maybe debug logs will provide more insight.
Termusic version: 0.10.0
Just to confirm, are you running on tag 0.10.0 exactly, or some git version?
If you are on 0.10.0 exactly, could you retry everything with latest git (currently its at d568ef8788c01e6d585ee1e89ed8bcda49a05479)?
PS: i am testing on Linux, i dont know much about macos systems.
Expected flexi_logger to be able to start: OutputIo(Os { code: 2, kind: NotFound, message: "No such file or directory" })
This sounds weird, to my knowledge flexi_logger does not care if the file already exists or not, if it does not it will be created (including parent directories). Could you try running with RUST_BACKTRACE=1 to see where in flexi_logger the issue happens so we can report it?
I did some more testing and can reproduce this and found the cause, opened a issue: https://github.com/emabee/flexi_logger/issues/194
Is this still a issue in 0.12.0? If yes, please re-test and provide the logs when running with RUST_BACKTRACE=1 RUST_LOG=info,termusic_server=trace,termusic=trace
If no new information will be provided in about ~1 week, i will close this.
As this has been stale for a while, i will close this.