lyrics-transcriber 0.19.2__py3-none-any.whl → 0.30.0__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.
Files changed (32) hide show
  1. lyrics_transcriber/__init__.py +2 -5
  2. lyrics_transcriber/cli/main.py +194 -0
  3. lyrics_transcriber/core/__init__.py +0 -0
  4. lyrics_transcriber/core/controller.py +283 -0
  5. lyrics_transcriber/core/corrector.py +56 -0
  6. lyrics_transcriber/core/fetcher.py +143 -0
  7. lyrics_transcriber/output/__init__.py +0 -0
  8. lyrics_transcriber/output/generator.py +210 -0
  9. lyrics_transcriber/storage/__init__.py +0 -0
  10. lyrics_transcriber/storage/dropbox.py +249 -0
  11. lyrics_transcriber/storage/tokens.py +116 -0
  12. lyrics_transcriber/{audioshake_transcriber.py → transcribers/audioshake.py} +44 -15
  13. lyrics_transcriber/transcribers/base.py +31 -0
  14. lyrics_transcriber/transcribers/whisper.py +186 -0
  15. {lyrics_transcriber-0.19.2.dist-info → lyrics_transcriber-0.30.0.dist-info}/METADATA +6 -17
  16. lyrics_transcriber-0.30.0.dist-info/RECORD +22 -0
  17. lyrics_transcriber-0.30.0.dist-info/entry_points.txt +3 -0
  18. lyrics_transcriber/llm_prompts/README.md +0 -10
  19. lyrics_transcriber/llm_prompts/llm_prompt_lyrics_correction_andrew_handwritten_20231118.txt +0 -55
  20. lyrics_transcriber/llm_prompts/llm_prompt_lyrics_correction_gpt_optimised_20231119.txt +0 -36
  21. lyrics_transcriber/llm_prompts/llm_prompt_lyrics_matching_andrew_handwritten_20231118.txt +0 -19
  22. lyrics_transcriber/llm_prompts/promptfooconfig.yaml +0 -61
  23. lyrics_transcriber/llm_prompts/test_data/ABBA-UnderAttack-Genius.txt +0 -48
  24. lyrics_transcriber/transcriber.py +0 -1128
  25. lyrics_transcriber/utils/cli.py +0 -179
  26. lyrics_transcriber-0.19.2.dist-info/RECORD +0 -18
  27. lyrics_transcriber-0.19.2.dist-info/entry_points.txt +0 -3
  28. /lyrics_transcriber/{utils → cli}/__init__.py +0 -0
  29. /lyrics_transcriber/{utils → output}/ass.py +0 -0
  30. /lyrics_transcriber/{utils → output}/subtitles.py +0 -0
  31. {lyrics_transcriber-0.19.2.dist-info → lyrics_transcriber-0.30.0.dist-info}/LICENSE +0 -0
  32. {lyrics_transcriber-0.19.2.dist-info → lyrics_transcriber-0.30.0.dist-info}/WHEEL +0 -0
@@ -1,179 +0,0 @@
1
- #!/usr/bin/env python
2
- import argparse
3
- import logging
4
- import pkg_resources
5
-
6
-
7
- def main():
8
- logger = logging.getLogger(__name__)
9
- log_handler = logging.StreamHandler()
10
- log_formatter = logging.Formatter(fmt="%(asctime)s.%(msecs)03d - %(levelname)s - %(module)s - %(message)s", datefmt="%Y-%m-%d %H:%M:%S")
11
- log_handler.setFormatter(log_formatter)
12
- logger.addHandler(log_handler)
13
-
14
- logger.debug("Parsing CLI args")
15
-
16
- parser = argparse.ArgumentParser(
17
- description="Create synchronised lyrics files in ASS and MidiCo LRC formats with word-level timestamps, from any input song file",
18
- formatter_class=lambda prog: argparse.HelpFormatter(prog, max_help_position=40),
19
- )
20
-
21
- parser.add_argument("audio_filepath", nargs="?", help="The audio file path to transcribe lyrics for.", default=argparse.SUPPRESS)
22
-
23
- package_version = pkg_resources.get_distribution("lyrics-transcriber").version
24
- parser.add_argument("-v", "--version", action="version", version=f"%(prog)s {package_version}")
25
- parser.add_argument("--log_level", default="INFO", help="Optional: Logging level, e.g. info, debug, warning. Default: INFO")
26
-
27
- parser.add_argument(
28
- "--artist",
29
- default=None,
30
- help="Optional: song artist for lyrics lookup and auto-correction",
31
- )
32
- parser.add_argument(
33
- "--title",
34
- default=None,
35
- help="Optional: song title for lyrics lookup and auto-correction",
36
- )
37
- parser.add_argument(
38
- "--audioshake_api_token",
39
- default=None,
40
- help="Optional: AudioShake API token for lyrics transcription and alignment. Can also be set with AUDIOSHAKE_API_TOKEN env var.",
41
- )
42
- parser.add_argument(
43
- "--genius_api_token",
44
- default=None,
45
- help="Optional: Genius API token for lyrics fetching. Can also be set with GENIUS_API_TOKEN env var.",
46
- )
47
- parser.add_argument(
48
- "--spotify_cookie",
49
- default=None,
50
- help="Optional: Spotify sp_dc cookie value for lyrics fetching. Can also be set with SPOTIFY_COOKIE_SP_DC env var.",
51
- )
52
-
53
- parser.add_argument(
54
- "--cache_dir",
55
- default="/tmp/lyrics-transcriber-cache/",
56
- help="Optional: directory to cache files downloaded or generated during execution",
57
- )
58
-
59
- parser.add_argument(
60
- "--output_dir",
61
- default=None,
62
- help="Optional: directory where the output lyrics files will be saved. Default: current directory",
63
- )
64
-
65
- parser.add_argument(
66
- "--transcription_model",
67
- default="medium",
68
- help="Optional: transcription model to use (currently only supports Whisper models, e.g. medium.en, large-v3). Default: medium",
69
- )
70
-
71
- parser.add_argument(
72
- "--llm_model",
73
- default="gpt-4o",
74
- help="Optional: LLM model to use (currently only supports OpenAI chat completion compatible models",
75
- )
76
-
77
- parser.add_argument(
78
- "--render_video",
79
- action="store_true",
80
- help="Optional: render a karaoke video with the generated lyrics",
81
- )
82
-
83
- parser.add_argument(
84
- "--video_resolution",
85
- default="360p",
86
- help="Optional: resolution of the karaoke video to render. Must be one of: 4k, 1080p, 720p, 360p. Default: 360p",
87
- )
88
-
89
- parser.add_argument(
90
- "--video_background_image",
91
- default=None,
92
- help="Optional: image file path to use for karaoke video background",
93
- )
94
-
95
- parser.add_argument(
96
- "--video_background_color",
97
- default="black",
98
- help="Optional: color to use for karaoke video background, in hex format or FFmpeg color name. Default: black",
99
- )
100
-
101
- parser.add_argument(
102
- "--openai_api_key",
103
- default=None,
104
- help="Optional: OpenAI API key for LLM model usage. Can also be set with OPENAI_API_KEY env var.",
105
- )
106
-
107
- args = parser.parse_args()
108
-
109
- log_level = getattr(logging, args.log_level.upper())
110
- logger.setLevel(log_level)
111
-
112
- if not hasattr(args, "audio_filepath"):
113
- parser.print_help()
114
- exit(1)
115
-
116
- if 1 <= [args.genius_api_token, args.title, args.artist].count(True) < 3:
117
- print(f"To use genius lyrics auto-correction, all 3 args genius_api_token, artist, title must be provided")
118
- print(args)
119
- exit(1)
120
-
121
- logger.debug("Loading LyricsTranscriber class")
122
-
123
- # Lazy load this class so help output is printed quickly rather than waiting for heavy libraries to load
124
- from lyrics_transcriber import LyricsTranscriber
125
-
126
- transcriber = LyricsTranscriber(
127
- args.audio_filepath,
128
- audioshake_api_token=args.audioshake_api_token,
129
- genius_api_token=args.genius_api_token,
130
- spotify_cookie=args.spotify_cookie,
131
- openai_api_key=args.openai_api_key,
132
- artist=args.artist,
133
- title=args.title,
134
- output_dir=args.output_dir,
135
- cache_dir=args.cache_dir,
136
- log_formatter=log_formatter,
137
- log_level=log_level,
138
- transcription_model=args.transcription_model,
139
- llm_model=args.llm_model,
140
- render_video=args.render_video,
141
- video_resolution=args.video_resolution,
142
- video_background_image=args.video_background_image,
143
- video_background_color=args.video_background_color,
144
- )
145
-
146
- outputs = transcriber.generate()
147
-
148
- logger.info(f"*** Success! ***")
149
-
150
- formatted_duration = f'{int(outputs["song_duration"] // 60):02d}:{int(outputs["song_duration"] % 60):02d}'
151
- logger.info(f"Total Song Duration: {formatted_duration}")
152
-
153
- formatted_singing_duration = f'{int(outputs["total_singing_duration"] // 60):02d}:{int(outputs["total_singing_duration"] % 60):02d}'
154
- logger.info(f"Total Singing Duration: {formatted_singing_duration}")
155
- logger.info(f"Singing Percentage: {outputs['singing_percentage']}%")
156
-
157
- logger.info(f"*** Outputs: ***")
158
- logger.info(f"Transcription output data file: {outputs['transcription_data_filepath']}")
159
- logger.info(f"Genius lyrics output file: {outputs['genius_lyrics_filepath']}")
160
- logger.info(f"Spotify lyrics data file: {outputs['spotify_lyrics_data_filepath']}")
161
-
162
- logger.info(f"Transcribed lyrics text file: {outputs['transcribed_lyrics_text_filepath']}")
163
- logger.info(f"Spotify lyrics text file: {outputs['spotify_lyrics_text_filepath']}")
164
- logger.info(f"Corrected lyrics text file: {outputs['corrected_lyrics_text_filepath']}")
165
-
166
- logger.info(f"MidiCo LRC output file: {outputs['midico_lrc_filepath']}")
167
- logger.info(f"ASS subtitles file: {outputs['ass_subtitles_filepath']}")
168
- logger.info(f"Karaoke Video file: {outputs['karaoke_video_filepath']}")
169
-
170
- logger.info(f"LLM Token Usage: input: {outputs['llm_token_usage']['input']} output: {outputs['llm_token_usage']['output']}")
171
- logger.info(
172
- f'LLM usage costs: {outputs["llm_costs_usd"]["input"]} + {outputs["llm_costs_usd"]["output"]} = ${outputs["llm_costs_usd"]["total"]}'
173
- )
174
-
175
- logger.info(f"Files copied to output dir: {outputs['output_dir']}")
176
-
177
-
178
- if __name__ == "__main__":
179
- main()
@@ -1,18 +0,0 @@
1
- lyrics_transcriber/__init__.py,sha256=bIRjsXAzlghS1rQxWNLU0wppZy0T_iciN9EclHLwNrQ,94
2
- lyrics_transcriber/audioshake_transcriber.py,sha256=AbIkghvguI1PV0fCMUHGRnidQwLPM_pQ96FI0Qk-aI0,5221
3
- lyrics_transcriber/llm_prompts/README.md,sha256=DPAGRDVGt9ZNcQAAoQGFhwesLY3D6hD8apL71yHP4yo,196
4
- lyrics_transcriber/llm_prompts/llm_prompt_lyrics_correction_andrew_handwritten_20231118.txt,sha256=a3XjAYfyhWt1uCKKqm_n2Pc0STdmBdiHHtJ7ODP99Nk,4046
5
- lyrics_transcriber/llm_prompts/llm_prompt_lyrics_correction_gpt_optimised_20231119.txt,sha256=r6HN3DD_3gwh3B_JPd2R0I4lDXuB5iy7B90J9agOxbQ,2369
6
- lyrics_transcriber/llm_prompts/llm_prompt_lyrics_matching_andrew_handwritten_20231118.txt,sha256=hvk2Vs3M3Q4zGQsiQnXvnpd8wXWfwsudYeqN5qFyNWs,1754
7
- lyrics_transcriber/llm_prompts/promptfooconfig.yaml,sha256=O4YxlLV7XSUiSw_1Q9G7ELC2VAbrYUV_N5QxrPbd1jE,3735
8
- lyrics_transcriber/llm_prompts/test_data/ABBA-UnderAttack-Genius.txt,sha256=8d-RvZtyINKUlpQLwMi-VD--Y59J-epPt7SZSqjFbPI,1690
9
- lyrics_transcriber/transcriber.py,sha256=AhovzKfAWJERjqBseItHk3rnj3M1rlPHRhbMk0ogqxQ,57568
10
- lyrics_transcriber/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
- lyrics_transcriber/utils/ass.py,sha256=b8lnjgXGD1OD1ld_b1xxUmSOf4nSEfz9BpgSkh16R4g,90291
12
- lyrics_transcriber/utils/cli.py,sha256=8Poba_9wQw0VmOK73vuK-w-abR9QmO4y4FYDHiAQbc0,6972
13
- lyrics_transcriber/utils/subtitles.py,sha256=_WG0pFoZMXcrGe6gbARkC9KrWzFNTMOsiqQwNL-H2lU,11812
14
- lyrics_transcriber-0.19.2.dist-info/LICENSE,sha256=BiPihPDxhxIPEx6yAxVfAljD5Bhm_XG2teCbPEj_m0Y,1069
15
- lyrics_transcriber-0.19.2.dist-info/METADATA,sha256=J1tlv6r2va-7Q_ygGvEPJ9DrIGa_hzCGWufVhXo6Vcc,5825
16
- lyrics_transcriber-0.19.2.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
17
- lyrics_transcriber-0.19.2.dist-info/entry_points.txt,sha256=lh6L-iR5CGELaNcouDK94X78eS5Ua_tK9lI4UEkza-k,72
18
- lyrics_transcriber-0.19.2.dist-info/RECORD,,
@@ -1,3 +0,0 @@
1
- [console_scripts]
2
- lyrics-transcriber=lyrics_transcriber.utils.cli:main
3
-
File without changes
File without changes
File without changes