Skip to content

Commit f57cc54

Browse files
committed
- Version 0.8.9.29 (0.9-beta26)
- checking TERM is done when needed - fix_pyradio_desktop_file changes - updating docs
1 parent d3f27cc commit f57cc54

File tree

8 files changed

+351
-172
lines changed

8 files changed

+351
-172
lines changed

README.html

Lines changed: 56 additions & 13 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 77 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ Ben Dowling - [https://github.com/coderholic](https://github.com/coderholic)
4848
* [Displaying Station Info](#displaying-station-info)
4949
* [Copying and pasting - Registers](#copying-and-pasting---registers)
5050
* [PyRadio Themes](#pyradio-themes)
51+
* [Virtual terminal restrictions](#virtual-terminal-restrictions)
5152
* [CSS color themes restrictions](#css-color-themes-restrictions)
5253
* [Secondary windows background](#secondary-windows-background)
5354
* [Theme defined secondary windows color](#theme-defined-secondary-windows-color)
@@ -67,6 +68,9 @@ Ben Dowling - [https://github.com/coderholic](https://github.com/coderholic)
6768
* [Tagging a title](#tagging-a-title)
6869
* [Online radio directory services](#online-radio-directory-services)
6970
* [Desktop Notifications](#desktop-notifications)
71+
* [Desktop File](#desktop-file)
72+
* [Specifying the terminal to use](#specifying-the-terminal-to-use)
73+
* [Specifying PyRadio parameters](#specifying-pyradio-parameters)
7074
* [Session Locking](#session-locking)
7175
* [Session unlocking](#session-unlocking)
7276
* [Update notification](#update-notification)
@@ -121,10 +125,11 @@ In any other case, and since **PyRadio** is currently not available via pip, you
121125
$ pyradio -h
122126
123127
usage: pyradio [-h] [-s STATIONS] [-p [PLAY]] [-u USE_PLAYER] [-a] [-ls] [-l]
124-
[-t THEME] [--show-themes] [--write-theme IN_THEME OUT_THEME,]
125-
[-tlp] [-scd] [-ocd] [-ep EXTRA_PLAYER_PARAMETERS]
126-
[-ap ACTIVE_PLAYER_PARAM_ID] [-lp] [-U] [--user] [-R]
127-
[--unlock] [-lt] [-d] [-V]
128+
[-t THEME] [--show-themes] [--no-themes]
129+
[--write-theme IN_THEME OUT_THEME,] [--terminal TERMINAL]
130+
[--terminal-param TERMINAL_PARAM] [-tlp] [-scd] [-ocd]
131+
[-ep EXTRA_PLAYER_PARAMETERS] [-ap ACTIVE_PLAYER_PARAM_ID]
132+
[-lp] [-U] [--user] [-R] [--unlock] [-lt] [-d] [-V]
128133
129134
Curses based Internet radio player
130135
@@ -146,8 +151,17 @@ options:
146151
-t THEME, --theme THEME
147152
Use specified theme.
148153
--show-themes Show Internal and System Themes names.
154+
--no-themes Disable themes (use default theme).
149155
--write-theme IN_THEME OUT_THEME,
150156
Write an Internal or System Theme to themes directory.
157+
--terminal TERMINAL Use this terminal for Desktop file instead of the
158+
auto-detected one. Use "none" to reset to the default
159+
terminal or "auto" to reset to the auto-detected one.
160+
--terminal-param TERMINAL_PARAM
161+
Use this as PyRadio parameter in the Desktop File.
162+
Please replace hyphens with underscores when passing
163+
the parameter, for example: --terminal-param "_p 3 _t
164+
light" (which will result to "pyradio -p 3 -t light").
151165
-tlp, --toggle-load-last-playlist
152166
Toggle autoload last opened playlist.
153167
-scd, --show-config-dir
@@ -565,7 +579,7 @@ The default player to use can also be set in **PyRadio**'s [configuration file](
565579

566580
### Extra Player Parameters
567581

568-
All three supported players can accept a significant number of "*command line parameters*", which are well documented and accessible through man pages (on linux and macOs) or the documentation (on Windows).
582+
All three supported players can accept a significant number of "*command line options*", which are well documented and accessible through man pages (on linux and macOs) or the documentation (on Windows).
569583

570584
**PyRadio** uses some of these parameters in order to execute and communicate with the players. In particular, the following parameters are in use **by default**:
571585

@@ -577,13 +591,13 @@ All three supported players can accept a significant number of "*command line pa
577591

578592
**Note:** The user should not use or change the above player parameters. Failing to do so, may render the player ***unusable***.
579593

580-
**PyRadio** provides a way for the user to add extra parameters to the player, either by a command line parameter, or the "*Configuration Window*" (under "*Player:*").
594+
**PyRadio** provides a way for the user to add extra parameters to the player, either by a command line option, or the "*Configuration Window*" (under "*Player:*").
581595

582596
This way, 10 sets of parameters can be inserted and made available for selection.
583597

584598
#### Using the command line
585599

586-
When the command line parameter (**-ep** or **--extra_player_parameters**) is used, the parameters specified must be of a specific format, and will be added to the list of parameters and made default for the player for the current session.
600+
When the command line option (**-ep** or **--extra_player_parameters**) is used, the parameters specified must be of a specific format, and will be added to the list of parameters and made default for the player for the current session.
587601

588602
The format of the parameter is the following: **[player_name:parameters]**
589603

@@ -621,7 +635,7 @@ The user can add ("**a**") a new parameter, edit ("**e**") an existing set and d
621635

622636
### Changing parameters set
623637

624-
When all desired parameter sets are already defined, using the **-ap** (**--active-player-param-id**) command line parameter can activate the set that corresponds to the number specified. The number to use for any given set can be retrieved using the **-lp** (**--list-player-parameters**) command line parameter.
638+
When all desired parameter sets are already defined, using the **-ap** (**--active-player-param-id**) command line option can activate the set that corresponds to the number specified. The number to use for any given set can be retrieved using the **-lp** (**--list-player-parameters**) command line option.
625639

626640
While **PyRadio** is running, the user can change the parameters set used by the player using the "*Player Extra Parameters*" window, by pressing "**Z**".
627641

@@ -833,6 +847,18 @@ The "*Theme selection window*" will remain open after activating a theme, so tha
833847

834848
Pressing "**SPACE**", will apply the theme and make it default, and pressing "**c**" will apply the theme and make it default and start a file watch function on the file, so that if the file changes, **PyRadio** will automatically update itself.
835849

850+
### Virtual terminal restrictions
851+
852+
After introducing CSS color themes, it has come to my attention that **PyRadio** will not display colors correctly when executed within specific terminals, *konsole*, *yakuake*, *deepin-teminal*, *qterminal* and *terminology*, just to name a few.
853+
854+
Now, I do not know whether this is because of the terminals themselves, python curses implementation or whatever, but that's that.
855+
856+
**PyRadio** will try to detect these terminals and disable themes (after displaying a relative message). Then the default theme will be used.
857+
858+
Some of the terminals that work ok, are: *gnome-terminal*, *mate-terminal*, *xfce4-terminal*, *lxterminal*, *terminator*, *termite*, *kitty*, *alacritty*, *sakura*, *roxterm*, *tilix*, *lilyterm*, *st*, *xst*, *rxvt*, *urxvt*, *uxterm*, *xterm*.
859+
860+
If you want to make **PyRadio** start in one of these terminal, just follow the instructions given at [Desktop File: Specifying the terminal to use](#specifying-the-terminal-to-use).
861+
836862
### CSS color themes restrictions
837863

838864
Using CSS colors imposes a couple of restrictions on the type of terminals **PyRadio** will be able to run:
@@ -841,7 +867,7 @@ Using CSS colors imposes a couple of restrictions on the type of terminals **PyR
841867
\
842868
**PyRadio** will set it to "*xterm-256color*" if not set. \
843869
\
844-
Furthermore, if TERM is set to anything like "**xterm***", "**screen***" or "**tmux***", **PyRadio** will set it to "*xterm-256color*" as well.
870+
Furthermore, if TERM is set to anything like "**xterm**", "**screen**" or "**tmux**", **PyRadio** will set it to "*xterm-256color*" as well.
845871

846872
2. Terminals that do not support at least 16 colors will not be able to display any of the new themes. The same goes for terminals that do not support changing their colors (through the **curses** library). \
847873
\
@@ -1043,7 +1069,7 @@ The way this works, according to the documenataion, is that one "can use the **m
10431069

10441070
The function can be enabled:
10451071

1046-
1. using the `-lt` (`--log-titles`) command line parameter, or
1072+
1. using the `-lt` (`--log-titles`) command line option, or
10471073
2. by pressing "**W**" while in the **Main**, the **Playlist** or the **Register** mode.
10481074

10491075
The titles are written in a file called `pyradio-titles.log` which is saved at **PyRadio** configuration directory.
@@ -1103,6 +1129,44 @@ If enabled, **PyRadio** will display:
11031129

11041130
To find out more about configuring this feature, please refer to [Desktop Notification](desktop-notification.md).
11051131

1132+
## Desktop File
1133+
1134+
**PyRadio** will install a Desktop File under **~/.local/share/applications**.
1135+
1136+
**Note:** The system wide Desktop File will probably be under **/usr/share/applications** or **/usr/local/share/applications**.
1137+
1138+
By default, this Desktop File will add a "**PyRadio**" entry under the "**Internet**" category (or menu), and will execute **PyRadio** no matter if the directory it resides in is the PATH or not, using the **default** terminal that the system uses.
1139+
1140+
In case of a local installation, when a system wide installation also exists, the entry will display "**PyRadio - Local**" to distinguish itself from the system wide "**PyRadio**" one.
1141+
1142+
**Note:** If the TERMINAL variable is set, the Desktop File will use that instead.
1143+
1144+
### Specifying the terminal to use
1145+
1146+
If a specific terminal has to be used, using the **--terminal** command line option is the way to go:
1147+
1148+
pyradio --terminal kitty
1149+
1150+
This command will set the terminal in the Desktop file, so that:
1151+
1152+
Exec=kitty -e pyradio
1153+
1154+
To have **PyRadio** try to find a suitable terminal, execute:
1155+
1156+
pyraio --terminal auto
1157+
1158+
To restore the original functionality (specifying no terminal):
1159+
1160+
pyradio --terminal none
1161+
1162+
#### Specifying PyRadio parameters
1163+
1164+
If a **PyRadio** parameter has to be present in the Desktop File, use the **--terminal-param** command line option:
1165+
1166+
pyradio --terminal none --terminal-param "_p 2"
1167+
1168+
This command will use no specific terminal and will pass the "**-p 2**" (play station No 2 automatically) parameter to **PyRadio**. To pass such a parameter, substitute all hyphens with underscores.
1169+
11061170
## Session Locking
11071171

11081172
**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.
@@ -1111,7 +1175,7 @@ Subsequent instances will be "*locked*". This means that the user can still play
11111175

11121176
### Session unlocking
11131177

1114-
If for any reason **PyRadio** always starts in "*locked mode*", one can **unlock** the session, using the "*--unlock*" command line parameter.
1178+
If for any reason **PyRadio** always starts in "*locked mode*", one can **unlock** the session, using the "*--unlock*" command line option.
11151179

11161180
## Update notification
11171181

@@ -1139,7 +1203,7 @@ Finally, execute the command:
11391203

11401204
## Cleaning up
11411205

1142-
**PyRadio** will uninstall all previously installed versions when updated (using the **-U** command line parameter), so no extra steps are needed any more to house keep your system.
1206+
**PyRadio** will uninstall all previously installed versions when updated (using the **-U** command line option), so no extra steps are needed any more to house keep your system.
11431207

11441208
## Debug mode
11451209

@@ -1200,7 +1264,7 @@ Having said that, if you are not packaging for a specific distribution, please d
12001264
- [ ] Use Radio Browser service ([#80](https://github.com/coderholic/pyradio/issues/80) [#93](https://github.com/coderholic/pyradio/issues/93) [#112](https://github.com/coderholic/pyradio/issues/112))
12011265
- [ ] Use some OPML service, [https://opml.radiotime.com](https://opml.radiotime.com) for example
12021266
- [x] Notify the user that the package's stations.csv has changed -v 0.8.9
1203-
- [x] Update / uninstall using command line parameters (-U / -R) - v. 0.8.9
1267+
- [x] Update / uninstall using command line options (-U / -R) - v. 0.8.9
12041268
- [x] Basic mouse support ([#119](https://github.com/coderholic/pyradio/issues/119)) - v. 0.8.8.3
12051269
- [x] Players extra parameters ([#118](https://github.com/coderholic/pyradio/issues/118)) - v. 0.8.8.3
12061270
- [x] New player selection configuration window ([#118](https://github.com/coderholic/pyradio/issues/118)) - v. 0.8.8.3

devel/fix_pyradio_desktop_file

Lines changed: 15 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ echo "
2222
Available options:
2323
-t TERMINAL
2424
Use this terminal for Desktop file instead of the auto-detected one.
25-
Use \"default\" to reset to the default terminal.
25+
Use \"none\" to reset to the default terminal.
2626
Use \"auto\" to reset to the auto-detected one.
2727
-p PARAMETER
2828
PyRadio parameter. Please replace hyphens with underscores.
@@ -41,24 +41,6 @@ the terminal \"my_term\" is \"-S\", execute as follows:
4141
"
4242
}
4343

44-
function install(){
45-
# run this from installation script only
46-
#
47-
# use REQ_TERMINAL if it exists, outerwise
48-
# use no terminal
49-
#
50-
# if REQ_TERMINAL is not specified, ans the
51-
# desktop file already exists, use the terminal
52-
# from it (or none if none is specified)
53-
54-
echo "Installing Desktop file ... "
55-
DESKTOP_FILE=~/.local/share/applications/pyradio.desktop
56-
# set -x
57-
get_req_terminal
58-
get_program
59-
write_desktop_file
60-
}
61-
6244
function write_desktop_file(){
6345
if [ -z "${REQ_TERMINAL}" ]
6446
then
@@ -78,16 +60,16 @@ Comment=Curses based Radio Player" > "${DESKTOP_FILE}"
7860
echo "TryExec=${PROGRAM}" >> "${DESKTOP_FILE}"
7961
if [ -z "${PARAM}" ]
8062
then
81-
echo "Exec=${REQ_TERMINAL}${PROGRAM}" | sed 's/Exec= /Exec=/' >> "${DESKTOP_FILE}"
63+
echo "Exec=${REQ_TERMINAL}${PROGRAM}" | sed -e 's/Exec= /Exec=/' -e 's/ / /g' >> "${DESKTOP_FILE}"
8264
else
8365
PARAM=" ${PARAM//_/-}"
84-
echo "Exec=${REQ_TERMINAL}${PROGRAM} ${PARAM}" | sed 's/Exec= /Exec=/' >> "${DESKTOP_FILE}"
66+
echo "Exec=${REQ_TERMINAL}${PROGRAM} ${PARAM}" | sed -e 's/Exec= /Exec=/' -e 's/ / /g' >> "${DESKTOP_FILE}"
8567
fi
8668
echo "Icon=/home/${USER}/.config/pyradio/pyradio.png" >> "${DESKTOP_FILE}"
8769
echo "${TERMINAL_LINE}" >> "${DESKTOP_FILE}"
8870
echo "Categories=Network" >> "${DESKTOP_FILE}"
8971

90-
if [ -e /usr/share/applications/pyradio.desktop ]
72+
if [ -e /usr/share/applications/pyradio.desktop ] || [ -e /usr/loacal/share/applications/pyradio.desktop ]
9173
then
9274
sed -i 's/Name=PyRadio/& - Local/' "${DESKTOP_FILE}"
9375
fi
@@ -147,7 +129,7 @@ function get_req_terminal(){
147129
REQ_TERMINAL="${REQ_TERMINAL} ${REQ_COMMAND}"
148130
fi
149131
fi
150-
if [ "${REQ_TERMINAL}" == "default" ]
132+
if [ "${REQ_TERMINAL}" == "none" ]
151133
then
152134
unset REQ_TERMINAL
153135
fi
@@ -221,7 +203,7 @@ do
221203
if [ "${REQ_TERMINAL}" = "auto" ]
222204
then
223205
echo "Auto-detecting terminal..."
224-
get_terminal
206+
[ -z "${TERMINAL}" ] && get_terminal || REQ_TERMINAL="${TERMINAL}"
225207
if [ -z "${REQ_TERMINAL}" ]
226208
then
227209
echo "No suitable terminal can be detected in this system..."
@@ -230,10 +212,10 @@ do
230212
echo
231213
exit 1
232214
else
233-
echo " Auto-detectet terminal: ${REQ_TERMINAL/ */}"
215+
echo " Auto-detecteted terminal: ${REQ_TERMINAL/ */}"
234216
fi
235217
else
236-
if [ "${REQ_TERMINAL}" != "default" ]
218+
if [ "${REQ_TERMINAL}" != "none" ]
237219
then
238220
if [[ "${REQ_TERMINAL}" != *" "* ]]
239221
then
@@ -257,10 +239,6 @@ do
257239
}
258240
shift
259241
;;
260-
--install|-i)
261-
INSTALL=1
262-
shift
263-
;;
264242
*) # unknown option
265243
POSITIONAL+=("$1") # save it in an array for later
266244
shift # past argument
@@ -269,4 +247,10 @@ do
269247
done
270248
set -- "${POSITIONAL[@]}" # restore positional parameters
271249

272-
install
250+
echo "Installing Desktop file ... "
251+
DESKTOP_FILE=~/.local/share/applications/pyradio.desktop
252+
# set -x
253+
get_req_terminal
254+
get_program
255+
write_desktop_file
256+

0 commit comments

Comments
 (0)