diff --git a/Changelog b/Changelog index b672325d..8cb54550 100644 --- a/Changelog +++ b/Changelog @@ -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 diff --git a/pyradio.1 b/pyradio.1 index 4fe41c54..4aebbd22 100644 --- a/pyradio.1 +++ b/pyradio.1 @@ -1,7 +1,7 @@ .\" Copyright (C) 2011 Ben Dowling .\" 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 diff --git a/pyradio/browser.py b/pyradio/browser.py index 0145680a..562b2eba 100644 --- a/pyradio/browser.py +++ b/pyradio/browser.py @@ -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): @@ -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: @@ -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: @@ -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 ''' diff --git a/pyradio/radio.py b/pyradio/radio.py index 7ed30d2e..b18bbdaa 100644 --- a/pyradio/radio.py +++ b/pyradio/radio.py @@ -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, @@ -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')): diff --git a/pyradio_rb.1 b/pyradio_rb.1 index 5cbae035..c5a114fd 100644 --- a/pyradio_rb.1 +++ b/pyradio_rb.1 @@ -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 diff --git a/radio-browser.html b/radio-browser.html index 35dd361d..f70445ed 100644 --- a/radio-browser.html +++ b/radio-browser.html @@ -76,7 +76,7 @@

Searching in the list of stations

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.

Searching for any string will return matches in the “Name” field only (just like in a local playlist), but starting the search string with a plus sign (“+”) will produce results from all available fields (visible or not).

Sorting stations

-

Pressing “S” (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.

+

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

Note: This sorting function is different than the query sorting criterion which can be selected in the Search window. This one just sorts a query result set, the one in the “Search window” affects the actual stations that will be in the result set.

Controls Top

These are the RadioBrowser specific keys one can use in addition to local playlist keys (if applicable).

@@ -125,17 +125,17 @@

Controls Configuration Top

This feature has not been implemented yet.

Station Database Information Top

-

The database information of the selected station can be displayed by pressing “I” (capital “i”). Keep in mind that, this is different than the “Station ino” displayed by pressing “i” (lowercase “i”), which is still available and presents live data.

+

The database information of the selected station can be displayed by pressing “I”. Keep in mind that, this is different than the “Station ino” displayed by pressing “i” (lowercase “i”), which is still available and presents live data.

Station clicking and voting Top

RadioBrowser provides two ways to measure a station’s popularity: voting and clicking.

Clicking a station means that the station has been listened to; PyRadio will send a “click request” any time the user starts playback of a station; RadioBrowser 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.)

For this reason PyRadio will in no case adjust the click count presented to the user.

-

Voting for a station is a different thing; the user has to choose to vote for it. In PyRadio a “vote request” is sent when “V” (capital “v”) is pressed. If the vote has been accepted, the vote counter will be increased by one.

+

Voting for a station is a different thing; the user has to choose to vote for it. In PyRadio a “vote request” is sent when “V” is pressed. If the vote has been accepted, the vote counter will be increased by one.

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

Server Selection Top

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

PyRadio will randomly select one of these servers and will display its location in its window title.

-

Pressing “C” (capital “c”) will provide a list of available servers to choose from. This selection will be honored until the service is closed.

+

Pressing “C” will provide a list of available servers to choose from. This selection will be honored until the service is closed.

Search Window Top

The “Search window” opens when “s” is pressed and loads the “search term” that was used to fetch the stations currently presented in the “RadioBrowser window”. If this is the first time this window is opened within this session, the search term that’s loaded is the “default search term”.

Note: In case the server returns no results, the window will automatically reopen so that you can redefine the “search term”.

@@ -206,10 +206,9 @@

History Management

-

Here is one thing you should take notice of: after inserting some data into any of the various fields, do not navigate to another “search term” before adding it to history; all your changes will be lost.

-

Another thing you should be aware of, is that the Search Window actually works on a copy of the search history used by the service itself, so any changes made in it (adding and deleting items) are not passed to the service, until “OK” is pressed. Pressing “Cancel” will make all the changes go away.

+

All movement actions (N, P, ^Y) will check if the data currently in the “form” fields can create a new search term and if so, will add it to the history.

+

The Search Window actually works on a copy of the search history used by the service itself, so any changes made in it (adding and deleting items) are not passed to the service, until “OK” is pressed. Pressing “Cancel” will make all the changes go away.

Even when “OK” is pressed, and the “Search Window” is closed, the “new” history is loaded into the service, but NOT saved to the configuration file.

-

To really save the “new” history, press “^V” in the Search Window.

-

Note: The history is also saved to file when one changes the “default” item, pressing “^B” in the Search Window.

+

To really save the “new” history, press “^V” in the Search Window, or press “y” in the confirmation window upon exiting the service.

diff --git a/radio-browser.md b/radio-browser.md index dffad3b1..7ca69e02 100644 --- a/radio-browser.md +++ b/radio-browser.md @@ -61,7 +61,7 @@ Searching for any string will return matches in the "**Name**" field only (just ### Sorting stations -Pressing "**S**" (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. +Pressing "**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. **Note:** This sorting function is different than the query sorting criterion which can be selected in the [Search window](#search-window). This one just sorts a query result set, the one in the "**Search window**" affects the actual stations that will be in the result set. @@ -87,7 +87,7 @@ This feature has not been implemented yet. ## Station Database Information -The database information of the selected station can be displayed by pressing "**I**" (capital "i"). Keep in mind that, this is different than the "Station ino" displayed by pressing "**i**" (lowercase "i"), which is still available and presents live data. +The database information of the selected station can be displayed by pressing "**I**". Keep in mind that, this is different than the "Station ino" displayed by pressing "**i**" (lowercase "i"), which is still available and presents live data. ## Station clicking and voting @@ -97,7 +97,7 @@ The database information of the selected station can be displayed by pressing "* For this reason **PyRadio** will in no case adjust the click count presented to the user. -**Voting** for a station is a different thing; the user has to choose to vote for it. In **PyRadio** a "vote request" is sent when "**V**" (capital "v") is pressed. If the vote has been accepted, the vote counter will be increased by one. +**Voting** for a station is a different thing; the user has to choose to vote for it. In **PyRadio** a "vote request" is sent when "**V**" is pressed. If the vote has been accepted, the vote counter will be increased by one. **Note:** 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. @@ -107,7 +107,7 @@ For this reason **PyRadio** will in no case adjust the click count presented to **PyRadio** will randomly select one of these servers and will display its location in its window title. -Pressing "**C**" (capital "c") will provide a list of available servers to choose from. This selection will be honored until the service is closed. +Pressing "**C**" will provide a list of available servers to choose from. This selection will be honored until the service is closed. ## Search Window @@ -170,12 +170,10 @@ The keys to manage the history are all **Control** combinations: |**^B** |Make the current history item the **default** one for **RadioBrowser** and save the history.
This means that, next time you open **RadioBrowser** this history item ("**search term**") will be automatically loaded.| |**^V** |Save the history.| -Here is one thing you should take notice of: after inserting some data into any of the various fields, do not navigate to another "**search term**" before adding it to history; all your changes will be lost. +All movement actions (**^N**, **^P**, **^Y**) will check if the data currently in the "form" fields can create a new **search term** and if so, will add it to the history. -Another thing you should be aware of, is that the **Search Window** actually works on a copy of the **search history** used by the service itself, so any changes made in it (adding and deleting items) are not passed to the service, until "**OK**" is pressed. Pressing "**Cancel**" will make all the changes go away. +The **Search Window** actually works on a copy of the **search history** used by the service itself, so any changes made in it (adding and deleting items) are not passed to the service, until "**OK**" is pressed. Pressing "**Cancel**" will make all the changes go away. Even when "**OK**" is pressed, and the "**Search Window**" is closed, the "new" history is loaded into the service, but NOT saved to the *configuration file*. -To really save the "new" history, press "**^V**" in the **Search Window**. - -**Note:** The history is also saved to file when one changes the "**default**" item, pressing "**^B**" in the **Search Window**. +To really save the "new" history, press "**^V**" in the **Search Window**, or press "**y**" in the confirmation window upon exiting the service.