Skip to content

Commit b617610

Browse files
committed
- adding --no-video command line parameter for vlc
- updating macOS installation instructions (based on Ventura) - removing more python 2 code
1 parent a2d1dc3 commit b617610

File tree

4 files changed

+115
-142
lines changed

4 files changed

+115
-142
lines changed

devel/build_install_pyradio

Lines changed: 10 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -390,26 +390,14 @@ done
390390
# echo "***** installing for user..."
391391
do_dev
392392

393-
if [ "${TO_PYTHON}" == "2" ];
394-
then
395-
tar czf pyradio.tar.gz pyradio
396-
for a_file in pyradio/*.py
397-
do
398-
sed -i "/open/s/, encoding='utf-8'//" "${a_file}"
399-
sed -i 's/console.print/# &/' "${a_file}"
400-
sed -i 's/from rich import print/# &/' "${a_file}"
401-
sed -i '/##### NO PYTHON2/,/##### END NO PYTHON2/d' "${a_file}"
402-
done
403-
else
404-
#
405-
# Use pipx by default, if installed
406-
echo -n "Looking for pipx ... "
407-
PIPX_VERSION=$(python"${TO_PYTHON}" -m pipx --version)
408-
[ -z "$PIPX_VERSION" ] || PIPX=1
409-
[ -z "$PIPX_VERSION" ] && {
410-
echo "Command used: python"${TO_PYTHON}" -m pipx --version 2>/dev/null"
411-
} || echo "$PIPX_VERSION"
412-
fi
393+
#
394+
# Use pipx by default, if installed
395+
echo -n "Looking for pipx ... "
396+
PIPX_VERSION=$(python"${TO_PYTHON}" -m pipx --version)
397+
[ -z "$PIPX_VERSION" ] || PIPX=1
398+
[ -z "$PIPX_VERSION" ] && {
399+
echo "Command used: python"${TO_PYTHON}" -m pipx --version 2>/dev/null"
400+
} || echo "$PIPX_VERSION"
413401

414402
if [ $(uname -s) = "Darwin" ] || [ $(uname -s) = "darwin" ]
415403
then
@@ -461,14 +449,6 @@ fi
461449
if [ -z "$PIPX" ]
462450
then
463451
# Normanl, old style installation
464-
if [ "${TO_PYTHON}" = "2" ]
465-
then
466-
cp setup.py setup.py.orig
467-
sed -i \
468-
-e 's/, find_namespace_packages/, find_packages/' \
469-
-e 's/find_namespace_packages.*/find_packages(),/' \
470-
setup.py
471-
fi
472452
if [ -e requirements.txt ]
473453
then
474454
python"${TO_PYTHON}" -m pip install -r requirements.txt . || pip_error
@@ -478,7 +458,7 @@ then
478458
[ -e setup.py.orig ] && cp setup.py.orig setup.py
479459
else
480460
# pipx installation
481-
# MacOS will always permorm an fully isolated installation
461+
# MacOS will always permorm a fully isolated installation
482462
if [ $(uname -s) == "Darwin" ] || [ $(uname -s) == "darwin" ]
483463
then
484464
PIPX_ISOLATE=1
@@ -490,17 +470,11 @@ else
490470
else
491471
python3 -m pipx install $PIPX_EDITABLE --force . || pipx_error
492472
[ -z "$PIPX_EDITABLE" ] && \
493-
cat requirements_pipx.txt | sed -e 's/#.*//' | xargs pipx inject pyradio
473+
cat requirements_pipx.txt | sed -e 's/#.*//' | xargs python3 -m pipx inject pyradio
494474
inst_type=2
495475
fi
496476
fi
497477

498-
if [ "${TO_PYTHON}" == "2" ];
499-
then
500-
tar xzf pyradio.tar.gz
501-
rm pyradio.tar.gz
502-
fi
503-
504478
do_undev
505479

506480
if [ $? -eq 0 ]

docs/macos.html

Lines changed: 39 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,17 @@ <h2 id="table-of-contents">Table of Contents <span style="padding-left: 10px;"><
4444
<!-- vim-markdown-toc Marked -->
4545
<ul>
4646
<li><a href="#preface">Preface</a></li>
47-
<li><a href="#install-a-media-player">Install a media player</a></li>
48-
<li><a href="#get-the-installation-script">Get the installation script</a></li>
49-
<li><a href="#python3-installation">Python3 installation</a>
47+
<li><a href="#preparation">Preparation</a>
5048
<ul>
51-
<li><a href="#dependencies-installation">Dependencies installation</a></li>
52-
<li><a href="#pyradio-installation">PyRadio installation</a></li>
49+
<li><a href="#homebrew-installation">Homebrew installation</a></li>
50+
<li><a href="#python-installation">Python Installation</a></li>
51+
<li><a href="#media-player-installation">Media player installation</a></li>
52+
<li><a href="#get-the-installation-script">Get the installation script</a></li>
5353
</ul></li>
54-
<li><a href="#installation-of-additional-package-managers">Installation of Additional Package Managers</a>
54+
<li><a href="#pyradio-installation">PyRadio installation</a>
5555
<ul>
56-
<li><a href="#homebrew">Homebrew</a></li>
57-
<li><a href="#macports">MacPorts</a></li>
56+
<li><a href="#dependencies-installation">Dependencies installation</a></li>
57+
<li><a href="#performing-the-installation">Performing the installation</a></li>
5858
</ul></li>
5959
</ul>
6060
<!-- vim-markdown-toc -->
@@ -64,53 +64,54 @@ <h2 id="preface">Preface <span style="padding-left: 10px;"><sup style="font-size
6464
<p>Furtermore, the pipx installation will be a fully isolated one, which means that all dependencies will be installed along with <strong>PyRadio</strong> in a virtual environment.</p>
6565
<p>That is a one-way street to follow since the combination of macOS versions, python installation methods and player installation methods is too complex to provide a complete installation guide for <strong>PyRadio</strong>.</p>
6666
<p><a target="_blank" href="https://pypa.github.io/pipx/">pipx</a> provides a standardization of the whole procedure which leads to an acceptable (enjoyable even) user experience.</p>
67-
<h2 id="install-a-media-player">Install a media player <span style="padding-left: 10px;"><sup style="font-size: 50%"><a href="#" title="Go to top of the page">Top</a></sup></span></h2>
68-
<p>First of all you will install a supported media player (<strong>MPV</strong>, <strong>MPLayer</strong> or <strong>VLC</strong>). You are free to install any one of them or even more than one. The steps to follow from now on depends entirely on you, meaning depends entirely on the media player(s) you want to install and use with <strong>PyRadio</strong>.</p>
67+
<h2 id="preparation">Preparation <span style="padding-left: 10px;"><sup style="font-size: 50%"><a href="#" title="Go to top of the page">Top</a></sup></span></h2>
68+
<p>These are the steps required before actually installing <strong>PyRadio</strong>.</p>
69+
<p style="margin: 1.5em 4em 0 4em; text-indent: -2.5em;"><strong>Note:</strong> The following installation instructions were performed on a freshly installed <strong>Ventura</strong> (macOS 13) system. Things may be a bit different for older macOs versions, but it will be the same for <strong>Sonoma</strong> (macOS 14).</p>
70+
<h3 id="homebrew-installation">Homebrew installation</h3>
71+
<p>This is the method <a target="_blank" href="https://brew.sh">Homebrew</a> recommends, so we just go with it.</p>
72+
<p>Open a terminal and execute:</p>
73+
<!-- START OF BREW LINK-->
74+
<pre>/bin/bash -c &quot;$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)&quot;</pre>
75+
<!-- END OF BREW LINK-->
76+
<h3 id="python-installation">Python Installation</h3>
77+
<p>Your system comes with a pre-installed version of Python, but it would be better to install the one provided by <strong>Homebrew</strong>.</p>
78+
<pre>brew install python3</pre>
79+
<p>This will also install “<em>Apple’s Command Line Developer Tools</em>” (if they are not already installed).</p>
80+
<p>Then, adjust your <strong>PATH</strong>, so that the newly installed Python will be the default one.</p>
81+
<pre>cat &lt;&lt; END &gt;&gt; ~/.zshrc
82+
export PATH=/usr/local/bin:&quot;$PATH&quot;
83+
END
84+
source ~/.zshrc</pre>
85+
<h3 id="media-player-installation">Media player installation</h3>
86+
<p>The next step is to install a supported media player (<strong>MPV</strong>, <strong>MPLayer</strong> or <strong>VLC</strong>). You are free to install any one of them or even more than one. The steps to follow from now on depends entirely on you, meaning depends entirely on the media player(s) you want to install and use with <strong>PyRadio</strong>.</p>
6987
<p><strong>1. VLC</strong></p>
70-
<p><strong>VLC</strong> provides a MacOS package, so you can just go get it from <a target="_blank" href="https://www.videolan.org/vlc/">its site</a>. This is the cleaner way and I would recommend it.</p>
88+
<p><strong>VLC</strong> provides a macOS package, so you can just go get it from <a target="_blank" href="https://www.videolan.org/vlc/">its site</a>. This is the cleaner way and I would recommend it.</p>
7189
<p>If this is the player you prefer, you will have to take one more step before it can be used with <strong>PyRadio</strong>.</p>
7290
<p>Open a terminal and type:</p>
7391
<pre>ln -s /Applications/VLC.app/Contents/MacOS/VLC ~/.local/bin/cvlc</pre>
7492
<p><strong>2. MPV or MPlayer</strong></p>
75-
<p><strong>MPV</strong> and <strong>MPlayer</strong> can be installed using either <a target="_blank" href="https://brew.sh">Homebrew</a> or <a target="_blank" href="https://www.macports.org/">MacPorts</a>. Installation info can be found at the <a href="#installation-of-additional-package-managers">end of this page</a>.</p>
76-
<p>After you have installed <a target="_blank" href="https://brew.sh">Homebrew</a> or <a target="_blank" href="https://www.macports.org/">MacPorts</a>, you can install the player of your choice.</p>
93+
<p><strong>MPV</strong> and <strong>MPlayer</strong> can be installed using <a target="_blank" href="https://brew.sh">Homebrew</a>.</p>
7794
<p><strong><em>a) MPV</em></strong></p>
7895
<pre>brew install mpv</pre>
79-
<p>or</p>
80-
<pre>sudo port install mpv</pre>
8196
<p><strong><em>b) MPlayer</em></strong></p>
8297
<pre>brew install mplayer</pre>
83-
<p>or</p>
84-
<pre>sudo port install MPlayer</pre>
85-
<h2 id="get-the-installation-script">Get the installation script <span style="padding-left: 10px;"><sup style="font-size: 50%"><a href="#" title="Go to top of the page">Top</a></sup></span></h2>
98+
<h3 id="get-the-installation-script">Get the installation script</h3>
8699
<p>Open a terminal and execute:</p>
87100
<pre>cd
88101
curl -L \
89102
https://raw.githubusercontent.com/coderholic/pyradio/master/pyradio/install.py \
90103
-o install.py</pre>
91-
<h2 id="python3-installation">Python3 installation <span style="padding-left: 10px;"><sup style="font-size: 50%"><a href="#" title="Go to top of the page">Top</a></sup></span></h2>
92-
<p>Execute:</p>
93-
<pre>python3</pre>
94-
<p>If this is the first time python3 is executed you will be prompted to allow the installation of “<em>Apple’s Command Line Developer Tools</em>”. Accept the installation, wait for it to complete, and reboot.</p>
95-
<p>When the system is up again, please check for updates (open <strong>App Store</strong> and click on <strong>Updates</strong>). Install any pending update and reboot.</p>
104+
<h2 id="pyradio-installation">PyRadio installation <span style="padding-left: 10px;"><sup style="font-size: 50%"><a href="#" title="Go to top of the page">Top</a></sup></span></h2>
96105
<p>Your system is ready now for <strong>PyRadio</strong> to be installed.</p>
97106
<h3 id="dependencies-installation">Dependencies installation</h3>
98107
<p>Open a terminal and type:</p>
99-
<pre>python3 -m pip install requests rich pipx
100-
python3 -m pipx ensurepath</pre>
101-
<p>Log out and log in again for the changes to take effect.</p>
102-
<h3 id="pyradio-installation">PyRadio installation</h3>
103-
<p>Once you are logged in again, open a terminal and type:</p>
104-
<pre>cd
105-
python3 install.py</pre>
108+
<pre>python3 -m pip install requests rich pipx --break-system-packages</pre>
109+
<p>Finally, type:</p>
110+
<pre>python3 -m pipx ensurepath
111+
source ~/.zshrc</pre>
112+
<h3 id="performing-the-installation">Performing the installation</h3>
113+
<p>Execute the following command:</p>
114+
<pre>python3 install.py</pre>
106115
<p>Enjoy!</p>
107-
<h2 id="installation-of-additional-package-managers">Installation of Additional Package Managers <span style="padding-left: 10px;"><sup style="font-size: 50%"><a href="#" title="Go to top of the page">Top</a></sup></span></h2>
108-
<p>These instructions must be followed only in case you want to use <strong>MPV</strong> or <strong>MPlayer</strong> with <strong>PyRadio</strong>.</p>
109-
<p>It goes without saying that it’s enough to install only one of these package managers.</p>
110-
<h3 id="homebrew">Homebrew</h3>
111-
<p>To install <a target="_blank" href="https://brew.sh">Homebrew</a> open a <strong>terminal</strong> and type:</p>
112-
<pre>/bin/bash -c &quot;$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)&quot;</pre>
113-
<h3 id="macports">MacPorts</h3>
114-
<p><a target="_blank" href="https://www.macports.org/">MacPorts</a> provide installation packages for each MacOS version, so just get to their <a target="_blank" href="https://www.macports.org/install.php">site</a> and get the one suitable for you.</p>
115116
</body>
116117
</html>

docs/macos.md

Lines changed: 56 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
<!-- vim-markdown-toc Marked -->
55

66
* [Preface](#preface)
7-
* [Install a media player](#install-a-media-player)
8-
* [Get the installation script](#get-the-installation-script)
9-
* [Python3 installation](#python3-installation)
7+
* [Preparation](#preparation)
8+
* [Homebrew installation](#homebrew-installation)
9+
* [Python Installation](#python-installation)
10+
* [Media player installation](#media-player-installation)
11+
* [Get the installation script](#get-the-installation-script)
12+
* [PyRadio installation](#pyradio-installation)
1013
* [Dependencies installation](#dependencies-installation)
11-
* [PyRadio installation](#pyradio-installation)
12-
* [Installation of Additional Package Managers](#installation-of-additional-package-managers)
13-
* [Homebrew](#homebrew)
14-
* [MacPorts](#macports)
14+
* [Performing the installation](#performing-the-installation)
1515

1616
<!-- vim-markdown-toc -->
1717

@@ -27,14 +27,49 @@ That is a one-way street to follow since the combination of macOS versions, pyth
2727

2828
[pipx](https://pypa.github.io/pipx/) provides a standardization of the whole procedure which leads to an acceptable (enjoyable even) user experience.
2929

30+
## Preparation
3031

31-
## Install a media player
32+
These are the steps required before actually installing **PyRadio**.
3233

33-
First of all you will install a supported media player (**MPV**, **MPLayer** or **VLC**). You are free to install any one of them or even more than one. The steps to follow from now on depends entirely on you, meaning depends entirely on the media player(s) you want to install and use with **PyRadio**.
34+
**Note:** The following installation instructions were performed on a freshly installed **Ventura** (macOS 13) system. Things may be a bit different for older macOs versions, but it will be the same for **Sonoma** (macOS 14).
35+
36+
### Homebrew installation
37+
38+
This is the method [Homebrew](https://brew.sh) recommends, so we just go with it.
39+
40+
Open a terminal and execute:
41+
42+
<!-- START OF BREW LINK-->
43+
```
44+
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
45+
```
46+
<!-- END OF BREW LINK-->
47+
48+
### Python Installation
49+
50+
Your system comes with a pre-installed version of Python, but it would be better to install the one provided by **Homebrew**.
51+
52+
brew install python3
53+
54+
This will also install "*Apple's Command Line Developer Tools*" (if they are not already installed).
55+
56+
57+
Then, adjust your **PATH**, so that the newly installed Python will be the default one.
58+
59+
```
60+
cat << END >> ~/.zshrc
61+
export PATH=/usr/local/bin:"$PATH"
62+
END
63+
source ~/.zshrc
64+
```
65+
66+
### Media player installation
67+
68+
The next step is to install a supported media player (**MPV**, **MPLayer** or **VLC**). You are free to install any one of them or even more than one. The steps to follow from now on depends entirely on you, meaning depends entirely on the media player(s) you want to install and use with **PyRadio**.
3469

3570
**1\. VLC**
3671

37-
**VLC** provides a MacOS package, so you can just go get it from [its site](https://www.videolan.org/vlc/). This is the cleaner way and I would recommend it.
72+
**VLC** provides a macOS package, so you can just go get it from [its site](https://www.videolan.org/vlc/). This is the cleaner way and I would recommend it.
3873

3974
If this is the player you prefer, you will have to take one more step before it can be used with **PyRadio**.
4075

@@ -45,27 +80,17 @@ Open a terminal and type:
4580

4681
**2\. MPV or MPlayer**
4782

48-
**MPV** and **MPlayer** can be installed using either [Homebrew](https://brew.sh) or [MacPorts](https://www.macports.org/). Installation info can be found at the [end of this page](#installation-of-additional-package-managers).
49-
50-
After you have installed [Homebrew](https://brew.sh) or [MacPorts](https://www.macports.org/), you can install the player of your choice.
83+
**MPV** and **MPlayer** can be installed using [Homebrew](https://brew.sh).
5184

5285
***a) MPV***
5386

5487
brew install mpv
5588

56-
or
57-
58-
sudo port install mpv
59-
6089
***b) MPlayer***
6190

6291
brew install mplayer
6392

64-
or
65-
66-
sudo port install MPlayer
67-
68-
## Get the installation script
93+
### Get the installation script
6994

7095
Open a terminal and execute:
7196

@@ -76,53 +101,26 @@ curl -L \
76101
-o install.py
77102
```
78103

79-
## Python3 installation
80-
81-
Execute:
82-
83-
python3
84-
85-
If this is the first time python3 is executed you will be prompted to allow the installation of "*Apple's Command Line Developer Tools*". Accept the installation, wait for it to complete, and reboot.
86-
87-
When the system is up again, please check for updates (open **App Store** and click on **Updates**). Install any pending update and reboot.
104+
## PyRadio installation
88105

89106
Your system is ready now for **PyRadio** to be installed.
90107

91-
92108
### Dependencies installation
93109

94110
Open a terminal and type:
95111

96-
```
97-
python3 -m pip install requests rich pipx
98-
python3 -m pipx ensurepath
99-
```
100-
101-
Log out and log in again for the changes to take effect.
112+
python3 -m pip install requests rich pipx --break-system-packages
102113

103-
### PyRadio installation
114+
Finally, type:
104115

105-
Once you are logged in again, open a terminal and type:
116+
python3 -m pipx ensurepath
117+
source ~/.zshrc
106118

107-
```
108-
cd
109-
python3 install.py
110-
```
111-
112-
Enjoy!
119+
### Performing the installation
113120

114-
## Installation of Additional Package Managers
121+
Execute the following command:
115122

116-
These instructions must be followed only in case you want to use **MPV** or **MPlayer** with **PyRadio**.
123+
python3 install.py
117124

118-
It goes without saying that it's enough to install only one of these package managers.
119-
120-
### Homebrew
121-
122-
To install [Homebrew](https://brew.sh) open a **terminal** and type:
123-
124-
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
125-
126-
### MacPorts
125+
Enjoy!
127126

128-
[MacPorts](https://www.macports.org/) provide installation packages for each MacOS version, so just get to their [site](https://www.macports.org/install.php) and get the one suitable for you.

pyradio/player.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3338,8 +3338,8 @@ def _buildStartOpts(self, streamUrl, playList=False):
33383338
if ok_to_go_on:
33393339
break
33403340

3341-
opts = [self.PLAYER_CMD, '--no-one-instance', '--no-volume-save',
3342-
'-Irc', '--rc-host', '127.0.0.1:' + str(self._port),
3341+
opts = [self.PLAYER_CMD, '--no-video', '--no-one-instance',
3342+
'--no-volume-save', '-Irc', '--rc-host', '127.0.0.1:' + str(self._port),
33433343
'--file-logging', '--logmode', 'text', '--log-verbose', '3',
33443344
'--logfile', self._vlc_stdout_log_file, '-vv',
33453345
self._url_to_use(streamUrl)]
@@ -3351,18 +3351,18 @@ def _buildStartOpts(self, streamUrl, playList=False):
33513351
else:
33523352
if self.recording == self.NO_RECORDING:
33533353
if self.WIN:
3354-
opts = [self.PLAYER_CMD, '--no-one-instance', '--no-volume-save',
3355-
'-Irc', '-vv', self._vlc_url]
3354+
opts = [self.PLAYER_CMD, '--no-video', '--no-one-instance',
3355+
'--no-volume-save', '-Irc', '-vv', self._vlc_url]
33563356
else:
3357-
opts = [self.PLAYER_CMD, '--no-one-instance', '--no-volume-save',
3358-
'-Irc', '-vv']
3357+
opts = [self.PLAYER_CMD, '--no-video', '--no-one-instance',
3358+
'--no-volume-save', '-Irc', '-vv']
33593359
else:
33603360
if self.WIN:
3361-
opts = [self.PLAYER_CMD, '--no-one-instance', '--no-volume-save',
3362-
'-Irc', '-vv', self._vlc_url]
3361+
opts = [self.PLAYER_CMD, '--no-video', '--no-one-instance',
3362+
'--no-volume-save', '-Irc', '-vv', self._vlc_url]
33633363
else:
3364-
opts = [self.PLAYER_CMD, '--no-one-instance', '--no-volume-save',
3365-
'-Irc', '-vv']
3364+
opts = [self.PLAYER_CMD, '--no-video', '--no-one-instance',
3365+
'--no-volume-save', '-Irc', '-vv']
33663366

33673367
if platform.lower().startswith('dar'):
33683368
# MacOS VLC does not support --no-one-instance

0 commit comments

Comments
 (0)