From 46ff54d31ad65b2402746694517e6683f4056877 Mon Sep 17 00:00:00 2001 From: Spiros Georgaras Date: Fri, 26 Feb 2021 13:39:59 +0200 Subject: [PATCH] - Version 0.8.8.3 - Fixing displaying help for parameters editor - Updating documentation --- Changelog | 10 +++++--- README.html | 52 ++++++++++++++++++++++++---------------- README.md | 11 +++++---- build.html | 9 ++++--- pyradio.1 | 10 ++++---- pyradio/config_window.py | 14 ++++++++--- pyradio/radio.py | 4 ++++ windows-mplayer.html | 11 +++++---- windows.html | 11 +++++---- 9 files changed, 86 insertions(+), 46 deletions(-) diff --git a/Changelog b/Changelog index f6e46ce7..f01a3c5d 100644 --- a/Changelog +++ b/Changelog @@ -1,12 +1,16 @@ -2021-02-12 s-n-g +2021-02-26 s-n-g * Basic mouse support implemented * Config option to enable mouse support added + * Implementing players extra parameters set. + * Player selection Config window redesigned. + * Adding -ep. -ap, -lp command line parameters. * Fixing a bug which would lead to a crash when "r" would be pressed in the config window. - * When altering connection type either from the config - or from the dialog ('z'), playback will be restarted + * Playback will be restarted when vital parameters are + changes (encoding, connection type, player parameters). * When restarting playback, play the correct station not the selected one. + * Fixing several minor bugs. 2021-01-09 s-n-g * adding autostart BAT file on Windows to diff --git a/README.html b/README.html index 46467a6e..1c167714 100644 --- a/README.html +++ b/README.html @@ -21,13 +21,16 @@ a{ color: SaddleBrown;} a:visited{color: SaddleBrown;} + -
+

PyRadio

Command line internet radio player.

-

Ben Dowling - https://github.com/coderholic

+

Ben Dowling - https://github.com/coderholic

Table of contents Top

Installation Top

-

The best way to install PyRadio is via a distribution package, if one exists (e.g. Arch Linux and derivatives can install pyradio-git from AUR).

+

The best way to install PyRadio is via a distribution package, if one exists (e.g. Arch Linux and derivatives can install pyradio-git from AUR).

In any other case, and since PyRadio is currently not available via pip, you will have to build it from source.

Command line options Top

$ pyradio -h
@@ -175,7 +178,7 @@ 

PyRadio’s Modes

The functions available through the secondary modes are content dependent, so you can see what command is available by pressing “?” while within a secondary mode. Pressing any other key will exit the secondary mode.

Config file Top

-

PyRadio upon its execution tries to read its configuration file (i.e. ~/.config/pyradio/config). If this file is not found, it will be created. If an error occurs while parsing it, an error message will be displayed and PyRadio will terminate.

+

PyRadio upon its execution tries to read its configuration file (i.e. ~/.config/pyradio/config). If this file is not found, it will be created. If an error occurs while parsing it, an error message will be displayed and PyRadio will terminate.

The file contains parameters such as the player to use, the playlist to load etc. It is heavily commented (as you can see here), so that manual editing is really easy. The best practice to manually edit this file is executing PyRadio with the -ocd command line option, which will open the configuration directory in your file manager, and then edit it using your preferable text editor.

The file can also be altered while PyRadio is running by pressing “c”, which will open the “Configuration window”. This window presents all PyRadio options and provide the way to change them and finally save them by pressing “s”.

In any case, PyRadio will save the file before exiting (or in case Ctrl-C is pressed) if needed (e.g. if a config parameter has been changed during its execution).

@@ -183,9 +186,9 @@

Config file About Playlist files Top

PyRadio reads the stations to use from a CSV file, where each line contains two columns, the first being the station name and the second being the stream URL.

Optionally, a third column can be inserted, stating the encoding used by the station (more on this at Specifying stations’ encoding).

-

PyRadio will by default load the user’s stations file (e.g. ~/.config/pyradio/stations.csv) to read the stations from. If this file is not found, it will be created and populated with a default set of stations.

+

PyRadio will by default load the user’s stations file (e.g. ~/.config/pyradio/stations.csv) to read the stations from. If this file is not found, it will be created and populated with a default set of stations.

Tip: If you already have a custom stations.csv file, but want to update it with PyRadio’s default one, you just rename it, run PyRadio (so that the default one get created) and then merge the two files.

-

Note: Older versions used to use ~/.pyradio as default stations file. If this file is found, it will be copied to use’s config directory (e.g. ~/.config/pyradio) and renamed to stations.csv or if this file exists, to pyradio.csv. In this case, this file will be the default one.

+

Note: Older versions used to use ~/.pyradio as default stations file. If this file is found, it will be copied to use’s config directory (e.g. ~/.config/pyradio) and renamed to stations.csv or if this file exists, to pyradio.csv. In this case, this file will be the default one.

Specifying a playlist to load (command line)

PyRadio will normally load its default playlist file, as described above, upon its execution. A different file can be loaded when the -s command line option is used.

The -s option will accept:

@@ -289,7 +292,7 @@

Global encoding declaration

This would be useful in the case where most of your stations do not use utf-8. Instead of editing the playlist and add the encoding to each and every affected station, you just set it globally.

Finding the right encoding

A valid encoding list can be found at:

-

https://docs.python.org/2.7/library/codecs.html#standard-encodings

+

https://docs.python.org/2.7/library/codecs.html#standard-encodings

replacing 2.7 with specific version: 3.0 up to current python version.

Player detection / selection Top

PyRadio is basically built around the existence of a valid media player it can use. Thus, it will auto detect the existence of its supported players upon its execution.

@@ -334,7 +337,7 @@

Extra Player Parameters

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:”).

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

Using the command line

-

When the command line parameter (-epp 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.

+

When the command line parameter (-epp 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.

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

Where:

    @@ -343,7 +346,7 @@

    Using the command line

Example:

pyradio -epp "vlc:--force-dolby-surround 2"
-

Note: When a parameter is passed to “mpv” or “mplayer”, PyRadio" will use the default player profile (called “pyradio”).

+

Note: When a parameter is passed to “mpv” or “mplayer”, PyRadio" will use the default player profile (called “pyradio”).

For “mpv” and “mplayer” a profile can be specified (“vlc” does not support profiles). In this case the format of the parameters part of the command line is: profile:profile_name.

Where:

    @@ -358,6 +361,7 @@

    Using the Configuration Window

    Each of the supported players can have up to 11 sets of extra parameters (the first one is the default).

    The user can add (“a”) a new parameter, edit (“e”) an existing set and delete (“x” or “DEL”) one.

    Changing parameters set

    +

    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.

    While PyRadio is running, the user can change the parameters set used by the player using the “Player Extra Parameters” window, by pressing “Z”.

    If playback is on, changing the player’s parameters will make the player restart the playback so that the new parameters get used.

    Note: Any changes made this way will not be saved but will be in effect until PyRadio terminates.

    @@ -376,7 +380,7 @@

    Player default volume level MPV

    MPV uses profiles to customize its behavior.

    -

    PyRadio defines a profile called “[pyradio]” in MPV’s configuration file (e.g. ~/.config/mpv/mpv.conf). This profile will be used every time playback is started.

    +

    PyRadio defines a profile called “[pyradio]” in MPV’s configuration file (e.g. ~/.config/mpv/mpv.conf). This profile will be used every time playback is started.

    Example:

    volume=100
     
    @@ -384,7 +388,7 @@ 

    MPV

    volume=50

    MPlayer

    MPlayer uses profiles to customize its behavior as well.

    -

    PyRadio defines a profile called “[pyradio]” in MPV’s configuration file (e.g. ~/.mplayer/config). This profile will be used every time playback is started.

    +

    PyRadio defines a profile called “[pyradio]” in MPV’s configuration file (e.g. ~/.mplayer/config). This profile will be used every time playback is started.

    Example:

    volume=100
     
    @@ -405,7 +409,7 @@ 

    Copying and pasting - Registers There are 36 named registers (name is a-z, 0-9) and one unnamed register.

    • Named registers are actually files that contain stations and can be opened and edited as regular playlist files. There are some differences in handling them: they are accessible either individually or using a special window, they are automatically saved, and writing errors are ignored. The later means that registers should not be regarded as normal playlist files that can be safely saved and used forever; this is true as long as there’s no problem with writing to them; if a writing error occurs they may get overwritten or emptied. To permanently save a register, on would rename it to a normal playlist file.

    • -
    • The unnamed register holds just one station (the one that has been copied or added to a register or deleted from a playlist), and it is the one used when pasting to a register or a playlist. One can see its contents by pressing "**".

    • +
    • The unnamed register holds just one station (the one that has been copied or added to a register or deleted from a playlist), and it is the one used when pasting to a register or a playlist. One can see its contents by pressing "**".

    To copy a station to a register one would press “y” and:

      @@ -424,7 +428,7 @@

      Copying and pasting - Registers
    • p” while editing a playlist or register.

    • \p” while editing a playlist or register. This would open the “Paste selection” window.

    • -
    • \p” in the “Playlist Selection or the”Registers" window.

    • +
    • \p” in the “Playlist Selection or the”Registers" window.

    PyRadio Themes Top

    PyRadio comes with 6 preconfigured (hard coded) themes:

    @@ -541,13 +545,21 @@

    Reporting bugs Then try to reproduce the bug and exit pyradio.

    Finally, include the file produced in your report.

    TODO Top

    -
      -
    • [ ] Any user request I find interesting :)
    • -
    • [x] Basic mouse support (#119)
    • -
    • [x] New player selection configuration window (#118)
    • -
    • [ ] Use Radio Browser service (#80 #93 #112)
    • -
    • [ ] Notify the user that the package’s stations.csv has changed
    • -
    • [ ] Update / uninstall using command line parameters (-U / -R)
    • +
        +
      • +Any user request I find interesting :)
      • +
      • +Basic mouse support (#119) - v. 0.8.8.3
      • +
      • +Players extra parameters (#118) - v. 0.8.8.3
      • +
      • +New player selection configuration window (#118) - v. 0.8.8.3
      • +
      • +Notify the user that the package’s stations.csv has changed
      • +
      • +Update / uninstall using command line parameters (-U / -R)
      • +
      • +Use Radio Browser service (#80 #93 #112)

      Acknowledgment Top

      PyRadio uses code from the following projects:

      diff --git a/README.md b/README.md index 2380b1d3..232037fd 100644 --- a/README.md +++ b/README.md @@ -435,7 +435,7 @@ This way, 10 sets of parameters can be inserted and made available for selection #### Using the command line -When the command line parameter (**-epp** 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. +When the command line parameter (**-epp** 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. The format of the parameter is the following: **[player_name:parameters]** @@ -477,6 +477,8 @@ The user can add ("**a**") a new parameter, edit ("**e**") an existing set and d ### Changing parameters set +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. + While **PyRadio** is running, the user can change the parameters set used by the player using the "*Player Extra Parameters*" window, by pressing "**Z**". If playback is on, changing the player's parameters will make the player restart the playback so that the new parameters get used. @@ -740,11 +742,12 @@ Finally, include the file produced in your report. ## TODO - [ ] Any user request I find interesting :) -- [x] Basic mouse support ([#119](https://github.com/coderholic/pyradio/issues/119)) -- [x] New player selection configuration window ([#118](https://github.com/coderholic/pyradio/issues/118)) -- [ ] 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)) +- [x] Basic mouse support ([#119](https://github.com/coderholic/pyradio/issues/119)) - v. 0.8.8.3 +- [x] Players extra parameters ([#118](https://github.com/coderholic/pyradio/issues/118)) - v. 0.8.8.3 +- [x] New player selection configuration window ([#118](https://github.com/coderholic/pyradio/issues/118)) - v. 0.8.8.3 - [ ] Notify the user that the package's stations.csv has changed - [ ] Update / uninstall using command line parameters (-U / -R) +- [ ] 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)) ## Acknowledgment diff --git a/build.html b/build.html index b5f916d6..9f17a060 100644 --- a/build.html +++ b/build.html @@ -21,13 +21,16 @@ a{ color: SaddleBrown;} a:visited{color: SaddleBrown;} + -
      +

      PyRadio Build Instructions

      PyRadio: Command line internet radio player.

      -

      Ben Dowling - https://github.com/coderholic

      +

      Ben Dowling - https://github.com/coderholic

      Table of contents Top

      • Building from source @@ -52,7 +55,7 @@

        Building from source 0: + return 2 + elif char in (curses.KEY_EXIT, 27, ord('q')) and \ self._focus > 0: self.edit_string = '' ret = 0 @@ -805,7 +807,7 @@ def _update_focus(self): class ExtraParameters(object): ''' display player's extra parameters - in a foreign curses window + in a foreign curses window ('Z') ''' def __init__(self, @@ -835,6 +837,9 @@ def __init__(self, self.max_lines = max_lines self.reset(saved=False) + ''' set cursor to active item ''' + for a_key in self._selections.keys(): + self._selections[a_key][0] = self._selections[a_key][2] self._get_width() def check_parameters(self): @@ -942,7 +947,7 @@ def _dict_to_list(self): self._selections[a_param_set][2] = int(a_param) - 1 else: self._items_dict[a_param_set].append(a_param) - # logger.error('DE selections = {}'.format(self._selections)) + logger.error('DE selections = {}'.format(self._selections)) def _list_to_dict(self): ''' convert self._items_dict to self._working_params ''' @@ -1086,6 +1091,7 @@ def keypress(self, char): 3 - error, cannot edit or delete first item 4 - edit parameter 5 - add parameter + 6 - line editor help ''' if char in ( curses.KEY_ENTER, ord('\n'), @@ -1382,6 +1388,7 @@ def keypress(self, char): 4 - Editor exited ''' if self.editing == 0: + ''' focus on players ''' if char in (9, ): if self._players[self.selection][1]: self._switch_column() @@ -1461,6 +1468,7 @@ def keypress(self, char): self._extra.set_player(self.selected_player_name()) else: + ''' focus on parameters ''' ret = self._extra.keypress(char) if ret == 2: ''' error, number of max lines reached ''' diff --git a/pyradio/radio.py b/pyradio/radio.py index 7d473dcf..be239337 100644 --- a/pyradio/radio.py +++ b/pyradio/radio.py @@ -339,6 +339,7 @@ def __init__(self, pyradio_config, play=False, req_player='', theme=''): self.ws.MOUSE_RESTART_INFO_MODE: self._print_mouse_restart_info, self.ws.IN_PLAYER_PARAMS_EDITOR: self._redisplay_player_select_win_refresh_and_resize, self.ws.USER_PARAMETER_ERROR: self._print_user_parameter_error, + self.ws.IN_PLAYER_PARAMS_EDITOR_HELP_MODE: self._show_params_ediror_help, } ''' list of help functions ''' @@ -4263,6 +4264,9 @@ def keypress(self, char): or parameters will be lost!!! self._player_select_win = None ''' + elif ret == 2: + ''' display line editor help ''' + self._show_params_ediror_help() elif ret == 3: ''' Got into paramater editor ''' self.ws.operation_mode = self.ws.IN_PLAYER_PARAMS_EDITOR diff --git a/windows-mplayer.html b/windows-mplayer.html index e7dda773..47396b23 100644 --- a/windows-mplayer.html +++ b/windows-mplayer.html @@ -21,13 +21,16 @@ a{ color: SaddleBrown;} a:visited{color: SaddleBrown;} + -
        +

        MPlayer Installation on Windows

        PyRadio: Command line internet radio player.

        -

        Ben Dowling - https://github.com/coderholic

        +

        Ben Dowling - https://github.com/coderholic

        Table of contents Top

        • MPlayer installation @@ -47,11 +50,11 @@

          MPlayer installation
        • %USERPROFILE%

          This is actually your “Home” directory.

          -

          Please make a note that you will add "%USERPROFILE%\mplayer to PATH.

        • +

          Please make a note that you will add "%USERPROFILE%\mplayer to PATH.

        • %APPDATA%\pyradio

          This is (or will be) “PyRadio’s configuration directory”.

          In case the pyradio directory does not exit, you just go ahead and create it.

          -

          (Make a note that you will add "%APPDATA%\pyradio\mplayer to PATH)

        • +

          (Make a note that you will add "%APPDATA%\pyradio\mplayer to PATH)

          In either case, in order to do that, open an Explorer File Manager window, and enter at its location field %USERPROFILE% or %APPDATA%.

          If you are unsure on how to do that, please refer to the following image (you can ENTER %USERPROFILE% or %APPDATA% or any other Windows System Variable this way).

          diff --git a/windows.html b/windows.html index e9c90ee6..6771f3b8 100644 --- a/windows.html +++ b/windows.html @@ -21,13 +21,16 @@ a{ color: SaddleBrown;} a:visited{color: SaddleBrown;} + -
          +

          PyRadio on Windows

          PyRadio: Command line internet radio player.

          -

          Ben Dowling - https://github.com/coderholic

          +

          Ben Dowling - https://github.com/coderholic

          Table of contents Top

          • Running PyRadio on Windows
          • @@ -87,7 +90,7 @@

            1.1 Installing Python

            When the download is done, run its setup and select “Custom Installation” so that you can “Add Python to environment varaibles”. You can refer to the following image to see the relevant setting.

            Python Installation

            1.2 Verifying the installation

            -

            Either if you have just installed Python or you already have it installed, you need to verify that its executable is in the PATH (i.e. Python can be executed from a console by typing“python”).

            +

            Either if you have just installed Python or you already have it installed, you need to verify that its executable is in the PATH (i.e. Python can be executed from a console by typing“python”).

            So, go ahead and open a console (the command is cmd) and type python.

            If you get something similar to the following snippet, you are good to go.

            Python 3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:54:40) [MSC v.1900 64 bit (AMD64)] on win
            @@ -157,7 +160,7 @@ 

            4.1 Using Git

            devel\build_install_pyradio

            4.2 Not using Git

            Go to PyRadio’s Releases page and download the latest release (either a zip or a tar.gz file).

            -

            Extract this file to your “Home” directory (“C:\Users\[Your User Name]” or “%USERPROFILE%) - you will get a directory whose name is similar to”pyradio-0.7.9".

            +

            Extract this file to your “Home” directory (“C:\Users\[Your User Name]” or “%USERPROFILE%) - you will get a directory whose name is similar to”pyradio-0.7.9".

            I will use this name for the following examples; you will have to use the actual name of directory you got from the extraction.

            Finally, open a console (press the Win key, type cmd and press ENTER or if you are on Windows 10, use Run it as Administrator as you can see in the following image).

            Run as Administrator