Compare commits

..

5 Commits

4 changed files with 22 additions and 7 deletions

View File

@ -1,5 +1,12 @@
# Changelog
## 1.3
* New property for songs: has_subtitles
* Upgrade dependencies
* Add songs without ass file as pending
* Song folders must have a metadata.json file
## 1.2
* Get karaoke ass generator from negromate.web
@ -9,6 +16,7 @@
* Use configuration file for commands defaults
## 1.1
* Start with generic negromate command with entry points for other modules
* Move image generating code to utils
* Migrate setup to pep517

View File

@ -1,6 +1,6 @@
import logging
VERSION = "1.2"
VERSION = "1.3"
logger = logging.getLogger("negromate.songs")

View File

@ -109,11 +109,18 @@ class Song:
self.karaoke_ass = karaoke_ass
generate_karaoke_ass(str(karaoke_template_file), str(self.ass), str(karaoke_ass))
@property
def has_subtitles(self):
return self.ass or self.srt or self.vtt
@property
def publish(self):
has_subtitles = self.ass or self.srt or self.vtt
has_video = self.video
return has_video and has_subtitles
return self.video and self.has_subtitles
@property
def pending(self):
finished = self.ass and self.video
return not finished
def load_songs(root_folder, generate=True, regenerate=False, karaoke_template_file=None):
@ -122,7 +129,7 @@ def load_songs(root_folder, generate=True, regenerate=False, karaoke_template_fi
for entry in root_folder.iterdir():
if entry.name in ['static', 'playlist', 'home', 'todo']:
continue
if entry.is_dir():
if entry.is_dir() and (entry / 'metadata.json').exists():
logger.info("building {}".format(entry.name))
try:
song = Song(entry, root_folder)
@ -133,7 +140,7 @@ def load_songs(root_folder, generate=True, regenerate=False, karaoke_template_fi
continue
if song.publish:
songs.append(song)
else:
if song.pending:
pending_songs.append(song)
songs.sort(key=lambda a: a.name)

View File

@ -25,7 +25,7 @@ install_requires =
importlib_metadata
webvtt-py
asstosrt ==0.1.6
srt ==1.6.0
srt ==3.5.2
[options.entry_points]
console_scripts =