Use negromate.commands entry_point

This commit is contained in:
Ales (Shagi) Zabala Alava 2020-11-06 17:12:14 +01:00
parent b705a47fb7
commit f1d5292177
4 changed files with 21 additions and 16 deletions

View File

View File

@ -0,0 +1,15 @@
from pathlib import Path
name = 'karaoke'
help_text = 'GUI for negromate karaoke'
def options(parser):
parser.add_argument(
'song_folder', type=Path,
help="Folder with the song database.")
def run(args):
from ..karaoke import main
main(args.song_folder)

View File

@ -2,8 +2,6 @@
import json import json
import os import os
import subprocess import subprocess
import sys
from pathlib import Path
import kivy import kivy
kivy.require('1.11.1') kivy.require('1.11.1')
@ -133,23 +131,15 @@ class KaraokeApp(App):
def build(self): def build(self):
super().build() super().build()
songs, pending_songs = load_songs(self.root_folder) songs, _ = load_songs(self.root_folder)
songs.sort(key=lambda a: a.name.lower()) songs.sort(key=lambda a: a.name.lower())
self.root.songs = [SongWidget(song=s) for s in songs] self.root.songs = [SongWidget(song=s) for s in songs]
return self.root return self.root
def main(): def main(path):
if len(sys.argv) == 2:
path = sys.argv[1]
else:
path = '../bideoak/'
# Window.fullscreen = True # Window.fullscreen = True
resource_add_path(os.path.dirname(__file__)) resource_add_path(os.path.dirname(__file__))
Config.set('graphics', 'font_name', 'resources/fonts/CyrBit.ttf') Config.set('graphics', 'font_name', 'resources/fonts/CyrBit.ttf')
Config.write() Config.write()
KaraokeApp(Path(path)).run() KaraokeApp(path).run()
if __name__ == '__main__':
main()

View File

@ -23,11 +23,11 @@ zip_safe = false
python_requires = >= 3.4 python_requires = >= 3.4
install_requires = install_requires =
kivy kivy
negromate.songs ==1.0 negromate.songs ==1.1
[options.entry_points] [options.entry_points]
console_scripts = negromate.commands =
negromate-karaoke = negromate.karaoke.karaoke:main karaoke = negromate.karaoke.commands.karaoke
[options.package_data] [options.package_data]
negromate.karaoke = negromate.karaoke =