Compare commits

..

No commits in common. "1dcfce393b4cca9c60a4ccac99f0664dc627f7ac" and "257fcc98fabd4d7d318a08867de9588f11c998c6" have entirely different histories.

4 changed files with 7 additions and 22 deletions

View File

@ -1,12 +1,5 @@
# Changelog # 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 ## 1.2
* Get karaoke ass generator from negromate.web * Get karaoke ass generator from negromate.web
@ -16,7 +9,6 @@
* Use configuration file for commands defaults * Use configuration file for commands defaults
## 1.1 ## 1.1
* Start with generic negromate command with entry points for other modules * Start with generic negromate command with entry points for other modules
* Move image generating code to utils * Move image generating code to utils
* Migrate setup to pep517 * Migrate setup to pep517

View File

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

View File

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

View File

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