Closed amano-kenji closed 6 months ago
~/.config/pyradio/data should go to ~/.local/share/pyradio https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
The data contained in this folder are actually part of the user's configuration; its containts partly depend on the way the program is used, so... I would have to think about this one...
What are these for? ~/.config/pyradio/data/cover.png ~/.config/pyradio/data/pyradio.png
These are icons needed for Desktop notification and desktop file (pyradio.png) and station recording using mkvtoolnix
(cover.png). They are there because I've been having problems locating them through various OS (MacOS is the king here), so having them at a predefined location was the solution.
stations.csv is created whenever I delete it. Perhaps, is it better to show
site-packages/pyradio/stations.csv
as built-in stations in playlist list?
No, that's not the way it would work.
The file is copied to ~/.config/pyradio
so the user can edit it as he wants, even replace all stations with his own.
If he wants to revert to the package provided stations, he can simply delete the file and it will be regenerated (copied).
This has been the behavior for a long time and I would not like to change it; it would just create unnecessary confusion.
If
default_playlist
is empty in config, thendefault_playlist
is the built-in playlist. Instead of copyingstations.csv
to~/.config/pyradio
, make it unmodifiable. I think users should have explicit control over playlists in~/.config/pyradio
.
Users do have explicit control over playlists in ~/.config/pyradio
; with the exception of stations.csv
as explained above.
Other than that, he can create / edit /delete playlists at will and set the default one using default_playlist
/ default_station
So, I would be very reluctant to change anything here...
~/.config/pyradio/recordings
does not belong in~/.config/pyradio
. Perhaps, recordings directory should be configurable with a sensible default value like~/pyradio-recordings
.
I would agree with you here; I have been thinking about it as well; just did not have the time to implement the required config / transfer functionality. Maybe it is time to do that, along with #215
It seems to me that you can just keep cover.png
and pyradio.png
in site-packages/pyradio
.
This has been the behavior for a long time and I would not like to change it; it would just create unnecessary confusion.
Is this behavior documented somewhere? I'm not going to fuss about small details, but I want to see details documented.
If contents in ~/.config/pyradio/data
don't correspond to changes in configuration interface, then they are not exactly configuration.
It seems to me that you can just keep
cover.png
andpyradio.png
insite-packages/pyradio
.
That's exactly what I intended to do at the beginning, but as I've said I used to have problems locating the files, so I just copied them to data
. I might revisit this behavior in the future, but for the time being they are there :wink:
Is this behavior documented somewhere? I'm not going to fuss about small details, but I want to see details documented.
It's right here: https://github.com/coderholic/pyradio/blob/master/docs/index.md#about-playlist-files
PyRadio will by default load the user's stations file (e.g. ~/.config/pyradio/stations.csv) to read the stations from. If this file is not found, it will be created and populated with a default set of stations.
Note: Older versions used to use ~/.pyradio as default stations file. If this file is found, it will be copied to use's config directory (e.g. ~/.config/pyradio) and renamed to stations.csv or if this file exists, to pyradio.csv. In this case, this file will be the default one.
If contents in
~/.config/pyradio/data
don't correspond to changes in configuration interface, then they are not exactly configuration.
The files in ~/.config/pyradio/data
may not correspond to changes in configuration interface, but they do change program behavior... There's data about last stations.csv
sync, last version update check, players buffer size, vlc configuration, scheduler configuration (still working on it...), search terms history, etc.
Things like search terms history and last version update check usually belong in ~/.local/share/PROGRAM-NAME
.
neovim stores such data in ~/.local/share/nvim
.
XDG base directory specification says
The $XDG_STATE_HOME contains state data that should persist between (application) restarts, but that is not important or portable enough to the user that it should be stored in $XDG_DATA_HOME. It may contain:
The specification distinguishes application state from application configuration.
On further inspection, it turns out that there is distinction between XDG_STATE_HOME and XDG_DATA_HOME.
Thanks for the heads up! I will look into it!
Upon further inspection, I discovered that ~/.local/share/nvim
contains files that can be reproduced on any computer.
~/.local/share/nvim
contains neovim packages. My neovim configuration specifies which neovim packages should be installed, and those packages go into ~/.local/share/nvim
. ~/.local/share/nvim
is akin to /usr/share/nvim
.
On the other hand, ~/.local/state/nvim
contains application state such as search history.
Thus, I believe image files belong in either ~/.local/share/pyradio
or site-package/pyradio
and other files in ~/.config/pyradio/data
belong in ~/.local/state/pyradio
.
vlc.conf
is to save vlc volume; vlc can report the volume but there's a problem here, some versions report with a maximum of 1000 and some versions with a maximum of 512, so... yes...
I've also remembered why I like having all config files in one place. I had to reinstall a pc yesterday at work (changing distro) and wanted to have pyradio also; I just had to tar on folder ~/.config/pyradio
and transfer it to the "new" pc, done :)
If vlc, mplayer, and mpv share the same volume, isn't it easier to save the volume as ~/.config/pyradio/volume
or ~/.local/state/pyradio/volume
and execute mpv|mplayer|vlc --volume=xxx ...
? This is cleaner than profile trick.
Executing media players with pyradio
profile is still good because I want to configure specific behaviors for pyradio.
Because XDG base directory specification says actions history (logs, history, recently used files, …) belongs to $XDG_STATE_HOME, pyradio-title.log
should go to $XDG_STATE_HOME
.
I came up with this summary.
data/cover.png
, data/pyradio.png
, data/UPDATE_ICON
$XDG_CACHE_HOME/pyradio
or nonedata/last-playlist
, data/last-sync
, data/search-playlist.txt
, data/search-station.txt
, pyradio-titles.log
$XDG_STATE_HOME/pyradio
data/vlc.conf
(This should become volume
that stores the volume for every player)
$XDG_STATE_HOME/pyradio/volume
$XDG_DATA_HOME/pyradio/volume
if you want think this should be portable across machines.recordings
$HOME/pyradio-recordings
$XDG_DATA_HOME/pyradio/recordings
Preparing for files migration :wink:
$ python to_delete.py | column --table
/home/spiros/.config/pyradio/data/INSTALLATION_TYPE --> /home/spiros/.local/share/pyradio/INSTALLATION_TYPE
/home/spiros/.config/pyradio/data/pyradio.png --> /home/spiros/.local/share/pyradio/pyradio.png
/home/spiros/.config/pyradio/data/cover.png --> /home/spiros/.local/share/pyradio/cover.png
/home/spiros/.config/pyradio/data/schedule.json --> /home/spiros/.local/share/pyradio/schedule.json
/home/spiros/.config/pyradio/data/vlc.conf --> /home/spiros/.local/state/pyradio/vlc.conf
/home/spiros/.config/pyradio/data/UPDATE_ICON --> /home/spiros/.local/state/pyradio/UPDATE_ICON
/home/spiros/.config/pyradio/data/asked-sync --> /home/spiros/.local/state/pyradio/asked-sync
/home/spiros/.config/pyradio/data/last-sync --> /home/spiros/.local/state/pyradio/last-sync
/home/spiros/.config/pyradio/data/.2024-01-06.date --> /home/spiros/.local/state/pyradio/.2024-01-06.date
/home/spiros/.config/pyradio/data/buffers --> /home/spiros/.local/state/pyradio/buffers
/home/spiros/.config/pyradio/pyradio-recording.txt --> /home/spiros/.local/state/pyradio/pyradio-recording.txt
/home/spiros/.config/pyradio/data/search-theme.txt --> /home/spiros/.local/state/pyradio/search-theme.txt
/home/spiros/.config/pyradio/data/search-group.txt --> /home/spiros/.local/state/pyradio/search-group.txt
/home/spiros/.config/pyradio/data/search-station.txt --> /home/spiros/.local/state/pyradio/search-station.txt
/home/spiros/.config/pyradio/data/search-playlist.txt --> /home/spiros/.local/state/pyradio/search-playlist.txt
/home/spiros/.config/pyradio/last_playlist --> /home/spiros/.local/state/pyradio/last_playlist
/home/spiros/.config/pyradio/data/.0.9.1.ver --> /home/spiros/.local/state/pyradio/.0.9.1.ver
/home/spiros/.config/pyradio/pyradio-titles.log --> /home/spiros/pyradio-titles.log
/home/spiros/.config/pyradio/data/user-cover.png1 --> /home/spiros/pyradio-not-migrated/user-cover.png1
/home/spiros/.local/share/pyradio/pyradio.png /home/spiros/.local/share/pyradio/cover.png /home/spiros/.local/state/pyradio/UPDATE_ICON
I think those belong to $XDG_CACHE_HOME/pyradio
because they look like cache files. They are not user-specific data. They are not application state. They shouldn't even exist..
/home/spiros/.local/state/pyradio/vlc.conf
vlc.conf
should become volume
which is volume for every player.
pyradio-recording.txt search-theme.txt search-group.txt search-station.txt search-playlist.txt
These files don't seem to be created by pyradio.
/home/spiros/pyradio-titles.log
I am not sure that I want to see pyradio-title.log
in $HOME
.
/home/spiros/.local/share/pyradio/pyradio.png /home/spiros/.local/share/pyradio/cover.png /home/spiros/.local/state/pyradio/UPDATE_ICON
I think those belong to $XDG_CACHE_HOME/pyradio because they look like cache files. They are not user-specific data. They are not application state. They shouldn't even exist..
Granted; their purpose has already been explained...
/home/spiros/.local/state/pyradio/vlc.conf
vlc.conf
should becomevolume
which is volume for every player.
That is not the case; mpv
and mplayer
support profiles; their default volume is part of a profiles - vlc
does not support profiles, so this file is for vlc lolume
only.
pyradio-recording.txt search-theme.txt search-group.txt search-station.txt search-playlist.txt
These files don't seem to be created by pyradio.
You are partly right...
pyradio-recording.txt
is not created by pyradio; it contains my notes regarding the implementation of the recording functionality...
The other txt
files are the search terms history files and are created when a search has been performed
/home/spiros/pyradio-titles.log
I am not sure that I want to see
pyradio-title.log
in$HOME
.
I think that's just where it should be; this file is the output of the "Titles logging" functionality. It is only created when the user enables it, or when he "likes"/"tags" a title, which means he would want it to be easily accessible
That is not the case; mpv and mplayer support profiles
I want pyradio to keep its own data inside its own folders. It took a while to figure out that pyradio saved its volume level in ~/.config/mpv/mpv.conf
.
mpv supports --volume
option. mplayer supports -volume
option. Both options interpret 0 as silence and 100 as full volume.
By passing volume as a command line option, one can have cross-player volume level in pyradio.
I like the fact that I can manually configure pyradio profile in mpv.conf
, but I prefer pyradio volume in pyradio directories.
Done in 0.9.3
Please refer to https://github.com/coderholic/pyradio/blob/master/docs/packaging.md
The amount of change seems daunting.
The amount of change seems daunting.
Well, yes... That's why it took so much time and I am expecting bugs to be present for a long time, or at least until users discover them :wink:
site-packages/pyradio/stations.csv
asbuilt-in stations
in playlist list? Ifdefault_playlist
is empty in config, thendefault_playlist
is the built-in playlist. Instead of copyingstations.csv
to~/.config/pyradio
, make it unmodifiable. I think users should have explicit control over playlists in ~/.config/pyradio.~/pyradio-recordings
.