max menu items = 9999; this isn't really supposed to give you the entire database
This commit is contained in:
parent
446b80da2e
commit
feb5277d7b
1
.gitignore
vendored
1
.gitignore
vendored
@ -2,3 +2,4 @@
|
||||
__pycache__/
|
||||
.idea/
|
||||
*.lock
|
||||
*.iml
|
||||
|
@ -15,3 +15,7 @@ def player():
|
||||
def options():
|
||||
return config.get('DEFAULT', 'player.options')
|
||||
|
||||
|
||||
def maxitems():
|
||||
return int(config.get('DEFAULT', 'menu_items.max'))
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
from python_console_menu import AbstractMenu, MenuItem
|
||||
import subprocess
|
||||
|
||||
from config import player, options
|
||||
from config import player, options, maxitems
|
||||
|
||||
|
||||
class RadioMenu(AbstractMenu):
|
||||
@ -11,6 +11,7 @@ class RadioMenu(AbstractMenu):
|
||||
station_list = []
|
||||
|
||||
for i in range(len(station_list)):
|
||||
if i < maxitems(): # The last item is the exit option, so not "<=".
|
||||
self.add_menu_item(
|
||||
MenuItem(
|
||||
i,
|
||||
@ -21,6 +22,8 @@ class RadioMenu(AbstractMenu):
|
||||
lambda url=station_list[i]["url"]: subprocess.run([player(), options(), url])
|
||||
)
|
||||
)
|
||||
else:
|
||||
break
|
||||
|
||||
def initialise(self):
|
||||
self.add_menu_item(MenuItem(9999, "Exit menu").set_as_exit_option())
|
||||
self.add_menu_item(MenuItem(maxitems(), "Exit menu").set_as_exit_option())
|
||||
|
@ -2,4 +2,4 @@
|
||||
radio_browser.api=all.api.radio-browser.info
|
||||
player.command=mpv
|
||||
player.options=--no-video
|
||||
|
||||
menu_items.max=9999
|
||||
|
Loading…
Reference in New Issue
Block a user