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

View File

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