Compare commits
6 Commits
Author | SHA1 | Date |
---|---|---|
|
12d0296517 | |
|
27b4fdf173 | |
|
f205a810c4 | |
|
acd83b32b5 | |
|
c2782293d4 | |
|
a76b268e05 |
|
@ -0,0 +1,26 @@
|
||||||
|
|
||||||
|
repos:
|
||||||
|
# Using this mirror lets us use mypyc-compiled black, which is about 2x faster
|
||||||
|
- repo: https://github.com/psf/black-pre-commit-mirror
|
||||||
|
rev: 24.2.0
|
||||||
|
hooks:
|
||||||
|
- id: black
|
||||||
|
# It is recommended to specify the latest version of Python
|
||||||
|
# supported by your project here, or alternatively use
|
||||||
|
# pre-commit's default_language_version, see
|
||||||
|
# https://pre-commit.com/#top_level-default_language_version
|
||||||
|
language_version: python3.11
|
||||||
|
|
||||||
|
- repo: https://github.com/pycqa/isort
|
||||||
|
rev: 5.13.2
|
||||||
|
hooks:
|
||||||
|
- id: isort
|
||||||
|
name: isort (python)
|
||||||
|
|
||||||
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||||
|
# Ruff version.
|
||||||
|
rev: v0.3.0
|
||||||
|
hooks:
|
||||||
|
# Run the linter.
|
||||||
|
- id: ruff
|
||||||
|
# - id: ruff-format We don't need this because we have black and isort.
|
|
@ -0,0 +1,11 @@
|
||||||
|
# Changelog
|
||||||
|
|
||||||
|
## 1.2
|
||||||
|
|
||||||
|
* chore: ruff, isort and black check
|
||||||
|
* chore: allow newer versions of negromate.songs
|
||||||
|
|
||||||
|
|
||||||
|
## 1.1
|
||||||
|
|
||||||
|
* Fix readme and dependencies
|
40
README.md
40
README.md
|
@ -1,17 +1,27 @@
|
||||||
Negro Mate Karaoke
|
Negro Mate Karaoke
|
||||||
==================
|
==================
|
||||||
|
|
||||||
Simple karaoke bideo browser.
|
Simple karaoke video browser.
|
||||||
|
|
||||||
|
This module provides one extra command to negromate:
|
||||||
|
|
||||||
|
negromate karaoke: GUI for negromate karaoke
|
||||||
|
|
||||||
|
|
||||||
|
Uses Kivy, a fairly large python library. It could be more easy to install this
|
||||||
|
package if Kivy is already installed in the system.
|
||||||
|
|
||||||
|
VLC is also used to play the songs.
|
||||||
|
|
||||||
|
Needs the following packages installed:
|
||||||
|
|
||||||
|
* python3-kivy (at least version 2.1.0)
|
||||||
|
* vlc
|
||||||
|
|
||||||
Uses kivy, installation instructions here: https://kivy.org/doc/stable/installation/installation-devel.html
|
|
||||||
|
|
||||||
Usage
|
Usage
|
||||||
-----
|
-----
|
||||||
|
|
||||||
Launch:
|
|
||||||
|
|
||||||
negromate-karaoke folder/with/songs
|
|
||||||
|
|
||||||
Keyboard shortcuts:
|
Keyboard shortcuts:
|
||||||
|
|
||||||
- A: Previous song
|
- A: Previous song
|
||||||
|
@ -19,21 +29,3 @@ Keyboard shortcuts:
|
||||||
- D: Next song
|
- D: Next song
|
||||||
|
|
||||||
The songs are played with vlc, so to exit a playing song: `Ctrl-C`.
|
The songs are played with vlc, so to exit a playing song: `Ctrl-C`.
|
||||||
|
|
||||||
|
|
||||||
Install Mini-howto
|
|
||||||
------------------
|
|
||||||
Instalation uses the pep517 packaging format, whichs requires pip version
|
|
||||||
19 or newer.
|
|
||||||
|
|
||||||
pip install "pip>=19"
|
|
||||||
|
|
||||||
Install dependencies for Kivy:
|
|
||||||
|
|
||||||
apt-get install python3-dev python-setuptools python-pygame python-opengl \
|
|
||||||
python-enchant python-dev build-essential python-pip libgl1-mesa-dev \
|
|
||||||
libgles2-mesa-dev zlib1g-dev
|
|
||||||
|
|
||||||
Install this package
|
|
||||||
|
|
||||||
pip install .
|
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
VERSION = "1.0"
|
VERSION = "1.2"
|
||||||
|
|
|
@ -1,17 +1,22 @@
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
name = 'karaoke'
|
name = "karaoke"
|
||||||
help_text = 'GUI for negromate karaoke'
|
help_text = "GUI for negromate karaoke"
|
||||||
|
|
||||||
|
|
||||||
def options(parser, config, **kwargs):
|
def options(parser, config, **kwargs):
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'-s', '--song_folder', type=Path,
|
"-s",
|
||||||
default=config['global']['song_folder'],
|
"--song_folder",
|
||||||
|
type=Path,
|
||||||
|
default=config["global"]["song_folder"],
|
||||||
help="Folder with the song database, defaults to {}".format(
|
help="Folder with the song database, defaults to {}".format(
|
||||||
config['global']['song_folder']))
|
config["global"]["song_folder"]
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def run(args, **kwargs):
|
def run(args, **kwargs):
|
||||||
from ..karaoke import main
|
from ..karaoke import main
|
||||||
|
|
||||||
main(args.song_folder.expanduser())
|
main(args.song_folder.expanduser())
|
||||||
|
|
|
@ -3,21 +3,23 @@ import os
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
import kivy
|
import kivy
|
||||||
kivy.require('2.0.0')
|
|
||||||
|
|
||||||
from kivy.app import App
|
|
||||||
from kivy.core.text import LabelBase
|
|
||||||
from kivy.core.window import Window
|
|
||||||
from kivy.properties import ObjectProperty, ListProperty, BooleanProperty
|
|
||||||
from kivy.resources import resource_add_path
|
|
||||||
from kivy.uix.boxlayout import BoxLayout
|
|
||||||
|
|
||||||
from negromate.songs.loader import load_songs
|
from negromate.songs.loader import load_songs
|
||||||
|
|
||||||
|
kivy.require("2.1.0")
|
||||||
|
|
||||||
|
from kivy.app import App # noqa: E402
|
||||||
|
from kivy.core.text import LabelBase # noqa: E402
|
||||||
|
from kivy.core.window import Window # noqa: E402
|
||||||
|
from kivy.properties import BooleanProperty # noqa: E402
|
||||||
|
from kivy.properties import ListProperty # noqa: E402
|
||||||
|
from kivy.properties import ObjectProperty # noqa: E402
|
||||||
|
from kivy.resources import resource_add_path # noqa: E402
|
||||||
|
from kivy.uix.boxlayout import BoxLayout # noqa: E402
|
||||||
|
|
||||||
|
|
||||||
class SongWidget(BoxLayout):
|
class SongWidget(BoxLayout):
|
||||||
active = BooleanProperty(False)
|
active = BooleanProperty(False)
|
||||||
song = ObjectProperty('')
|
song = ObjectProperty("")
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def name(self):
|
def name(self):
|
||||||
|
@ -49,18 +51,18 @@ class KaraokeGUI(BoxLayout):
|
||||||
self.keyboard = Window.request_keyboard(
|
self.keyboard = Window.request_keyboard(
|
||||||
self.keyboard_closed,
|
self.keyboard_closed,
|
||||||
self,
|
self,
|
||||||
'text',
|
"text",
|
||||||
)
|
)
|
||||||
self.keyboard.bind(on_key_down=self.on_key_down)
|
self.keyboard.bind(on_key_down=self.on_key_down)
|
||||||
|
|
||||||
def on_key_down(self, keyboard, keycode, text, modifiers):
|
def on_key_down(self, keyboard, keycode, text, modifiers):
|
||||||
if text == 'a':
|
if text == "a":
|
||||||
self.previous()
|
self.previous()
|
||||||
return True
|
return True
|
||||||
elif text == 'd':
|
elif text == "d":
|
||||||
self.next()
|
self.next()
|
||||||
return True
|
return True
|
||||||
elif text == 's':
|
elif text == "s":
|
||||||
self.play()
|
self.play()
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
@ -69,7 +71,7 @@ class KaraokeGUI(BoxLayout):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def on_songs(self, instance, value):
|
def on_songs(self, instance, value):
|
||||||
container = self.ids['song_container']
|
container = self.ids["song_container"]
|
||||||
container.clear_widgets()
|
container.clear_widgets()
|
||||||
for song in self.songs:
|
for song in self.songs:
|
||||||
container.add_widget(song)
|
container.add_widget(song)
|
||||||
|
@ -79,12 +81,12 @@ class KaraokeGUI(BoxLayout):
|
||||||
for song in self.songs:
|
for song in self.songs:
|
||||||
song.active = False
|
song.active = False
|
||||||
value.active = True
|
value.active = True
|
||||||
current_song_image = self.ids['current_song_image']
|
current_song_image = self.ids["current_song_image"]
|
||||||
current_song_title = self.ids['current_song_title']
|
current_song_title = self.ids["current_song_title"]
|
||||||
current_song_image.source = value.cover
|
current_song_image.source = value.cover
|
||||||
current_song_title.text = value.name
|
current_song_title.text = value.name
|
||||||
|
|
||||||
scrollview = self.ids['songs_scroll']
|
scrollview = self.ids["songs_scroll"]
|
||||||
scrollview.scroll_to(value)
|
scrollview.scroll_to(value)
|
||||||
|
|
||||||
def previous(self):
|
def previous(self):
|
||||||
|
@ -108,19 +110,26 @@ class KaraokeGUI(BoxLayout):
|
||||||
self.active_song = self.songs[idx]
|
self.active_song = self.songs[idx]
|
||||||
|
|
||||||
def play(self):
|
def play(self):
|
||||||
subprocess.call([
|
subprocess.call(
|
||||||
'cvlc',
|
[
|
||||||
'--fullscreen',
|
"cvlc",
|
||||||
'--no-sub-autodetect-file',
|
"--fullscreen",
|
||||||
'--sub-file',
|
"--no-sub-autodetect-file",
|
||||||
|
"--sub-file",
|
||||||
self.active_song.subtitle,
|
self.active_song.subtitle,
|
||||||
self.active_song.video,
|
self.active_song.video,
|
||||||
'vlc://quit'
|
"vlc://quit",
|
||||||
])
|
]
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class KaraokeApp(App):
|
class KaraokeApp(App):
|
||||||
kv_directory = os.path.join(os.path.dirname(__file__, ), 'kv_templates')
|
kv_directory = os.path.join(
|
||||||
|
os.path.dirname(
|
||||||
|
__file__,
|
||||||
|
),
|
||||||
|
"kv_templates",
|
||||||
|
)
|
||||||
|
|
||||||
def __init__(self, root_folder, **kwargs):
|
def __init__(self, root_folder, **kwargs):
|
||||||
super().__init__(**kwargs)
|
super().__init__(**kwargs)
|
||||||
|
@ -137,7 +146,5 @@ class KaraokeApp(App):
|
||||||
def main(path):
|
def main(path):
|
||||||
# Window.fullscreen = True
|
# Window.fullscreen = True
|
||||||
resource_add_path(os.path.dirname(__file__))
|
resource_add_path(os.path.dirname(__file__))
|
||||||
LabelBase.register(
|
LabelBase.register(name="CyrBit", fn_regular="resources/fonts/CyrBit.ttf")
|
||||||
name='CyrBit',
|
|
||||||
fn_regular='resources/fonts/CyrBit.ttf')
|
|
||||||
KaraokeApp(path).run()
|
KaraokeApp(path).run()
|
||||||
|
|
|
@ -1,2 +1 @@
|
||||||
Kivy==2.0.0
|
negromate.songs>=1.5
|
||||||
negromate.songs==1.4
|
|
||||||
|
|
|
@ -22,8 +22,7 @@ packages = find_namespace:
|
||||||
zip_safe = false
|
zip_safe = false
|
||||||
python_requires = >= 3.4
|
python_requires = >= 3.4
|
||||||
install_requires =
|
install_requires =
|
||||||
kivy
|
negromate.songs >=1.5
|
||||||
negromate.songs ==1.4
|
|
||||||
|
|
||||||
[options.entry_points]
|
[options.entry_points]
|
||||||
negromate.commands =
|
negromate.commands =
|
||||||
|
|
Loading…
Reference in New Issue