Skip to content

Commit 66ff258

Browse files
committed
- Version 0.8.9.7 (0.9-beta4)
- All Search Window movement keys (^N, ^P, ^Y) ill add a new history item (if possible) - ^B does not save history to file - Do not close browser if network fails - Fixing a couple of python 2 crashes
1 parent 434a586 commit 66ff258

File tree

7 files changed

+61
-51
lines changed

7 files changed

+61
-51
lines changed

Changelog

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1-
2021-08-18 s-n-g
1+
2021-08-20 s-n-g
22
* Version 0.8.9.7 (0.9-beta4)
33
* RadioBrowser: closing with "q" or "Escape"
44
* RadioBrowser: do not close if network fails
55
* RadioBrowser: added hidebroken to all queries
66
* RadioBrowser: if limit=0, disable result limit
77
* RadioBrowser: finalized config save / read function
8+
* RadioBrowser: All Search Window movement keys (^N, ^P, ^Y)
9+
will add a new history item (if possible)
10+
* RadioBrowser: ^B does not save history to file
811
* RadioBrowser: Better navigation in the Search Window
912
* Fixed a couple of python 2 crashes
1013
* Updated docs

pyradio.1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.\" Copyright (C) 2011 Ben Dowling <http://www.coderholic.com/pyradio>
22
.\" This manual is freely distributable under the terms of the GPL.
33
.\"
4-
.TH pyradio1 "August 2021" PyRadio
4+
.TH pyradio 1 "August 2021" PyRadio
55

66
.SH Name
77
.PP

pyradio/browser.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2251,6 +2251,10 @@ def keypress(self, char):
22512251

22522252
elif char in (curses.ascii.SO, ):
22532253
''' ^N - Next history item '''
2254+
cur_history_id = self._selected_history_id
2255+
self._handle_new_or_existing_search_term()
2256+
if abs(self._selected_history_id - cur_history_id) > 1:
2257+
self._selected_history_id = cur_history_id
22542258
if len(self._history) > 1:
22552259
self._selected_history_id += 1
22562260
if self._selected_history_id >= len(self._history):
@@ -2260,6 +2264,10 @@ def keypress(self, char):
22602264

22612265
elif char in (curses.ascii.DLE, ):
22622266
''' ^P - Previous history item '''
2267+
cur_history_id = self._selected_history_id
2268+
self._handle_new_or_existing_search_term()
2269+
if abs(self._selected_history_id - cur_history_id) > 1:
2270+
self._selected_history_id = cur_history_id
22632271
if len(self._history) > 1:
22642272
self._selected_history_id -= 1
22652273
if self._selected_history_id <0:
@@ -2278,6 +2286,7 @@ def keypress(self, char):
22782286

22792287
elif char in (curses.ascii.CAN, ):
22802288
''' ^X - Delete history item '''
2289+
self._handle_new_or_existing_search_term()
22812290
if len(self._history) > 2 and \
22822291
self._selected_history_id > 0:
22832292
if self._default_history_id == self._selected_history_id:
@@ -2301,7 +2310,8 @@ def keypress(self, char):
23012310
self._print_history_legend()
23022311
self._win.refresh()
23032312
''' returning 5 will triger history save '''
2304-
return 5
2313+
# return 5
2314+
self._cnf.dirty = True
23052315

23062316
elif char in (curses.ascii.EM, ):
23072317
''' ^Y - Set default item '''

pyradio/radio.py

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4332,7 +4332,7 @@ def _ask_to_save_browser_config(self):
43324332
|{}|'s service configuration has been
43334333
altered but not saved. Do you want to save it now?
43344334
4335-
Press |y| to save it or any other key to decline.
4335+
Press |y| to save it or |n| to disregard it.
43364336
'''
43374337
self._show_help(txt.format(self._cnf.online_browser.BROWSER_NAME),
43384338
mode_to_set=self.ws.ASK_TO_SAVE_BROWSER_CONFIG,
@@ -5334,30 +5334,32 @@ def keypress(self, char):
53345334
return
53355335

53365336
elif self.ws.operation_mode == self.ws.ASK_TO_SAVE_BROWSER_CONFIG:
5337-
self.ws.close_window()
5338-
self.stations = self._cnf.stations
5339-
self._align_stations_and_refresh(self.ws.PLAYLIST_MODE,
5340-
a_startPos=self.startPos,
5341-
a_selection=self.selection,
5342-
force_scan_playlist=True)
5343-
if self.playing < 0:
5344-
self._put_selection_in_the_middle(force=True)
5345-
self.refreshBody()
5346-
if char == ord('y'):
5347-
if self._cnf._online_browser.save_config():
5348-
self._show_notification_with_delay(
5349-
txt='___History successfully saved!___',
5350-
mode_to_set=self.ws.NORMAL_MODE,
5351-
callback_function=self.refreshBody)
5352-
else:
5353-
self._show_notification_with_delay(
5354-
txt='___Error saving History!___',
5355-
delay=1.25,
5356-
mode_to_set=self.ws.NORMAL_MODE,
5357-
callback_function=self.refreshBody)
5358-
self._cnf.online_browser = None
5359-
self._cnf.browsing_station_service = False
5360-
self._normal_mode_resize()
5337+
if char in (ord('n'), ord('n')):
5338+
self.ws.close_window()
5339+
self.stations = self._cnf.stations
5340+
self._align_stations_and_refresh(self.ws.PLAYLIST_MODE,
5341+
a_startPos=self.startPos,
5342+
a_selection=self.selection,
5343+
force_scan_playlist=True)
5344+
if self.playing < 0:
5345+
self._put_selection_in_the_middle(force=True)
5346+
self.refreshBody()
5347+
if char == ord('y'):
5348+
if self._cnf._online_browser.save_config():
5349+
self._show_notification_with_delay(
5350+
txt='___History successfully saved!___',
5351+
mode_to_set=self.ws.NORMAL_MODE,
5352+
callback_function=self.refreshBody)
5353+
else:
5354+
self._show_notification_with_delay(
5355+
txt='___Error saving History!___',
5356+
delay=1.25,
5357+
mode_to_set=self.ws.NORMAL_MODE,
5358+
callback_function=self.refreshBody)
5359+
self._cnf.online_browser = None
5360+
self._cnf.browsing_station_service = False
5361+
self._normal_mode_resize()
5362+
return
53615363

53625364
elif self.ws.operation_mode == self.ws.CLEAR_REGISTER_MODE:
53635365
if char in (ord('y'), ord('n')):

pyradio_rb.1

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -209,16 +209,14 @@ Save the history.
209209

210210
.RE
211211
.RS 5
212-
Here is one thing you should take notice of: after inserting some data into any of the various fields, do not navigate to another \fIsearch term\fR before adding it to the history; all your changes will be lost.
213212

214-
Another thing you should be aware of, is that the \fBSearch Window\fR actually works on a copy of the \fIsearch history\fR used by the service itself, so any changes made in it (adding and deleting items) are not passed to the service, until "\fIOK\fR" is pressed. Pressing "\fICancel\fR" will make all the changes go away.
213+
All movement actions (\fI^N\fR, \fI^P\fR, \fI^Y\fR) will check if the data currently in the "form" fields can create a new \fBsearch term\fR and if so, will add it to the history.
215214

216-
Even when "\fIOK\fR" is pressed, and the "\fBSearch Window\fR" is closed, the "new" history is loaded into the service, but \fBNOT\fR saved to the \fIconfiguration file\fR.
215+
Tthe \fBSearch Window\fR actually works on a copy of the \fIsearch history\fR used by the service itself, so any changes made in it (adding and deleting items) are not passed to the service, until "\fIOK\fR" is pressed. Pressing "\fICancel\fR" will make all the changes go away.
217216

218-
To really save the "new" history, press "\fI^V\fR" in the \fBSearch Window\fR.
217+
Even when "\fIOK\fR" is pressed, and the "\fBSearch Window\fR" is closed, the "new" history is loaded into the service, but \fBNOT\fR saved to the \fIconfiguration file\fR.
219218

220-
.IP \fBNote:
221-
The history is also saved to file when one changes the "\fIdefault\fR" item, pressing "\fI^B\fR" in the \fBSearch Window\fR.
219+
To really save the "new" history, press "\fI^V\fR" in the \fBSearch Window\fR, or press "\fIy\fR" in the confirmation window upon exiting the service.
222220
.RE
223221

224222
.SH Reporting Bugs

radio-browser.html

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ <h3 id="searching-in-the-list-of-stations">Searching in the list of stations</h3
7676
<p>The normal local playlist search function has been enhanced in order to be able to search through the list of stations, since each station has a lot more info attached to it.</p>
7777
<p>Searching for any string will return matches in the “<strong>Name</strong>” field only (just like in a local playlist), but starting the search string with a plus sign (“<strong>+</strong>”) will produce results from all available fields (visible or not).</p>
7878
<h3 id="sorting-stations">Sorting stations</h3>
79-
<p>Pressing “<strong>S</strong>(capital “s”) will present the user with a sorting list. Selecting one of the items will sort the stations based on it; selecting it again will reverse sorting order.</p>
79+
<p>Pressing “<strong>S</strong>” will present the user with a sorting list. Selecting one of the items will sort the stations based on it; selecting it again will reverse sorting order.</p>
8080
<p style="margin: 1.5em 4em 0 4em; text-indent: -2.5em;"><strong>Note:</strong> This sorting function is different than the query sorting criterion which can be selected in the <a href="#search-window">Search window</a>. This one just sorts a query result set, the one in the “<strong>Search window</strong>” affects the actual stations that will be in the result set.</p>
8181
<h2 id="controls">Controls <span style="padding-left: 10px;"><sup style="font-size: 50%"><a href="#" title="Go to top of the page">Top</a></sup></style></h2>
8282
<p>These are the <strong>RadioBrowser</strong> specific keys one can use in addition to local playlist keys (if applicable).</p>
@@ -125,17 +125,17 @@ <h2 id="controls">Controls <span style="padding-left: 10px;"><sup style="font-si
125125
<h2 id="configuration">Configuration <span style="padding-left: 10px;"><sup style="font-size: 50%"><a href="#" title="Go to top of the page">Top</a></sup></style></h2>
126126
<p>This feature has not been implemented yet.</p>
127127
<h2 id="station-database-information">Station Database Information <span style="padding-left: 10px;"><sup style="font-size: 50%"><a href="#" title="Go to top of the page">Top</a></sup></style></h2>
128-
<p>The database information of the selected station can be displayed by pressing “<strong>I</strong> (capital “i”). Keep in mind that, this is different than the “Station ino” displayed by pressing “<strong>i</strong>” (lowercase “i”), which is still available and presents live data.</p>
128+
<p>The database information of the selected station can be displayed by pressing “<strong>I</strong>”. Keep in mind that, this is different than the “Station ino” displayed by pressing “<strong>i</strong>” (lowercase “i”), which is still available and presents live data.</p>
129129
<h2 id="station-clicking-and-voting">Station clicking and voting <span style="padding-left: 10px;"><sup style="font-size: 50%"><a href="#" title="Go to top of the page">Top</a></sup></style></h2>
130130
<p><strong>RadioBrowser</strong> provides two ways to measure a station’s popularity: voting and clicking.</p>
131131
<p><strong>Clicking</strong> a station means that the station has been listened to; <strong>PyRadio</strong> will send a “click request” any time the user starts playback of a station; <strong>RadioBrowser</strong> will either reject or accept the action, and either ignore or increase click count for the station based on several criteria (time between consecutive clicks, possibly IP, etc.)</p>
132132
<p>For this reason <strong>PyRadio</strong> will in no case adjust the click count presented to the user.</p>
133-
<p><strong>Voting</strong> for a station is a different thing; the user has to choose to vote for it. In <strong>PyRadio</strong> a “vote request” is sent when “<strong>V</strong>(capital “v”) is pressed. If the vote has been accepted, the vote counter will be increased by one.</p>
133+
<p><strong>Voting</strong> for a station is a different thing; the user has to choose to vote for it. In <strong>PyRadio</strong> a “vote request” is sent when “<strong>V</strong>” is pressed. If the vote has been accepted, the vote counter will be increased by one.</p>
134134
<p style="margin: 1.5em 4em 0 4em; text-indent: -2.5em;"><strong>Note:</strong> Inconsistencies between a voted for station’s local vote counter value and the one reported in a consecutive server response should be expected, since it seems servers’ vote counter sync may take some time to complete.</p>
135135
<h2 id="server-selection">Server Selection <span style="padding-left: 10px;"><sup style="font-size: 50%"><a href="#" title="Go to top of the page">Top</a></sup></style></h2>
136136
<p><strong>RadioBrowser</strong> provides several servers to the public (currently in Germany, France and The Netherlands), which are constantly kept in sync. Its API provides a way to “discover” these servers and then select the one to use.</p>
137137
<p><strong>PyRadio</strong> will randomly select one of these servers and will display its location in its window title.</p>
138-
<p>Pressing “<strong>C</strong>(capital “c”) will provide a list of available servers to choose from. This selection will be honored until the service is closed.</p>
138+
<p>Pressing “<strong>C</strong>” will provide a list of available servers to choose from. This selection will be honored until the service is closed.</p>
139139
<h2 id="search-window">Search Window <span style="padding-left: 10px;"><sup style="font-size: 50%"><a href="#" title="Go to top of the page">Top</a></sup></style></h2>
140140
<p>The “<strong>Search window</strong>” opens when “<strong>s</strong>” is pressed and loads the “<strong>search term</strong>” that was used to fetch the stations currently presented in the “<strong>RadioBrowser window</strong>”. If this is the first time this window is opened within this session, the search term that’s loaded is the “<strong>default search term</strong>”.</p>
141141
<p style="margin: 1.5em 4em 0 4em; text-indent: -2.5em;"><strong>Note:</strong> In case the server returns no results, the window will automatically reopen so that you can redefine the “<strong>search term</strong>”.</p>
@@ -206,10 +206,9 @@ <h3 id="history-management">History Management</h3>
206206
</tr>
207207
</tbody>
208208
</table>
209-
<p>Here is one thing you should take notice of: after inserting some data into any of the various fields, do not navigate to another “<strong>search term</strong>” before adding it to history; all your changes will be lost.</p>
210-
<p>Another thing you should be aware of, is that the <strong>Search Window</strong> actually works on a copy of the <strong>search history</strong> used by the service itself, so any changes made in it (adding and deleting items) are not passed to the service, until “<strong>OK</strong>” is pressed. Pressing “<strong>Cancel</strong>” will make all the changes go away.</p>
209+
<p>All movement actions (<strong><sup>N<strong>, </strong></sup>P</strong>, <strong>^Y</strong>) will check if the data currently in the “form” fields can create a new <strong>search term</strong> and if so, will add it to the history.</p>
210+
<p>The <strong>Search Window</strong> actually works on a copy of the <strong>search history</strong> used by the service itself, so any changes made in it (adding and deleting items) are not passed to the service, until “<strong>OK</strong>” is pressed. Pressing “<strong>Cancel</strong>” will make all the changes go away.</p>
211211
<p>Even when “<strong>OK</strong>” is pressed, and the “<strong>Search Window</strong>” is closed, the “new” history is loaded into the service, but NOT saved to the <em>configuration file</em>.</p>
212-
<p>To really save the “new” history, press “<strong>^V</strong>” in the <strong>Search Window</strong>.</p>
213-
<p style="margin: 1.5em 4em 0 4em; text-indent: -2.5em;"><strong>Note:</strong> The history is also saved to file when one changes the “<strong>default</strong>” item, pressing “<strong>^B</strong>” in the <strong>Search Window</strong>.</p>
212+
<p>To really save the “new” history, press “<strong>^V</strong>” in the <strong>Search Window</strong>, or press “<strong>y</strong>” in the confirmation window upon exiting the service.</p>
214213
</body>
215214
</html>

0 commit comments

Comments
 (0)