From 7e4135929c161623fc6d9b1e189399c5c3b1ee68 Mon Sep 17 00:00:00 2001 From: Spiros Georgaras Date: Thu, 4 Jan 2024 18:00:01 +0200 Subject: [PATCH] version 0.9.2.21 --- docs/index.html | 18 +++++ docs/index.md | 18 +++++ docs/pyradio.1 | 184 ++++++++++++++++++++++++++++-------------- pyradio/main.py | 2 +- pyradio/mkvtoolnix.py | 2 +- 5 files changed, 161 insertions(+), 63 deletions(-) diff --git a/docs/index.html b/docs/index.html index be50ba31..e70d5d25 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1126,12 +1126,14 @@

Installation Command line options Top

$ pyradio -h
 
+
 Usage: pyradio [-h] [-c CONFIG_DIR] [-p [STATION_NUMBER]] [-u PLAYER] [-a]
                [-l] [-lt] [-sd] [-od] [-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] [-scv PNG_FILE] [-srt] [-ach]
+               [--headless IP_AND_PORT] [--address] [-fd]
 
 Curses based Internet radio player
 
@@ -1223,6 +1225,22 @@ 

Command line options Controls Top

                  Main window                                      Playlists window                   Themes window
diff --git a/docs/index.md b/docs/index.md
index 0a54e492..5324e2a8 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -120,12 +120,14 @@ In any other case, and since **PyRadio** is currently not available via pip, you
 ```
 $ pyradio -h
 
+
 Usage: pyradio [-h] [-c CONFIG_DIR] [-p [STATION_NUMBER]] [-u PLAYER] [-a]
                [-l] [-lt] [-sd] [-od] [-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] [-scv PNG_FILE] [-srt] [-ach]
+               [--headless IP_AND_PORT] [--address] [-fd]
 
 Curses based Internet radio player
 
@@ -218,6 +220,22 @@ Recording stations:
                         file, much like the one produced by the previous
                         command line parameter.
 
+Headless operation:
+  --headless IP_AND_PORT
+                        Start in headless mode. IP_AND_PORT can be a) auto
+                        (use localhost:11111), b) localhost:XXXXX (access the
+                        web server through localhost), c) lan:XXXXX (access
+                        the web server through the LAN) or d) IP_ADDRESS:XXXX
+                        (the IP_ADDRESS must be already assigned to one of the
+                        network interfaces). XXXXX can be any port number
+                        above 1025. Please make sure it is different than the
+                        one set in the configuration file.
+  --address             Show remote control server address.
+  -fd, --free-dead-headless-server
+                        Use this if your headless server has terminated
+                        unexpectedly, and you cannot start a new one (you get
+                        a message that it is already running).
+
 ```
 
 ## Controls
diff --git a/docs/pyradio.1 b/docs/pyradio.1
index 61f323a0..d968cb68 100644
--- a/docs/pyradio.1
+++ b/docs/pyradio.1
@@ -21,74 +21,136 @@ It currently supports the following players: \fIMPV\fR, \fIMPlayer\fR and \fIVLC
 
 .SH Options
 
-.IP \fB-c\fR\ [\fICONFIG\fR],\ \fB\ \--config-dir\ \fR[\fICONFIG\fR]
-Use specified configuration directory instead of the default one. \fBpyradio\fR will try to create it, if it does not exist. Not available on Windows.
-.IP \fB-s\fR,\fB\ \--stations\ \fR[\fISTATIONS\fR]
-Use specified station CSV file.
-.IP \fB-p\fR,\fB\ \--play\ \fR\<\fIPLAY\fR\>
-Play station number \fR\<\fIPLAY\fR\>. Select randome station if \fR\<\fIPLAY\fR\> not specified.
-.IP \fB-u\fR,\fB\ \--use-player\ \fR[\fIUSE_PLAYER\fR]
-Specify which player to use (\fImpv\fR,\ \fImplayer\fR\ or\ \fIvlc\fR). A comma-separated list of players can be givven, thus specifying detection order.
-.IP \fB-a\fR,\fB\ \--add
+.PP
+\fIGeneral options:\fR
+.IP\ \fB-c\fR\ \fICONFIG_DIR\fR,\ \fB--config\fR\fB-dir\fR\ \fICONFIG_DIR\fR
+Use specified configuration directory instead of the
+default one. PyRadio will try to create it, if it does
+not exist. Not available on Windows.
+.IP\ \fB-p\fR\ [\fISTATION_NUMBER\fR],\ \fB--play\fR\ [\fISTATION_NUMBER\fR]
+Start and play. The value is num station or empty for
+random.
+.IP\ \fB-u\fR\ \fIPLAYER\fR,\ \fB--use\fR\fB-player\fR\ \fIPLAYER\fR
+Use specified player. A comma-separated list can be
+used to specify detection order. Supported players:
+\fImpv\fR, \fImplayer\fR, \fIvlc\fR.
+.IP\ \fB-a\fR,\ \fB--add\fR
 Add station to list.
-.IP \fB-ls\fR,\fB\ \--list-playlists
-List of available playlists in config dir.
-.IP \fB-l\fR,\fB\ \--list
+.IP\ \fB-l\fR,\ \fB--list\fR
 List of available stations in a playlist.
-.IP \fB-t\fR\ \fITHEME\fR,\ \fB--theme\fR\ \fITHEME\fR
-Use specified \fITHEME\fR.
-.IP \fB--show-themes\fR
-Show \fIInternal\fR and \fISystem Themes\fR names.
-.IP \fB--no-themes\fR
-Disable themes (use default theme).
-.IP \fB--write-theme\ \fIIN_THEME\ OUT_THEME\fR
-Write an \fIInternal\fR or \fISystem Theme\fR to themes directory.
-.IP \fB--terminal\ \fITERMINAL\fR
-Use this terminal for Desktop file instead of the auto-detected one. Use "none" to reset to the default terminal, or "\fIauto\fR" to reset to the auto-detected one.
-.IP \fB--terminal-param\ \fITERMINAL_PARAM\fR
-Use this as \fBpyradio\fR parameter in the Desktop File. Please replace hyphens with underscores when passing the parameter, for example: \fI--terminal-param\fR "\fB_p 3 _t light\fR" (which will result to "\fIpyradio \fB-p 3 -t light\fR").
-.IP \fB-tlp\fR,\ \fB--toggle-load-last-playlist
+.IP\ \fB-lt\fR,\ \fB--log\fR\fB-titles\fR
+Log titles to file.
+.IP\ \fB-sd\fR,\ \fB--show\fR\fB-config\fR\fB-dir\fR
+Print config directory [\fICONFIG\fR \fIDIR\fR] location and exit.
+.IP\ \fB-od\fR,\ \fB--open\fR\fB-config\fR\fB-dir\fR
+Open config directory [\fICONFIG\fR \fIDIR\fR] with default file
+manager.
+.IP\ \fB-d\fR,\ \fB--debug\fR
+Start PyRadio in debug mode.
+.IP\ \fB-ul\fR,\ \fB--unlock\fR
+Remove sessions' lock file.
+.IP\ \fB-us\fR,\ \fB--update\fR\fB-stations\fR
+
+Update "\fIstations.csv\fR" (if needed).
+.IP\ \fB-U\fR,\ \fB--update\fR
+Update PyRadio.
+.IP\ \fB-R\fR,\ \fB--uninstall\fR
+Uninstall PyRadio.
+.IP\ \fB-V\fR,\ \fB--version\fR
+Display version information.
+
+.PP
+\fIPlaylist selection:\fR
+.IP\ \fB-ls\fR,\ \fB--list\fR\fB-playlists\fR
+List of available playlists in config dir.
+.IP\ \fB-s\fR\ \fIPLAYLIST\fR,\ \fB--stations\fR\ \fIPLAYLIST\fR
+Load the specified playlist instead of the default
+one.
+.IP\ \fB-tlp\fR,\ \fB--toggle\fR\fB-load\fR\fB-last\fR\fB-playlist\fR
 Toggle autoload last opened playlist.
-.IP \fB-sd\fR,\fB--show-config-dir\fR
-Print config directory (\fI[CONFIG DIR]\fR) location and exit.
-.IP \fB-od\fR,\fB--open-config-dir\fR
-Open config directory (\fI[CONFIG DIR]\fR) with default file manager.
-.IP \fB-or\fR,\fB--open-recordings\fR
-Open the Recordings folder.
-.IP \fB-oc\fR,\ \fB--open-cache\fR
+
+.PP
+\fIThemes:\fR
+.IP\ \fB-t\fR\ \fITHEME\fR,\ \fB--theme\fR\ \fITHEME\fR
+Use specified theme.
+.IP\ \fB--show\fR\fB-themes\fR
+Show Internal and System Themes names.
+.IP\ \fB--no\fR\fB-themes\fR
+Disable themes (use default theme).
+.IP\ \fB--write\fR\fB-theme\fR\ \fIIN_THEME\fR\ \fIOUT_THEME\fR,
+Write an Internal or System Theme to themes directory.
+
+.PP
+\fITerminal selection:\fR
+.IP\ \fB--terminal\fR\ \fITERMINAL\fR
+Use this terminal for Desktop file instead of the
+auto-detected one. Use "\fInone\fR" to reset to the default
+terminal or "\fIauto\fR" to reset to the auto-detected one.
+.IP\ \fB--terminal-param\fR\ \fITERMINAL_PARAM\fR
+Use this as PyRadio parameter in the Desktop File.
+Please replace hyphens with underscores when passing
+the parameter, for example: \fB--terminal-param\fR \fI"_p 3 _t
+light"\fR (which will result to "\fBpyradio \fI-p 3 -t light\fR").
+
+.PP
+\fICache:\fR
+.IP\ \fB-oc\fR,\ \fB--open\fR\fB-cache\fR
 Open the Cache folder.
-.IP \fB-sc\fR,\ \fB--show-cache\fR
+.IP\ \fB-sc\fR,\ \fB--show\fR\fB-cache\fR
 Show Cache contents.
-.IP \fB-cc\fR,\ \fB--clear-cache\fR
+.IP\ \fB-cc\fR,\ \fB--clear\fR\fB-cache\fR
 Clear Cache contents.
-.IP \fB-gc\fR,\ \fB--get-cache\fR
+.IP\ \fB-gc\fR,\ \fB--get\fR\fB-cache\fR
 Download source code, keep it in the cache and exit.
-.IP \fB-us\fR,\ \fB--update_stations
-Update "\fIstations.csv\fR" (if needed).
-.IP \fB-lt\fR,\ \fB--log-titles\fR
-Log titles to file.
-.IP \fB-r\fR,\ \fB--record\fR
-Turn recording on (not available for VLC player on Windows).
-.IP \fB-mkv\ \fIMKV_FILE\fR,\ \fB--mkv-file\ \fIMKV_FILE
-Specify a previously recorded MKV file to be used with one of the following options. The \fIMKV_FILE\fR can either be an absolute or a relative path, or a number provided by the \fB-lr\fR command line paremater. If it is a relative path, it should be found in the current or in the Recordings directory.
-.IP \fB-scv\fR\ \fIPNG_FILE\fR,\ \fB--set-mkv-cover\ \fIPNG_FILE
-Add or change the cover image of a previously recorded \fBMKV\fR file. \fIPNG_FILE\fR can either be an absolute or a relative path. If relative, it should be found in the current or in the Recordings directory.
-.IP \fB-srt\fR,\ \fB--export-srt
-Export a previously recorded \fBMKV\fR file chapters to an \fISRT\fR file. The file produced will have the name of the input file with the "\fImkv\fR" extension replaced by "\fIsrt\fR".
-.IP \fB-ach\fR,\ \fB--add-chapters
-Add (or replace) chapter markers to a previously recorded \fBMKV\fR file. The chapters file will be a \fISRT\fR file, much like the one produced by the previous command line parameter.
-.IP \fB-d\fR,\fB\ \--debug
-Enable \fBDEBUG MODE\fR.
-.IP \fB-ul\fR,\ \fB--unlock\fR
-Remove sessions' lock file.
-.IP \fB-U\fR,\ \fB--update\fR
-Update \fBpyradio\fR.
-.IP \fB-R\fR,\ \fB--uninstall\fR
-Uninstall \fBpyradio\fR.
-.IP \fB-V\fR,\fB\ \--version\fR
-Display version information.
-.IP \fB-h\fR,\fB\ \--help
-Display usage information and exit.
+
+.PP
+\fIRecording stations:\fR
+.IP\ \fB-r\fR,\ \fB--record\fR
+Turn recording on (not available for \fIVLC\fR player on
+Windows).
+.IP\ \fB-or\fR,\ \fB--open\fR\fB-recordings\fR
+Open the Recordings folder.
+.IP\ \fB-lr\fR,\ \fB--list\fR\fB-recordings\fR
+List recorded files.
+.IP\ \fB-mkv\fR\ \fIMKV_FILE\fR,\ \fB--mkv\fR\fB-file\fR\ \fIMKV_FILE\fR
+Specify a previously recorded \fIMKV\fR file to be used with
+one of the following options. The \fIMKV_FILE\fR can either
+be an absolute or a relative path, or a number
+provided by the \fB-lr\fR command line paremater. If it is a
+relative path, it should be found in the current or in
+the Recordings directory.
+.IP\ \fB-scv\fR\ \fIPNG_FILE\fR,\ \fB--set\fR\fB-mkv\fR\fB-cover\fR\ \fIPNG_FILE\fR
+Add or change the cover image of a previously recorded
+\fIMKV\fR file. \fIPNG_FILE\fR can either be an absolute or a
+relative path. If relative, it should be found in the
+current or in the Recordings directory.
+.IP\ \fB-srt\fR,\ \fB--export\fR\fB-srt\fR
+Export a previously recorded \fIMKV\fR file chapters to an
+\fISRT\fR file. The file produced will have the name of the
+input file with the "mkv" extension replaced by "srt".
+.IP\ \fB-ach\fR,\ \fB--add\fR\fB-chapters\fR
+Add (or replace) chapter markers to a previously
+recorded \fIMKV\fR file. The chapters file will be a \fISRT\fR
+file, much like the one produced by the previous
+command line parameter.
+
+.PP
+\fIHeadless operation:\fR
+.IP\ \fB--headless\fR\ \fIIP_AND_IPORT\fR
+Start in headless mode. \fIIP_AND_IPORT\fR can be a) auto
+(use \fBlocalhost\fR:\fI11111\fR), b) \fBlocalhost\fR:\fIXXXXX\fR (access the
+web server through localhost), c) \fBlan\fR:\fIXXXXX\fR (access
+the web server through the \fILAN\fR) or d) \fBIP_ADDRESS\fR:\fIXXXX\fR
+(the \fBIP_ADDRESS\fR must be already assigned to one of the
+network interfaces). \fIXXXXX\fR can be any port number
+above 1025. Please make sure it is different than the
+one set in the configuration file.
+.IP\ \fB--address\fR
+Show remote control server address.
+.IP\ \fB-fd\fR,\ \fB--free\fR\fB-dead\fR\fB-headless\fR\fB-server\fR
+Use this if your headless server has terminated
+unexpectedly, and you cannot start a new one (you get
+a message that it is already running).
 
 .RE
 .PP
diff --git a/pyradio/main.py b/pyradio/main.py
index 0a80356c..6e3b8f6a 100644
--- a/pyradio/main.py
+++ b/pyradio/main.py
@@ -335,7 +335,7 @@ def shell():
     else:
         gr_headless = parser.add_argument_group('• Headless operation')
         gr_headless.add_argument('--headless', default=None, metavar=('IP_AND_PORT', ),
-                                 help='Start in headless mode. IP_AND_PORT can be a) auto (use localhost:11111), b) localhost:XXXXX (access the web server through localhost), c) lan:XXXXX (access the web server through the LAN) or d) IP_ADDRESS:XXXX (the IP_ADDRESS must be an assigned to one of the network interfaces). XXXXX can be any port number above 1025. Please make sure it is different than the one set in the configuration file.')
+                                 help='Start in headless mode. IP_AND_PORT can be a) auto (use localhost:11111), b) localhost:XXXXX (access the web server through localhost), c) lan:XXXXX (access the web server through the LAN) or d) IP_ADDRESS:XXXX (the IP_ADDRESS must be already assigned to one of the network interfaces). XXXXX can be any port number above 1025. Please make sure it is different than the one set in the configuration file.')
         gr_headless.add_argument('--address', action='store_true',
                                 help='Show remote control server address.')
         gr_headless.add_argument('-fd', '--free-dead-headless-server', action='store_true',
diff --git a/pyradio/mkvtoolnix.py b/pyradio/mkvtoolnix.py
index d0b0ee5c..4328fed6 100644
--- a/pyradio/mkvtoolnix.py
+++ b/pyradio/mkvtoolnix.py
@@ -218,7 +218,7 @@ def update_cover(self, print_messages=True):
                 return None
         if not self._cover_file.endswith('.png'):
             if print_messages:
-                print('  File not supported: "{}"'.format(out[1]))
+                print('  File not supported: "{}"'.format(self._cover_file))
                 sys.exit(1)
             else:
                 return None