lyrics-transcriber 0.16.0__py3-none-any.whl → 0.16.2__py3-none-any.whl

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.
@@ -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:
@@ -146,9 +162,6 @@ class LyricsTranscriber:
146
162
  if self.audio_filepath is None:
147
163
  raise Exception("audio_filepath must be specified as the input source to transcribe")
148
164
 
149
- if not self.song_known:
150
- raise Exception("cannot correct song lyrics without artist and title to fetch lyrics")
151
-
152
165
  self.create_folders()
153
166
 
154
167
  def generate(self):
@@ -961,8 +974,11 @@ class LyricsTranscriber:
961
974
  return cache_filepath
962
975
 
963
976
  def get_song_slug(self):
964
- artist_slug = slugify.slugify(self.artist, lowercase=False)
965
- title_slug = slugify.slugify(self.title, lowercase=False)
977
+ if not self.artist and not self.title:
978
+ return "unknown_song_" + self.get_file_hash(self.audio_filepath)
979
+
980
+ artist_slug = slugify.slugify(self.artist or "unknown_artist", lowercase=False)
981
+ title_slug = slugify.slugify(self.title or "unknown_title", lowercase=False)
966
982
  return artist_slug + "-" + title_slug
967
983
 
968
984
  def get_file_hash(self, filepath):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lyrics-transcriber
3
- Version: 0.16.0
3
+ Version: 0.16.2
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
@@ -6,13 +6,13 @@ lyrics_transcriber/llm_prompts/llm_prompt_lyrics_correction_gpt_optimised_202311
6
6
  lyrics_transcriber/llm_prompts/llm_prompt_lyrics_matching_andrew_handwritten_20231118.txt,sha256=hvk2Vs3M3Q4zGQsiQnXvnpd8wXWfwsudYeqN5qFyNWs,1754
7
7
  lyrics_transcriber/llm_prompts/promptfooconfig.yaml,sha256=O4YxlLV7XSUiSw_1Q9G7ELC2VAbrYUV_N5QxrPbd1jE,3735
8
8
  lyrics_transcriber/llm_prompts/test_data/ABBA-UnderAttack-Genius.txt,sha256=8d-RvZtyINKUlpQLwMi-VD--Y59J-epPt7SZSqjFbPI,1690
9
- lyrics_transcriber/transcriber.py,sha256=JuYCIg1Ni2136KW4NjhbSVYhS0BUSNxugxrwWvMPX8w,48371
9
+ lyrics_transcriber/transcriber.py,sha256=uSMI55Y8htMJI-F8_qqFYyEypItMA0uyqWgBXPJL_Nk,49038
10
10
  lyrics_transcriber/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
11
  lyrics_transcriber/utils/ass.py,sha256=b8lnjgXGD1OD1ld_b1xxUmSOf4nSEfz9BpgSkh16R4g,90291
12
12
  lyrics_transcriber/utils/cli.py,sha256=8Poba_9wQw0VmOK73vuK-w-abR9QmO4y4FYDHiAQbc0,6972
13
13
  lyrics_transcriber/utils/subtitles.py,sha256=_WG0pFoZMXcrGe6gbARkC9KrWzFNTMOsiqQwNL-H2lU,11812
14
- lyrics_transcriber-0.16.0.dist-info/LICENSE,sha256=BiPihPDxhxIPEx6yAxVfAljD5Bhm_XG2teCbPEj_m0Y,1069
15
- lyrics_transcriber-0.16.0.dist-info/METADATA,sha256=_g249T7uAdFe-uvmoDJqTb07EY44xUk94-vyQR5xsEc,5775
16
- lyrics_transcriber-0.16.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
17
- lyrics_transcriber-0.16.0.dist-info/entry_points.txt,sha256=lh6L-iR5CGELaNcouDK94X78eS5Ua_tK9lI4UEkza-k,72
18
- lyrics_transcriber-0.16.0.dist-info/RECORD,,
14
+ lyrics_transcriber-0.16.2.dist-info/LICENSE,sha256=BiPihPDxhxIPEx6yAxVfAljD5Bhm_XG2teCbPEj_m0Y,1069
15
+ lyrics_transcriber-0.16.2.dist-info/METADATA,sha256=P7LB3BWSw4xTFELQMu_KvhVUVsVEZOohsTfNrzVIUcs,5775
16
+ lyrics_transcriber-0.16.2.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
17
+ lyrics_transcriber-0.16.2.dist-info/entry_points.txt,sha256=lh6L-iR5CGELaNcouDK94X78eS5Ua_tK9lI4UEkza-k,72
18
+ lyrics_transcriber-0.16.2.dist-info/RECORD,,