Skip to content

Commit cc2dd7d

Browse files
committed
- updating docs
- build_install_pyradio will be more strict in checking before deleting installation folder
1 parent 94ef237 commit cc2dd7d

File tree

12 files changed

+203
-160
lines changed

12 files changed

+203
-160
lines changed

Changelog

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
2021-03-23 s-n-g
2+
* Implemented a simplified method to install, update, uninstall.
3+
* PyRadio will detect its player abnormal termination.
4+
* Player's connection timeout can now be disabled. Once a player is
5+
started, it will be considered to be connected immediately.
6+
* Active players parameter list is always synchronized to saved.
7+
18
2021-02-27 s-n-g
29
* Version 0.8.8.5 (BUG FIX release)
310
* Fixing -ap value not activated by player

README.html

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ <h2 id="table-of-contents">Table of contents <span style="padding-left: 10px;"><
5757
<li><a href="#cleaning-up">Cleaning up</a></li>
5858
<li><a href="#debug-mode">Debug mode</a></li>
5959
<li><a href="#reporting-bugs">Reporting bugs</a></li>
60+
<li><a href="#packaging-pyradio">Packagin PyRadio</a></li>
6061
<li><a href="#todo">TODO</a></li>
6162
<li><a href="#acknowlegement">Acknowlegement</a></li>
6263
</ul>
@@ -550,6 +551,19 @@ <h2 id="reporting-bugs">Reporting bugs <span style="padding-left: 10px;"><sup st
550551
$ pyradio -d</pre>
551552
<p>Then try to reproduce the bug and exit <strong>pyradio</strong>.</p>
552553
<p>Finally, include the file produced in your report.</p>
554+
<h2 id="packaging-pyradio">Packaging Pyradio <span style="padding-left: 10px;"><sup style="font-size: 50%"><a href="#" title="Go to top of the page">Top</a></sup></style></h2>
555+
<p>If you are a packager and would like to produce a package for your distribution please do follow this mini guide.</p>
556+
<p><strong>PyRadio</strong> is able to update and uninstall itself, when installed from sources.</p>
557+
<p>This is something you do not want to be available when your package is used; <strong>PyRadio</strong> should be updated and uninstalled using the distro package manager.</p>
558+
<p>In order to accomplice that, you just have to change the <strong>distro</strong> configuration parameter in the <strong>config</strong> file.</p>
559+
<p><strong>PyRadio</strong> will read this parameter and will disable updating and uninstalling, when set to anything other than “<strong>None</strong>”.</p>
560+
<p>So, here’s how you do that:</p>
561+
<p>Once you are in the sources top level directory (typically “<em>pyradio</em>”), you execute the command:</p>
562+
<pre>sed -i &#39;s/distro = None/distro = YOUR DISTRO NAME&#39; pyradio/config</pre>
563+
<p>Then you go on to produce the package as you would normally do.</p>
564+
<p>For example, an <strong>Arch Linux</strong> packager would use this command:</p>
565+
<pre>sed -i &#39;s/distro = None/distro = Arch Linux&#39; pyradio/config</pre>
566+
<p>The distro name you insert here will appear in <strong>PyRadio</strong>’s log file, so that I know where the package came from while debugging, so if you are not packaging for a specific distribution, please do use something meaningful (for example, using “<em>xxx</em>” will do the job, but provides no useful information).</p>
553567
<h2 id="todo">TODO <span style="padding-left: 10px;"><sup style="font-size: 50%"><a href="#" title="Go to top of the page">Top</a></sup></style></h2>
554568
<ul class="task-list">
555569
<li><input type="checkbox" disabled="" />

README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ Ben Dowling - [https://github.com/coderholic](https://github.com/coderholic)
2929
* [Cleaning up](#cleaning-up)
3030
* [Debug mode](#debug-mode)
3131
* [Reporting bugs](#reporting-bugs)
32+
* [Packagin PyRadio](#packaging-pyradio)
3233
* [TODO](#todo)
3334
* [Acknowlegement](#acknowlegement)
3435

@@ -742,6 +743,36 @@ Then try to reproduce the bug and exit **pyradio**.
742743

743744
Finally, include the file produced in your report.
744745

746+
## Packaging Pyradio
747+
748+
If you are a packager and would like to produce a package for your distribution please do follow this mini guide.
749+
750+
**PyRadio** is able to update and uninstall itself, when installed from sources.
751+
752+
This is something you do not want to be available when your package is used; **PyRadio** should be updated and uninstalled using the distro package manager.
753+
754+
In order to accomplice that, you just have to change the **distro** configuration parameter in the **config** file.
755+
756+
**PyRadio** will read this parameter and will disable updating and uninstalling, when set to anything other than "**None**".
757+
758+
So, here's how you do that:
759+
760+
Once you are in the sources top level directory (typically "*pyradio*"), you execute the command:
761+
762+
```
763+
sed -i 's/distro = None/distro = YOUR DISTRO NAME' pyradio/config
764+
```
765+
766+
Then you go on to produce the package as you would normally do.
767+
768+
For example, an **Arch Linux** packager would use this command:
769+
770+
```
771+
sed -i 's/distro = None/distro = Arch Linux' pyradio/config
772+
```
773+
774+
The distro name you insert here will appear in **PyRadio**'s log file, so that I know where the package came from while debugging, so if you are not packaging for a specific distribution, please do use something meaningful (for example, using "*xxx*" will do the job, but provides no useful information).
775+
745776
## TODO
746777

747778
- [ ] Any user request I find interesting :)

build.html

Lines changed: 23 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,7 @@ <h2 id="table-of-contents">Table of contents <span style="padding-left: 10px;"><
4242
<li><a href="#macos">macOS</a></li>
4343
<li><a href="windows.html">Windows</a></li>
4444
</ul></li>
45-
<li><a href="#performing-the-installation">Performing the installation</a>
46-
<ul>
47-
<li><a href="#development-version">Development version</a></li>
48-
<li><a href="#stable-version">Stable version</a></li>
49-
</ul></li>
45+
<li><a href="#performing-the-installation">Performing the installation</a></li>
5046
</ul></li>
5147
<li><a href="README.html">Return to main doc</a></li>
5248
</ul>
@@ -56,21 +52,23 @@ <h2 id="building-from-source">Building from source <span style="padding-left: 10
5652
<li>A pre-built package is not available to you.</li>
5753
<li>You want to use a particular python version. For example, most pre-built packages nowadays are built using python 3.x. If for any reason you have to use python 2.x, this is the way to go.</li>
5854
</ul>
59-
<p>For the installation you will need <strong><em>git</em></strong>, <strong><em>setuptools</em></strong> (e.g. <em>python-setuptools</em>, <em>python3-setuptools</em> or <em>python2-setuptools</em>) and <strong><em>requests</em></strong> (e.g. <em>python-requests</em>, <em>python3-requests</em> or <em>python2-requests</em>) to be already installed.</p>
60-
<p>Finally, you will use the <strong><em>build_install_pyradio</em></strong> script, located int the <strong><em>devel</em></strong> directory.</p>
61-
<p>To see your options, execute:</p>
62-
<pre>devel/build_install_pyradio -h</pre>
55+
<p>For the installation you will need:</p>
56+
<ol type="1">
57+
<li><strong><em>setuptools</em></strong> (e.g. <em>python-setuptools</em>, <em>python3-setuptools</em> or <em>python2-setuptools</em>)</li>
58+
<li><strong><em>requests</em></strong> (e.g. <em>python-requests</em>, <em>python3-requests</em> or <em>python2-requests</em>) to be already installed.</li>
59+
</ol>
60+
<p>The procedure presented here will not provide you with the sources; it will download and install them and then delete them. If you have to have <strong>PyRadio</strong>’s sources, you can just:</p>
61+
<pre>git clone https://github.com/coderholic/pyradio.git</pre>
62+
<p>or download a zip from <strong>PyRadio</strong>’s <a target="_blank" href="https://github.com/coderholic/pyradio">main page</a>.</p>
6363
<h2 id="preparing-for-the-installation">Preparing for the installation <span style="padding-left: 10px;"><sup style="font-size: 50%"><a href="#" title="Go to top of the page">Top</a></sup></style></h2>
6464
<p>Before installing <strong>PyRadio</strong> you have to prepare your system, so that you end up with a working installation. The process depends on the OS you are on.</p>
6565
<h3 id="linux">Linux</h3>
66-
<p>Use your distribution method to install <em>python-setuptools</em>, <em>python-requests</em>, <em>git</em>, <em>sed</em> and any one of <em>MPV</em>, <em>MPlayer</em> and/or <em>VLC</em>.</p>
66+
<p>Use your distribution method to install <em>python-setuptools</em>, <em>python-requests</em>, <em>sed</em> and any one of <em>MPV</em>, <em>MPlayer</em> and/or <em>VLC</em>.</p>
6767
<p>When you are done, proceed to “<a href="#performing-the-installation">Performing the installation</a>”.</p>
6868
<h3 id="macos">macOS</h3>
6969
<p>Everything you need to install, run and keep <strong>pyradio</strong> up-to-date is available on <a target="_blank" href="https://github.com/Homebrew/homebrew">Homebrew</a>. If you haven’t already downloaded its client, go ahead and do it.</p>
7070
<p>Open a <strong>terminal</strong> and type:</p>
7171
<pre>/usr/bin/ruby -e &quot;$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)&quot;</pre>
72-
<p>Then just install <strong>git</strong>:</p>
73-
<pre>brew install git</pre>
7472
<p>Depending on your Mac OS version, you may have to install <strong>sed</strong> too:</p>
7573
<pre>brew install gnu-sed --default-names</pre>
7674
<p>Now it’s time to install a media player. You are free to install any one of them or even more than one…</p>
@@ -89,24 +87,18 @@ <h3 id="macos">macOS</h3>
8987
sudo ln -s /usr/local/bin/vlc /usr/local/bin/cvlc</pre>
9088
<p>Your system is ready now for <strong>pyradio</strong> to be installed. You can follow the instructions given at “<a href="#performing-the-installation">Performing the installation</a>”.</p>
9189
<h2 id="performing-the-installation">Performing the installation <span style="padding-left: 10px;"><sup style="font-size: 50%"><a href="#" title="Go to top of the page">Top</a></sup></style></h2>
92-
<p>First thing you do is get the source. Open a <strong>terminal</strong> and type:</p>
93-
<pre>git clone https://github.com/coderholic/pyradio.git
94-
cd pyradio</pre>
95-
<p>Then you have to decide to either build the development version or one of the available stable versions.</p>
96-
<h3 id="development-version">Development version</h3>
97-
<pre>devel/build_install_pyradio</pre>
98-
<h3 id="stable-version">Stable version</h3>
99-
<p>Get tag information.</p>
100-
<pre>git fetch --all --tags --prune
101-
git tag</pre>
102-
<p>This will report to you something similar to:</p>
103-
<pre>0.1
104-
0.4
105-
0.6.0</pre>
106-
<p>Now is the time to pick a version.</p>
107-
<p>For this example we will go with v. <strong>0.6.0</strong>.</p>
108-
<pre>git checkout tags/0.6.0 -b 0.6.0</pre>
109-
<p>Finally, build and install</p>
110-
<pre>devel/build_install_pyradio</pre>
90+
<p>First thing you do is get the installation script. Open a <strong>terminal</strong> and type:</p>
91+
<pre>cd
92+
wget https://raw.githubusercontent.com/coderholic/pyradio/devel/pyradio/install.py</pre>
93+
<p>or using curl:</p>
94+
<pre>cd
95+
curl -L https://raw.githubusercontent.com/coderholic/pyradio/devel/pyradio/install.py -o install.py</pre>
96+
<p><strong>Note</strong>: If you have neither <em>wget</em> or <em>curl</em> installed, just right click on <a target="_blank" href="https://raw.githubusercontent.com/coderholic/pyradio/devel/pyradio/install.py">this link</a> and use your browser “<strong>Save as</strong>” menu entry to save the file in your home folder.</p>
97+
<p>Finally, execute the command:</p>
98+
<pre>python install.py</pre>
99+
<p>On <strong>Debian</strong> based systems you will have to execute:</p>
100+
<pre>python3 install.py</pre>
101+
<p>If for some reason you want a <strong>python 2</strong> installation, execute:</p>
102+
<pre>python2 install.py</pre>
111103
</body>
112104
</html>

build.md

Lines changed: 22 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ Ben Dowling - [https://github.com/coderholic](https://github.com/coderholic)
1212
* [macOS](#macos)
1313
* [Windows](windows.md)
1414
* [Performing the installation](#performing-the-installation)
15-
* [Development version](#development-version)
16-
* [Stable version](#stable-version)
1715
* [Return to main doc](README.md)
1816

1917
## Building from source
@@ -23,28 +21,31 @@ Reasons to build from source
2321
* A pre-built package is not available to you.
2422
* You want to use a particular python version. For example, most pre-built packages nowadays are built using python 3.x. If for any reason you have to use python 2.x, this is the way to go.
2523

26-
For the installation you will need ***git***, ***setuptools*** (e.g. *python-setuptools*, *python3-setuptools* or *python2-setuptools*) and ***requests*** (e.g. *python-requests*, *python3-requests* or *python2-requests*) to be already installed.
24+
For the installation you will need:
2725

28-
Finally, you will use the ***build_install_pyradio*** script, located int the ***devel*** directory.
26+
1. ***setuptools*** (e.g. *python-setuptools*, *python3-setuptools* or *python2-setuptools*)
27+
2. ***requests*** (e.g. *python-requests*, *python3-requests* or *python2-requests*) to be already installed.
2928

30-
To see your options, execute:
29+
The procedure presented here will not provide you with the sources; it will download and install them and then delete them. If you have to have **PyRadio**'s sources, you can just:
3130

3231
```
33-
devel/build_install_pyradio -h
32+
git clone https://github.com/coderholic/pyradio.git
3433
```
3534

35+
or download a zip from **PyRadio**'s [main page](https://github.com/coderholic/pyradio).
36+
3637
## Preparing for the installation
3738

3839
Before installing **PyRadio** you have to prepare your system, so that you end up with a working installation. The process depends on the OS you are on.
3940

4041
### Linux
4142

42-
Use your distribution method to install *python-setuptools*, *python-requests*, *git*, *sed* and any one of *MPV*, *MPlayer* and/or *VLC*.
43+
Use your distribution method to install *python-setuptools*, *python-requests*, *sed* and any one of *MPV*, *MPlayer* and/or *VLC*.
4344

4445
When you are done, proceed to "[Performing the installation](#performing-the-installation)".
4546

4647

47-
### macOS
48+
### macOS
4849

4950
Everything you need to install, run and keep **pyradio** up-to-date is available on [Homebrew](https://github.com/Homebrew/homebrew). If you haven't already downloaded its client, go ahead and do it.
5051

@@ -54,12 +55,6 @@ Open a **terminal** and type:
5455
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
5556
```
5657

57-
Then just install **git**:
58-
59-
```
60-
brew install git
61-
```
62-
6358
Depending on your Mac OS version, you may have to install **sed** too:
6459

6560
```
@@ -107,49 +102,37 @@ Your system is ready now for **pyradio** to be installed. You can follow the ins
107102

108103
## Performing the installation
109104

110-
First thing you do is get the source. Open a **terminal** and type:
105+
First thing you do is get the installation script. Open a **terminal** and type:
111106

112107
```
113-
git clone https://github.com/coderholic/pyradio.git
114-
cd pyradio
108+
cd
109+
wget https://raw.githubusercontent.com/coderholic/pyradio/devel/pyradio/install.py
115110
```
116111

117-
Then you have to decide to either build the development version or one of the available stable versions.
118-
119-
### Development version
112+
or using curl:
120113

121114
```
122-
devel/build_install_pyradio
115+
cd
116+
curl -L https://raw.githubusercontent.com/coderholic/pyradio/devel/pyradio/install.py -o install.py
123117
```
124118

125-
### Stable version
126-
127-
Get tag information.
128-
129-
```
130-
git fetch --all --tags --prune
131-
git tag
132-
```
119+
**Note**: If you have neither *wget* or *curl* installed, just right click on [this link](https://raw.githubusercontent.com/coderholic/pyradio/devel/pyradio/install.py) and use your browser "**Save as**" menu entry to save the file in your home folder.
133120

134-
This will report to you something similar to:
121+
Finally, execute the command:
135122

136123
```
137-
0.1
138-
0.4
139-
0.6.0
124+
python install.py
140125
```
141126

142-
Now is the time to pick a version.
143-
144-
For this example we will go with v. **0.6.0**.
127+
On **Debian** based systems you will have to execute:
145128

146129
```
147-
git checkout tags/0.6.0 -b 0.6.0
130+
python3 install.py
148131
```
149132

150-
Finally, build and install
133+
If for some reason you want a **python 2** installation, execute:
151134

152135
```
153-
devel/build_install_pyradio
136+
python2 install.py
154137
```
155138

devel/build_install_pyradio

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,4 +326,14 @@ python"${TO_PYTHON}" setup.py build && {
326326
#git checkout pyradio/radio.py
327327
}
328328
rm sed.$$ 2>/dev/null
329-
[ -z "$REMOVE_DIR" ] || [[ $REMOVE_DIR == *pyradio ]] && sudo rm -fr "$REMOVE_DIR"
329+
330+
# remove instasllation directory
331+
if [ ! -z "$REMOVE_DIR" ];then
332+
if [ "$REMOVE_DIR" = "$HOME/pyradio" ] || \
333+
[ "$REMOVE_DIR" = "$HOME/tmp-pyradio" ] || \
334+
[ "$REMOVE_DIR" = "/tmp/pyradio" ] || \
335+
[ "$REMOVE_DIR" = "/tmp/tmp-pyradio" ];then
336+
sudo rm -fr "$REMOVE_DIR"
337+
fi
338+
fi
339+

pyradio/config.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1335,7 +1335,7 @@ def _get_lock_file(self):
13351335
if platform == 'win32':
13361336
self._session_lock_file = path.join(getenv('APPDATA'), 'pyradio', 'pyradio.lock')
13371337
else:
1338-
self._session_lock_file = path.join(getenv('HOME'), '.config', 'pyradio')
1338+
self._session_lock_file = path.join(getenv('HOME'), '.config', 'pyradio', 'pyradio.lock')
13391339
if path.exists(self._session_lock_file):
13401340
if platform == 'win32':
13411341
win_lock = path.join(getenv('APPDATA'), 'pyradio', '_windows.lock')
@@ -1475,6 +1475,8 @@ def read_config(self):
14751475
'vlc_parameter'):
14761476
self._config_to_params(sp)
14771477
elif sp[0] == 'distro':
1478+
''' mark as dirty to force saving config to remove setting '''
1479+
self.dirty_config = True
14781480
self._distro = sp[1].strip()
14791481

14801482
''' read distro from package config file '''
@@ -1490,7 +1492,7 @@ def read_config(self):
14901492
self._distro = sp[1].strip()
14911493
# print('Package distro is "{}"'.format(self._distro))
14921494
except:
1493-
pass
1495+
self._distro = 'None'
14941496

14951497
''' make sure extra params have only up to 10 items each
14961498
(well, actually 11 items, since the first one is the

0 commit comments

Comments
 (0)