diff --git a/negromate/karaoke/commands/__init__.py b/negromate/karaoke/commands/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/negromate/karaoke/commands/karaoke.py b/negromate/karaoke/commands/karaoke.py new file mode 100644 index 0000000..f91965e --- /dev/null +++ b/negromate/karaoke/commands/karaoke.py @@ -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) diff --git a/negromate/karaoke/karaoke.py b/negromate/karaoke/karaoke.py index 87cc6fe..fa4145d 100755 --- a/negromate/karaoke/karaoke.py +++ b/negromate/karaoke/karaoke.py @@ -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() diff --git a/setup.cfg b/setup.cfg index 744635e..d36aa83 100644 --- a/setup.cfg +++ b/setup.cfg @@ -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 =