Skip to content

Commit b2121fe

Browse files
committed
Version 0.8.8-beta5 (adding vlc windows support)
1 parent bc210b0 commit b2121fe

15 files changed

+825
-211
lines changed

README.html

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,29 @@
77
<title>PyRadio README</title>
88
<style type="text/css">
99
html {margin: 2em;}
10-
h2 {margin-top: 2.5em; border-bottom:1px solid #D6D6D6;}
11-
h3 {margin-top: 2em;}
10+
h2 {margin-top: 2.5em; border-bottom:1px solid SaddleBrown; color: SaddleBrown;}
11+
h3 {margin-top: 2em; color: SaddleBrown;}
12+
h4 {margin-top: 2em; color: SaddleBrown;}
13+
STRONG {color: SaddleBrown;}
1214
dl {margin: 2em;}
1315
dd {margin: 1em;}
1416
dt {font-weight: bold;}
15-
pre { background-color: #F6F6F6; padding: 1.5em; border: 1px solid #E6E6E6; overflow: auto;}
17+
TABLE {border: 1px solid SaddleBrown;}
18+
TH {text-align: left; color: SaddleBrown;border: 1px solid SaddleBrown;}
19+
TD {text-align: left; padding-right: 8px;border: 1px solid SaddleBrown;}
20+
pre { background-color: rgba(139, 69, 19, 0.80); color: #fff; padding: 1.5em; border: 1px solid #A87207; border-radius: 15px; overflow: auto;}
1621
code{white-space: pre-wrap;}
1722
span.smallcaps{font-variant: small-caps;}
1823
span.underline{text-decoration: underline;}
1924
div.column{display: inline-block; vertical-align: top; width: 50%;}
20-
</style>
25+
a{ color: SaddleBrown;}
26+
a:visited{color: SaddleBrown;}
27+
</style>
2128
</head>
2229
<body>
2330
<header>
2431
</header>
25-
<h1 id="pyradio">PyRadio</h1>
32+
<h1 style="color: SaddleBrown"id="pyradio">PyRadio</h1>
2633
<p>Command line internet radio player.</p>
2734
<p>Ben Dowling - <a target="_blank" href="https://github.com/coderholic" class="uri">https://github.com/coderholic</a></p>
2835
<h2 id="table-of-contents">Table of contents <span style="padding-left: 10px;"><sup style="font-size: 50%"><a href="#" title="Go to top of the page">Top</a></sup></style></h2>

build.html

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,29 @@
77
<title>PyRadio Build Instructions</title>
88
<style type="text/css">
99
html {margin: 2em;}
10-
h2 {margin-top: 2.5em; border-bottom:1px solid #D6D6D6;}
11-
h3 {margin-top: 2em;}
10+
h2 {margin-top: 2.5em; border-bottom:1px solid SaddleBrown; color: SaddleBrown;}
11+
h3 {margin-top: 2em; color: SaddleBrown;}
12+
h4 {margin-top: 2em; color: SaddleBrown;}
13+
STRONG {color: SaddleBrown;}
1214
dl {margin: 2em;}
1315
dd {margin: 1em;}
1416
dt {font-weight: bold;}
15-
pre { background-color: #F6F6F6; padding: 1.5em; border: 1px solid #E6E6E6; overflow: auto;}
17+
TABLE {border: 1px solid SaddleBrown;}
18+
TH {text-align: left; color: SaddleBrown;border: 1px solid SaddleBrown;}
19+
TD {text-align: left; padding-right: 8px;border: 1px solid SaddleBrown;}
20+
pre { background-color: rgba(139, 69, 19, 0.80); color: #fff; padding: 1.5em; border: 1px solid #A87207; border-radius: 15px; overflow: auto;}
1621
code{white-space: pre-wrap;}
1722
span.smallcaps{font-variant: small-caps;}
1823
span.underline{text-decoration: underline;}
1924
div.column{display: inline-block; vertical-align: top; width: 50%;}
20-
</style>
25+
a{ color: SaddleBrown;}
26+
a:visited{color: SaddleBrown;}
27+
</style>
2128
</head>
2229
<body>
2330
<header>
2431
</header>
25-
<h1 id="pyradio-build-instructions">PyRadio Build Instructions</h1>
32+
<h1 style="color: SaddleBrown"id="pyradio-build-instructions">PyRadio Build Instructions</h1>
2633
<p><strong>PyRadio</strong>: Command line internet radio player.</p>
2734
<p>Ben Dowling - <a target="_blank" href="https://github.com/coderholic" class="uri">https://github.com/coderholic</a></p>
2835
<h2 id="table-of-contents">Table of contents <span style="padding-left: 10px;"><sup style="font-size: 50%"><a href="#" title="Go to top of the page">Top</a></sup></style></h2>

devel/pre-commit

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# convert TABs to SPACEs in Changelog
33
sed -i 's/\t/ /g' Changelog
44
# Create HTML file from md files
5-
for afile in README.md build.md windows.md
5+
for afile in README.md build.md windows.md windows-mplayer.md
66
do
77
#[ -z "$(git status | grep ${afile})" ] || {
88
out=${afile/%.md/.html}
@@ -12,6 +12,8 @@ do
1212
echo '% PyRadio Build Instructions' > tmp.md
1313
elif [ "$afile" = "windows.md" ];then
1414
echo '% PyRadio on Windows' > tmp.md
15+
elif [ "$afile" = "windows-mplayer.md" ];then
16+
echo '% MPlayer Installation on Windows' > tmp.md
1517
fi
1618
cat ${afile} >> tmp.md
1719
pandoc -s -t html tmp.md -o ${out} || {
@@ -21,12 +23,17 @@ do
2123
}
2224
sed -i '/<style[^>]*>/a \
2325
html {margin: 2em;} \
24-
h2 {margin-top: 2.5em; border-bottom:1px solid #D6D6D6;} \
25-
h3 {margin-top: 2em;} \
26+
h2 {margin-top: 2.5em; border-bottom:1px solid SaddleBrown; color: SaddleBrown;} \
27+
h3 {margin-top: 2em; color: SaddleBrown;} \
28+
h4 {margin-top: 2em; color: SaddleBrown;} \
29+
STRONG {color: SaddleBrown;} \
2630
dl {margin: 2em;} \
2731
dd {margin: 1em;} \
2832
dt {font-weight: bold;} \
29-
pre { background-color: #F6F6F6; padding: 1.5em; border: 1px solid #E6E6E6; overflow: auto;}' ${out}
33+
TABLE {border: 1px solid SaddleBrown;} \
34+
TH {text-align: left; color: SaddleBrown;border: 1px solid SaddleBrown;} \
35+
TD {text-align: left; padding-right: 8px;border: 1px solid SaddleBrown;} \
36+
pre { background-color: rgba(139, 69, 19, 0.80); color: #fff; padding: 1.5em; border: 1px solid #A87207; border-radius: 15px; overflow: auto;}' ${out}
3037
sed -i -e 's/<code>//g' \
3138
-e 's{</code>{{g' \
3239
-e 's{<a href="#pyradio">pyradio</a>{[pyradio]{' \
@@ -37,10 +44,14 @@ do
3744
-e 's/\.md">/.html">/g' \
3845
-e '/h1 class="title"/d' \
3946
-e 's/<a href="http/<a target="_blank" href="http/g' \
40-
-e 's{</h2>{ <span style="padding-left: 10px;"><sup style="font-size: 50%"><a href="#" title="Go to top of the page">Top</a></sup></style>&{' ${out}
47+
-e 's{</h2>{ <span style="padding-left: 10px;"><sup style="font-size: 50%"><a href="#" title="Go to top of the page">Top</a></sup></style>&{' \
48+
-e 's|<.style>$|a{ color: SaddleBrown;}\na:visited{color: SaddleBrown;}\n</style>|' \
49+
-e 's/<h1 /<h1 style="color: SaddleBrown"/' \
50+
${out}
51+
sed -i '/max-width/d' "${out}"
4152
rm tmp.md
42-
if [ "$out" = "windows.html" ];then
43-
sed -i -e 's/h3 {margin-top: 2em;}/h3 {margin-top: 2.5em; border-bottom:1px solid #D6D6D6;}/' \
53+
if [ "$out" = "windows.html" ] || [ "$out" = "windows-mplayer.html" ];then
54+
sed -i -e 's/h3 {margin-top: 2em; color: SaddleBrown;}/h3 {margin-top: 2.5em; color: SaddleBrown; border-bottom:1px solid SaddleBrown;}/' \
4455
-e 's{</h3>{ <span style="padding-left: 10px;"><sup style="font-size: 50%"><a href="#" title="Go to top of the page">Top</a></sup></style>&{' \
4556
"$out"
4657
fi

pyradio/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# New stable version: ''
77
# Beta version: 'betax', x=1,2,3...
88
# RC version: 'RCx', x=1,23...
9-
app_state = 'beta4'
9+
app_state = 'beta5'
1010

1111
__version__ = version = '.'.join(map(str, version_info))
1212
__project__ = __name__

pyradio/config

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,15 @@ default_encoding = utf-8
4848
# Default value: 10
4949
connection_timeout = 10
5050

51+
# Force http connections
52+
# Most radio stations use plain old http protocol to broadcast, but
53+
# some of them use https. If this is enabled, all connections will
54+
# use http; results depend on the combination of station/player.
55+
#
56+
# Valid values: True, true, False, false
57+
# Default value: False
58+
force_http = False
59+
5160
# Default theme
5261
# Hardcooded themes:
5362
# dark (default) (8 colors)

pyradio/config.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1188,10 +1188,9 @@ def read_config(self):
11881188
if sp[1] == '':
11891189
return -2
11901190
if sp[0] == 'player':
1191-
if platform.startswith('win'):
1192-
self.opts['player'][1] = 'mplayer'
1193-
else:
1194-
self.opts['player'][1] = sp[1].lower().strip()
1191+
self.opts['player'][1] = sp[1].lower().strip()
1192+
if sys.platform.startswith('win'):
1193+
self.opts['player'][1] = self.opts['player'][1].replace('mpv,', '')
11951194
elif sp[0] == 'connection_timeout':
11961195
self.opts['connection_timeout'][1] = sp[1].strip()
11971196
# check integer number and set to 10 if error

pyradio/config_window.py

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,10 @@ class PyRadioConfigWindow(object):
3939
_num_of_help_lines = 0
4040
_help_text = []
4141
_help_text.append(None)
42-
if platform.startswith('win'):
43-
_help_text.append(['When running on Windows, PyRadio can only use mplayer as its player.', '|',
44-
'Thus, this option is disabled.'])
45-
else:
46-
_help_text.append(['Specify the player to use with PyRadio, or the player detection order.', '|',
47-
'This is the eqivelant to the -u , --use-player command line option.', '|',
48-
'Example:', ' player = vlc', 'or', ' player = vlc,mpv, mplayer', '|',
49-
'Default value: mpv,mplayer,vlc'])
42+
_help_text.append(['Specify the player to use with PyRadio, or the player detection order.', '|',
43+
'This is the eqivelant to the -u , --use-player command line option.', '|',
44+
'Example:', ' player = vlc', 'or', ' player = vlc,mpv, mplayer', '|',
45+
'Default value: mpv,mplayer,vlc'])
5046
_help_text.append(['This is the playlist to open at start up, if none is specified.', '|',
5147
'This is the equivalent to the -s , --stations command line option.', '|',
5248
'Default value: stations'])
@@ -400,10 +396,7 @@ def keypress(self, char):
400396
vals = list(self._config_options.items())
401397
sel = vals[self.selection][0]
402398
if sel == 'player':
403-
if platform.startswith('win'):
404-
return -1, []
405-
else:
406-
return self.n_u.SELECT_PLAYER_MODE, []
399+
return self.n_u.SELECT_PLAYER_MODE, []
407400
elif sel == 'default_encoding':
408401
return self.n_u.SELECT_ENCODING_MODE, []
409402
elif sel == 'theme':
@@ -438,7 +431,10 @@ class PyRadioSelectPlayer(object):
438431

439432
_win = None
440433

441-
_players = ( 'mpv', 'mplayer', 'vlc' )
434+
if platform == 'win32':
435+
_players = ( 'mplayer', 'vlc' )
436+
else:
437+
_players = ( 'mpv', 'mplayer', 'vlc' )
442438
_working_players = [ [], [] ]
443439

444440
# REMINDER: column 1 is acive players - displayed right

pyradio/del_vlc_log.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import os
2+
from sys import platform
3+
4+
def RemoveWinVlcLogFiles(*args):
5+
""" Removes all VLC log files within pyradio config
6+
directory on Windows.
7+
8+
Files currently in use will not be deleted.
9+
"""
10+
if platform.startswith('win'):
11+
adir = args[0]
12+
#print('config = "{}"'.format(adir))
13+
files = [file for file in os.listdir(adir) if 'vlc_log.' in file]
14+
if files:
15+
for afile in files:
16+
#print(afile)
17+
try:
18+
#print('removing "{}"'.format(afile))
19+
os.remove(os.path.join(adir, afile))
20+
except:
21+
pass
22+
23+
if __name__ == "__main__":
24+
# example:
25+
import threading
26+
threading.Thread(target=RemoveWinVlcLogFiles('C:\\Users\\Spiros\\AppData\\Roaming\\pyradio')).start()

pyradio/main.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@
1212

1313
PATTERN = '%(asctime)s - %(name)s - %(levelname)s - %(message)s'
1414

15-
IMPLEMENTED_PLAYERS =('mpv', 'mplayer', 'cvlc')
15+
if platform.startswith('win'):
16+
IMPLEMENTED_PLAYERS =('mplayer', 'cvlc')
17+
else:
18+
IMPLEMENTED_PLAYERS =('mpv', 'mplayer', 'cvlc')
1619

1720
@contextmanager
1821
def pyradio_config_file():
@@ -182,7 +185,10 @@ def shell():
182185

183186
if args.debug:
184187
__configureLogger()
185-
print('Debug mode activated; printing messages to file: "~/pyradio.log"')
188+
if platform.startswith('win'):
189+
print('Debug mode activated\n printing messages to file: "{}\pyradio.log"'.format(getenv('USERPROFILE')))
190+
else:
191+
print('Debug mode activated; printing messages to file: "~/pyradio.log"')
186192
else:
187193
''' Refer to https://docs.python.org/3.7/howto/logging.html
188194
section "What happens if no configuration is provided"

0 commit comments

Comments
 (0)