Skip to content

Commit 43b208f

Browse files
committed
version 0.9.0
- Radio Browser Search Terms will now be saved (when altered from config) - fixing config search terms color when focus lost - fixing search term not shown on Windows - fixing 'd' for config window - fixing dirty config indication for python2 - updating docs
1 parent 3aafefd commit 43b208f

9 files changed

+74
-40
lines changed

Changelog

+12
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
2023-01-28 s-n-g
2+
* version 0.9.0
3+
* finalizing Radio Browser service (adding config
4+
search term navigation), closing #93 and partially
5+
closing #80
6+
* adding search function to all stations/playlists
7+
lists
8+
* when terminal cannot change colors, always ask to
9+
not display the warning message
10+
* window title will not be resetted randomly
11+
* fixing python2 config dirty indication
12+
113
2023-01-16 s-n-g
214
* version 0.8.9.36 (0.9-beta33)
315
* fixing config win left ("h") key: will not exit when should be

README.html

+12
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,18 @@ <h2 id="requirements">Requirements <span style="padding-left: 10px;"><sup style=
192192
<h2 id="changelog">Changelog <span style="padding-left: 10px;"><sup style="font-size: 50%"><a href="#" title="Go to top of the page">Top</a></sup></span></h2>
193193
<pre style="height: 200px;">
194194

195+
2023-01-28 s-n-g
196+
* version 0.9.0
197+
* finalizing Radio Browser service (adding config
198+
search term navigation), closing #93 and partially
199+
closing #80
200+
* adding search function to all stations/playlists
201+
lists
202+
* when terminal cannot change colors, always ask to
203+
not display the warning message
204+
* window title will not be resetted randomly
205+
* fixing python2 config dirty indication
206+
195207
2023-01-16 s-n-g
196208
* version 0.8.9.36 (0.9-beta33)
197209
* fixing config win left ("h") key: will not exit when should be

pyradio/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
" pyradio -- Console radio player. "
22

3-
version_info = (0, 8, 9, 36)
3+
version_info = (0, 9, 0)
44

55
# Set it to True if new stations have been
66
# added to the package's stations.csv

pyradio/browser.py

+34-25
Original file line numberDiff line numberDiff line change
@@ -1704,12 +1704,16 @@ def __init__(
17041704
'ping_count': 1,
17051705
'ping_timeout': 1,
17061706
'terms': [{
1707+
'type': '',
1708+
'term': current_limit,
1709+
'post_data': {}
1710+
},
1711+
{
17071712
'type': 'topvote',
17081713
'term': '100',
17091714
'post_data': {'reverse': 'true'}
17101715
}]},
17111716
)
1712-
# self._print_params()
17131717
self._win = self._parent = parent
17141718
self.maxY, self.maxX = self._parent.getmaxyx()
17151719

@@ -1749,8 +1753,11 @@ def __init__(
17491753
self._global_functions = {}
17501754
if global_functions is not None:
17511755
self._global_functions = global_functions.copy()
1756+
if ord('d') in self._global_functions.keys():
1757+
del self._global_functions[ord('d')]
17521758
if ord('t') in self._global_functions.keys():
17531759
del self._global_functions[ord('t')]
1760+
# self._print_params()
17541761

17551762
@property
17561763
def urls(self):
@@ -1851,13 +1858,6 @@ def _init_set_working_params(self,
18511858
self._params[1]['limit'] = self._params[0]['limit']
18521859
self._params[1]['terms'] = deepcopy(self._params[0]['terms'])
18531860

1854-
for n in self._params[0].keys():
1855-
if n == 'terms':
1856-
for i, k in enumerate(self._params[0][n]):
1857-
logger.error('term {0}: {1}'.format(i, k))
1858-
else:
1859-
logger.error('{0}: {1}'.format(n, self._params[0][n]))
1860-
18611861
def _revert_to_saved_params(self):
18621862
self._revert_params(1)
18631863

@@ -1888,9 +1888,11 @@ def _revert_params(self, index):
18881888
self._widgets[4].string = self._params[0]['server'] if self._params[0]['server'] else 'Random'
18891889
# TODO: set of ping count and timeout
18901890
self._fix_ping_enable()
1891+
self._widgets[-1].set_data(self._params[0]['default'], self._params[0]['limit'], self._params[0]['terms'])
18911892
for n in self._widgets:
1892-
n.show(self._win)
1893+
n.show(self._win)
18931894
self._win.refresh()
1895+
# self._widgets[-1].refresh()
18941896
# self._print_params()
18951897

18961898
def _fix_ping_enable(self):
@@ -2249,7 +2251,6 @@ def keypress(self, char):
22492251

22502252
elif char == ord('d'):
22512253
self._revert_to_default_params()
2252-
self._config.dirty = False
22532254
self.calculate_dirty()
22542255

22552256
elif char in (curses.KEY_UP, ord('j')):
@@ -4447,6 +4448,11 @@ def selection(self, val):
44474448
self._selection = val
44484449
self.show()
44494450

4451+
def set_data(self, default, default_limit, items):
4452+
self._selection = self._default = default
4453+
self._default_limit = default_limit
4454+
self._items = deepcopy(items)
4455+
44504456
def get_result(self):
44514457
return self._default, self._items
44524458

@@ -4465,12 +4471,12 @@ def _get_win(self):
44654471
def refresh(self, parent=None):
44664472
self.show(parent)
44674473

4468-
def _print_post_data(self, token):
4474+
def _print_post_data(self, token, col):
44694475
str_out = 15 * ' '
44704476
if 'post_data' in self._items[self._selection]:
44714477
if token in self._items[self._selection]['post_data']:
44724478
str_out = '{}'.format(self._items[self._selection]['post_data'][token].ljust(15))
4473-
self._win.addstr(str_out, self._header_color)
4479+
self._win.addstr(str_out, col)
44744480

44754481
def show(self, parent=None):
44764482
if self._focused:
@@ -4507,18 +4513,18 @@ def show(self, parent=None):
45074513
self._win.addstr('/{} '.format(len(self._items) - 1), self._color)
45084514

45094515
if self._selection == 0:
4510-
self._win.addstr(' Template Item!', col)
4516+
self._win.addstr(' Template Item! ', col)
45114517
elif self._selection == self._default:
4512-
self._win.addstr(' Default Item! ', col)
4518+
self._win.addstr(' Default Item! ', col)
45134519
else:
4514-
self._win.addstr(' ', col)
4520+
self._win.addstr(' ', col)
45154521

45164522
self._win.addstr(1, 0, ' Type: ', self._color)
45174523
str_out = 15 * ' '
45184524
if self._items:
45194525
if 'type' in self._items[self._selection].keys():
45204526
str_out = self._items[self._selection]['type'].ljust(15)
4521-
self._win.addstr(str_out, self._header_color)
4527+
self._win.addstr(str_out, col)
45224528

45234529
self._win.addstr(1, 25, ' Limit: ', self._color)
45244530
str_out = 15 * ' '
@@ -4535,10 +4541,10 @@ def show(self, parent=None):
45354541
else:
45364542
if limit != '':
45374543
str_out = '{}'.format(limit)
4538-
self._win.addstr(str_out, self._header_color)
4544+
self._win.addstr(str_out, col)
45394545

45404546
self._win.addstr(' Codec: ', self._color)
4541-
self._print_post_data('codec')
4547+
self._print_post_data('codec', col)
45424548

45434549
self._win.addstr(2, 0, ' Term: ', self._color)
45444550
str_out = 15 * ' '
@@ -4553,23 +4559,23 @@ def show(self, parent=None):
45534559
x = self._items[self._selection]['term']
45544560
except TypeError:
45554561
x = str(self._items[self._selection]['term'])
4556-
str_out = x
4557-
self._win.addstr(str_out, self._header_color)
4562+
str_out = x.ljust(15)
4563+
self._win.addstr(str_out, col)
45584564

45594565
self._win.addstr(2, 25, ' Language: ', self._color)
4560-
self._print_post_data('language')
4566+
self._print_post_data('language', col)
45614567

45624568
self._win.addstr(3, 0, ' Name: ', self._color)
4563-
self._print_post_data('name')
4569+
self._print_post_data('name', col)
45644570

45654571
self._win.addstr(3, 25, ' Tag: ', self._color)
4566-
self._print_post_data('tag')
4572+
self._print_post_data('tag', col)
45674573

45684574
self._win.addstr(4, 0, ' Country: ', self._color)
4569-
self._print_post_data('country')
4575+
self._print_post_data('country', col)
45704576

45714577
self._win.addstr(4, 25, ' State: ', self._color)
4572-
self._print_post_data('state')
4578+
self._print_post_data('state', col)
45734579

45744580
self._win.addstr(5, 0, ' Sorting: ', self._color)
45754581
if self._items:
@@ -4595,6 +4601,9 @@ def show(self, parent=None):
45954601

45964602
self._win.hline(6, 0, ' ', self._width, fcol)
45974603
self._win.addstr(6, 0, ' Extra keys: x - delete item , Space - make item default', fcol)
4604+
# do this for windows
4605+
self._win.touchwin()
4606+
#####################
45984607
self._win.refresh()
45994608
self._showed = True
46004609

pyradio/config_window.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -299,11 +299,10 @@ def _print_title(self):
299299
self._cnf.dirty_config = True
300300
col = 12
301301
X = int((self.maxX - len(self._title) - 1) / 2)
302-
for i, n in enumerate(dirty_title):
303-
try:
304-
self._win.addstr(0, X+i, n, curses.color_pair(col))
305-
except:
306-
self._win.addstr(0, X+1, n.encode('utf-8'), curses.color_pair(col))
302+
try:
303+
self._win.addstr(0, X, dirty_title, curses.color_pair(col))
304+
except:
305+
self._win.addstr(0, X, dirty_title.encode('utf-8'), curses.color_pair(col))
307306
self._win.addstr(self._title + ' ', curses.color_pair(4))
308307

309308
if self._cnf.distro != 'None':

pyradio/simple_curses_widgets.py

-2
Original file line numberDiff line numberDiff line change
@@ -865,7 +865,6 @@ def value(self):
865865
@value.setter
866866
def value(self, val):
867867
self._value = int(val)
868-
logger.error('Count: {}'.format(self._value))
869868

870869
@property
871870
def minimum(self):
@@ -4147,7 +4146,6 @@ def value(self):
41474146
@value.setter
41484147
def value(self, val):
41494148
self._value = val
4150-
logger.error('Bool: {}'.format(self._value))
41514149

41524150
def _print_full_line(self, col):
41534151
tmp = self._full_selection[0] * ' ' + self._prefix + str(self._value) + self._suffix

pyradio_rb.1

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.\" Copyright (C) 2018-2023 Spiros Georgaras <[email protected]>
22
.\" This manual is freely distributable under the terms of the GPL.
33
.\"
4-
.TH pyradio_rb 1 "May 2022" pyradio
4+
.TH pyradio_rb 1 "January 2023" pyradio
55

66
.SH Name
77
.PP
@@ -127,9 +127,11 @@ Default value: \fI1\fR
127127
The default server to connect to when using the service.
128128

129129
Default value: \fIRandom\fR
130-
.IP \fI6.\fR\ \fBDefault\ Search\ Term
130+
.IP \fI6.\fR\ \fBSearch\ Terms
131131

132-
Not implemented yet
132+
User defined \fISearch Terms\fR displayed in a compact way.
133+
134+
Available actions: change the \fBdefault\fR search term and \fBdelete\fR existing search terms.
133135

134136
.RE
135137

radio-browser.html

+3-2
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,9 @@ <h2 id="configuration">Configuration <span style="padding-left: 10px;"><sup styl
159159
<li><p><strong>Default Server</strong><br />
160160
The default server to connect to when using the service.<br />
161161
Default value: <em>Random</em></p></li>
162-
<li><p><strong>Default Search Term</strong><br />
163-
Not implemented yet</p></li>
162+
<li><p><strong>Search Terms</strong><br />
163+
User defined “<em>Search Terms</em>” displayed in a compact way.<br />
164+
Available actions: change the <strong>default</strong> search term and <strong>delete</strong> existing search terms.</p></li>
164165
</ol>
165166
<h3 id="server-pinging">Server pinging</h3>
166167
<p><strong>RadioBrowser</strong> currently provides a network of 3 servers to connect to (always kept in sync with each other), in order to limit down time.</p>

radio-browser.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,9 @@ Default value: *1*
116116
The default server to connect to when using the service.\
117117
Default value: *Random*
118118

119-
6. **Default Search Term**\
120-
Not implemented yet
119+
6. **Search Terms**\
120+
User defined "*Search Terms*" displayed in a compact way. \
121+
Available actions: change the **default** search term and **delete** existing search terms.
121122

122123
### Server pinging
123124

0 commit comments

Comments
 (0)