Skip to content

Commit a5b6e66

Browse files
committed
files for the previous commit
1 parent 308dbb1 commit a5b6e66

14 files changed

+206
-54
lines changed

Changelog

+7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
2024-12-04 s-n-g
2+
* version 0.9.3.11.2 - 0.9.3.12-beta2
3+
* Implementing the Shortcuts Window, making it possible to customize
4+
PyRadio's key bindings
5+
* fixing install.py (#262)
6+
* implementing #252
7+
18
2024-10-17 s-n-g
29
* version 0.9.3.11.1 (BUG FIX) - 0.9.3.12-beta1
310
* adding -sdd (--show_dirs) command line parameter

README.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ Command line internet radio player.
3535
- Station editor (add/edit) with [CJK characters support](#cjk-characters-support)
3636
- Configuration editor
3737
- Search function
38+
- Customizable key bindings
3839
- Easy installation / updating
3940
- Runs on Linux, macOS and Windows
4041

@@ -65,7 +66,9 @@ In any other case you will have to [build it from source](docs/build.md).
6566

6667
**Note:** Please avoid installing **PyRadio** via **pip**. I (user [s-n-g](https://github.com/s-n-g) @ github) am not the creator of this project, nor do I maintain it on [The Python Package Index (PyPI)](https://pypi.org/project/pyradio/). As a result, the version available there is outdated and I cannot provide any support for it. \
6768
\
68-
Furthermore, please refrain from using any third-party packaging methods, such as **Snap** or **AppImage**. I am not affiliated with these services or projects, and I cannot guarantee the functionality or version of **PyRadio** provided through them. Additionally, I am unable to offer support for any issues related to these packaging methods.
69+
Furthermore, please refrain from using any third-party packaging methods, such as **Snap** or **AppImage**. I am not affiliated with these services or projects, and I cannot guarantee the functionality or version of **PyRadio** provided through them. Additionally, I am unable to offer support for any issues related to these packaging methods. \
70+
\
71+
In any of the above cases, if you do ask for help, I will ask you to install your distro package (or build **PyRadio** from source), before attempting to provide any further help.
6972

7073
## Basic usage
7174

devel/what_tag

+12-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ cYellow="[1;3${colorYellow}m"${cBold}
1010

1111
echo -en "pyproject.toml ${cGreen}"
1212
grep version pyproject.toml
13-
echo -en "${cReset}__init.py ${cRed}"
13+
echo -en "${cReset}__init__.py ${cRed}"
1414
grep '^version_info ' pyradio/__init__.py
1515
echo -en "${cReset}install.py ${cYellow}"
1616
grep '^PyRadioInstallPyReleaseVersion ' pyradio/install.py
@@ -58,4 +58,15 @@ and execute ${cRed}./add-pkgver${cReset} to get AUR package
5858
ready for update.
5959
"
6060

61+
echo "Running ${cGreen}./devel/get_shortcuts_and_classes.py${cReset}"
62+
python ./devel/get_shortcuts_and_classes.py
63+
64+
chk=$(LANG=en_US.UTF-8 git st | grep modified)
65+
if [ ! -z "${chk}" ]
66+
then
67+
echo "Not commited files:"
68+
echo "${cRed}${chk}${cReset}"
69+
echo "Please commit them and try again"
70+
exit 1
71+
fi
6172

docs/index.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,8 @@ <h2 id="requirements">Requirements <span style="padding-left: 10px;"><sup style=
187187
<h2 id="changelog">Changelog <span style="padding-left: 10px;"><sup style="font-size: 50%"><a href="#" title="Go to top of the page">Top</a></sup></span></h2>
188188
<pre style="height: 200px;">
189189

190-
2024-10-17 s-n-g
191-
* version 0.9.3.11.2 (BUG FIX) - 0.9.3.12-beta2
190+
2024-12-04 s-n-g
191+
* version 0.9.3.11.2 - 0.9.3.12-beta2
192192
* Implementing the Shortcuts Window, making it possible to customize
193193
PyRadio's key bindings
194194
* fixing install.py (#262)

docs/index.md

+30-3
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Command line internet radio player.
1313
* [Command line options](#command-line-options)
1414
* [Controls](#controls)
1515
* [Global shortcuts](#global-shortcuts)
16+
* [Customizing key bindings](#customizing-key-bindings)
1617
* [HTML help](#html-help)
1718
* [PyRadio Modes](#pyradio-modes)
1819
* [Secondary Modes](#secondary-modes)
@@ -71,6 +72,7 @@ Command line internet radio player.
7172
* [Update notification](#update-notification)
7273
* [Remote Control Server](#remote-control-server)
7374
* [Remote Control Client](#remote-control-client)
75+
* [Playing a station in the terminal](#playing-a-station-in-the-terminal)
7476
* [Debug mode](#debug-mode)
7577
* [Reporting bugs](#reporting-bugs)
7678
* [Packaging PyRadio](#packaging-pyradio)
@@ -90,6 +92,7 @@ Command line internet radio player.
9092
- Station editor (add/edit) with [CJK characters support](#cjk-characters-support)
9193
- Configuration editor
9294
- Search function
95+
- Customizable key bindings
9396
- Easy installation / updating
9497
- Runs on Linux, macOS and Windows
9598

@@ -126,9 +129,9 @@ Furthermore, please refrain from using any third-party packaging methods, such a
126129

127130
```
128131
# pyradio -h
129-
Usage: pyradio [-h] [-c CONFIG_DIR] [-p [STATION_NUMBER]] [-u PLAYER] [-l]
130-
[-lt] [-sds] [-sd] [-od] [-pc] [-d] [-ul] [-us] [-U] [-R] [-V]
131-
[-ls] [-s PLAYLIST] [-tlp] [-t THEME] [--show-themes]
132+
Usage: pyradio [-h] [-c CONFIG_DIR] [-p [STATION_NUMBER]] [-x] [-u PLAYER]
133+
[-l] [-lt] [-sds] [-sd] [-od] [-pc] [-d] [-ul] [-us] [-U] [-R]
134+
[-V] [-ls] [-s PLAYLIST] [-tlp] [-t THEME] [--show-themes]
132135
[--no-themes] [--write-theme IN_THEME OUT_THEME,]
133136
[--terminal TERMINAL] [--terminal-param TERMINAL_PARAM] [-oc]
134137
[-sc] [-cc] [-gc] [-r] [-or] [-lr] [-mkv MKV_FILE]
@@ -146,6 +149,9 @@ General options:
146149
-p [STATION_NUMBER], --play [STATION_NUMBER]
147150
Start and play.The value is num station or empty for
148151
random.
152+
-x, --external-player
153+
Play station in external player. Can be combined with
154+
--play.
149155
-u PLAYER, --use-player PLAYER
150156
Use specified player. A comma-separated list can be
151157
used to specify detection order. Supported players:
@@ -247,6 +253,9 @@ Headless operation:
247253

248254
## Controls
249255

256+
The following list shows a **default** key bindings list used within the program.
257+
258+
250259
Main window Playlists window Themes window
251260
-------------------------------------------------------------------------------------------------------------------------------------
252261
Up/Down/j/k/
@@ -316,6 +325,12 @@ When focus is on a "*Line editor*", all shortcuts will work when preceded by a "
316325

317326
[2] Function not available in the **RadioBrowser** Search window.
318327

328+
### Customizing key bindings
329+
330+
**PyRadio** provides the possibility to customize the key bindings above.
331+
332+
Just open the configuration window and navigate to **Keyboard Shortcuts**. Please do read the help screen provided therein (press "*?" to get to it).
333+
319334
## HTML help
320335

321336
While in **PyRadio** main window, one can open the HTML (offline) help using "**\\h**".
@@ -1171,6 +1186,18 @@ If you'd like to set up a "headless" **PyRadio** operation for your linux box, p
11711186

11721187
For more information, please refer to [the relevant page](client.md).
11731188

1189+
## Playing a station in the terminal
1190+
1191+
A user request [Shortcut to quit pyradio and launch standalone player (e.g. mpv) with currently selected station](https://github.com/coderholic/pyradio/issues/252) lead to the possibility to use any player in the terminal.
1192+
1193+
This action will be triggered by pressing "*X*".
1194+
1195+
After the player stops, **PyRadio** will stop as well.
1196+
1197+
**Note:** On Windows, **mpv** and **VLC** will open a new player window instead of executing in the terminal.
1198+
1199+
In addition, a command line parameter has been added "*-x*" ("*--exteranl-player*") which when used in conjuction with the "*-p*" ("*--play*") command line parameter, will instruct **PyRadio** to play a station and terminate after the playback stops.
1200+
11741201
## Debug mode
11751202

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

docs/pyradio.1

+11-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
.\" Copyright (C) 2018-2024 Spiros Georgaras <[email protected]>
33
.\" This manual is freely distributable under the terms of the GPL.
44
.\"
5-
.TH pyradio 1 "June 2024" pyradio
5+
.TH pyradio 1 "December 2024" pyradio
66

77
.SH Name
88
.PP
@@ -1950,6 +1950,16 @@ If so, a notification message will be displayed, informing the user about it and
19501950

19511951
\fBpyradio\fR will uninstall all previously installed versions when updated (using the \fB-U\fR command line parameter), so no extra steps are needed any more to house keep your system.
19521952

1953+
.SH Playing a station in the terminal
1954+
1955+
A user request \fBShortcut to quit pyradio and launch standalone player (e.g. mpv) with currently selected station\fR (\fIhttps://github.com/coderholic/pyradio/issues/252\fR) lead to the possibility to use any player in the terminal.
1956+
1957+
This action will be triggered by pressing "\fIX\fR".
1958+
1959+
After the player stops, \fBpyradio\fR will stop as well.
1960+
1961+
In addition, a command line parameter has been added "\fI-x\fR" ("\fI--exteranl-player\fR") which when used in conjuction with the "\fI-p\fR" ("\fI--play\fR") command line parameter, will instruct \fBpyradio\fR to play a station and terminate after the playback stops.
1962+
19531963
.SH Debug Mode
19541964
.PP
19551965
Adding the \fB-d\fR option to the command line will instruct \fBpyradio\fR to enter \fBDebug mode\fR, 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 \fIpyradio.log\fR.

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "pyradio"
3-
version = "0.9.3.11.1"
3+
version = "0.9.3.11.2"
44
authors = [
55
{ name="Ben Dowling", email="[email protected]" },
66
{ name="Spiros Georgaras", email="[email protected]" },

pyradio/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# -*- coding: utf-8 -*-
22
" pyradio -- Console radio player. "
33

4-
version_info = (0, 9, 3, 11, 1)
4+
version_info = (0, 9, 3, 11, 2)
55

66
# Set it to True if new stations have been
77
# added to the package's stations.csv

pyradio/config_window.py

+18-11
Original file line numberDiff line numberDiff line change
@@ -3514,17 +3514,12 @@ def _rename_keyboard_json_file(file_path):
35143514
return new_file_name
35153515

35163516
def _start_editing(self):
3517+
self.existing_conflict = None
35173518
self._win.addstr(self._selection - self._start + 2, self.maxX-8, '[edit]', curses.color_pair(6))
35183519
self._win.refresh()
35193520
self._editing = True
35203521
if logger.isEnabledFor(logging.DEBUG):
35213522
logger.debug('editing "{}"'.format(self._list[self._selection]))
3522-
for i in range(self._selection, -1, -1):
3523-
if self._list[i][1] is None:
3524-
self._in_group = i
3525-
break
3526-
if logger.isEnabledFor(logging.DEBUG):
3527-
logger.debug(f'editing in group "{self._list[self._in_group][0]}"')
35283523

35293524
def _stop_editing(self):
35303525
self._win.addstr(self._selection - self._start + 2, self.maxX-8, ' ', curses.color_pair(6))
@@ -3760,7 +3755,7 @@ def show(self, parent=None):
37603755
self._b_ok, self._b_cancel = self._widget.buttons
37613756
self._b_ok.focused = self._b_cancel.focused = False
37623757

3763-
self._win.addstr(1, 2, 'Shortcuts', curses.color_pair(12))
3758+
self._win.addstr(1, 2, 'Actions', curses.color_pair(12))
37643759
self._win.addstr(1, self._max_length-3, 'Default User New', curses.color_pair(12))
37653760

37663761
for i in range(0, self._number_of_lines):
@@ -3921,6 +3916,7 @@ def _get_available_keys(self):
39213916

39223917
# Separate characters into categories
39233918
digits = sorted([char for char in available_characters if char.isdigit()]) # Sort digits
3919+
digits.pop(0)
39243920
letters = sorted([char for char in available_characters if char.isalpha()]) # Sort letters
39253921
function_keys_list = sorted([char for char in available_characters if char.startswith('F')]) # Sort function keys
39263922
if 'F' in function_keys_list:
@@ -3974,6 +3970,7 @@ def keypress(self, char):
39743970
logger.error(f'{the_key = }')
39753971

39763972
logger.error('\n\n============')
3973+
self._old_key_value = (self._list[self._selection][3], self._list[self._selection][6])
39773974
self._list[self._selection][3] = char
39783975
self._list[self._selection][6] = ctrl_code_to_string(char)
39793976
ret = self._validate_key()
@@ -3994,8 +3991,8 @@ def keypress(self, char):
39943991
''' disable editing '''
39953992
self._stop_editing()
39963993
else:
3997-
self._list[self._selection][3] = self._list[self._selection][2]
3998-
self._list[self._selection][6] = self._list[self._selection][5]
3994+
# restore previous values on conflict
3995+
self._list[self._selection][3], self._list[self._selection][6] = self._old_key_value
39993996

40003997
return ret
40013998
else:
@@ -4008,6 +4005,16 @@ def keypress(self, char):
40084005
self.keys_string = msg + self._get_available_keys() + '\n\n'
40094006
return -4
40104007

4008+
elif char == kbkey['revert_def']:
4009+
for i in range(len(self._list)):
4010+
self._list[i][3] = self._list[i][1]
4011+
self._list[i][6] = self._list[i][4]
4012+
self._needs_update = True
4013+
elif char == kbkey['revert_saved']:
4014+
for i in range(len(self._list)):
4015+
self._list[i][3] = self._list[i][2]
4016+
self._list[i][6] = self._list[i][5]
4017+
self._needs_update = True
40114018
elif char == ord('x'):
40124019
self._list[self._selection][3] = self._list[self._selection][2]
40134020
self._list[self._selection][6] = self._list[self._selection][5]
@@ -4030,8 +4037,8 @@ def keypress(self, char):
40304037
self._go_down(step=5)
40314038
elif char == curses.KEY_PPAGE:
40324039
self._go_up(step=5)
4033-
elif char in (curses.KEY_EXIT, 27, kbkey['q']):
4034-
return -1
4040+
# elif char in (curses.KEY_EXIT, 27, kbkey['q']):
4041+
# return -1
40354042
elif char in (curses.KEY_RIGHT, kbkey['l']):
40364043
if self._focus > 0:
40374044
self._focus_next()

pyradio/install.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
''' This is PyRadio version this
1818
install.py was released for
1919
'''
20-
PyRadioInstallPyReleaseVersion = '0.9.3.11.1'
20+
PyRadioInstallPyReleaseVersion = '0.9.3.11.2'
2121

2222
locale.setlocale(locale.LC_ALL, "")
2323

pyradio/keyboard.py

+5
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,8 @@ def is_valid_char(char, win):
436436
Returns:
437437
bool: True if c is valid, False otherwise.
438438
"""
439+
if char in (9, ord('\t')):
440+
return False
439441
# if char <= 127:
440442
if (65 <= char <= 90) or (97 <= char <= 122) or (1 <= char <= 47):
441443
''' 1 byte '''
@@ -456,6 +458,9 @@ def is_valid_char(char, win):
456458
elif char in (
457459
ord('='), ord('.'), ord('+'),
458460
ord('`'), ord('-'),
461+
ord('1'), ord('2'), ord('3'),
462+
ord('4'), ord('5'), ord('6'),
463+
ord('7'), ord('8'), ord('9'),
459464
curses.KEY_F1,
460465
curses.KEY_F2,
461466
curses.KEY_F3,

0 commit comments

Comments
 (0)