Skip to content

Commit 6c145f6

Browse files
committed
random station selection keeps on until a working station is found
1 parent b3baa78 commit 6c145f6

File tree

7 files changed

+658
-105
lines changed

7 files changed

+658
-105
lines changed

Changelog

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
1-
2019-02-01 s-n-g
1+
2019-02-03 s-n-g
22

3-
* Trying to minimize the possibility of curses layout breakage
3+
* Avoiding curses layout breakage due to BROKEN PIPE errors
44
* Start of playback detection implemented. This is done by
55
detecting the players audio decoder info, which actually mean
66
that playback is on. If not detected within a timeout value,
77
failure to connect is presumed
8-
* Volume adjustment, saving and muting inhibited before start
8+
* Volume adjustment, saving and muting is inhibited before start
99
of playback is detected
10+
* Playing a station in random order will not stop until a
11+
working station is acquired or another action is taken (e.g
12+
pressing a key)
1013
* Adding search function for both player and playlist mode
1114
* Stations name is limited to window width
1215
* Station title is validated before displayed

pyradio/config

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ default_encoding = utf-8
4545
# message indicating that playback has actually started.
4646
# If this does not happen (within this number of seconds after the
4747
# connection is initiated), PyRadio will consider the station
48-
# unreachable, and display the "Connection failed" message.
48+
# unreachable, and display the "Failed to connect to: [station]"
49+
# message.
4950
#
5051
# Valid values: 1 - ..
5152
# Default value: 10

pyradio/config.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,8 @@ def _save_config(self):
627627
# message indicating that playback has actually started.
628628
# If this does not happen (within this number of seconds after the
629629
# connection is initiated), PyRadio will consider the station
630-
# unreachable, and display the "Connection failed" message.
630+
# unreachable, and display the "Failed to connect to: [station]"
631+
# message.
631632
#
632633
# Valid values: 1 - ..
633634
# Default value: 10

pyradio/edit.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import curses.ascii
33
import logging
44
from sys import version_info
5-
from .simple_widgets import SimpleCursesLineEdit
5+
from .simple_curses_widgets import SimpleCursesLineEdit
66
from .log import Log
77

88
import locale
@@ -16,8 +16,8 @@ class PyRadioSearch(SimpleCursesLineEdit):
1616

1717
def __init__(self, parent, begin_y, begin_x, **kwargs):
1818
SimpleCursesLineEdit.__init__(self, parent, begin_y, begin_x,
19-
key_up_function_handler=self._get_history_previous,
20-
key_down_function_handler=self._get_history_next,
19+
key_up_function_handler=self._get_history_next,
20+
key_down_function_handler=self._get_history_previous,
2121
**kwargs)
2222
if version_info < (3, 0):
2323
self._range_command='xrange'

pyradio/player.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -228,8 +228,8 @@ def updateStatus(self, *args):
228228
else:
229229
if self.oldUserInput['Title'] == '':
230230
self.oldUserInput['Title'] = 'Connecting to: "{}"'.format(self.name)
231-
if (logger.isEnabledFor(logging.DEBUG)):
232-
logger.debug('Connecting to: "{}"'.format(self.name))
231+
if (logger.isEnabledFor(logging.INFO)):
232+
logger.info('Connecting to: "{}"'.format(self.name))
233233
self.outputStream.write(self.oldUserInput['Title'])
234234
except:
235235
if logger.isEnabledFor(logging.ERROR):
@@ -290,7 +290,9 @@ def play(self, name, streamUrl, encoding = ''):
290290
self.show_volume = True
291291
self.title_prefix = ''
292292
self.playback_is_on = False
293-
self.outputStream.write('Station: {}'.format(name), self.status_update_lock)
293+
self.outputStream.write('Station: "{}"'.format(name), self.status_update_lock)
294+
if logger.isEnabledFor(logging.INFO):
295+
logger.info('Selected Station: "{}"'.format(name))
294296
if encoding:
295297
self._station_encoding = encoding
296298
else:
@@ -626,6 +628,12 @@ def _format_title_string(self, title_string):
626628
ret_string = tmp[:tmp.find("';")]
627629
else:
628630
ret_string = title_string
631+
if '"artist":"' in ret_string:
632+
""" work on format:
633+
ICY Info: START_SONG='{"artist":"Clelia Cafiero","title":"M. Mussorgsky-Quadri di un'esposizione"}';
634+
Fund on "ClassicaViva Web Radio: Classical"
635+
"""
636+
ret_string = self.icy_title_prefix + ret_string[ret_string.find('"artist":')+10:].replace('","title":"', ' - ').replace('"}\';', '')
629637
return self._title_string_format_text_tag(ret_string)
630638

631639
def _format_volume_string(self, volume_string):

0 commit comments

Comments
 (0)