+Online radio directory services Top
+PyRadio supports the following Online radio directory services:
+
+To access supported services, just press “O” (capital “o”) at the program’s main window.
Session Locking Top
PyRadio uses session locking, which actually means that only the first instance executed within a given session will be able to write to the configuration file.
Subsequent instances will be “locked”. This means that the user can still play stations, load and edit playlists, load and test themes, but any changes will not be recorded in the configuration file.
@@ -573,14 +581,6 @@ Cleaning up Debug mode Top
Adding the “-d” option to the command line will instruct PyRadio to enter Debug mode, which means that it will print debug messages to a file. This file will always reside in the user’s home directory and will be named pyradio.log.
In case of a bug or a glitch, please include this file to the issue you will open at github.
-Online radio directory services Top
-PyRadio supports the following Online radio directory services:
-
-To access supported services, just press “O” (capital “o”) at the program’s main window.
Reporting bugs Top
When a bug is found, please do report it by opening an issue at github, as already stated above.
In you report you should, at the very least, state your pyradio version, python version and method of installation (built from source, AUR, snap, whatever).
diff --git a/README.md b/README.md
index c5ca6232..5eb5b4b7 100644
--- a/README.md
+++ b/README.md
@@ -41,13 +41,13 @@ Ben Dowling - [https://github.com/coderholic](https://github.com/coderholic)
* [PyRadio Themes](#pyradio-themes)
* [Using transparency](#using-transparency)
* [Mouse support](#mouse-support)
+* [Online radio directory services](#online-radio-directory-services)
* [Session Locking](#session-locking)
* [Session unlocking](#session-unlocking)
* [Update notification](#update-notification)
* [Updating a pre 0.8.9 installation](#updating-a-pre-0.8.9-installation)
* [Cleaning up](#cleaning-up)
* [Debug mode](#debug-mode)
-* [Online radio directory services](#online-radio-directory-services)
* [Reporting bugs](#reporting-bugs)
* [Packaging PyRadio](#packaging-pyradio)
* [TODO](#todo)
@@ -669,6 +669,18 @@ Then, the mouse can be used as follows:
| **Wheel** | Scroll up / down |
| **Shift-Wheel** | Adjust volume
(does not work with all terminals) |
+## Online radio directory services
+
+**PyRadio** supports the following *Online radio directory services*:
+
+- [RadioBrowser](https://www.radio-browser.info/)
+
+ This is a community driven effort (like wikipedia) with the aim of collecting as many internet radio and TV stations as possible.
+
+ Read more at [PyRadio RadioBrowser Implementation](radio-browser.md)
+
+To access supported services, just press "**O**" (capital "*o*") at the program's main window.
+
## Session Locking
**PyRadio** uses session locking, which actually means that only the first instance executed within a given session will be able to write to the configuration file.
@@ -713,18 +725,6 @@ Adding the "**-d**" option to the command line will instruct **PyRadio** to ente
In case of a bug or a glitch, please include this file to the issue you will [open at github](https://github.com/coderholic/pyradio/issues).
-## Online radio directory services
-
-**PyRadio** supports the following *Online radio directory services*:
-
-- [RadioBrowser](https://www.radio-browser.info/)
-
- This is a community driven effort (like wikipedia) with the aim of collecting as many internet radio and TV stations as possible.
-
- Read more at [PyRadio RadioBrowser Implementation](radio-browser.md)
-
-To access supported services, just press "**O**" (capital "*o*") at the program's main window.
-
## Reporting bugs
When a bug is found, please do report it by [opening an issue at github](https://github.com/coderholic/pyradio/issues), as already stated above.
diff --git a/pyradio/__init__.py b/pyradio/__init__.py
index 4dcf34d7..0a07f9bd 100644
--- a/pyradio/__init__.py
+++ b/pyradio/__init__.py
@@ -1,6 +1,6 @@
" pyradio -- Console radio player. "
-version_info = (0, 8, 9, 4)
+version_info = (0, 8, 9, 5)
# Application state:
# New stable version: ''
diff --git a/pyradio/browser.py b/pyradio/browser.py
index b7a1522f..fd704a00 100644
--- a/pyradio/browser.py
+++ b/pyradio/browser.py
@@ -37,8 +37,8 @@
RADIO_BROWSER_SEARCH_BY_TERMS = {
'byuuid': -1,
- 'byname': 5,
- 'bynameexact': 5,
+ 'byname': 6,
+ 'bynameexact': 6,
'bycodec': 16,
'bycodecexact': 16,
'bycountry': 8,
@@ -306,6 +306,12 @@ class RadioBrowserInfo(PyRadioStationsBrowser):
keyboard_handler = None
+ ''' _search_history_index - current item in this browser - corresponds to search window _history_id
+ _search_default_history_index - autoload item in this browser - corresponds to search window _default_history_id
+ '''
+ _search_history_index = 1
+ _search_default_history_index = 1
+
def __init__(self,
config,
config_encoding,
@@ -361,8 +367,8 @@ def initialize(self):
})
# self._search_history.append({
- # 'type': 'bytagexact',
- # 'term': 'jpop',
+ # 'type': 'bytag',
+ # 'term': 'big band',
# 'post_data': {'order': 'votes', 'reverse': 'true'},
# })
@@ -1257,7 +1263,10 @@ def do_search(self, parent=None, init=False):
limit=self._default_max_number_of_results,
init=init
)
- self._search_win.set_search_history(self._search_history_index, self._search_history, init)
+ self._search_win.set_search_history(
+ self._search_default_history_index,
+ self._search_history_index,
+ self._search_history, init)
self.keyboard_handler = self._search_win
self._search_win.show()
@@ -1325,7 +1334,11 @@ class RadioBrowserInfoSearchWindow(object):
_default_limit = 100
- _history_id = _selected_history_id = 0
+ ''' _selected_history_id : current id in search window
+ _history_id : current id (active in browser) - corresponds in browser to _search_history_index
+ _default_history_id : default id (autoload for service) - corresponds in browser to _search_default_history_index
+ '''
+ _history_id = _selected_history_id = _default_history_id = 1
_history = []
def __init__(self,
@@ -1501,10 +1514,11 @@ def _widgets_to_search_term(self):
if len(what_type) == 1:
''' simple search '''
- # logger.error('DE simple search')
+ logger.error('DE simple search')
for n in RADIO_BROWSER_SEARCH_BY_TERMS.items():
if n[1] == what_type[0]:
ret['type'] = n [0]
+ logger.error('DE type = {}'.format(ret['type']))
break
if self._widgets[what_type[0] - 1].checked:
ret['type'] += 'exact'
@@ -1557,6 +1571,7 @@ def get_history(self):
def set_search_history(
self,
+ main_window_default_search_history_index,
main_window_search_history_index,
main_window_search_history,
init=False
@@ -1567,6 +1582,7 @@ def set_search_history(
'''
self._history_id = main_window_search_history_index
if init:
+ self._default_history_id = main_window_default_search_history_index
self._selected_history_id = main_window_search_history_index
logger.error('DE set_search_history - _selected_history_id={}'.format(self._selected_history_id))
self._history = deepcopy(main_window_search_history)
@@ -1816,7 +1832,7 @@ def show(self):
self._win.refresh()
self._calculate_widgets_yx(Y, X)
# logger.error('== 1 widget[{0}].Y = {1}'.format(3, self._widgets[3].Y))
- for n in range(0,6):
+ for n in range(0,5):
''' place editors' captions '''
# self._win.addstr(
# self.yx[n+1][0],
@@ -1850,17 +1866,24 @@ def show(self):
# logger.error('== 2 widget[{0}].Y = {1}'.format(3, self._widgets[3].Y))
self._h_buttons.calculate_buttons_position()
- self._print_history_legent()
+ self._print_history_legend()
self._display_all_widgets()
- def _print_history_legent(self):
+ def _print_history_legend(self):
self._win.addstr(self.maxY - 2, 2 , 'History item: ')
self._win.addstr('{}'.format(self._selected_history_id), curses.color_pair(4))
self._win.addstr('/{} '.format(len(self._history)-1))
- if self._selected_history_id == self._history_id:
- self._win.addstr(self.maxY - 3, 2, 'Item in Browser', curses.color_pair(4))
- else:
- self._win.addstr(self.maxY - 3, 2, 25 * ' ')
+
+ self._win.addstr(self.maxY - 3, 2, 25 * ' ')
+ if self._selected_history_id == 0:
+ self._win.addstr(self.maxY - 3, 2, 'Template!!!', curses.color_pair(4))
+ elif self._selected_history_id == self._history_id:
+ if self._default_history_id == self._history_id:
+ self._win.addstr(self.maxY - 3, 2, 'Item in Browser, Default', curses.color_pair(4))
+ else:
+ self._win.addstr(self.maxY - 3, 2, 'Item in Browser', curses.color_pair(4))
+ elif self._selected_history_id == self._default_history_id:
+ self._win.addstr(self.maxY - 3, 2, 'Default item', curses.color_pair(4))
msg = 'History navigation: ^N/^P, Go to empty item: ^Y'
thisX = self.maxX - 2 - len(msg)
@@ -1987,7 +2010,7 @@ def keypress(self, char):
self._selected_history_id += 1
if self._selected_history_id >= len(self._history):
self._selected_history_id = 0
- self._print_history_legent()
+ self._print_history_legend()
self._activate_search_term(self._history[self._selected_history_id])
elif char in (curses.ascii.DLE, ):
@@ -1996,7 +2019,7 @@ def keypress(self, char):
self._selected_history_id -= 1
if self._selected_history_id <0:
self._selected_history_id = len(self._history) - 1
- self._print_history_legent()
+ self._print_history_legend()
self._activate_search_term(self._history[self._selected_history_id])
elif char in (curses.ascii.SYN, ):
@@ -2014,7 +2037,7 @@ def keypress(self, char):
elif char in (curses.ascii.EM, ):
''' ^Y - Set default item '''
self._selected_history_id = 0
- self._print_history_legent()
+ self._print_history_legend()
self._activate_search_term(self._history[self._selected_history_id])
else:
@@ -2073,7 +2096,7 @@ def keypress(self, char):
new_focus = self._focus + 2
# logger.error('DE focus = {}'.format(new_focus))
if new_focus == 15:
- new_focus = 17
+ new_focus = 16
# logger.error('DE focus = {}'.format(new_focus))
self._apply_new_focus(new_focus)
else:
diff --git a/pyradio/radio.py b/pyradio/radio.py
index 2ef9c449..37ce3964 100644
--- a/pyradio/radio.py
+++ b/pyradio/radio.py
@@ -4630,7 +4630,8 @@ def keypress(self, char):
elif char in (ord('t'), ) and \
self.ws.operation_mode not in (self.ws.EDIT_STATION_MODE,
self.ws.ADD_STATION_MODE, self.ws.THEME_MODE,
- self.ws.RENAME_PLAYLIST_MODE, self.ws.CREATE_PLAYLIST_MODE) and \
+ self.ws.RENAME_PLAYLIST_MODE, self.ws.CREATE_PLAYLIST_MODE,
+ self.ws.BROWSER_SEARCH_MODE) and \
self.ws.operation_mode not in self.ws.PASSIVE_WINDOWS and \
not self.is_search_mode(self.ws.operation_mode) and \
self.ws.window_mode not in (self.ws.CONFIG_MODE, ):