lyrics-transcriber 0.16.1__tar.gz → 0.16.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (17) hide show
  1. {lyrics_transcriber-0.16.1 → lyrics_transcriber-0.16.3}/PKG-INFO +1 -1
  2. {lyrics_transcriber-0.16.1 → lyrics_transcriber-0.16.3}/lyrics_transcriber/transcriber.py +23 -7
  3. {lyrics_transcriber-0.16.1 → lyrics_transcriber-0.16.3}/pyproject.toml +1 -1
  4. {lyrics_transcriber-0.16.1 → lyrics_transcriber-0.16.3}/LICENSE +0 -0
  5. {lyrics_transcriber-0.16.1 → lyrics_transcriber-0.16.3}/README.md +0 -0
  6. {lyrics_transcriber-0.16.1 → lyrics_transcriber-0.16.3}/lyrics_transcriber/__init__.py +0 -0
  7. {lyrics_transcriber-0.16.1 → lyrics_transcriber-0.16.3}/lyrics_transcriber/audioshake_transcriber.py +0 -0
  8. {lyrics_transcriber-0.16.1 → lyrics_transcriber-0.16.3}/lyrics_transcriber/llm_prompts/README.md +0 -0
  9. {lyrics_transcriber-0.16.1 → lyrics_transcriber-0.16.3}/lyrics_transcriber/llm_prompts/llm_prompt_lyrics_correction_andrew_handwritten_20231118.txt +0 -0
  10. {lyrics_transcriber-0.16.1 → lyrics_transcriber-0.16.3}/lyrics_transcriber/llm_prompts/llm_prompt_lyrics_correction_gpt_optimised_20231119.txt +0 -0
  11. {lyrics_transcriber-0.16.1 → lyrics_transcriber-0.16.3}/lyrics_transcriber/llm_prompts/llm_prompt_lyrics_matching_andrew_handwritten_20231118.txt +0 -0
  12. {lyrics_transcriber-0.16.1 → lyrics_transcriber-0.16.3}/lyrics_transcriber/llm_prompts/promptfooconfig.yaml +0 -0
  13. {lyrics_transcriber-0.16.1 → lyrics_transcriber-0.16.3}/lyrics_transcriber/llm_prompts/test_data/ABBA-UnderAttack-Genius.txt +0 -0
  14. {lyrics_transcriber-0.16.1 → lyrics_transcriber-0.16.3}/lyrics_transcriber/utils/__init__.py +0 -0
  15. {lyrics_transcriber-0.16.1 → lyrics_transcriber-0.16.3}/lyrics_transcriber/utils/ass.py +0 -0
  16. {lyrics_transcriber-0.16.1 → lyrics_transcriber-0.16.3}/lyrics_transcriber/utils/cli.py +0 -0
  17. {lyrics_transcriber-0.16.1 → lyrics_transcriber-0.16.3}/lyrics_transcriber/utils/subtitles.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lyrics-transcriber
3
- Version: 0.16.1
3
+ Version: 0.16.3
4
4
  Summary: Automatically create synchronised lyrics files in ASS and MidiCo LRC formats with word-level timestamps, using Whisper and lyrics from Genius and Spotify
5
5
  Home-page: https://github.com/karaokenerds/python-lyrics-transcriber
6
6
  License: MIT
@@ -32,8 +32,8 @@ class LyricsTranscriber:
32
32
  log_formatter=None,
33
33
  transcription_model="medium",
34
34
  llm_model="gpt-4o",
35
- llm_prompt_matching="lyrics_transcriber/llm_prompts/llm_prompt_lyrics_matching_andrew_handwritten_20231118.txt",
36
- llm_prompt_correction="lyrics_transcriber/llm_prompts/llm_prompt_lyrics_correction_andrew_handwritten_20231118.txt",
35
+ llm_prompt_matching=None,
36
+ llm_prompt_correction=None,
37
37
  render_video=False,
38
38
  video_resolution="360p",
39
39
  video_background_image=None,
@@ -68,9 +68,25 @@ class LyricsTranscriber:
68
68
 
69
69
  self.transcription_model = transcription_model
70
70
  self.llm_model = llm_model
71
+
72
+ # Use package-relative paths for prompt files
73
+ if llm_prompt_matching is None:
74
+ llm_prompt_matching = os.path.join(
75
+ os.path.dirname(__file__), "llm_prompts", "llm_prompt_lyrics_matching_andrew_handwritten_20231118.txt"
76
+ )
77
+ if llm_prompt_correction is None:
78
+ llm_prompt_correction = os.path.join(
79
+ os.path.dirname(__file__), "llm_prompts", "llm_prompt_lyrics_correction_andrew_handwritten_20231118.txt"
80
+ )
81
+
71
82
  self.llm_prompt_matching = llm_prompt_matching
72
83
  self.llm_prompt_correction = llm_prompt_correction
73
84
 
85
+ if not os.path.exists(self.llm_prompt_matching):
86
+ raise FileNotFoundError(f"LLM prompt file not found: {self.llm_prompt_matching}")
87
+ if not os.path.exists(self.llm_prompt_correction):
88
+ raise FileNotFoundError(f"LLM prompt file not found: {self.llm_prompt_correction}")
89
+
74
90
  self.openai_client = None
75
91
 
76
92
  if self.openai_api_key:
@@ -746,9 +762,6 @@ class LyricsTranscriber:
746
762
  if "h264_videotoolbox" in ffmpeg_codes:
747
763
  video_codec = "h264_videotoolbox"
748
764
  self.logger.info(f"video codec set to hardware accelerated h264_videotoolbox")
749
- elif "h264_qsv" in ffmpeg_codes:
750
- video_codec = "h264_qsv"
751
- self.logger.info(f"video codec set to hardware accelerated h264_qsv")
752
765
 
753
766
  ffmpeg_cmd += [
754
767
  # Use accompaniment track as audio
@@ -958,8 +971,11 @@ class LyricsTranscriber:
958
971
  return cache_filepath
959
972
 
960
973
  def get_song_slug(self):
961
- artist_slug = slugify.slugify(self.artist, lowercase=False)
962
- title_slug = slugify.slugify(self.title, lowercase=False)
974
+ if not self.artist and not self.title:
975
+ return "unknown_song_" + self.get_file_hash(self.audio_filepath)
976
+
977
+ artist_slug = slugify.slugify(self.artist or "unknown_artist", lowercase=False)
978
+ title_slug = slugify.slugify(self.title or "unknown_title", lowercase=False)
963
979
  return artist_slug + "-" + title_slug
964
980
 
965
981
  def get_file_hash(self, filepath):
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "lyrics-transcriber"
3
- version = "0.16.1"
3
+ version = "0.16.3"
4
4
  description = "Automatically create synchronised lyrics files in ASS and MidiCo LRC formats with word-level timestamps, using Whisper and lyrics from Genius and Spotify"
5
5
  authors = ["Andrew Beveridge <andrew@beveridge.uk>"]
6
6
  license = "MIT"