From 72905f5ca03764fcc1597d4663a880b8cb94b012 Mon Sep 17 00:00:00 2001 From: Spiros Georgaras Date: Sat, 1 Jul 2023 18:26:21 +0300 Subject: [PATCH] - version 0.9.2.12 - updating docs --- Changelog | 8 ++++++++ README.html | 9 +++++++++ README.md | 2 ++ devel/build_install_pyradio.bat | 13 +++++++------ pyproject.toml | 2 +- pyradio/__init__.py | 2 +- pyradio/install.py | 2 +- pyradio/player.py | 22 +++++++++++----------- pyradio/radio.py | 3 ++- recording.html | 8 +++++++- recording.md | 15 +++++++++++++-- 11 files changed, 62 insertions(+), 24 deletions(-) diff --git a/Changelog b/Changelog index 697fc3b6..ea1eb157 100644 --- a/Changelog +++ b/Changelog @@ -1,3 +1,11 @@ +2023-07-01 s-n-g + * version 0.9.2.12 + * Implementing VLC recorder (not for Windows) + * MPlayer recorder will display volume level + * MPlayer on Windows 7 will not use profiles + * Trying different recorded file limit to start monitor + * updating docs + 2023-06-20 s-n-g * version 0.9.2.11 * implementing station recording for MPlayer media player diff --git a/README.html b/README.html index cde8d8c4..8d10a1c8 100644 --- a/README.html +++ b/README.html @@ -207,6 +207,14 @@

Requirements Changelog Top

 
+2023-07-01 s-n-g
+    * version 0.9.2.12
+    * Implementing VLC recorder (not for Windows)
+    * MPlayer recorder will display volume level
+    * MPlayer on Windows 7 will not use profiles
+    * Trying different recorded file limit to start monitor
+    * updating docs
+
 2023-06-20 s-n-g
     * version 0.9.2.11
     * implementing station recording for MPlayer media player
@@ -1461,6 +1469,7 @@ 

Player detection / selection Changing player mid-session

If the user faces a playback problem with a given station, chances are that a different player will successfully play it.

Pressing “\m” will bring up the “Switch Media Player” window, where a different player can be activated.

+

If recording is on while using the previously activated player, it will remain on with the newly activated one. This actually means that the recording will stop when the old player is stopped and resumed when the new player is activated (creating a new recorder file). There is just one exception to that; selecting VLC is not possible on Windows, since VLC does not support recording on this platform.

Note: The activated player will not be saved; PyRadio will still use the player defined at its config next time it is executed.

Extra Player Parameters

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

diff --git a/README.md b/README.md index ec58866a..53add523 100644 --- a/README.md +++ b/README.md @@ -671,6 +671,8 @@ If the user faces a playback problem with a given station, chances are that a di Pressing "**\\m**" will bring up the "*Switch Media Player*" window, where a different player can be activated. +If **recording is on** while using the previously activated player, it will remain on with the newly activated one. This actually means that the recording will stop when the old player is stopped and resumed when the new player is activated (creating a new recorder file). There is just one exception to that; selecting **VLC** is not possible on **Windows**, since **VLC** does not support recording on this platform. + **Note:** The activated player will not be saved; **PyRadio** will still use the player defined at its config next time it is executed. ### Extra Player Parameters diff --git a/devel/build_install_pyradio.bat b/devel/build_install_pyradio.bat index f1029f46..f346bec9 100755 --- a/devel/build_install_pyradio.bat +++ b/devel/build_install_pyradio.bat @@ -27,12 +27,12 @@ IF %ERRORLEVEL% == 1 ( SET ERRPKG=pip GOTO piperror ) -ECHO Installing / Updating windows-curses -%PROGRAM% -m pip install --upgrade windows-curses 1>NUL 2>NUL -IF %ERRORLEVEL% == 1 ( - SET ERRPKG=windows-curses - GOTO piperror -) +REM ECHO Installing / Updating windows-curses +REM %PROGRAM% -m pip install --upgrade windows-curses 1>NUL 2>NUL +REM IF %ERRORLEVEL% == 1 ( +REM SET ERRPKG=windows-curses +REM GOTO piperror +REM ) ECHO Installing / Updating rich %PROGRAM% -m pip install --upgrade rich 1>NUL 2>NUL IF %ERRORLEVEL% == 1 ( @@ -47,6 +47,7 @@ IF %ERRORLEVEL% == 1 ( ) echo pywin32 > requirements.txt +echo windows-curses >> requirements.txt echo requests >> requirements.txt echo rich >> requirements.txt echo dnspython >> requirements.txt diff --git a/pyproject.toml b/pyproject.toml index 66171aac..064c0348 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "pyradio" -version = "0.9.2.11" +version = "0.9.2.12" authors = [ { name="Ben Dowling", email="ben.m.dowling@gmail.com" }, { name="Spiros Georgaras", email="sng@hellug.gr" }, diff --git a/pyradio/__init__.py b/pyradio/__init__.py index 5e3874d7..d9bd3928 100644 --- a/pyradio/__init__.py +++ b/pyradio/__init__.py @@ -1,6 +1,6 @@ " pyradio -- Console radio player. " -version_info = (0, 9, 2, 11) +version_info = (0, 9, 2, 12) # Set it to True if new stations have been # added to the package's stations.csv diff --git a/pyradio/install.py b/pyradio/install.py index 23cef3b7..3b39c62d 100755 --- a/pyradio/install.py +++ b/pyradio/install.py @@ -15,7 +15,7 @@ ''' This is PyRadio version this install.py was released for ''' -PyRadioInstallPyReleaseVersion = '0.9.2.11' +PyRadioInstallPyReleaseVersion = '0.9.2.12' import locale locale.setlocale(locale.LC_ALL, "") diff --git a/pyradio/player.py b/pyradio/player.py index 0c21a900..1187d99f 100644 --- a/pyradio/player.py +++ b/pyradio/player.py @@ -412,7 +412,7 @@ def create_monitor_player(self, stop, limit, notify_function): if stop(): logger.error('Asked to stop. Exiting....') return - logger.error('while 2') + # logger.error('while 2') while os.path.getsize(self.recording_filename) < limit: sleep(.1) if stop(): @@ -422,17 +422,17 @@ def create_monitor_player(self, stop, limit, notify_function): if stop(): logger.error('\n\nAsked to stop. Exiting....\n\n') return - logger.error('----------------------starting!') + # logger.error('----------------------starting!') self.monitor_process = subprocess.Popen( self.monitor_opts, shell=False, stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.STDOUT ) - logger.error('self.monitor_process.pid = {}'.format(self.monitor_process)) - logger.error('------------------ to notify function') + # logger.error('self.monitor_process.pid = {}'.format(self.monitor_process)) + # logger.error('------------------ to notify function') notify_function() - logger.error('------------------ after notify function') + # logger.error('------------------ after notify function') if logger.isEnabledFor(logging.INFO): logger.info('Executing command: {}'.format(' '.join(self.monitor_opts))) logger.info('----==== {} monitor started ====----'.format(self.PLAYER_NAME)) @@ -1631,7 +1631,7 @@ def play(self, ): ''' use a multimedia player to play a stream ''' self.monitor = self.monitor_process = self.monitor_opts = None - logger.error('self.monitor_process.pid = {}'.format(self.monitor_process)) + # logger.error('self.monitor_process.pid = {}'.format(self.monitor_process)) self.recording_filename = '' self.volume = -1 self.close() @@ -1741,7 +1741,7 @@ def play(self, logger.info('----==== {} player started ====----'.format(self.PLAYER_NAME)) if self.recording == self.RECORD_AND_LISTEN \ and self.PLAYER_NAME != 'mpv': - logger.error('=======================\n\n') + # logger.error('=======================\n\n') limit = 120000 if self.PLAYER_NAME == 'mplayer': if not platform.startswith('win'): @@ -1756,22 +1756,22 @@ def play(self, target=self.create_monitor_player, args=(lambda: self.stop_mpv_status_update_thread, limit, self._start_monitor_update_thread) ).start() - logger.error('=======================\n\n') + # logger.error('=======================\n\n') def _sendCommand(self, command): ''' send keystroke command to player ''' if [x for x in ('q', 'shutdown') if command.startswith(x)]: self._command_to_player(self.process, command) - logger.error('self.monitor_process.pid = {}'.format(self.monitor_process)) + # logger.error('self.monitor_process.pid = {}'.format(self.monitor_process)) if self.monitor_process is not None: self._command_to_player(self.monitor_process, command) return - logger.error('self.monitor_process.pid = {}'.format(self.monitor_process)) + # logger.error('self.monitor_process.pid = {}'.format(self.monitor_process)) if self.monitor_process is not None and \ [x for x in ('/', '*', 'p', 'm', 'vol', 'pause' ) if command.startswith(x) ]: - logger.error('\n\nsending command: "{}"\n\n'.format(command)) + # logger.error('\n\nsending command: "{}"\n\n'.format(command)) self._command_to_player(self.monitor_process, command) else: self._command_to_player(self.process, command) diff --git a/pyradio/radio.py b/pyradio/radio.py index ae3c6ea7..d464d37a 100644 --- a/pyradio/radio.py +++ b/pyradio/radio.py @@ -240,7 +240,8 @@ def keypress(self, char): ord('s'), ord(' '), ord('l'), curses.KEY_RIGHT ): - if not self._no_vlc: + if not (self._no_vlc and \ + self._available_players[self._selected] == 'vlc'): return self._available_players[self._selected] elif char in (ord('h'), curses.KEY_LEFT, ord('q'), curses.KEY_EXIT, 27): diff --git a/recording.html b/recording.html index a138a0e8..38685ae5 100644 --- a/recording.html +++ b/recording.html @@ -56,6 +56,7 @@

Table of Contents <
  • MPV
  • MPlayer
  • VLC
  • +
  • VLC recording on Windows
  • Recording implementation
      @@ -65,6 +66,7 @@

      Table of Contents <

  • +

    [Return to main doc]

    Intro Top

    PyRadio v. 0.9.2.8 introduces the ability to record stations, a feature used mainly to facilitate another feature: the ability to pause and resume playback.

    All supported media players (MPV, MPlayer and VLC) support stream recording, each implementing it in a different way, which pose a challenge for the front end implementation.

    @@ -99,7 +101,6 @@

    MPlayer

  • pausing and resuming the monitor for long will lead to song titles being out of sync, since the recorder will keep receiving data (and song titles) even when the playback if off.
  • VLC

    -

    Note: VLC recording has not been implemented yet!

    VLC stream recording has the following characteristics:

    • it does not have the ability to record and play a stream at the same time.
      @@ -108,6 +109,11 @@

      VLC

    • the monitor will be started after the output file gets to a certain size, set to 120000 bytes by trial and error.
    • pausing and resuming the monitor for long will lead to song titles being out of sync, since the recorder will keep receiving data (and song titles) even when the playback if off.
    +

    VLC recording on Windows

    +

    VLC recording in not supported on Windows.

    +

    The VLC implementation on Window is a bit clumsy as it is as a radio player, and duplicating all this clumsiness in order to support recording as well, is just too much.

    +

    Trying to enable recording while VLC is the active player will lead to displaying a message informing the user of the situation and ways to proceed.

    +

    Consequently, this restriction has been applied to the “Switch Media Player” window (opened with “\m”); when recording a station and trying to change the player in use on Windows, selecting VLC is not supported.

    Recording implementation Top

    The following keys are used for this feature:

    diff --git a/recording.md b/recording.md index b8adf8d7..0265684d 100644 --- a/recording.md +++ b/recording.md @@ -26,6 +26,7 @@ ___ * [MPV](#mpv) * [MPlayer](#mplayer) * [VLC](#vlc) + * [VLC recording on Windows](#vlc-recording-on-windows) * [Recording implementation](#recording-implementation) * [File location](#file-location) * [File type](#file-type) @@ -33,6 +34,8 @@ ___ +[[Return to main doc]](README.md) + ## Intro **PyRadio v. 0.9.2.8** introduces the ability to record stations, a feature used mainly to facilitate another feature: the ability to *pause and resume playback*. @@ -76,8 +79,6 @@ This means that the front end (**PyRadio**) will have to use two *mplayer* insta ### VLC -**Note**: **VLC** recording has not been implemented yet! - **VLC** stream recording has the following characteristics: - it does not have the ability to record and play a stream at the same time. \ @@ -86,6 +87,16 @@ This means that the front end (**PyRadio**) will have to use two *vlc* instances - the **monitor** will be started after the output file gets to a certain size, set to 120000 bytes by trial and error. - pausing and resuming the **monitor** for long will lead to song titles being out of sync, since the **recorder** will keep receiving data (and song titles) even when the playback if off. +### VLC recording on Windows + +**VLC** recording in **not** supported on **Windows**. + +The **VLC** implementation on **Window** is a bit clumsy as it is as a radio player, and duplicating all this clumsiness in order to support recording as well, is just too much. + +Trying to enable recording while **VLC** is the active player will lead to displaying a message informing the user of the situation and ways to proceed. + +Consequently, this restriction has been applied to the "*Switch Media Player*" window (opened with "**\\m**"); when recording a station and trying to change the player in use on **Windows**, selecting **VLC** is not supported. + ## Recording implementation The following keys are used for this feature: