Skip to content

Commit 2955150

Browse files
committed
- if both XDG_DATA_HOME and XDG_STATE_HOME directories already exist,
xdg_compliant will be set to True, even if not set in the configuration file (it means an XDG migration has been performed in the past; using the non-XDG dirs will lead to data loss)
1 parent f511501 commit 2955150

File tree

10 files changed

+38
-1580
lines changed

10 files changed

+38
-1580
lines changed

docs/headless.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ <h3 id="how-it-works">How it works</h3>
132132
<li><p>we cannot start a second headless server, and</p></li>
133133
<li><p>we can get info about the server running.</p></li>
134134
</ul>
135-
<p>The “headless server lock file” is saved as <em>~/.config/pyeadio/data/server-headles.txt</em> (or <em>~/.local/share/pyradio</em> if <strong>xdg_compliant</strong> is set to True), and will contain the IP address and port the servers is listening to. This is especially useful in case a user script needs to get this info (instead of parsing the output of the command <strong>pyradio –addr</strong>).</p>
135+
<p>The “headless server lock file” is saved as <em>~/.config/pyradio/data/server-headles.txt</em> (or <em>~/.local/share/pyradio/server-headles.txt</em> if <strong>xdg_compliant</strong> is set to True), and will contain the IP address and port the servers is listening to. This is especially useful in case a user script needs to get this info (instead of parsing the output of the command <strong>pyradio –addr</strong>).</p>
136136
<h2 id="installation">Installation <span style="padding-left: 10px;"><sup style="font-size: 50%"><a href="#" title="Go to top of the page">Top</a></sup></span></h2>
137137
<p>By the term “installation”, we mean that we set up things in such a way, that after we log into the system, we find <strong>PyRadio</strong> ready to accept connections.</p>
138138
<p>So, the installation can be as easy as adding a line in a configuration file (or the startup section of the <em>desktop environment</em>) or as hard as adding a system service.</p>

docs/headless.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ It will create a "headless server lock file", though, so that
123123

124124
- we can get info about the server running.
125125

126-
The "headless server lock file" is saved as *~/.config/pyeadio/data/server-headles.txt* (or *~/.local/share/pyradio* if **xdg_compliant** is set to True), and will contain the IP address and port the servers is listening to. This is especially useful in case a user script needs to get this info (instead of parsing the output of the command **pyradio --addr**).
126+
The "headless server lock file" is saved as *~/.config/pyradio/data/server-headles.txt* (or *~/.local/share/pyradio/server-headles.txt* if **xdg_compliant** is set to True), and will contain the IP address and port the servers is listening to. This is especially useful in case a user script needs to get this info (instead of parsing the output of the command **pyradio --addr**).
127127

128128
## Installation
129129

docs/pyradio.1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1248,7 +1248,7 @@ Furthermore, if TERM is set to anything like "\fIxterm*\fR", "\fIscreen*\fR" or
12481248
.IP 2. 3
12491249
Terminals that do not support at least 16 colors will not be able to display any of the new themes. The same goes for terminals that do not support changing their colors (through the \fBcurses\fR library).
12501250

1251-
These terminal will default to the old "\fBdark\fR" theme, displaying whatever colors the active palette dictates.
1251+
These terminal will default to either the "\fBdark\fR" or the "\fBlight\fR theme (determined by the configuration parameter \fIconsole_theme\fR), displaying whatever colors the active palette dictates.
12521252

12531253
.IP 3. 3
12541254
There are a couple of terminals (that I know of) which will permit changing their colors but will not be able to present the changed color on the fly.

docs/themes.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ <h3 id="css-color-themes-restrictions">CSS color themes restrictions</h3>
183183
Furthermore, if TERM is set to anything like “<strong>xterm</strong>”, “<strong>screen</strong>” or “<strong>tmux</strong>”, <strong>PyRadio</strong> will set it to “<em>xterm-256color</em>” as well.</p></li>
184184
<li><p>Terminals that do not support at least 16 colors will not be able to display any of the new themes. The same goes for terminals that do not support changing their colors (through the <strong>curses</strong> library).<br />
185185
<br />
186-
These terminal will default to the old <strong>dark</strong>” theme, displaying whatever colors the active palette dictates.</p></li>
186+
These terminal will default to either the “<strong>dark</strong>or the “<strong>light</strong>theme (determined by the configuration parameter <strong>console_theme</strong>), displaying whatever colors the active palette dictates.</p></li>
187187
<li><p>There are a couple of terminals (that I know of) which will permit changing their colors but will not be able to present the changed color on the fly.<br />
188188
<br />
189189
This means that, in order for a theme change to take full effect, <strong>PyRadio</strong> will have to be restarted.</p></li>

docs/themes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ Furthermore, if TERM is set to anything like "**xterm**", "**screen**" or "**tmu
153153

154154
2. Terminals that do not support at least 16 colors will not be able to display any of the new themes. The same goes for terminals that do not support changing their colors (through the **curses** library). \
155155
\
156-
These terminal will default to the old "**dark**" theme, displaying whatever colors the active palette dictates.
156+
These terminal will default to either the "**dark**" or the "**light**" theme (determined by the configuration parameter **console_theme**), displaying whatever colors the active palette dictates.
157157

158158
3. There are a couple of terminals (that I know of) which will permit changing their colors but will not be able to present the changed color on the fly. \
159159
\

pyradio/config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ remote_control_server_auto_start = False
194194
# Packagers should set this paramater as resired!
195195
#
196196
# Default value: False
197-
xdg_compliant = True
197+
xdg_compliant = False
198198

199199
# The name of the distribution providing the package. If this parameter is set
200200
# to anything other than "None" PyRadio will not permit updating (-U command

pyradio/config.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2343,6 +2343,16 @@ def _read_config(self, distro_config=False):
23432343
pass
23442344
self._first_read = False
23452345

2346+
''' detect previous XDG Base installation '''
2347+
if not platform.startswith('win') and \
2348+
not self.xdg_compliant and \
2349+
distro_config:
2350+
d_dir = XdgDirs.get_xdg_dir('XDG_DATA_HOME')
2351+
s_dir = XdgDirs.get_xdg_dir('XDG_STATE_HOME')
2352+
if path.exists(d_dir) and path.exists(s_dir):
2353+
print('[magenta]XDG Dirs[/magenta] found; enabling [magenta]XDG Base compliant[/magenta] operation')
2354+
self.xdg_compliant = True
2355+
23462356
def _make_sure_dirs_exist(self):
23472357
if self.opts['recording_dir'][1] == '':
23482358
self.opts['recording_dir'][1] = path.join(path.expanduser('~'), 'pyradio-recordings')

0 commit comments

Comments
 (0)