Compare commits
5 Commits
257fcc98fa
...
1dcfce393b
Author | SHA1 | Date |
---|---|---|
Ales (Shagi) Zabala Alava | 1dcfce393b | |
Ales (Shagi) Zabala Alava | 132ed675e7 | |
Ales (Shagi) Zabala Alava | b4fdf6dafb | |
Ales (Shagi) Zabala Alava | 91d5c60d0a | |
Ales (Shagi) Zabala Alava | 6146dd9311 |
|
@ -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
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import logging
|
||||
|
||||
VERSION = "1.2"
|
||||
VERSION = "1.3"
|
||||
|
||||
|
||||
logger = logging.getLogger("negromate.songs")
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue