Skip to content

Commit cd6eaaa

Browse files
committed
- changing windows installation method to pip
- adding F7, F8, F9, F10 functionalit on Windows - updating docs
1 parent a7b90ca commit cd6eaaa

14 files changed

+284
-145
lines changed

Changelog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
2022-03-10 s-n-g
2+
* Windows installation method updated to pip
3+
* adding F7, F8, F9, F10 functionality for Windows
4+
* updating docs
5+
16
2022-02-14 s-n-g
27
* version 0.8.9.14 (0.9-beta11)
38
* fixing typo in player.py

README.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,11 @@ <h2 id="requirements">Requirements <span style="padding-left: 10px;"><sup style=
143143
<h2 id="changelog">Changelog <span style="padding-left: 10px;"><sup style="font-size: 50%"><a href="#" title="Go to top of the page">Top</a></sup></style></h2>
144144
<pre style="height: 200px;">
145145

146+
2022-03-10 s-n-g
147+
* Windows installation method updated to pip
148+
* adding F7, F8, F9, F10 functionality for Windows
149+
* updating docs
150+
146151
2022-02-14 s-n-g
147152
* version 0.8.9.14 (0.9-beta11)
148153
* fixing typo in player.py

build.html

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ <h2 id="table-of-contents">Table of Contents <span style="padding-left: 10px;"><
4343
<ul>
4444
<li><a href="#preparing-for-the-installation">Preparing for the installation</a>
4545
<ul>
46+
<li><a href="#notice-for-python-2-users">Notice for Python 2 users</a></li>
4647
<li><a href="#linux">Linux</a></li>
4748
<li><a href="#macos">macOS</a></li>
4849
<li><a href="#windows">Windows</a></li>
@@ -56,10 +57,17 @@ <h2 id="table-of-contents">Table of Contents <span style="padding-left: 10px;"><
5657
<p><a href="README.html">[Return to main doc]</a></p>
5758
<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>
5859
<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>
60+
<h3 id="notice-for-python-2-users">Notice for Python 2 users</h3>
61+
<p>If you are still using <strong>Python 2</strong>, plase make sure “<strong>pip</strong>” is installed. Execute the following command to verify its existance:</p>
62+
<pre>python[2] -m pip list</pre>
63+
<p>If you get a response, you are good to go. Otherwise, use your distro package manager to install it.</p>
64+
<p>If your distro does not provide it (some do not anymore), use the following commands to get it:</p>
65+
<pre>curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py
66+
sudo python[2] get-pip.py</pre>
5967
<h3 id="linux">Linux</h3>
6068
<p>Use your distribution method to install</p>
6169
<ol type="1">
62-
<li><em>python-setuptools</em></li>
70+
<li><em>python-wheel</em></li>
6371
<li><em>python-requests</em></li>
6472
<li><em>python-dnspython</em></li>
6573
<li><em>python-psutil</em></li>
@@ -69,7 +77,7 @@ <h3 id="linux">Linux</h3>
6977
<p>When you are done, proceed to “<a href="#performing-the-installation">Performing the installation</a>”.</p>
7078
<h3 id="macos">macOS</h3>
7179
<p>First thing you do is install python dependencies (assuming python 3 is installed):</p>
72-
<pre>pip3 install --upgrade requests dnspython psutil</pre>
80+
<pre>pip3 install --upgrade wheel requests dnspython psutil</pre>
7381
<p>Everything else you need to install and run <strong>pyradio</strong> 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>
7482
<p>Open a <strong>terminal</strong> and type:</p>
7583
<pre>/usr/bin/ruby -e &quot;$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)&quot;</pre>

build.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Ben Dowling - [https://github.com/coderholic](https://github.com/coderholic)
88
<!-- vim-markdown-toc Marked -->
99

1010
* [Preparing for the installation](#preparing-for-the-installation)
11+
* [Notice for Python 2 users](#notice-for-python-2-users)
1112
* [Linux](#linux)
1213
* [macOS](#macos)
1314
* [Windows](#windows)
@@ -23,11 +24,24 @@ Ben Dowling - [https://github.com/coderholic](https://github.com/coderholic)
2324

2425
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.
2526

27+
### Notice for Python 2 users
28+
29+
If you are still using **Python 2**, plase make sure "**pip**" is installed. Execute the following command to verify its existance:
30+
31+
python[2] -m pip list
32+
33+
If you get a response, you are good to go. Otherwise, use your distro package manager to install it.
34+
35+
If your distro does not provide it (some do not anymore), use the following commands to get it:
36+
37+
curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py
38+
sudo python[2] get-pip.py
39+
2640
### Linux
2741

2842
Use your distribution method to install
2943

30-
1. *python-setuptools*
44+
1. *python-wheel*
3145
2. *python-requests*
3246
3. *python-dnspython*
3347
4. *python-psutil*
@@ -41,7 +55,7 @@ When you are done, proceed to "[Performing the installation](#performing-the-in
4155

4256
First thing you do is install python dependencies (assuming python 3 is installed):
4357

44-
pip3 install --upgrade requests dnspython psutil
58+
pip3 install --upgrade wheel requests dnspython psutil
4559

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

devel/build_install_pyradio.bat

Lines changed: 64 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
@ECHO OFF
22
IF "%1"=="--help" GOTO displayhelp
33
IF "%1"=="-h" GOTO displayhelp
4-
setlocal EnableDelayedExpansion
4+
SETLOCAL EnableDelayedExpansion
55

66
IF EXIST DEV (SET NO_DEV=0) ELSE (SET NO_DEV=1)
77
REM echo(NO_DEV = %NO_DEV%
@@ -11,8 +11,8 @@ REM GOTO endnopause
1111
:: https://gist.github.com/neremin/3a4020c172053d837ab37945d81986f6
1212
:: https://stackoverflow.com/questions/13212033/get-windows-version-in-a-batch-file
1313
net session >nul 2>&1
14-
IF '%errorlevel%' == '0' ( GOTO START ) ELSE (
15-
for /f "tokens=4-5 delims=. " %%i in ('ver') do set VERSION=%%i.%%j
14+
IF "%errorlevel%" == "0" ( GOTO START ) ELSE (
15+
FOR /f "tokens=4-5 delims=. " %%i in ('ver') do SET VERSION=%%i.%%j
1616
IF "%version%" == "6.1" ( GOTO win7exit )
1717
IF "%version%" == "6.0" ( GOTO win7exit )
1818
GOTO getPrivileges
@@ -36,47 +36,47 @@ IF "%1"=="" (
3636
CLS
3737
ECHO Installing / Updating python modules
3838
pip install --upgrade windows-curses 1>NUL 2>NUL
39-
if %ERRORLEVEL% == 1 (
40-
set ERRPKG=windows-curses
39+
IF %ERRORLEVEL% == 1 (
40+
SET ERRPKG=windows-curses
4141
GOTO piperror
4242
)
4343
pip install --upgrade pywin32 1>NUL 2>NUL
44-
if %ERRORLEVEL% == 1 (
45-
set ERRPKG=pywin32
44+
IF %ERRORLEVEL% == 1 (
45+
SET ERRPKG=pywin32
4646
GOTO piperror
4747
)
4848
pip install --upgrade requests 1>NUL 2>NUL
49-
if %ERRORLEVEL% == 1 (
50-
set ERRPKG=requests
49+
IF %ERRORLEVEL% == 1 (
50+
SET ERRPKG=requests
5151
GOTO piperror
5252
)
5353
pip install --upgrade dnspython 1>NUL 2>NUL
54-
if %ERRORLEVEL% == 1 (
55-
set ERRPKG=dnspython
54+
IF %ERRORLEVEL% == 1 (
55+
SET ERRPKG=dnspython
5656
GOTO piperror
5757
)
5858
pip install --upgrade psutil 1>NUL 2>NUL
59-
if %ERRORLEVEL% == 1 (
60-
set ERRPKG=psutil
59+
IF %ERRORLEVEL% == 1 (
60+
SET ERRPKG=psutil
6161
GOTO piperror
6262
)
6363
pip install --upgrade patool 1>NUL 2>NUL
64-
if %ERRORLEVEL% == 1 (
65-
set ERRPKG=patool
64+
IF %ERRORLEVEL% == 1 (
65+
SET ERRPKG=patool
6666
GOTO piperror
6767
)
6868
pip install --upgrade psutil 1>NUL 2>NUL
69-
if %ERRORLEVEL% == 1 (
70-
set ERRPKG=pyunpack
69+
IF %ERRORLEVEL% == 1 (
70+
SET ERRPKG=pyunpack
7171
GOTO piperror
7272
)
7373
pip install --upgrade wheel 1>NUL 2>NUL
74-
if %ERRORLEVEL% == 1 (
75-
set ERRPKG=wheel
74+
IF %ERRORLEVEL% == 1 (
75+
SET ERRPKG=wheel
7676
GOTO piperror
7777
)
7878
)
79-
goto START
79+
GOTO START
8080
IF '%1'=='ELEV' ( GOTO START ) ELSE ( ECHO Running elevated in a different window)
8181
ECHO >>DOPAUSE
8282

@@ -262,33 +262,56 @@ GOTO endnopause
262262
ECHO This may take some time...
263263
ECHO ***********************************************************
264264
ECHO.
265-
ECHO PyRadio will NOT uninstall NPV, MPlayer, Python and/or Git.
266-
ECHO You will have to manually uninstall them.
267-
ECHO.
268-
ECHO PyRadio user files will be left instact.
269-
ECHO You can find them at
270-
ECHO %APPDATA%\pyradio
265+
ECHO PyRadio will NOT uninstall Python and/or Git.
266+
ECHO You will have to manually uninstall them (IF desired).
271267
ECHO.
272268
ECHO ***********************************************************
273269
ECHO.
274270
DEL pyremove.bat 2>NUL
275271
ECHO ECHO Uninstalling PyRadio>>pyremove.bat
276-
ECHO ECHO ** Gathering information...>>pyremove.bat
277-
ECHO ECHO ** Removing executable ... done>>pyremove.bat
278-
ECHO ECHO ** Removing Desktop shortcut ... done >>pyremove.bat
279-
ECHO IF EXIST "%DESKTOP%\PyRadio.lnk" DEL "%DESKTOP%\PyRadio.lnk" 2>NUL >>pyremove.bat
280-
python devel\site.py exe 2>NUL >>pyremove.bat
281-
python devel\site.py 2>NUL >dirs
282-
python -m site --user-site 2>NUL >>dirs
283-
python devel\windirs.py
272+
:: ECHO ECHO ** Gathering information>>pyremove.bat
273+
:: ECHO ECHO ** Removing executable>>pyremove.bat
274+
ECHO ECHO ** Removing Desktop shortcut>>pyremove.bat
275+
ECHO IF EXIST "%DESKTOP%\PyRadio.lnk" DEL "%DESKTOP%\PyRadio.lnk">>pyremove.bat
276+
:: python devel\site.py exe 2>NUL >>pyremove.bat
277+
:: python devel\site.py 2>NUL >dirs
278+
:: python -m site --user-site 2>NUL >>dirs
279+
:: python devel\windirs.py
284280
python devel\unreg.py
285-
ECHO DEL dirs >>pyremove.bat
286-
ECHO python -m pip uninstall -y pyradio >>pyremove.bat
287-
ECHO ECHO. >>pyremove.bat
288-
ECHO ECHO. >>pyremove.bat
289-
ECHO ECHO PyRadio successfully uninstalled! >>pyremove.bat
290-
ECHO ECHO. >>pyremove.bat
291-
:: IF EXIST "DOPAUSE" ( ECHO PAUSE >>pyremove.bat )
281+
282+
SET ANS=""
283+
:readit
284+
ECHO User files are under "%APPDATA%\pyradio"
285+
SET /p ANS="Do you want to remove them (y/n)?: "
286+
:: ECHO %ANS%
287+
IF "%ANS%" == "y" GOTO :addtobat
288+
IF "%ANS%" == "n" GOTO :addtobat
289+
GOTO :readit
290+
:addtobat
291+
292+
IF "%ANS%" == "y" (
293+
ECHO ECHO ** Removing user files>>pyremove.bat
294+
ECHO RD /Q /S "%APPDATA%\pyradio">>pyremove.bat
295+
) else (
296+
ECHO ECHO ** Removing stations.csv>>pyremove.bat
297+
ECHO DEL "%APPDATA%\pyradio\stations.csv">>pyremove.bat
298+
IF EXIST %APPDATA%\pyradio\mpv (
299+
ECHO ECHO ** Removing MPV>>pyremove.bat
300+
ECHO RD /Q /S "%APPDATA%\pyradio\mpv">>pyremove.bat
301+
)
302+
IF EXIST %APPDATA%\pyradio\mplayer (
303+
ECHO ECHO ** Removing MPlayer>>pyremove.bat
304+
ECHO RD /Q /S "%APPDATA%\pyradio\mplayer">>pyremove.bat
305+
)
306+
)
307+
308+
ECHO IF EXIST dirs DEL dirs >>pyremove.bat
309+
ECHO python -m pip uninstall -y pyradio>>pyremove.bat
310+
ECHO ECHO.>>pyremove.bat
311+
ECHO ECHO.>>pyremove.bat
312+
:: ECHO ECHO PyRadio successfully uninstalled! >>pyremove.bat
313+
::ECHO ECHO. >>pyremove.bat
314+
IF EXIST "DOPAUSE" ( ECHO PAUSE>>pyremove.bat )
292315
:: PAUSE
293316
CALL pyremove.bat
294317
IF %ALL% == 1 ( GOTO noparam )

pyradio/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
" pyradio -- Console radio player. "
22

3-
version_info = (0, 8, 9, 14)
3+
version_info = (0, 8, 9, 15)
44

55
# Application state:
66
# New stable version: ''

pyradio/config.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1139,10 +1139,13 @@ class PyRadioConfig(PyRadioStations):
11391139
current_pyradio_version = None
11401140

11411141
''' Windows manage players trigger '''
1142-
MANAGE_PLAYERS = False
1142+
WIN_MANAGE_PLAYERS = False
11431143

11441144
''' Windows print EXE location trigger '''
1145-
PRINT_PATHS = False
1145+
WIN_PRINT_PATHS = False
1146+
1147+
''' Windows Uninstall trigger '''
1148+
WIN_UNINSTALL = False
11461149

11471150
def __init__(self):
11481151
self.backup_player_params = None

pyradio/main.py

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -443,12 +443,37 @@ def shell():
443443

444444
''' curses is off '''
445445
if pyradio.setup_return_status:
446-
if pyradio_config.PRINT_PATHS and platform.startswith('win'):
446+
if pyradio_config.WIN_UNINSTALL and platform.startswith('win'):
447+
from msvcrt import getwch
448+
from os import sep
449+
import subprocess
450+
the_path = __file__.split(sep)
451+
the_file = sep.join(the_path[:-1]) + sep + 'install.py'
452+
print('\nTo complete the process you will have to execute a batch file.')
453+
print('Windows Explorer will open the location of the batch file to run.')
454+
print('')
455+
print('Please double click')
456+
print('')
457+
print(' uninstall.bat')
458+
print('')
459+
print('to remove PyRadio from your system.')
460+
print('')
461+
print('After you are done, you can delete the folder it resides in.')
462+
print('\nPress any key to continue...', end='', flush=True)
463+
getwch()
464+
#print('\nPress any key to exit...', end='', flush=True)
465+
#getwch()
466+
subprocess.call('python ' + the_file + ' -R',
467+
stdout=subprocess.DEVNULL,
468+
stderr=subprocess.DEVNULL)
469+
sys.exit()
470+
471+
if pyradio_config.WIN_PRINT_PATHS and platform.startswith('win'):
447472
''' print exe path '''
448473
print('')
449474
print_exe_paths()
450475

451-
if pyradio_config.MANAGE_PLAYERS and platform.startswith('win'):
476+
if pyradio_config.WIN_MANAGE_PLAYERS and platform.startswith('win'):
452477
''' manage players'''
453478
from .win import install_player
454479
install_player()

0 commit comments

Comments
 (0)