Skip to content

Commit

Permalink
- Version 0.8.9.5 (0.9-beta2)
Browse files Browse the repository at this point in the history
- Fixed a crash that would occur when searching for name only in
  RadioBrowser Search Window
- Do not display the Theme Selection Window when pressing "t" in a
  RadioBrowser Line Editor
- Updated History legend area
- Updated docs
  • Loading branch information
s-n-g committed Aug 11, 2021
1 parent 6c85f91 commit be61272
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 42 deletions.
9 changes: 9 additions & 0 deletions Changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
2021-08-11
* Version 0.8.9.5 (0.9-beta2)
* Fixed a crash that would occur when searching for name only in
RadioBrowser Search Window
* Do not display the Theme Selection Window when pressing "t" in a
RadioBrowser Line Editor
* Updated History legend aread
* Updated docs

2021-08-11
* Version 0.8.9.4 (0.9-beta1)
* Radio Browser implementation is now usable (but still not complete)
Expand Down
18 changes: 9 additions & 9 deletions README.html
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ <h2 id="table-of-contents">Table of Contents <span style="padding-left: 10px;"><
<li><a href="#using-transparency">Using transparency</a></li>
</ul></li>
<li><a href="#mouse-support">Mouse support</a></li>
<li><a href="#online-radio-directory-services">Online radio directory services</a></li>
<li><a href="#session-locking">Session Locking</a>
<ul>
<li><a href="#session-unlocking">Session unlocking</a></li>
Expand All @@ -96,7 +97,6 @@ <h2 id="table-of-contents">Table of Contents <span style="padding-left: 10px;"><
</ul></li>
<li><a href="#cleaning-up">Cleaning up</a></li>
<li><a href="#debug-mode">Debug mode</a></li>
<li><a href="#online-radio-directory-services">Online radio directory services</a></li>
<li><a href="#reporting-bugs">Reporting bugs</a></li>
<li><a href="#packaging-pyradio">Packaging PyRadio</a></li>
<li><a href="#todo">TODO</a></li>
Expand Down Expand Up @@ -550,6 +550,14 @@ <h2 id="mouse-support">Mouse support <span style="padding-left: 10px;"><sup styl
</tr>
</tbody>
</table>
<h2 id="online-radio-directory-services">Online radio directory services <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>PyRadio</strong> supports the following <em>Online radio directory services</em>:</p>
<ul>
<li><a target="_blank" href="https://www.radio-browser.info/">RadioBrowser</a></p>
<p>This is a community driven effort (like wikipedia) with the aim of collecting as many internet radio and TV stations as possible.</p>
<p>Read more at <a href="radio-browser.html">PyRadio RadioBrowser Implementation</a></p></li>
</ul>
<p>To access supported services, just press “<strong>O</strong>” (capital “<em>o</em>”) at the program’s main window.</p>
<h2 id="session-locking">Session Locking <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>PyRadio</strong> 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.</p>
<p>Subsequent instances will be “<em>locked</em>”. This means that the user can still play stations, load and edit playlists, load and test themes, but any changes will <strong>not</strong> be recorded in the configuration file.</p>
Expand All @@ -573,14 +581,6 @@ <h2 id="cleaning-up">Cleaning up <span style="padding-left: 10px;"><sup style="f
<h2 id="debug-mode">Debug mode <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>Adding the “<strong>-d</strong>” option to the command line will instruct <strong>PyRadio</strong> to enter <em>Debug mode</em>, 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 <em>pyradio.log</em>.</p>
<p>In case of a bug or a glitch, please include this file to the issue you will <a target="_blank" href="https://github.com/coderholic/pyradio/issues">open at github</a>.</p>
<h2 id="online-radio-directory-services">Online radio directory services <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>PyRadio</strong> supports the following <em>Online radio directory services</em>:</p>
<ul>
<li><a target="_blank" href="https://www.radio-browser.info/">RadioBrowser</a></p>
<p>This is a community driven effort (like wikipedia) with the aim of collecting as many internet radio and TV stations as possible.</p>
<p>Read more at <a href="radio-browser.html">PyRadio RadioBrowser Implementation</a></p></li>
</ul>
<p>To access supported services, just press “<strong>O</strong>” (capital “<em>o</em>”) at the program’s main window.</p>
<h2 id="reporting-bugs">Reporting bugs <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>When a bug is found, please do report it by <a target="_blank" href="https://github.com/coderholic/pyradio/issues">opening an issue at github</a>, as already stated above.</p>
<p>In you report you should, at the very least, state your <strong>pyradio version</strong>, <strong>python version</strong> and <strong>method</strong> of installation (built from source, AUR, snap, whatever).</p>
Expand Down
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -669,6 +669,18 @@ Then, the mouse can be used as follows:
| **Wheel** | Scroll up / down |
| **Shift-Wheel** | Adjust volume<br>(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.
Expand Down Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion pyradio/__init__.py
Original file line number Diff line number Diff line change
@@ -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: ''
Expand Down
59 changes: 41 additions & 18 deletions pyradio/browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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'},
# })

Expand Down Expand Up @@ -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()

Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -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],
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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, ):
Expand All @@ -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, ):
Expand All @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
3 changes: 2 additions & 1 deletion pyradio/radio.py
Original file line number Diff line number Diff line change
Expand Up @@ -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, ):
Expand Down

0 comments on commit be61272

Please sign in to comment.