@@ -515,11 +515,9 @@ def read_playlist_file(
515515
516516 ret = 0
517517 if self ._register_to_open :
518- logger .error ('register_to_open = {}' .format (self ._register_to_open ))
519518 stationFile , ret = self ._get_register_filename_from_register ()
520519 self ._is_register = True
521520 else :
522- logger .error ('stationFile = {}' .format (stationFile ))
523521 stationFile , ret = self ._get_playlist_abspath_from_data (stationFile = stationFile )
524522 self ._is_register = False
525523 read_file = True
@@ -1141,6 +1139,7 @@ class PyRadioConfig(PyRadioStations):
11411139 opts ['theme_title' ] = ['Theme Options' , '' ]
11421140 opts ['theme' ] = ['Theme: ' , 'dark' ]
11431141 opts ['use_transparency' ] = ['Use transparency: ' , False ]
1142+ opts ['calculated_color_factor' ] = ['Calculated color: ' , '0' ]
11441143 opts ['playlist_manngement_title' ] = ['Playlist Management Options' , '' ]
11451144 opts ['confirm_station_deletion' ] = ['Confirm station deletion: ' , True ]
11461145 opts ['confirm_playlist_reload' ] = ['Confirm playlist reload: ' , True ]
@@ -1377,6 +1376,19 @@ def use_transparency(self, val):
13771376 self .opts ['use_transparency' ][1 ] = val
13781377 self .opts ['dirty_config' ][1 ] = True
13791378
1379+ @property
1380+ def calculated_color_factor (self ):
1381+ return float (self .opts ['calculated_color_factor' ][1 ])
1382+
1383+ @calculated_color_factor .setter
1384+ def calculated_color_factor (self , value ):
1385+ try :
1386+ test = float (str (value ))
1387+ self .opts ['calculated_color_factor' ][1 ] = str (value )
1388+ except (ValueError , TypeError , NameError ):
1389+ self .opts ['calculated_color_factor' ][1 ] = '0'
1390+ self .opts ['dirty_config' ][1 ] = True
1391+
13801392 @property
13811393 def default_encoding (self ):
13821394 return self .opts ['default_encoding' ][1 ]
@@ -1788,6 +1800,16 @@ def read_config(self):
17881800 self .opts ['use_transparency' ][1 ] = True
17891801 else :
17901802 self .opts ['use_transparency' ][1 ] = False
1803+ elif sp [0 ] == 'calculated_color_factor' :
1804+ try :
1805+ t = round (float (sp [1 ]), 2 )
1806+ s_t = str (t )[:4 ]
1807+ if s_t == '0.0' :
1808+ s_t = '0'
1809+ self .opts ['calculated_color_factor' ][1 ] = s_t
1810+ except (ValueError , TypeError ):
1811+ self .opts ['calculated_color_factor' ][1 ] = '0'
1812+ self .use_calculated_colors = False if self .opts ['calculated_color_factor' ][1 ] == '0' else True
17911813 elif sp [0 ] == 'force_http' :
17921814 if sp [1 ].lower () == 'true' :
17931815 self .opts ['force_http' ][1 ] = True
@@ -2068,27 +2090,31 @@ def save_config(self, from_command_line=False):
20682090# Default value: False
20692091use_transparency = {9}
20702092
2093+ # Calculated color factor
2094+ # Valid values: 0-0.2
2095+ # Default value: 0
2096+ calculated_color_factor = {10}
20712097
20722098# Playlist management
20732099#
20742100# Specify whether you will be asked to confirm
20752101# every station deletion action
20762102# Valid values: True, true, False, false
20772103# Default value: True
2078- confirm_station_deletion = {10 }
2104+ confirm_station_deletion = {11 }
20792105
20802106# Specify whether you will be asked to confirm
20812107# playlist reloading, when the playlist has not
20822108# been modified within PyRadio
20832109# Valid values: True, true, False, false
20842110# Default value: True
2085- confirm_playlist_reload = {11 }
2111+ confirm_playlist_reload = {12 }
20862112
20872113# Specify whether you will be asked to save a
20882114# modified playlist whenever it needs saving
20892115# Valid values: True, true, False, false
20902116# Default value: False
2091- auto_save_playlist = {12 }
2117+ auto_save_playlist = {13 }
20922118
20932119'''
20942120 copyfile (self .config_file , self .config_file + '.restore' )
@@ -2107,6 +2133,7 @@ def save_config(self, from_command_line=False):
21072133 self .opts ['force_http' ][1 ],
21082134 self .opts ['theme' ][1 ] if not self .opts ['auto_update_theme' ][1 ] else '*' + self .opts ['theme' ][1 ],
21092135 self .opts ['use_transparency' ][1 ],
2136+ self .opts ['calculated_color_factor' ][1 ],
21102137 self .opts ['confirm_station_deletion' ][1 ],
21112138 self .opts ['confirm_playlist_reload' ][1 ],
21122139 self .opts ['auto_save_playlist' ][1 ]))
@@ -2825,7 +2852,7 @@ def download(self, a_theme=None, a_path=None, print_errors=None):
28252852# Message window border foreground and background.
28262853# The background color can be left unset.
28272854# Please refer to the following link for more info
2828- # https://github.com/coderholic/pyradio#calculated_colors
2855+ # https://github.com/coderholic/pyradio#calculated-colors
28292856#
28302857Messages Border {color4}
28312858
@@ -2868,7 +2895,7 @@ def download(self, a_theme=None, a_path=None, print_errors=None):
28682895# Message window border foreground and background.
28692896# The background color can be left unset.
28702897# Please refer to the following link for more info
2871- # https://github.com/coderholic/pyradio#calculated_colors
2898+ # https://github.com/coderholic/pyradio#calculated-colors
28722899#
28732900Messages Border {color2}
28742901
@@ -3014,7 +3041,7 @@ def download(self, a_theme=None, a_path=None, print_errors=None):
30143041# Message window border foreground and background.
30153042# The background color can be left unset.
30163043# Please refer to the following link for more info
3017- # https://github.com/coderholic/pyradio#calculated_colors
3044+ # https://github.com/coderholic/pyradio#calculated-colors
30183045#
30193046Messages Border {color8}
30203047
@@ -3057,7 +3084,7 @@ def download(self, a_theme=None, a_path=None, print_errors=None):
30573084# Message window border foreground and background.
30583085# The background color can be left unset.
30593086# Please refer to the following link for more info
3060- # https://github.com/coderholic/pyradio#calculated_colors
3087+ # https://github.com/coderholic/pyradio#calculated-colors
30613088#
30623089Messages Border {color8}
30633090
@@ -3100,7 +3127,7 @@ def download(self, a_theme=None, a_path=None, print_errors=None):
31003127# Message window border foreground and background.
31013128# The background color can be left unset.
31023129# Please refer to the following link for more info
3103- # https://github.com/coderholic/pyradio#calculated_colors
3130+ # https://github.com/coderholic/pyradio#calculated-colors
31043131#
31053132Messages Border {color8}
31063133
@@ -3143,7 +3170,7 @@ def download(self, a_theme=None, a_path=None, print_errors=None):
31433170# Message window border foreground and background.
31443171# The background color can be left unset.
31453172# Please refer to the following link for more info
3146- # https://github.com/coderholic/pyradio#calculated_colors
3173+ # https://github.com/coderholic/pyradio#calculated-colors
31473174#
31483175Messages Border {color8}
31493176
0 commit comments