Skip to content

Commit

Permalink
files for the previous commit
Browse files Browse the repository at this point in the history
  • Loading branch information
s-n-g committed Dec 4, 2024
1 parent 308dbb1 commit a5b6e66
Show file tree
Hide file tree
Showing 14 changed files with 206 additions and 54 deletions.
7 changes: 7 additions & 0 deletions Changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
2024-12-04 s-n-g
* version 0.9.3.11.2 - 0.9.3.12-beta2
* Implementing the Shortcuts Window, making it possible to customize
PyRadio's key bindings
* fixing install.py (#262)
* implementing #252

2024-10-17 s-n-g
* version 0.9.3.11.1 (BUG FIX) - 0.9.3.12-beta1
* adding -sdd (--show_dirs) command line parameter
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ Command line internet radio player.
- Station editor (add/edit) with [CJK characters support](#cjk-characters-support)
- Configuration editor
- Search function
- Customizable key bindings
- Easy installation / updating
- Runs on Linux, macOS and Windows

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

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

## Basic usage

Expand Down
13 changes: 12 additions & 1 deletion devel/what_tag
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ cYellow="[1;3${colorYellow}m"${cBold}

echo -en "pyproject.toml ${cGreen}"
grep version pyproject.toml
echo -en "${cReset}__init.py ${cRed}"
echo -en "${cReset}__init__.py ${cRed}"
grep '^version_info ' pyradio/__init__.py
echo -en "${cReset}install.py ${cYellow}"
grep '^PyRadioInstallPyReleaseVersion ' pyradio/install.py
Expand Down Expand Up @@ -58,4 +58,15 @@ and execute ${cRed}./add-pkgver${cReset} to get AUR package
ready for update.
"

echo "Running ${cGreen}./devel/get_shortcuts_and_classes.py${cReset}"
python ./devel/get_shortcuts_and_classes.py

chk=$(LANG=en_US.UTF-8 git st | grep modified)
if [ ! -z "${chk}" ]
then
echo "Not commited files:"
echo "${cRed}${chk}${cReset}"
echo "Please commit them and try again"
exit 1
fi

4 changes: 2 additions & 2 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,8 @@ <h2 id="requirements">Requirements <span style="padding-left: 10px;"><sup style=
<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>
<pre style="height: 200px;">

2024-10-17 s-n-g
* version 0.9.3.11.2 (BUG FIX) - 0.9.3.12-beta2
2024-12-04 s-n-g
* version 0.9.3.11.2 - 0.9.3.12-beta2
* Implementing the Shortcuts Window, making it possible to customize
PyRadio's key bindings
* fixing install.py (#262)
Expand Down
33 changes: 30 additions & 3 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Command line internet radio player.
* [Command line options](#command-line-options)
* [Controls](#controls)
* [Global shortcuts](#global-shortcuts)
* [Customizing key bindings](#customizing-key-bindings)
* [HTML help](#html-help)
* [PyRadio Modes](#pyradio-modes)
* [Secondary Modes](#secondary-modes)
Expand Down Expand Up @@ -71,6 +72,7 @@ Command line internet radio player.
* [Update notification](#update-notification)
* [Remote Control Server](#remote-control-server)
* [Remote Control Client](#remote-control-client)
* [Playing a station in the terminal](#playing-a-station-in-the-terminal)
* [Debug mode](#debug-mode)
* [Reporting bugs](#reporting-bugs)
* [Packaging PyRadio](#packaging-pyradio)
Expand All @@ -90,6 +92,7 @@ Command line internet radio player.
- Station editor (add/edit) with [CJK characters support](#cjk-characters-support)
- Configuration editor
- Search function
- Customizable key bindings
- Easy installation / updating
- Runs on Linux, macOS and Windows

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

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

## Controls

The following list shows a **default** key bindings list used within the program.


Main window Playlists window Themes window
-------------------------------------------------------------------------------------------------------------------------------------
Up/Down/j/k/
Expand Down Expand Up @@ -316,6 +325,12 @@ When focus is on a "*Line editor*", all shortcuts will work when preceded by a "

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

### Customizing key bindings

**PyRadio** provides the possibility to customize the key bindings above.

Just open the configuration window and navigate to **Keyboard Shortcuts**. Please do read the help screen provided therein (press "*?" to get to it).

## HTML help

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

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

## Playing a station in the terminal

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.

This action will be triggered by pressing "*X*".

After the player stops, **PyRadio** will stop as well.

**Note:** On Windows, **mpv** and **VLC** will open a new player window instead of executing in the terminal.

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.

## Debug mode

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*.
Expand Down
12 changes: 11 additions & 1 deletion docs/pyradio.1
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
.\" Copyright (C) 2018-2024 Spiros Georgaras <sng@hellug.gr>
.\" This manual is freely distributable under the terms of the GPL.
.\"
.TH pyradio 1 "June 2024" pyradio
.TH pyradio 1 "December 2024" pyradio

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

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

.SH Playing a station in the terminal

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.

This action will be triggered by pressing "\fIX\fR".

After the player stops, \fBpyradio\fR will stop as well.

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.

.SH Debug Mode
.PP
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.
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "pyradio"
version = "0.9.3.11.1"
version = "0.9.3.11.2"
authors = [
{ name="Ben Dowling", email="ben.m.dowling@gmail.com" },
{ name="Spiros Georgaras", email="sng@hellug.gr" },
Expand Down
2 changes: 1 addition & 1 deletion pyradio/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
" pyradio -- Console radio player. "

version_info = (0, 9, 3, 11, 1)
version_info = (0, 9, 3, 11, 2)

# Set it to True if new stations have been
# added to the package's stations.csv
Expand Down
29 changes: 18 additions & 11 deletions pyradio/config_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -3514,17 +3514,12 @@ def _rename_keyboard_json_file(file_path):
return new_file_name

def _start_editing(self):
self.existing_conflict = None
self._win.addstr(self._selection - self._start + 2, self.maxX-8, '[edit]', curses.color_pair(6))
self._win.refresh()
self._editing = True
if logger.isEnabledFor(logging.DEBUG):
logger.debug('editing "{}"'.format(self._list[self._selection]))
for i in range(self._selection, -1, -1):
if self._list[i][1] is None:
self._in_group = i
break
if logger.isEnabledFor(logging.DEBUG):
logger.debug(f'editing in group "{self._list[self._in_group][0]}"')

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

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

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

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

logger.error('\n\n============')
self._old_key_value = (self._list[self._selection][3], self._list[self._selection][6])
self._list[self._selection][3] = char
self._list[self._selection][6] = ctrl_code_to_string(char)
ret = self._validate_key()
Expand All @@ -3994,8 +3991,8 @@ def keypress(self, char):
''' disable editing '''
self._stop_editing()
else:
self._list[self._selection][3] = self._list[self._selection][2]
self._list[self._selection][6] = self._list[self._selection][5]
# restore previous values on conflict
self._list[self._selection][3], self._list[self._selection][6] = self._old_key_value

return ret
else:
Expand All @@ -4008,6 +4005,16 @@ def keypress(self, char):
self.keys_string = msg + self._get_available_keys() + '\n\n'
return -4

elif char == kbkey['revert_def']:
for i in range(len(self._list)):
self._list[i][3] = self._list[i][1]
self._list[i][6] = self._list[i][4]
self._needs_update = True
elif char == kbkey['revert_saved']:
for i in range(len(self._list)):
self._list[i][3] = self._list[i][2]
self._list[i][6] = self._list[i][5]
self._needs_update = True
elif char == ord('x'):
self._list[self._selection][3] = self._list[self._selection][2]
self._list[self._selection][6] = self._list[self._selection][5]
Expand All @@ -4030,8 +4037,8 @@ def keypress(self, char):
self._go_down(step=5)
elif char == curses.KEY_PPAGE:
self._go_up(step=5)
elif char in (curses.KEY_EXIT, 27, kbkey['q']):
return -1
# elif char in (curses.KEY_EXIT, 27, kbkey['q']):
# return -1
elif char in (curses.KEY_RIGHT, kbkey['l']):
if self._focus > 0:
self._focus_next()
Expand Down
2 changes: 1 addition & 1 deletion pyradio/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
''' This is PyRadio version this
install.py was released for
'''
PyRadioInstallPyReleaseVersion = '0.9.3.11.1'
PyRadioInstallPyReleaseVersion = '0.9.3.11.2'

locale.setlocale(locale.LC_ALL, "")

Expand Down
5 changes: 5 additions & 0 deletions pyradio/keyboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,8 @@ def is_valid_char(char, win):
Returns:
bool: True if c is valid, False otherwise.
"""
if char in (9, ord('\t')):
return False
# if char <= 127:
if (65 <= char <= 90) or (97 <= char <= 122) or (1 <= char <= 47):
''' 1 byte '''
Expand All @@ -456,6 +458,9 @@ def is_valid_char(char, win):
elif char in (
ord('='), ord('.'), ord('+'),
ord('`'), ord('-'),
ord('1'), ord('2'), ord('3'),
ord('4'), ord('5'), ord('6'),
ord('7'), ord('8'), ord('9'),
curses.KEY_F1,
curses.KEY_F2,
curses.KEY_F3,
Expand Down
Loading

0 comments on commit a5b6e66

Please sign in to comment.