lyrics-transcriber 0.12.9__py3-none-any.whl → 0.13.1__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.
@@ -190,6 +190,9 @@ class LyricsTranscriber:
190
190
  online_lyrics_text_key = f"{online_lyrics_source}_lyrics_text"
191
191
  online_lyrics_filepath_key = f"{online_lyrics_source}_lyrics_filepath"
192
192
 
193
+ if online_lyrics_text_key not in self.outputs:
194
+ continue
195
+
193
196
  data_input_str = (
194
197
  f'Data input 1:\n{self.outputs["transcribed_lyrics_text"]}\nData input 2:\n{self.outputs[online_lyrics_text_key]}\n'
195
198
  )
@@ -274,7 +277,7 @@ class LyricsTranscriber:
274
277
  total_segments = len(self.outputs["transcription_data_dict"]["segments"])
275
278
  self.logger.info(f"Beginning correction using LLM, total segments: {total_segments}")
276
279
 
277
- with open(self.outputs["llm_transcript_filepath"], "a", buffering=1) as llm_transcript_file:
280
+ with open(self.outputs["llm_transcript_filepath"], "a", buffering=1, encoding="utf-8") as llm_transcript_file:
278
281
  self.logger.debug(f"writing LLM chat instructions: {self.outputs['llm_transcript_filepath']}")
279
282
 
280
283
  llm_transcript_header = f"--- SYSTEM instructions passed in for all segments ---:\n\n{system_prompt}\n"
@@ -370,7 +373,7 @@ class LyricsTranscriber:
370
373
  self.logger.info(f'Successfully processed correction for all {len(corrected_lyrics_dict["segments"])} lyrics segments')
371
374
 
372
375
  self.logger.debug(f"writing corrected lyrics data JSON filepath: {corrected_lyrics_data_json_cache_filepath}")
373
- with open(corrected_lyrics_data_json_cache_filepath, "w") as corrected_lyrics_data_json_cache_file:
376
+ with open(corrected_lyrics_data_json_cache_filepath, "w", encoding="utf-8") as corrected_lyrics_data_json_cache_file:
374
377
  corrected_lyrics_data_json_cache_file.write(json.dumps(corrected_lyrics_dict, indent=4))
375
378
 
376
379
  self.outputs["corrected_lyrics_data_filepath"] = corrected_lyrics_data_json_cache_filepath
@@ -405,7 +408,7 @@ class LyricsTranscriber:
405
408
  self.outputs["corrected_lyrics_text"] = ""
406
409
 
407
410
  self.logger.debug(f"writing lyrics plain text to corrected_lyrics_text_filepath: {corrected_lyrics_text_filepath}")
408
- with open(corrected_lyrics_text_filepath, "w") as f:
411
+ with open(corrected_lyrics_text_filepath, "w", encoding="utf-8") as f:
409
412
  for corrected_segment in self.outputs["corrected_lyrics_data_dict"]["segments"]:
410
413
  self.outputs["corrected_lyrics_text"] += corrected_segment["text"].strip() + "\n"
411
414
  f.write(corrected_segment["text".strip()] + "\n")
@@ -452,7 +455,7 @@ class LyricsTranscriber:
452
455
  self.logger.debug(
453
456
  f"writing lyrics data JSON to spotify_lyrics_data_json_cache_filepath: {spotify_lyrics_data_json_cache_filepath}"
454
457
  )
455
- with open(spotify_lyrics_data_json_cache_filepath, "w") as f:
458
+ with open(spotify_lyrics_data_json_cache_filepath, "w", encoding="utf-8") as f:
456
459
  f.write(spotify_lyrics_json)
457
460
  except Exception as e:
458
461
  self.logger.warn(f"caught exception while attempting to fetch from spotify: ", e)
@@ -472,7 +475,7 @@ class LyricsTranscriber:
472
475
  self.outputs["spotify_lyrics_text"] = ""
473
476
 
474
477
  self.logger.debug(f"writing lyrics plain text to spotify_lyrics_text_filepath: {spotify_lyrics_text_filepath}")
475
- with open(spotify_lyrics_text_filepath, "w") as f:
478
+ with open(spotify_lyrics_text_filepath, "w", encoding="utf-8") as f:
476
479
  for line in lines:
477
480
  self.outputs["spotify_lyrics_text"] += line["words"].strip() + "\n"
478
481
  f.write(line["words"].strip() + "\n")
@@ -504,7 +507,7 @@ class LyricsTranscriber:
504
507
  lyrics = self.clean_genius_lyrics(song.lyrics)
505
508
 
506
509
  self.logger.debug(f"writing clean lyrics to genius_lyrics_cache_filepath: {genius_lyrics_cache_filepath}")
507
- with open(genius_lyrics_cache_filepath, "w") as f:
510
+ with open(genius_lyrics_cache_filepath, "w", encoding="utf-8") as f:
508
511
  f.write(lyrics)
509
512
 
510
513
  self.outputs["genius_lyrics_filepath"] = genius_lyrics_cache_filepath
@@ -558,7 +561,7 @@ class LyricsTranscriber:
558
561
 
559
562
  lrc_filename = self.outputs["midico_lrc_filepath"]
560
563
  self.logger.debug(f"writing midico formatted word timestamps to LRC file: {lrc_filename}")
561
- with open(lrc_filename, "w") as f:
564
+ with open(lrc_filename, "w", encoding="utf-8") as f:
562
565
  f.write("[re:MidiCo]\n")
563
566
  for segment in self.outputs["corrected_lyrics_data_dict"]["segments"]:
564
567
  for i, word in enumerate(segment["words"]):
@@ -752,7 +755,7 @@ class LyricsTranscriber:
752
755
  self.outputs["transcribed_lyrics_text"] = ""
753
756
 
754
757
  self.logger.debug(f"writing lyrics plain text to transcribed_lyrics_text_filepath: {transcribed_lyrics_text_filepath}")
755
- with open(transcribed_lyrics_text_filepath, "w") as f:
758
+ with open(transcribed_lyrics_text_filepath, "w", encoding="utf-8") as f:
756
759
  for segment in self.outputs["transcription_data_dict"]["segments"]:
757
760
  self.outputs["transcribed_lyrics_text"] += segment["text"] + "\n"
758
761
  f.write(segment["text"].strip() + "\n")
@@ -2,7 +2,6 @@
2
2
  import argparse
3
3
  import logging
4
4
  import pkg_resources
5
- from lyrics_transcriber import LyricsTranscriber
6
5
 
7
6
 
8
7
  def main():
@@ -110,6 +109,9 @@ def main():
110
109
 
111
110
  logger.debug("Loading LyricsTranscriber class")
112
111
 
112
+ # Lazy load this class so help output is printed quickly rather than waiting for heavy libraries to load
113
+ from lyrics_transcriber import LyricsTranscriber
114
+
113
115
  transcriber = LyricsTranscriber(
114
116
  args.audio_filepath,
115
117
  genius_api_token=args.genius_api_token,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lyrics-transcriber
3
- Version: 0.12.9
3
+ Version: 0.13.1
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
@@ -13,21 +13,22 @@ Classifier: Programming Language :: Python :: 3.9
13
13
  Classifier: Programming Language :: Python :: 3.10
14
14
  Classifier: Programming Language :: Python :: 3.11
15
15
  Classifier: Programming Language :: Python :: 3.12
16
- Requires-Dist: Cython (>=0,<1)
17
- Requires-Dist: dtw-python (>=1,<2)
18
- Requires-Dist: llvmlite (>=0,<1)
19
- Requires-Dist: lyricsgenius (>=3,<4)
20
- Requires-Dist: numba (>=0.57,<0.58)
21
- Requires-Dist: numpy (>=1,<2)
22
- Requires-Dist: onnx (>=1,<2)
23
- Requires-Dist: onnxruntime (>=1,<2)
16
+ Requires-Dist: Cython (>=0)
17
+ Requires-Dist: dtw-python (>=1)
18
+ Requires-Dist: llvmlite (>=0)
19
+ Requires-Dist: lyricsgenius (>=3)
20
+ Requires-Dist: numba (>=0.57)
21
+ Requires-Dist: numpy (>=1)
22
+ Requires-Dist: onnx (>=1)
23
+ Requires-Dist: onnxruntime (>=1)
24
24
  Requires-Dist: openai (>=1,<2)
25
- Requires-Dist: openai-whisper (==20231117)
26
- Requires-Dist: python-slugify (>=8,<9)
27
- Requires-Dist: syrics (>=0,<1)
28
- Requires-Dist: torch (>1)
29
- Requires-Dist: tqdm (>=4,<5)
30
- Requires-Dist: whisper-timestamped (>=1,<2)
25
+ Requires-Dist: openai-whisper (>=20231117)
26
+ Requires-Dist: python-slugify (>=8)
27
+ Requires-Dist: syrics (>=0)
28
+ Requires-Dist: torch (>=1)
29
+ Requires-Dist: tqdm (>=4)
30
+ Requires-Dist: transformers (>=4)
31
+ Requires-Dist: whisper-timestamped (>=1)
31
32
  Project-URL: Documentation, https://github.com/karaokenerds/python-lyrics-transcriber/blob/main/README.md
32
33
  Project-URL: Repository, https://github.com/karaokenerds/python-lyrics-transcriber
33
34
  Description-Content-Type: text/markdown
@@ -5,13 +5,13 @@ lyrics_transcriber/llm_prompts/llm_prompt_lyrics_correction_gpt_optimised_202311
5
5
  lyrics_transcriber/llm_prompts/llm_prompt_lyrics_matching_andrew_handwritten_20231118.txt,sha256=hvk2Vs3M3Q4zGQsiQnXvnpd8wXWfwsudYeqN5qFyNWs,1754
6
6
  lyrics_transcriber/llm_prompts/promptfooconfig.yaml,sha256=O4YxlLV7XSUiSw_1Q9G7ELC2VAbrYUV_N5QxrPbd1jE,3735
7
7
  lyrics_transcriber/llm_prompts/test_data/ABBA-UnderAttack-Genius.txt,sha256=8d-RvZtyINKUlpQLwMi-VD--Y59J-epPt7SZSqjFbPI,1690
8
- lyrics_transcriber/transcriber.py,sha256=ykodPGx-bDmT3BBGY5MywfMfmUGUrUsQw7C-k-PzYS0,38686
8
+ lyrics_transcriber/transcriber.py,sha256=YrDx8OhVV6UUljuDic4DmBsQnkalH-iBUFX2Svl7L1U,38915
9
9
  lyrics_transcriber/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
10
  lyrics_transcriber/utils/ass.py,sha256=b8lnjgXGD1OD1ld_b1xxUmSOf4nSEfz9BpgSkh16R4g,90291
11
- lyrics_transcriber/utils/cli.py,sha256=-xzokp8RZMh8DDCr-PZbh4yHqlnJP70Ts62-VnjZq48,6398
11
+ lyrics_transcriber/utils/cli.py,sha256=RaZieUW9NuajCq3nU5IvBa-NgFCQ27wraUgrKqOfe7M,6512
12
12
  lyrics_transcriber/utils/subtitles.py,sha256=GPLbo9oX3WJIY4wRO40k0RZF-UqvKjr2LFnXVOS0RHI,10762
13
- lyrics_transcriber-0.12.9.dist-info/LICENSE,sha256=BiPihPDxhxIPEx6yAxVfAljD5Bhm_XG2teCbPEj_m0Y,1069
14
- lyrics_transcriber-0.12.9.dist-info/METADATA,sha256=et_XjNqSkHONMdJ8KlO9olAK3KkAQ4Wz7HIR8rw0YP0,5051
15
- lyrics_transcriber-0.12.9.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
16
- lyrics_transcriber-0.12.9.dist-info/entry_points.txt,sha256=lh6L-iR5CGELaNcouDK94X78eS5Ua_tK9lI4UEkza-k,72
17
- lyrics_transcriber-0.12.9.dist-info/RECORD,,
13
+ lyrics_transcriber-0.13.1.dist-info/LICENSE,sha256=BiPihPDxhxIPEx6yAxVfAljD5Bhm_XG2teCbPEj_m0Y,1069
14
+ lyrics_transcriber-0.13.1.dist-info/METADATA,sha256=j426j7GVyhXPl0kb26Zs6LXYJovCunPRW8iH1YFX0Q0,5047
15
+ lyrics_transcriber-0.13.1.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
16
+ lyrics_transcriber-0.13.1.dist-info/entry_points.txt,sha256=lh6L-iR5CGELaNcouDK94X78eS5Ua_tK9lI4UEkza-k,72
17
+ lyrics_transcriber-0.13.1.dist-info/RECORD,,