Skip to content

Commit

Permalink
- Version 0.8.9.7 (0.9-beta4)
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
s-n-g committed Aug 20, 2021
1 parent 434a586 commit 66ff258
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 51 deletions.
5 changes: 4 additions & 1 deletion Changelog
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
2021-08-18 s-n-g
2021-08-20 s-n-g
* Version 0.8.9.7 (0.9-beta4)
* RadioBrowser: closing with "q" or "Escape"
* RadioBrowser: do not close if network fails
* RadioBrowser: added hidebroken to all queries
* RadioBrowser: if limit=0, disable result limit
* RadioBrowser: finalized config save / read function
* RadioBrowser: All Search Window movement keys (^N, ^P, ^Y)
will add a new history item (if possible)
* RadioBrowser: ^B does not save history to file
* RadioBrowser: Better navigation in the Search Window
* Fixed a couple of python 2 crashes
* Updated docs
Expand Down
2 changes: 1 addition & 1 deletion pyradio.1
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.\" Copyright (C) 2011 Ben Dowling <http://www.coderholic.com/pyradio>
.\" This manual is freely distributable under the terms of the GPL.
.\"
.TH pyradio1 "August 2021" PyRadio
.TH pyradio 1 "August 2021" PyRadio

.SH Name
.PP
Expand Down
12 changes: 11 additions & 1 deletion pyradio/browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -2251,6 +2251,10 @@ def keypress(self, char):

elif char in (curses.ascii.SO, ):
''' ^N - Next history item '''
cur_history_id = self._selected_history_id
self._handle_new_or_existing_search_term()
if abs(self._selected_history_id - cur_history_id) > 1:
self._selected_history_id = cur_history_id
if len(self._history) > 1:
self._selected_history_id += 1
if self._selected_history_id >= len(self._history):
Expand All @@ -2260,6 +2264,10 @@ def keypress(self, char):

elif char in (curses.ascii.DLE, ):
''' ^P - Previous history item '''
cur_history_id = self._selected_history_id
self._handle_new_or_existing_search_term()
if abs(self._selected_history_id - cur_history_id) > 1:
self._selected_history_id = cur_history_id
if len(self._history) > 1:
self._selected_history_id -= 1
if self._selected_history_id <0:
Expand All @@ -2278,6 +2286,7 @@ def keypress(self, char):

elif char in (curses.ascii.CAN, ):
''' ^X - Delete history item '''
self._handle_new_or_existing_search_term()
if len(self._history) > 2 and \
self._selected_history_id > 0:
if self._default_history_id == self._selected_history_id:
Expand All @@ -2301,7 +2310,8 @@ def keypress(self, char):
self._print_history_legend()
self._win.refresh()
''' returning 5 will triger history save '''
return 5
# return 5
self._cnf.dirty = True

elif char in (curses.ascii.EM, ):
''' ^Y - Set default item '''
Expand Down
52 changes: 27 additions & 25 deletions pyradio/radio.py
Original file line number Diff line number Diff line change
Expand Up @@ -4332,7 +4332,7 @@ def _ask_to_save_browser_config(self):
|{}|'s service configuration has been
altered but not saved. Do you want to save it now?
Press |y| to save it or any other key to decline.
Press |y| to save it or |n| to disregard it.
'''
self._show_help(txt.format(self._cnf.online_browser.BROWSER_NAME),
mode_to_set=self.ws.ASK_TO_SAVE_BROWSER_CONFIG,
Expand Down Expand Up @@ -5334,30 +5334,32 @@ def keypress(self, char):
return

elif self.ws.operation_mode == self.ws.ASK_TO_SAVE_BROWSER_CONFIG:
self.ws.close_window()
self.stations = self._cnf.stations
self._align_stations_and_refresh(self.ws.PLAYLIST_MODE,
a_startPos=self.startPos,
a_selection=self.selection,
force_scan_playlist=True)
if self.playing < 0:
self._put_selection_in_the_middle(force=True)
self.refreshBody()
if char == ord('y'):
if self._cnf._online_browser.save_config():
self._show_notification_with_delay(
txt='___History successfully saved!___',
mode_to_set=self.ws.NORMAL_MODE,
callback_function=self.refreshBody)
else:
self._show_notification_with_delay(
txt='___Error saving History!___',
delay=1.25,
mode_to_set=self.ws.NORMAL_MODE,
callback_function=self.refreshBody)
self._cnf.online_browser = None
self._cnf.browsing_station_service = False
self._normal_mode_resize()
if char in (ord('n'), ord('n')):
self.ws.close_window()
self.stations = self._cnf.stations
self._align_stations_and_refresh(self.ws.PLAYLIST_MODE,
a_startPos=self.startPos,
a_selection=self.selection,
force_scan_playlist=True)
if self.playing < 0:
self._put_selection_in_the_middle(force=True)
self.refreshBody()
if char == ord('y'):
if self._cnf._online_browser.save_config():
self._show_notification_with_delay(
txt='___History successfully saved!___',
mode_to_set=self.ws.NORMAL_MODE,
callback_function=self.refreshBody)
else:
self._show_notification_with_delay(
txt='___Error saving History!___',
delay=1.25,
mode_to_set=self.ws.NORMAL_MODE,
callback_function=self.refreshBody)
self._cnf.online_browser = None
self._cnf.browsing_station_service = False
self._normal_mode_resize()
return

elif self.ws.operation_mode == self.ws.CLEAR_REGISTER_MODE:
if char in (ord('y'), ord('n')):
Expand Down
10 changes: 4 additions & 6 deletions pyradio_rb.1
Original file line number Diff line number Diff line change
Expand Up @@ -209,16 +209,14 @@ Save the history.

.RE
.RS 5
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.

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.
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.

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.
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.

To really save the "new" history, press "\fI^V\fR" in the \fBSearch Window\fR.
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.

.IP \fBNote:
The history is also saved to file when one changes the "\fIdefault\fR" item, pressing "\fI^B\fR" in the \fBSearch Window\fR.
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.
.RE

.SH Reporting Bugs
Expand Down
15 changes: 7 additions & 8 deletions radio-browser.html
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ <h3 id="searching-in-the-list-of-stations">Searching in the list of stations</h3
<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>
<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>
<h3 id="sorting-stations">Sorting stations</h3>
<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>
<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>
<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>
<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>
<p>These are the <strong>RadioBrowser</strong> specific keys one can use in addition to local playlist keys (if applicable).</p>
Expand Down Expand Up @@ -125,17 +125,17 @@ <h2 id="controls">Controls <span style="padding-left: 10px;"><sup style="font-si
<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>
<p>This feature has not been implemented yet.</p>
<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>
<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>
<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>
<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>
<p><strong>RadioBrowser</strong> provides two ways to measure a station’s popularity: voting and clicking.</p>
<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>
<p>For this reason <strong>PyRadio</strong> will in no case adjust the click count presented to the user.</p>
<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>
<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>
<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>
<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>
<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>
<p><strong>PyRadio</strong> will randomly select one of these servers and will display its location in its window title.</p>
<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>
<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>
<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>
<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>
<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>
Expand Down Expand Up @@ -206,10 +206,9 @@ <h3 id="history-management">History Management</h3>
</tr>
</tbody>
</table>
<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>
<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>
<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>
<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>
<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>
<p>To really save the “new” history, press “<strong>^V</strong>” in the <strong>Search Window</strong>.</p>
<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>
<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>
</body>
</html>
Loading

0 comments on commit 66ff258

Please sign in to comment.