Skip to content

Commit cb4b6c4

Browse files
committed
- Adding recording man page
- Updating docs
1 parent ddc6271 commit cb4b6c4

File tree

8 files changed

+503
-46
lines changed

8 files changed

+503
-46
lines changed

devel/build_install_pyradio

+2
Original file line numberDiff line numberDiff line change
@@ -473,11 +473,13 @@ then
473473
[ -z "${NO_DEV}" ] && [ -e pyradio/config.py.dev ] && mv pyradio/config.py.dev pyradio/config.py
474474
gzip -k pyradio.1
475475
gzip -k pyradio_rb.1
476+
gzip -k pyradio_rec.1
476477
gzip -k pyradio_server.1
477478
mkdir -p ~/.local/share/man/man1 2>/dev/null
478479
mv -f pyradio.1.gz ~/.local/share/man/man1 2>/dev/null || mv -f pyradio.1.gz ~/.local/local/share/man/man1
479480
mv -f pyradio_rb.1.gz ~/.local/share/man/man1 2>/dev/null || mv -f pyradio_rb.1.gz ~/.local/local/share/man/man1
480481
mv -f pyradio_server.1.gz ~/.local/share/man/man1 2>/dev/null || mv -f pyradio_server.1.gz ~/.local/local/share/man/man1
482+
mv -f pyradio_rec.1.gz ~/.local/share/man/man1 2>/dev/null || mv -f pyradio_rec.1.gz ~/.local/local/share/man/man1
481483
DOC=~/.local/share/doc/pyradio
482484
mkdir -p "$DOC" 2>/dev/null
483485
if [ ! -d "$DOC" ]

pyradio.1

+7-3
Original file line numberDiff line numberDiff line change
@@ -743,8 +743,7 @@ Pressing "\fI\\m\fR" will bring up the "\fBSwitch Media Player\fR" window, where
743743
.IP \fBNote\fR
744744
The activated player will not be saved; **PyRadio** will still use the player defined at its config next time it is executed.
745745

746-
.SH
747-
\fBExtra Player Parameters\fR
746+
.SH Extra Player Parameters
748747

749748
All three supported players can accept a significant number of "\fIcommand line parameters\fR", which are well documented and accessible through man pages (on linux and macOs) or the documentation (on Windows).
750749

@@ -1831,4 +1830,9 @@ You can see a complete list of contributors at
18311830

18321831
.SH See also
18331832

1834-
pyradio_rb(1) pyradio_server(1)
1833+
.IP \fIpyradio_rb(1)
1834+
RadioBrowser Implementation
1835+
.IP \fIpyradio_rec(1)
1836+
Recording stations
1837+
.IP \fIpyradio_server(1)
1838+
Remote Control Server

pyradio/install.py

+45-40
Original file line numberDiff line numberDiff line change
@@ -721,13 +721,30 @@ def _add_colors(self, txt):
721721
x = t.replace('mpv', '[green]mpv[/green]').replace('mplayer', '[green]mplayer[/green]').replace('vlc', '[green]vlc[/green]')
722722
return '[bold]' + x.replace('||', r']').replace('|', r'\[') + '[/bold]'
723723

724+
724725
class PythonExecutable(object):
726+
''' A class to verify that python is installed
727+
and in the PATH
728+
'''
725729
is_debian = False
726730
_python = [None, None]
727731
requested_python_version = 3
728732

729-
def __init__(self, requested_python_version):
733+
def __init__(
734+
self,
735+
requested_python_version,
736+
terminate_if_not_found=False):
737+
''' Parameters
738+
==========
739+
requested_python_version
740+
The version of python we are looking for
741+
(either 2 or 3)
742+
terminate_if_not_found
743+
If True, the program will terminate if python
744+
is not found (default is False)
745+
'''
730746
self.requested_python_version = requested_python_version
747+
self._terminate_if_not_found = terminate_if_not_found
731748
if not platform.system().lower().startswith('win'):
732749
self._check_if_is_debian_based()
733750
self._get_pythons()
@@ -790,16 +807,25 @@ def _get_python(self, version):
790807
stdout=subprocess.PIPE,
791808
stderr=subprocess.PIPE
792809
)
793-
# print(p.communicate())
794-
# print(p.returncode)
795-
# if p.communicate()[0]:
796810
p.communicate()
797811
if p.returncode == 0:
798812
self._python[version - 2] = 'python' + str(version)
799813

800-
def can_install(self):
801-
return True if self._python[self.requested_python_version - 2] else False
814+
if self._terminate_if_not_found and \
815+
not self.can_use():
816+
print('''
802817
818+
Python {} was not found in your system.
819+
If you have already installed it, you probably have not added it in your PATH.
820+
To verify that Python is in your PATH open a terminal/console and type "python".
821+
If you get en error, you have to add it to your PATH.
822+
'''.format('2' if self.requested_python_version == 2 else '3'))
823+
sys.exit(1)
824+
825+
def can_use(self):
826+
''' Can I use the python I requested?
827+
'''
828+
return True if self._python[self.requested_python_version - 2] else False
803829

804830
class PyRadioUpdate(object):
805831

@@ -847,17 +873,10 @@ def __init__(self,
847873
self._package = package
848874
self.user = user
849875
self._github_long_description = github_long_description
850-
self._python_exec = PythonExecutable(python_version_to_use)
851-
if self._python_exec.python is None:
852-
print('''
853-
854-
Python was not found in your system.
855-
If you have already installed it, chances are you have not added it in your PATH.
856-
To verify that Python is in your PATH open a terminal/console and type "python".
857-
If you get en error, you have to add it to your PATH.
858-
''')
859-
sys.exit(1)
860-
876+
self._python_exec = PythonExecutable(
877+
python_version_to_use,
878+
terminate_if_not_found=True
879+
)
861880
self.python2 = True if python_version_to_use == 2 else False
862881
self._pix_isolated = pix_isolated
863882

@@ -1259,17 +1278,10 @@ def __init__(self,
12591278
self._package = package
12601279
self._fromTUI = fromTUI
12611280
self._github_long_description = github_long_description
1262-
self._python_exec = PythonExecutable(python_version_to_use)
1263-
if self._python_exec.python is None:
1264-
print('''
1265-
1266-
Python was not found in your system.
1267-
If you have already installed it, chances are you have not added it in your PATH.
1268-
To verify that Python is in your PATH open a terminal/console and type "python".
1269-
If you get en error, you have to add it to your PATH.
1270-
''')
1271-
sys.exit(1)
1272-
1281+
self._python_exec = PythonExecutable(
1282+
python_version_to_use,
1283+
terminate_if_not_found=True
1284+
)
12731285
self.python2 = True if python_version_to_use == 2 else False
12741286
self._pix_isolated = pix_isolated
12751287
self._get_cache = False
@@ -1465,19 +1477,12 @@ def _do_it(self, mode='update'):
14651477
print_python2()
14661478

14671479
python_version_to_use = 2 if args.python2 else 3
1468-
python_exec = PythonExecutable(python_version_to_use)
1469-
1470-
if python_exec.python is None:
1471-
print('''
1472-
1473-
Python was not found in your system.
1474-
If you have already installed it, chances are you have not added it in your PATH.
1475-
To verify that Python is in your PATH open a terminal/console and type "python".
1476-
If you get en error, you have to add it to your PATH.
1477-
''')
1478-
sys.exit(1)
1480+
python_exec = PythonExecutable(
1481+
python_version_to_use,
1482+
terminate_if_not_found=True
1483+
)
14791484

1480-
if not python_exec.can_install:
1485+
if not python_exec.can_use:
14811486
print('Error: Python {} not found on your system...\n'.format('2' if python_exec.requested_python_version == 2 else '3'))
14821487
sys.exit(1)
14831488

pyradio/stations.csv

100755100644
File mode changed.

pyradio_rb.1

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
.PP
88
pyradio \- a curses Internet radio player.
99

10-
.SH \fBPyRadio\ RadioBrowser\ Implementation
10+
.SH PyRadio\ RadioBrowser\ Implementation
1111

1212
\fBRadioBrowser\fR "is a community driven effort (like wikipedia) with the aim of collecting as many internet radio and TV stations as possible".
1313

0 commit comments

Comments
 (0)