Skip to content

Commit 5ffa561

Browse files
committed
adding get_internal_header
1 parent 058bbe3 commit 5ffa561

File tree

2 files changed

+24
-15
lines changed

2 files changed

+24
-15
lines changed

pyradio/browser.py

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -477,36 +477,45 @@ def _get_output_format(self, width):
477477
else:
478478
self._output_format = 5
479479

480-
def get_columns_separators(self, width, force_py2=False):
481-
if not force_py2 and not PY3:
482-
return []
480+
def get_columns_separators(self, width):
483481
self._get_output_format(width)
484482
if self._output_format == 0:
485-
return []
483+
return ()
486484
elif self._output_format == 1:
487-
return [ width - 10 ]
485+
return ( width - 10 )
488486
elif self._output_format == 2:
489-
return [width -18,
487+
return (width -18,
490488
width -10
491-
]
489+
)
492490
elif self._output_format == 3:
493-
return [width -27,
491+
return (width -27,
494492
width -19,
495493
width -10
496-
]
494+
)
497495
elif self._output_format == 4:
498-
return [width -42,
496+
return (width -42,
499497
width -34,
500498
width -25,
501499
width -14
502-
]
500+
)
503501
elif self._output_format == 5:
504-
return [width -58,
502+
return (width -58,
505503
width -50,
506504
width -41,
507505
width -30,
508506
width -15
509-
]
507+
)
508+
509+
def get_internal_header(self, width):
510+
title = ((),
511+
('Bitrate'),
512+
('Votes', 'Bitrate'),
513+
('Votes', 'Clicks', 'Bitrate'),
514+
('Votes', 'Clicks', 'Bitrate', 'Country'),
515+
('Votes', 'Clicks', 'Bitrate', 'Country', 'Language')
516+
)
517+
col_sep = self.get_columns_separators(width)
518+
return col_sep, title[self._output_format]
510519

511520

512521
class PyRadioBrowserInfoData(object):

pyradio/radio.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,7 @@ def _print_body_header(self):
493493
cur_mode = self.ws.previous_operation_mode
494494
if cur_mode == self.ws.NORMAL_MODE:
495495
if self._cnf.browsing_station_service:
496-
ticks = self._cnf.online_browser.get_columns_separators(self.bodyMaxX - 2, force_py2=True)
496+
ticks = self._cnf.online_browser.get_columns_separators(self.bodyMaxX - 2)
497497
if ticks:
498498
for n in ticks:
499499
if version_info < (3, 0):
@@ -558,7 +558,7 @@ def __displayBodyLine(self, lineNum, pad, station):
558558
self.bodyWin.addstr(lineNum + 1, 1, line, col)
559559

560560
if self._cnf.browsing_station_service and sep_col:
561-
ticks = self._cnf.online_browser.get_columns_separators(self.bodyMaxX - 2, force_py2=True)
561+
ticks = self._cnf.online_browser.get_columns_separators(self.bodyMaxX - 2)
562562
for n in ticks:
563563
self.bodyWin.chgat(lineNum + 1, n, 1, sep_col)
564564

0 commit comments

Comments
 (0)