Skip to content

Commit fd91fb8

Browse files
committed
- Selected station / playlist will be visible when resizing the terminal.
- Calculating initial loaded playlist position in window. - Implemented dynamic list padding. - Correctly display failed station when returning to stations mode. - Updating docs
1 parent 1294d44 commit fd91fb8

File tree

8 files changed

+150
-58
lines changed

8 files changed

+150
-58
lines changed

Changelog

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,21 @@
1+
2019-02-07 s-n-g
2+
3+
* Selected station / playlist will be visible when resizing the terminal.
4+
* Calculating initial loaded playlist position in window.
5+
* Implemented dynamic list padding.
6+
* Correctly display failed station when returning to stations mode.
7+
* Updating docs
8+
19
2019-02-04 s-n-g
210

3-
* Version 0.7.3
11+
* Version 0.7.3
412
* Added "p" command to jump to playing station / loaded playlist.
513
* Added two more themes (dark_16_colors and light_16_colors)
6-
* Improved black_on_white theme
14+
* Improved black_on_white theme.
715
* On a 8 color terminal, the fall-back theme will be "light",
816
if "light_16_colors" is default.
9-
* Exiting if terminal cannot display colors.
10-
* Fixed player selection error screen.
17+
* Exiting if terminal cannot display colors.
18+
* Fixed player selection error screen.
1119
* Fixed a regression which might appear when loading a playlist
1220

1321
2019-02-02 s-n-g

README.html

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
dl {margin: 2em;}
1313
dd {margin: 1em;}
1414
dt {font-weight: bold;}
15-
pre { background-color: #F6F6F6; padding: 1.5em; border: 1px solid #E6E6E6;}
15+
pre { background-color: #F6F6F6; padding: 1.5em; border: 1px solid #E6E6E6; overflow: auto;}
1616
code{white-space: pre-wrap;}
1717
span.smallcaps{font-variant: small-caps;}
1818
span.underline{text-decoration: underline;}
@@ -89,20 +89,27 @@ <h2 id="command-line-options">Command line options</h2>
8989
<li><strong>-t</strong> - parameter <strong>theme</strong> (default value: <strong>dark</strong>)</li>
9090
</ul>
9191
<h2 id="controls">Controls</h2>
92-
<pre>Up/Down/j/k/PgUp/PgDown Change station selection.
93-
g Jump to first station.
94-
&lt;n&gt;G Jump to n-th / last station.
95-
Enter/Right/l Play selected station.
96-
r Select and play a random station.
97-
Space/Left/h Stop/start playing selected station.
98-
-/+ or ,/. Change volume.
99-
m Mute.
100-
v Save volume (not applicable for vlc).
101-
o s R Open / Save / Reload playlist.
102-
DEL,x Delete selected station.
103-
t T Load theme / Toggle transparency.
104-
? Show keys help.
105-
Esc/q Quit.</pre>
92+
<pre> Main window Playlists window Themes window
93+
------------------------------------------------------------------------------------------------------------------------------
94+
Up/Down/j/k/
95+
PgUp/PgDown Change station selection Change station playlist Change station theme
96+
g Jump to first station Jump to first playlist Jump to first theme
97+
&lt;n&gt;G Jump to n-th / last station Jump to n-th / last playlist Jump to n-th / last theme
98+
p Jump to playing station Jump to playing playlist -
99+
Enter/Right/l Play selected station Open selected playlist Apply selected theme
100+
r Select and play a random station Re-read playlists from disk -
101+
Space/Left/h Stop/start playing selected station - -
102+
Space - - Apply theme and make it default
103+
-/+ or ,/. Change volume [Valid] [Valid]
104+
m Mute / unmute player [Valid] [Valid]
105+
v Save volume (not applicable for vlc) [Valid] [Valid]
106+
o s R Open / Save / Reload playlist - -
107+
DEL,x Delete selected station - -
108+
t T Load theme / Toggle transparency [Valid] [Valid]
109+
? Show keys help [Valid] [Valid]
110+
# Redraw window [Valid] [Valid]
111+
Esc/q Quit - -
112+
Esc/q/Left/h - Cancel / close window Cancel / close window</pre>
106113
<h2 id="config-file">Config file</h2>
107114
<p><strong>PyRadio</strong> upon its execution tries to read its configuration file (i.e. <em>~/.config/pyradio/config</em>). If this file is not found, it will be created. If an error occurs while parsing it, an error message will be displayed and <strong><em>PyRadio</em></strong> will terminate.</p>
108115
<p>The file contains parameters such as the player to use, the playlist to load etc. It is heavily commented (as you can see <a href="pyradio/config">here</a>), so that manual editing is really easy. The best practice to manually edit this file is executing <strong><em>PyRadio</em></strong> with the <strong>-ocd</strong> command line option, which will open the configuration directory in your file manager, and then edit it using your preferable text editor.</p>
@@ -219,10 +226,12 @@ <h3 id="mplayer">MPlayer</h3>
219226
volstep=1
220227
volume=28</pre>
221228
<h2 id="pyradio-themes">PyRadio Themes</h2>
222-
<p><strong>PyRadio</strong> comes with 4 preconfigured (hard coded) themes:</p>
229+
<p><strong>PyRadio</strong> comes with 6 preconfigured (hard coded) themes:</p>
223230
<ol type="1">
224231
<li><strong>dark</strong> (8 color theme). This is the appearance <strong>PyRadio</strong> has always had. Enabled by default.</li>
225232
<li><strong>light</strong> (8 color theme). A theme for light terminal background settings.</li>
233+
<li><strong>dark_16_colors</strong> (16 color theme). “<strong>dark</strong>” theme alternative.</li>
234+
<li><strong>light_16_colors</strong> (16 color theme). “<strong>light</strong>” them alternative.</li>
226235
<li><strong>white_on_black</strong> or <strong>wob</strong> (256 color b&amp;w theme). A theme for dark terminal background settings.</li>
227236
<li><strong>black_on_white</strong> or <strong>bow</strong> (256 color b&amp;w theme). A theme for light terminal background settings.</li>
228237
</ol>

README.md

Lines changed: 28 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -74,20 +74,27 @@ The following options can also be set in **PyRadio**'s [configuration file](#con
7474
## Controls
7575

7676
```
77-
Up/Down/j/k/PgUp/PgDown Change station selection.
78-
g Jump to first station.
79-
<n>G Jump to n-th / last station.
80-
Enter/Right/l Play selected station.
81-
r Select and play a random station.
82-
Space/Left/h Stop/start playing selected station.
83-
-/+ or ,/. Change volume.
84-
m Mute.
85-
v Save volume (not applicable for vlc).
86-
o s R Open / Save / Reload playlist.
87-
DEL,x Delete selected station.
88-
t T Load theme / Toggle transparency.
89-
? Show keys help.
90-
Esc/q Quit.
77+
Main window Playlists window Themes window
78+
------------------------------------------------------------------------------------------------------------------------------
79+
Up/Down/j/k/
80+
PgUp/PgDown Change station selection Change station playlist Change station theme
81+
g Jump to first station Jump to first playlist Jump to first theme
82+
<n>G Jump to n-th / last station Jump to n-th / last playlist Jump to n-th / last theme
83+
p Jump to playing station Jump to playing playlist -
84+
Enter/Right/l Play selected station Open selected playlist Apply selected theme
85+
r Select and play a random station Re-read playlists from disk -
86+
Space/Left/h Stop/start playing selected station - -
87+
Space - - Apply theme and make it default
88+
-/+ or ,/. Change volume [Valid] [Valid]
89+
m Mute / unmute player [Valid] [Valid]
90+
v Save volume (not applicable for vlc) [Valid] [Valid]
91+
o s R Open / Save / Reload playlist - -
92+
DEL,x Delete selected station - -
93+
t T Load theme / Toggle transparency [Valid] [Valid]
94+
? Show keys help [Valid] [Valid]
95+
# Redraw window [Valid] [Valid]
96+
Esc/q Quit - -
97+
Esc/q/Left/h - Cancel / close window Cancel / close window
9198
```
9299

93100
## Config file
@@ -219,7 +226,7 @@ Station1,Station1_URL,
219226
Station2,Station2_URL,iso-8859-7
220227
```
221228

222-
**Note:**
229+
**Note:**
223230
Using the ***-a*** command line option will save you all this trouble, as it will automatically take care of creating a valid ***CSV*** file.
224231

225232
### Global encoding declaration
@@ -312,12 +319,14 @@ Example:
312319

313320
## PyRadio Themes
314321

315-
**PyRadio** comes with 4 preconfigured (hard coded) themes:
322+
**PyRadio** comes with 6 preconfigured (hard coded) themes:
316323

317324
1. **dark** (8 color theme). This is the appearance **PyRadio** has always had. Enabled by default.
318325
2. **light** (8 color theme). A theme for light terminal background settings.
319-
3. **white_on_black** or **wob** (256 color b&w theme). A theme for dark terminal background settings.
320-
4. **black_on_white** or **bow** (256 color b&w theme). A theme for light terminal background settings.
326+
3. **dark_16_colors** (16 color theme). "**dark**" theme alternative.
327+
4. **light_16_colors** (16 color theme). "**light**" them alternative.
328+
5. **white_on_black** or **wob** (256 color b&w theme). A theme for dark terminal background settings.
329+
6. **black_on_white** or **bow** (256 color b&w theme). A theme for light terminal background settings.
321330

322331
The visual result of an applied theme greatly depends on the terminal settings (e.g. foreground and background color settings, palette used, number of colors supported, real or pseudo-transparency support, etc.)
323332

@@ -333,7 +342,7 @@ The use of custom themes and theme editing is not implemented yet; theses are fe
333342

334343
**PyRadio** themes are able to be used with a transparent background.
335344

336-
Pressing "**T**" will toggle the transparency setting and save this state in **PyRadio**'s configuration file (transparency is off by default).
345+
Pressing "**T**" will toggle the transparency setting and save this state in **PyRadio**'s configuration file (transparency is off by default).
337346

338347
Setting transparency on, will actually force **PyRadio** to not use its own background color, effectively making it to display whatever is on the terminal (color/picture/transparency). The visual result depends on terminal settings and whether a compositor is running.
339348

build.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
dl {margin: 2em;}
1313
dd {margin: 1em;}
1414
dt {font-weight: bold;}
15-
pre { background-color: #F6F6F6; padding: 1.5em; border: 1px solid #E6E6E6;}
15+
pre { background-color: #F6F6F6; padding: 1.5em; border: 1px solid #E6E6E6; overflow: auto;}
1616
code{white-space: pre-wrap;}
1717
span.smallcaps{font-variant: small-caps;}
1818
span.underline{text-decoration: underline;}

devel/pre-commit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ do
2121
dl {margin: 2em;} \
2222
dd {margin: 1em;} \
2323
dt {font-weight: bold;} \
24-
pre { background-color: #F6F6F6; padding: 1.5em; border: 1px solid #E6E6E6;}' ${out}
24+
pre { background-color: #F6F6F6; padding: 1.5em; border: 1px solid #E6E6E6; overflow: auto;}' ${out}
2525
sed -i -e 's/<code>//g' \
2626
-e 's{</code>{{g' \
2727
-e 's{<a href="#pyradio">pyradio</a>{[pyradio]{' \

pyradio.1

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,13 +345,17 @@ volume=28
345345
.SH PYRADIO THEMES
346346
.PP
347347

348-
\fBpyradio\fR comes with 4 preconfigured (hard coded) themes:
348+
\fBpyradio\fR comes with 6 preconfigured (hard coded) themes:
349349

350350
.IP \fBdark\fR\ (8\ color\ theme)
351351
This is the appearance \fBpyradio\fR has always had. Enabled by default.
352352
.IP \fBlight\fR\ (8\ color\ theme)
353353
A theme for light terminal background settings.
354-
.IP \fBwhite_on_black\fR\ or\ \fBwob\fR \(256\ color\ b&w\ theme)
354+
.IP \fBdark_16_colors\fR\ (16\ color\ theme)
355+
\fIdark\fR theme alternative.
356+
.IP \fBlight_16_colors\fR\ (16\ color\ theme)
357+
\fIlight\fR theme alternative.
358+
.IP \fBwhite_on_black\fR\ or\ \fBwob\fR\ (256\ color\ b&w\ theme)
355359
A theme for dark terminal background settings.
356360
.IP \fBblack_on_white\fR\ or\ \fBbow\fR\ (256\ color\ b&w\ theme)
357361
A theme for light terminal background settings.

pyradio/config.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,14 @@ def list_playlists(self):
404404
for i, a_playlist in enumerate(self.playlists):
405405
print(' {0}. {1}'.format(str(i+1).rjust(pad), a_playlist[0]))
406406

407+
def current_playlist_index(self):
408+
if logger.isEnabledFor(logging.ERROR):
409+
if not self.playlists:
410+
self.read_playlists()
411+
for i, a_playlist in enumerate(self.playlists):
412+
if a_playlist[0] == self.stations_filename_only_no_extension:
413+
return i
414+
407415
class PyRadioConfig(PyRadioStations):
408416

409417
def __init__(self):

0 commit comments

Comments
 (0)