sdm-pycli 2.0.0__tar.gz → 2.0.1__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sdm-pycli
3
- Version: 2.0.0
3
+ Version: 2.0.1
4
4
  Summary: A fast, zero-config CLI tool to download and sync playlists from Spotify, Apple Music, Tidal, YouTube, and SoundCloud.
5
5
  Author: Antares699
6
6
  License: MIT
@@ -22,6 +22,7 @@ Requires-Dist: typer>=0.12.0
22
22
  Requires-Dist: imageio-ffmpeg>=0.4.9
23
23
  Requires-Dist: ytmusicapi>=1.5.0
24
24
  Requires-Dist: spotapi>=1.2.0
25
+ Requires-Dist: Pillow>=9.0.0
25
26
  Dynamic: license-file
26
27
 
27
28
  # SDM - SDM Downloads Music
@@ -39,7 +40,7 @@ Recently, Spotify restricted their Web API, requiring developers to have a Premi
39
40
  - **Universal Support:** Spotify, Apple Music, Tidal, YouTube, and SoundCloud.
40
41
  - **Smart Syncing:** Two-way mirroring. Run `sdm sync` to fetch new tracks and clean up removed ones.
41
42
  - **Multi-Format:** Download in M4A (default), MP3, FLAC, or OPUS with native tags.
42
- - **Perfect Metadata:** Embeds Track, Artist, Album, Cover Art, Track/Disc Numbers, Genre, and Release Year.
43
+ - **Perfect Metadata:** Embeds Track, Artist, Album, Cover Art, Track/Disc Numbers, Genre, Release Year, and automatically generates `.m3u8` playlists.
43
44
  - **Advanced Processing:** Synced lyrics via LRCLIB, custom 2-pass EBU R128 (-14 LUFS) audio normalization algorithm for perfectly balanced studio-grade levels without dynamic range compression artifacts, and SponsorBlock trimming.
44
45
 
45
46
  ## Installation
@@ -126,13 +127,15 @@ sdm sync "C:\Users\You\Music\My Playlist"
126
127
  To import a local audio file into your playlist with official metadata and protect it from future sync deletions, run
127
128
 
128
129
  ```bash
129
- sdm inject [filePath] [trackUrl]
130
+ sdm inject [filePath] [trackUrl (Optional)]
130
131
  ```
131
132
 
133
+ If the `trackUrl` is omitted, `sdm` will launch an interactive search menu to help you find and apply metadata (including Last.fm enrichment and high-resolution cover art).
134
+
132
135
  Example:
133
136
 
134
137
  ```bash
135
- sdm inject "C:\Users\You\Downloads\song.mp3" https://open.spotify.com/track/0VjIjW4GlUZAMYd2vXMi3b
138
+ sdm inject "C:\Users\You\Downloads\song.mp3"
136
139
  ```
137
140
 
138
141
  ### Config
@@ -173,30 +176,32 @@ sdm search "Never Gonna Give You Up - Rick Astley"
173
176
 
174
177
  ### Stats
175
178
 
176
- To show statistics for your local library (such as track count, total size, and format distribution), run
179
+ To show comprehensive statistics for your local library (such as track count, total size, format distribution, Top Genres, Top Artists, and Decades), run
177
180
 
178
181
  ```bash
179
182
  sdm stats [directory]
180
183
  ```
181
184
 
185
+ This command also runs a Health Check, warning you if any files are missing cover art or have a bitrate below 128kbps. Add the `-v` or `--verbose` flag to print a detailed list of problematic files.
186
+
182
187
  Example:
183
188
 
184
189
  ```bash
185
- sdm stats "C:\Users\You\Music"
190
+ sdm stats "C:\Users\You\Music" -v
186
191
  ```
187
192
 
188
193
  ### Migrate
189
194
 
190
- To bulk convert a downloaded library to a different audio format, run
195
+ To bulk convert a downloaded library to a different audio format (multithreaded for significantly faster processing), run
191
196
 
192
197
  ```bash
193
- sdm migrate --dir [directory] [target_format]
198
+ sdm migrate --dir [directory] [target_format] -w [workers]
194
199
  ```
195
200
 
196
201
  Example:
197
202
 
198
203
  ```bash
199
- sdm migrate --dir "C:\Users\You\Music\FLAC Library" opus
204
+ sdm migrate --dir "C:\Users\You\Music\FLAC Library" opus -w 5
200
205
  ```
201
206
 
202
207
  ## Options & Flags
@@ -205,11 +210,13 @@ sdm migrate --dir "C:\Users\You\Music\FLAC Library" opus
205
210
  |---|---|
206
211
  | `-o, --output` | Save to a specific directory |
207
212
  | `-f, --format` | Audio format: `m4a`, `mp3`, `flac`, `opus` (default: `m4a`) |
208
- | `-w, --workers` | Number of concurrent downloads (default: `3`) |
213
+ | `-w, --workers` | Number of concurrent downloads or migrations (default: `3`) |
214
+ | `-v, --verbose` | Show detailed list of tracks with warnings during `stats` |
209
215
  | `--cleanup` | Run sync cleanup logic on a standard download to remove orphaned files |
210
216
  | `--index` | Manually override the track index number when injecting a file |
211
217
  | `--dir` | Target directory for the migrate and stats commands |
212
218
  | `--lyrics` | Fetch and embed synced lyrics from LRCLIB |
219
+ | `--resize-covers` | Resize high-res cover art to 600x600px to save storage space |
213
220
  | `--normalize` | Apply custom 2-pass EBU R128 (-14 LUFS) volume normalization |
214
221
  | `--sponsor-block` | Trim non-music sections from YouTube sources |
215
222
  | `--dry-run` | Simulate a sync/download without making changes |
@@ -217,6 +224,7 @@ sdm migrate --dir "C:\Users\You\Music\FLAC Library" opus
217
224
  | `--refresh-metadata` | Re-tag existing files with the latest metadata (alias: `--refresh`) |
218
225
  | `--cookies` | Pass browser cookies for age-restricted content |
219
226
  | `--lastfm-key` | Enable extensive track-level genres and wiki summaries via Last.fm API |
227
+ | `--version` | Show the version and exit |
220
228
 
221
229
  Example with flags:
222
230
 
@@ -13,7 +13,7 @@ Recently, Spotify restricted their Web API, requiring developers to have a Premi
13
13
  - **Universal Support:** Spotify, Apple Music, Tidal, YouTube, and SoundCloud.
14
14
  - **Smart Syncing:** Two-way mirroring. Run `sdm sync` to fetch new tracks and clean up removed ones.
15
15
  - **Multi-Format:** Download in M4A (default), MP3, FLAC, or OPUS with native tags.
16
- - **Perfect Metadata:** Embeds Track, Artist, Album, Cover Art, Track/Disc Numbers, Genre, and Release Year.
16
+ - **Perfect Metadata:** Embeds Track, Artist, Album, Cover Art, Track/Disc Numbers, Genre, Release Year, and automatically generates `.m3u8` playlists.
17
17
  - **Advanced Processing:** Synced lyrics via LRCLIB, custom 2-pass EBU R128 (-14 LUFS) audio normalization algorithm for perfectly balanced studio-grade levels without dynamic range compression artifacts, and SponsorBlock trimming.
18
18
 
19
19
  ## Installation
@@ -100,13 +100,15 @@ sdm sync "C:\Users\You\Music\My Playlist"
100
100
  To import a local audio file into your playlist with official metadata and protect it from future sync deletions, run
101
101
 
102
102
  ```bash
103
- sdm inject [filePath] [trackUrl]
103
+ sdm inject [filePath] [trackUrl (Optional)]
104
104
  ```
105
105
 
106
+ If the `trackUrl` is omitted, `sdm` will launch an interactive search menu to help you find and apply metadata (including Last.fm enrichment and high-resolution cover art).
107
+
106
108
  Example:
107
109
 
108
110
  ```bash
109
- sdm inject "C:\Users\You\Downloads\song.mp3" https://open.spotify.com/track/0VjIjW4GlUZAMYd2vXMi3b
111
+ sdm inject "C:\Users\You\Downloads\song.mp3"
110
112
  ```
111
113
 
112
114
  ### Config
@@ -147,30 +149,32 @@ sdm search "Never Gonna Give You Up - Rick Astley"
147
149
 
148
150
  ### Stats
149
151
 
150
- To show statistics for your local library (such as track count, total size, and format distribution), run
152
+ To show comprehensive statistics for your local library (such as track count, total size, format distribution, Top Genres, Top Artists, and Decades), run
151
153
 
152
154
  ```bash
153
155
  sdm stats [directory]
154
156
  ```
155
157
 
158
+ This command also runs a Health Check, warning you if any files are missing cover art or have a bitrate below 128kbps. Add the `-v` or `--verbose` flag to print a detailed list of problematic files.
159
+
156
160
  Example:
157
161
 
158
162
  ```bash
159
- sdm stats "C:\Users\You\Music"
163
+ sdm stats "C:\Users\You\Music" -v
160
164
  ```
161
165
 
162
166
  ### Migrate
163
167
 
164
- To bulk convert a downloaded library to a different audio format, run
168
+ To bulk convert a downloaded library to a different audio format (multithreaded for significantly faster processing), run
165
169
 
166
170
  ```bash
167
- sdm migrate --dir [directory] [target_format]
171
+ sdm migrate --dir [directory] [target_format] -w [workers]
168
172
  ```
169
173
 
170
174
  Example:
171
175
 
172
176
  ```bash
173
- sdm migrate --dir "C:\Users\You\Music\FLAC Library" opus
177
+ sdm migrate --dir "C:\Users\You\Music\FLAC Library" opus -w 5
174
178
  ```
175
179
 
176
180
  ## Options & Flags
@@ -179,11 +183,13 @@ sdm migrate --dir "C:\Users\You\Music\FLAC Library" opus
179
183
  |---|---|
180
184
  | `-o, --output` | Save to a specific directory |
181
185
  | `-f, --format` | Audio format: `m4a`, `mp3`, `flac`, `opus` (default: `m4a`) |
182
- | `-w, --workers` | Number of concurrent downloads (default: `3`) |
186
+ | `-w, --workers` | Number of concurrent downloads or migrations (default: `3`) |
187
+ | `-v, --verbose` | Show detailed list of tracks with warnings during `stats` |
183
188
  | `--cleanup` | Run sync cleanup logic on a standard download to remove orphaned files |
184
189
  | `--index` | Manually override the track index number when injecting a file |
185
190
  | `--dir` | Target directory for the migrate and stats commands |
186
191
  | `--lyrics` | Fetch and embed synced lyrics from LRCLIB |
192
+ | `--resize-covers` | Resize high-res cover art to 600x600px to save storage space |
187
193
  | `--normalize` | Apply custom 2-pass EBU R128 (-14 LUFS) volume normalization |
188
194
  | `--sponsor-block` | Trim non-music sections from YouTube sources |
189
195
  | `--dry-run` | Simulate a sync/download without making changes |
@@ -191,6 +197,7 @@ sdm migrate --dir "C:\Users\You\Music\FLAC Library" opus
191
197
  | `--refresh-metadata` | Re-tag existing files with the latest metadata (alias: `--refresh`) |
192
198
  | `--cookies` | Pass browser cookies for age-restricted content |
193
199
  | `--lastfm-key` | Enable extensive track-level genres and wiki summaries via Last.fm API |
200
+ | `--version` | Show the version and exit |
194
201
 
195
202
  Example with flags:
196
203
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "sdm-pycli"
7
- version = "2.0.0"
7
+ version = "2.0.1"
8
8
  description = "A fast, zero-config CLI tool to download and sync playlists from Spotify, Apple Music, Tidal, YouTube, and SoundCloud."
9
9
  readme = "README.md"
10
10
  authors = [
@@ -26,7 +26,8 @@ dependencies = [
26
26
  "typer>=0.12.0",
27
27
  "imageio-ffmpeg>=0.4.9",
28
28
  "ytmusicapi>=1.5.0",
29
- "spotapi>=1.2.0"
29
+ "spotapi>=1.2.0",
30
+ "Pillow>=9.0.0"
30
31
  ]
31
32
  requires-python = ">=3.8"
32
33
 
@@ -1,3 +1,3 @@
1
1
  """SDM - SDM Downloads Music. A fast CLI tool to download and sync playlists from Spotify, Apple Music, Tidal, YouTube, and SoundCloud."""
2
2
 
3
- __version__ = "2.0.0"
3
+ __version__ = "2.0.1"
@@ -34,6 +34,27 @@ app = typer.Typer(
34
34
 
35
35
  console = Console()
36
36
 
37
+ __version__ = "2.0.1"
38
+
39
+
40
+ def version_callback(value: bool):
41
+ if value:
42
+ console.print(f"sdm version {__version__}")
43
+ raise typer.Exit()
44
+
45
+
46
+ @app.callback()
47
+ def sdm_callback(
48
+ version: typing.Optional[bool] = typer.Option(
49
+ None,
50
+ "--version",
51
+ callback=version_callback,
52
+ is_eager=True,
53
+ help="Show the version and exit.",
54
+ ),
55
+ ):
56
+ pass
57
+
37
58
 
38
59
  class AudioFormat(str, Enum):
39
60
  m4a = "m4a"
@@ -55,6 +76,7 @@ def execute_sync_or_download(
55
76
  normalize: bool,
56
77
  lyrics: bool,
57
78
  refresh_metadata: bool,
79
+ resize_covers: bool = False,
58
80
  ):
59
81
  is_static = False
60
82
  if url:
@@ -168,7 +190,9 @@ def execute_sync_or_download(
168
190
  filepath = output_dir / filename
169
191
  if not filepath.exists():
170
192
  return "error", "File not found on disk"
171
- if embed_metadata(filepath, track, fetch_lyrics=lyrics):
193
+ if embed_metadata(
194
+ filepath, track, fetch_lyrics=lyrics, resize_covers=resize_covers
195
+ ):
172
196
  return "success", filename
173
197
  else:
174
198
  return "error", "Failed to refresh metadata"
@@ -185,6 +209,7 @@ def execute_sync_or_download(
185
209
  fetch_lyrics=lyrics,
186
210
  ydl_opts=shared_ydl_opts,
187
211
  refresh_metadata=refresh_metadata,
212
+ resize_covers=resize_covers,
188
213
  )
189
214
 
190
215
  with Progress(
@@ -355,6 +380,7 @@ def execute_sync_or_download(
355
380
  normalize=normalize,
356
381
  fetch_lyrics=lyrics,
357
382
  refresh_metadata=refresh_metadata,
383
+ resize_covers=resize_covers,
358
384
  )
359
385
  if f_status in ["fallback_success", "success"]:
360
386
  sync_manager.mark_synced(track["id"], f_message)
@@ -381,7 +407,7 @@ def execute_sync_or_download(
381
407
  sync_manager.flush()
382
408
 
383
409
  if not dry_run and not is_static:
384
- m3u_path = output_dir / "_playlist.m3u"
410
+ m3u_path = output_dir / "_playlist.m3u8"
385
411
  try:
386
412
  with open(m3u_path, "w", encoding="utf-8") as f:
387
413
  f.write("#EXTM3U\n")
@@ -391,7 +417,9 @@ def execute_sync_or_download(
391
417
  if fname:
392
418
  f.write(fname + "\n")
393
419
  except Exception as e:
394
- console.print(f"[yellow]Warning:[/] Failed to generate _playlist.m3u ({e})")
420
+ console.print(
421
+ f"[yellow]Warning:[/] Failed to generate _playlist.m3u8 ({e})"
422
+ )
395
423
 
396
424
  console.print("\n[bold green]Done![/bold green]")
397
425
 
@@ -497,6 +525,7 @@ def search(
497
525
  normalize=False,
498
526
  lyrics=lyrics,
499
527
  refresh_metadata=False,
528
+ resize_covers=False,
500
529
  )
501
530
 
502
531
 
@@ -572,6 +601,12 @@ def download(
572
601
  help="Force re-tagging of existing local files",
573
602
  rich_help_panel="Metadata & Tags",
574
603
  ),
604
+ resize_covers: bool = typer.Option(
605
+ False,
606
+ "--resize-covers",
607
+ help="Resize high-res cover art to 600x600 to save space",
608
+ rich_help_panel="Metadata & Tags",
609
+ ),
575
610
  ):
576
611
  output_dir = output.resolve()
577
612
  kwargs = _merge_config(locals())
@@ -581,6 +616,7 @@ def download(
581
616
  sponsor_block = kwargs.get("sponsor_block", sponsor_block)
582
617
  normalize = kwargs.get("normalize", normalize)
583
618
  lyrics = kwargs.get("lyrics", lyrics)
619
+ resize_covers = kwargs.get("resize_covers", resize_covers)
584
620
 
585
621
  execute_sync_or_download(
586
622
  url=url,
@@ -595,6 +631,7 @@ def download(
595
631
  normalize=normalize,
596
632
  lyrics=lyrics,
597
633
  refresh_metadata=refresh_metadata,
634
+ resize_covers=resize_covers,
598
635
  )
599
636
 
600
637
 
@@ -659,6 +696,12 @@ def sync(
659
696
  help="Force re-tagging of existing local files",
660
697
  rich_help_panel="Metadata & Tags",
661
698
  ),
699
+ resize_covers: bool = typer.Option(
700
+ False,
701
+ "--resize-covers",
702
+ help="Resize high-res cover art to 600x600 to save space",
703
+ rich_help_panel="Metadata & Tags",
704
+ ),
662
705
  ):
663
706
  output_dir = dir.resolve()
664
707
  kwargs = _merge_config(locals())
@@ -668,6 +711,7 @@ def sync(
668
711
  sponsor_block = kwargs.get("sponsor_block", sponsor_block)
669
712
  normalize = kwargs.get("normalize", normalize)
670
713
  lyrics = kwargs.get("lyrics", lyrics)
714
+ resize_covers = kwargs.get("resize_covers", resize_covers)
671
715
 
672
716
  execute_sync_or_download(
673
717
  url=None,
@@ -682,6 +726,7 @@ def sync(
682
726
  normalize=normalize,
683
727
  lyrics=lyrics,
684
728
  refresh_metadata=refresh_metadata,
729
+ resize_covers=resize_covers,
685
730
  )
686
731
 
687
732
 
@@ -697,7 +742,10 @@ def inject(
697
742
  readable=True,
698
743
  help="Path to the local audio file to inject",
699
744
  ),
700
- url: str = typer.Argument(..., help="Track URL to extract metadata and tags from"),
745
+ url: typing.Optional[str] = typer.Argument(
746
+ None,
747
+ help="Track URL to extract metadata and tags from. If omitted, will prompt for search.",
748
+ ),
701
749
  output: Path = typer.Option(
702
750
  ".", "--output", "-o", help="Output directory", rich_help_panel="Output Options"
703
751
  ),
@@ -726,6 +774,12 @@ def inject(
726
774
  help="Automatically fetch and embed synced lyrics",
727
775
  rich_help_panel="Metadata & Tags",
728
776
  ),
777
+ resize_covers: bool = typer.Option(
778
+ False,
779
+ "--resize-covers",
780
+ help="Resize high-res cover art to 600x600 to save space",
781
+ rich_help_panel="Metadata & Tags",
782
+ ),
729
783
  ):
730
784
  output_dir = output.resolve()
731
785
  sync_manager = SyncManager(output_dir)
@@ -734,7 +788,73 @@ def inject(
734
788
  "[bold green]sdm: Fetching metadata for injected track...[/bold green]"
735
789
  )
736
790
  try:
737
- tracks = fetch_tracks(url)
791
+ url_to_use = url
792
+ selected = None
793
+ if not url_to_use:
794
+ from ytmusicapi import YTMusic
795
+ from rich.prompt import Prompt, IntPrompt
796
+
797
+ query = Prompt.ask(
798
+ "No URL provided. Enter a track name to search for metadata"
799
+ )
800
+ console.print(f"[cyan]Searching for '[bold]{query}[/bold]'...[/cyan]")
801
+ ytmusic = YTMusic()
802
+ try:
803
+ results = ytmusic.search(query, filter="songs", limit=10)
804
+ except Exception as e:
805
+ console.print(f"[bold red]Search failed:[/] {e}")
806
+ raise typer.Exit(1)
807
+
808
+ if not results:
809
+ console.print("[yellow]No results found.[/yellow]")
810
+ raise typer.Exit()
811
+
812
+ results = results[:10]
813
+
814
+ table = Table(
815
+ title="Search Results", show_header=True, header_style="bold magenta"
816
+ )
817
+ table.add_column("#", style="dim", justify="right")
818
+ table.add_column("Title")
819
+ table.add_column("Artist")
820
+ table.add_column("Album")
821
+ table.add_column("Duration", justify="right")
822
+
823
+ for i, r in enumerate(results, start=1):
824
+ t_title = r.get("title", "Unknown")
825
+ artists_data = r.get("artists", [])
826
+ t_artists = (
827
+ ", ".join([a["name"] for a in artists_data if "name" in a])
828
+ if artists_data
829
+ else "Unknown"
830
+ )
831
+ album_data = r.get("album")
832
+ t_album = album_data.get("name", "Unknown") if album_data else "Unknown"
833
+ duration = r.get("duration", "0:00")
834
+ table.add_row(str(i), t_title, t_artists, t_album, duration)
835
+
836
+ console.print(table)
837
+
838
+ choice = IntPrompt.ask(
839
+ "Enter the number of the track to use for metadata (0 to cancel)",
840
+ choices=[str(i) for i in range(len(results) + 1)],
841
+ show_choices=False,
842
+ default=0,
843
+ )
844
+
845
+ if choice == 0:
846
+ console.print("Cancelled.")
847
+ raise typer.Exit()
848
+
849
+ selected = results[choice - 1]
850
+ vid = selected.get("videoId")
851
+ if not vid:
852
+ console.print("[bold red]Selected track has no video ID.[/bold red]")
853
+ raise typer.Exit(1)
854
+
855
+ url_to_use = f"https://music.youtube.com/watch?v={vid}"
856
+
857
+ tracks = fetch_tracks(url_to_use)
738
858
  if not tracks:
739
859
  console.print("[bold red]Error:[/] No track metadata found for the URL.")
740
860
  raise typer.Exit(code=1)
@@ -746,6 +866,54 @@ def inject(
746
866
  raise typer.Exit(code=1)
747
867
 
748
868
  track = tracks[0]
869
+
870
+ if not url and selected:
871
+ clean_title = selected.get("title")
872
+ if clean_title:
873
+ track["name"] = clean_title
874
+
875
+ artists_data = selected.get("artists", [])
876
+ clean_artists = [a["name"] for a in artists_data if "name" in a]
877
+ if clean_artists:
878
+ track["artists"] = clean_artists
879
+
880
+ album_data = selected.get("album")
881
+ if album_data and "name" in album_data:
882
+ track["album"] = album_data["name"]
883
+
884
+ thumbnails = selected.get("thumbnails", [])
885
+ if thumbnails:
886
+ largest_thumb = max(thumbnails, key=lambda x: x.get("width", 0))
887
+ thumb_url = largest_thumb.get("url", "")
888
+ if thumb_url:
889
+ import re
890
+
891
+ high_res_url = re.sub(
892
+ r"([=-])w\d+-h\d+", r"\g<1>w1200-h1200", thumb_url
893
+ )
894
+ track["cover_url"] = high_res_url
895
+
896
+ cfg = load_config()
897
+ lastfm_key = cfg.get("lastfm_key")
898
+ if lastfm_key and track.get("artists") and track.get("name"):
899
+ from sdm.metadata import get_lastfm_metadata
900
+ import re
901
+
902
+ c_artist = track["artists"][0]
903
+ c_name = re.sub(
904
+ r"[\(\[].*?(feat|ft|remaster|radio|edit|mix).*?[\)\]]",
905
+ "",
906
+ track["name"],
907
+ flags=re.I,
908
+ ).strip()
909
+ genres, wiki, mbid = get_lastfm_metadata(c_artist, c_name, lastfm_key)
910
+ if genres:
911
+ track["genres"] = genres
912
+ if wiki:
913
+ track["wiki"] = wiki
914
+ if mbid:
915
+ track["mbid"] = mbid
916
+
749
917
  if index:
750
918
  index_val = index
751
919
  else:
@@ -798,7 +966,9 @@ def inject(
798
966
  _apply_twopass_loudnorm(final_filepath, format.value)
799
967
 
800
968
  console.print("[cyan]Embedding metadata...[/cyan]")
801
- if embed_metadata(final_filepath, track, fetch_lyrics=lyrics):
969
+ if embed_metadata(
970
+ final_filepath, track, fetch_lyrics=lyrics, resize_covers=resize_covers
971
+ ):
802
972
  sync_manager.mark_injected(track["id"], final_filepath.name)
803
973
  console.print(
804
974
  f"[bold green]Successfully injected and synced:[/] {filename_template}"
@@ -850,6 +1020,8 @@ def _merge_config(kwargs):
850
1020
  kwargs["normalize"] = cfg["normalize"]
851
1021
  if kwargs.get("lyrics") is False and "lyrics" in cfg:
852
1022
  kwargs["lyrics"] = cfg["lyrics"]
1023
+ if kwargs.get("resize_covers") is False and "resize_covers" in cfg:
1024
+ kwargs["resize_covers"] = cfg["resize_covers"]
853
1025
  return kwargs
854
1026
 
855
1027
 
@@ -871,6 +1043,9 @@ def config(
871
1043
  None, "--normalize", help="Apply audio normalization"
872
1044
  ),
873
1045
  lyrics: bool = typer.Option(None, "--lyrics", help="Fetch lyrics"),
1046
+ resize_covers: bool = typer.Option(
1047
+ None, "--resize-covers", help="Resize cover art"
1048
+ ),
874
1049
  lastfm_key: str = typer.Option(
875
1050
  None, "--lastfm-key", help="Last.fm API Key for extensive metadata"
876
1051
  ),
@@ -903,6 +1078,9 @@ def config(
903
1078
  if lyrics is not None:
904
1079
  cfg["lyrics"] = lyrics
905
1080
  updated = True
1081
+ if resize_covers is not None:
1082
+ cfg["resize_covers"] = resize_covers
1083
+ updated = True
906
1084
  if lastfm_key is not None:
907
1085
  cfg["lastfm_key"] = lastfm_key
908
1086
  updated = True
@@ -1027,9 +1205,19 @@ def tag(
1027
1205
  )
1028
1206
 
1029
1207
 
1208
+ from collections import Counter
1209
+ import mutagen
1210
+
1211
+
1030
1212
  @app.command(help="Show statistics for the local library.")
1031
1213
  def stats(
1032
1214
  dir: Path = typer.Argument(".", help="Directory to check"),
1215
+ verbose: bool = typer.Option(
1216
+ False,
1217
+ "--verbose",
1218
+ "-v",
1219
+ help="Show detailed list of tracks with warnings",
1220
+ ),
1033
1221
  ):
1034
1222
  output_dir = dir.resolve()
1035
1223
  sync_manager = SyncManager(output_dir)
@@ -1046,17 +1234,114 @@ def stats(
1046
1234
  total_injected = len(injected_ids)
1047
1235
 
1048
1236
  total_size = 0
1049
- formats = {}
1050
- missing = 0
1237
+ formats = Counter()
1238
+ missing_files = 0
1239
+
1240
+ genres_count = Counter()
1241
+ artists_count = Counter()
1242
+ decades_count = Counter()
1243
+
1244
+ health_missing_cover = []
1245
+ health_low_bitrate = []
1246
+
1247
+ console.print("\n")
1248
+ with Progress(
1249
+ SpinnerColumn(spinner_name="dots" if console.is_terminal else "line"),
1250
+ TextColumn("[bold cyan]Scanning library tags...[/bold cyan]"),
1251
+ BarColumn(),
1252
+ "[progress.percentage]{task.percentage:>3.0f}%",
1253
+ console=console,
1254
+ ) as progress:
1255
+ task = progress.add_task("Scanning...", total=len(rows))
1256
+ for _, filename in rows:
1257
+ filepath = output_dir / filename
1258
+ if not filepath.exists():
1259
+ missing_files += 1
1260
+ progress.advance(task)
1261
+ continue
1051
1262
 
1052
- for _, filename in rows:
1053
- filepath = output_dir / filename
1054
- if filepath.exists():
1055
1263
  total_size += filepath.stat().st_size
1056
1264
  ext = filepath.suffix.lower()
1057
- formats[ext] = formats.get(ext, 0) + 1
1058
- else:
1059
- missing += 1
1265
+ formats[ext] += 1
1266
+
1267
+ try:
1268
+ audio = mutagen.File(filepath)
1269
+ if audio is not None:
1270
+ artist = None
1271
+ genre = None
1272
+ year = None
1273
+ has_cover = False
1274
+
1275
+ if ext == ".m4a":
1276
+ artist = (
1277
+ audio.get("\xa9ART", [""])[0]
1278
+ if "\xa9ART" in audio
1279
+ else None
1280
+ )
1281
+ genre = (
1282
+ audio.get("\xa9gen", [""])[0]
1283
+ if "\xa9gen" in audio
1284
+ else None
1285
+ )
1286
+ year = (
1287
+ audio.get("\xa9day", [""])[0]
1288
+ if "\xa9day" in audio
1289
+ else None
1290
+ )
1291
+ has_cover = "covr" in audio
1292
+ elif ext == ".mp3":
1293
+ artist = str(audio.get("TPE1", "")) if "TPE1" in audio else None
1294
+ genre = str(audio.get("TCON", "")) if "TCON" in audio else None
1295
+ date = audio.get("TDRC", None) or audio.get("TYER", None)
1296
+ if date:
1297
+ year = str(date)
1298
+ has_cover = any(key.startswith("APIC") for key in audio.keys())
1299
+ elif ext in [".flac", ".opus"]:
1300
+ artist = (
1301
+ audio.get("artist", [""])[0] if "artist" in audio else None
1302
+ )
1303
+ genre = (
1304
+ audio.get("genre", [""])[0] if "genre" in audio else None
1305
+ )
1306
+ year = audio.get("date", [""])[0] if "date" in audio else None
1307
+ if ext == ".flac":
1308
+ has_cover = (
1309
+ hasattr(audio, "pictures") and len(audio.pictures) > 0
1310
+ )
1311
+ else:
1312
+ has_cover = "metadata_block_picture" in audio
1313
+
1314
+ if artist:
1315
+ artists_count[artist] += 1
1316
+ if genre:
1317
+ import re
1318
+
1319
+ for part in re.split(r"[,/]", genre):
1320
+ p = part.strip()
1321
+ if p:
1322
+ genres_count[p] += 1
1323
+ if year and len(year) >= 4:
1324
+ try:
1325
+ dec = int(year[:4]) // 10 * 10
1326
+ decades_count[f"{dec}s"] += 1
1327
+ except ValueError:
1328
+ pass
1329
+
1330
+ if not has_cover:
1331
+ health_missing_cover.append(filepath.name)
1332
+
1333
+ if (
1334
+ hasattr(audio, "info")
1335
+ and hasattr(audio.info, "bitrate")
1336
+ and audio.info.bitrate
1337
+ ):
1338
+ if audio.info.bitrate < 128000:
1339
+ health_low_bitrate.append(filepath.name)
1340
+
1341
+ except Exception:
1342
+ pass
1343
+
1344
+ progress.advance(task)
1060
1345
 
1061
1346
  size_mb = total_size / (1024 * 1024)
1062
1347
 
@@ -1064,8 +1349,9 @@ def stats(
1064
1349
  title=f"Library Statistics: {output_dir.name}",
1065
1350
  show_header=True,
1066
1351
  header_style="bold magenta",
1352
+ expand=True,
1067
1353
  )
1068
- table.add_column("Metric", style="cyan")
1354
+ table.add_column("Metric", style="cyan", width=20)
1069
1355
  table.add_column("Value", style="green")
1070
1356
 
1071
1357
  table.add_row("Source URL", source_url or "None")
@@ -1076,10 +1362,73 @@ def stats(
1076
1362
  format_str = ", ".join(f"{ext}: {count}" for ext, count in formats.items())
1077
1363
  table.add_row("Formats", format_str or "None")
1078
1364
 
1079
- if missing > 0:
1080
- table.add_row("Missing Files", str(missing), style="red")
1365
+ if missing_files > 0:
1366
+ table.add_row("Missing Files", str(missing_files), style="red")
1081
1367
 
1082
1368
  console.print(table)
1369
+ console.print()
1370
+
1371
+ from rich.panel import Panel
1372
+
1373
+ def make_chart_panel(counter, title, color="cyan", limit=5):
1374
+ if not counter:
1375
+ return Panel(
1376
+ "[dim]No data[/dim]",
1377
+ title=f"[bold {color}]{title}[/bold {color}]",
1378
+ border_style=color,
1379
+ )
1380
+
1381
+ max_val = max(counter.values())
1382
+ lines = []
1383
+ for name, count in counter.most_common(limit):
1384
+ bar_len = int((count / max_val) * 40) if max_val > 0 else 0
1385
+ bar = "█" * bar_len
1386
+ lines.append(f"{name[:15]:<15} | [{color}]{bar}[/{color}] {count}")
1387
+ return Panel(
1388
+ "\n".join(lines),
1389
+ title=f"[bold {color}]{title}[/bold {color}]",
1390
+ border_style=color,
1391
+ )
1392
+
1393
+ console.print(make_chart_panel(genres_count, "Top Genres", "magenta"))
1394
+ console.print()
1395
+ console.print(make_chart_panel(artists_count, "Top Artists", "green"))
1396
+ console.print()
1397
+ console.print(make_chart_panel(decades_count, "Decades", "yellow"))
1398
+ console.print()
1399
+
1400
+ health_lines = []
1401
+ if not health_missing_cover and not health_low_bitrate and missing_files == 0:
1402
+ health_lines.append(
1403
+ "[bold green][PASS] Library is in perfect health![/bold green]"
1404
+ )
1405
+ else:
1406
+ if missing_files > 0:
1407
+ health_lines.append(
1408
+ f"[bold red][FAIL] {missing_files} files are missing from disk![/bold red]"
1409
+ )
1410
+ if health_missing_cover:
1411
+ health_lines.append(
1412
+ f"[yellow][WARN] {len(health_missing_cover)} files are missing cover art.[/yellow]"
1413
+ )
1414
+ if verbose:
1415
+ for f in health_missing_cover:
1416
+ health_lines.append(f" - {f}")
1417
+ if health_low_bitrate:
1418
+ health_lines.append(
1419
+ f"[yellow][WARN] {len(health_low_bitrate)} files have a bitrate < 128kbps.[/yellow]"
1420
+ )
1421
+ if verbose:
1422
+ for f in health_low_bitrate:
1423
+ health_lines.append(f" - {f}")
1424
+
1425
+ console.print(
1426
+ Panel(
1427
+ "\n".join(health_lines),
1428
+ title="[bold red]Library Health[/bold red]",
1429
+ border_style="red",
1430
+ )
1431
+ )
1083
1432
 
1084
1433
 
1085
1434
  @app.command(help="Bulk convert a downloaded library to a different audio format.")
@@ -1088,6 +1437,13 @@ def migrate(
1088
1437
  target_format: AudioFormat = typer.Argument(
1089
1438
  ..., help="Target audio format (m4a, mp3, flac, opus)"
1090
1439
  ),
1440
+ workers: int = typer.Option(
1441
+ 3,
1442
+ "--workers",
1443
+ "-w",
1444
+ help="Number of concurrent conversions",
1445
+ rich_help_panel="Performance",
1446
+ ),
1091
1447
  ):
1092
1448
  output_dir = dir.resolve()
1093
1449
  sync_manager = SyncManager(output_dir)
@@ -1097,14 +1453,61 @@ def migrate(
1097
1453
  console.print("[yellow]No tracked files found in directory.[/yellow]")
1098
1454
  raise typer.Exit()
1099
1455
 
1456
+ from rich.panel import Panel
1457
+
1100
1458
  console.print(
1101
- f"[bold cyan]Migrating {len(rows)} files to {target_format.value}...[/bold cyan]"
1459
+ Panel(
1460
+ f"[bold cyan]Migrating {len(rows)} files to {target_format.value}...[/bold cyan]",
1461
+ title="⚡ sdm migrate",
1462
+ )
1102
1463
  )
1464
+
1103
1465
  import subprocess
1104
1466
 
1105
1467
  migrated_count = 0
1106
1468
  error_count = 0
1107
1469
 
1470
+ def worker(track_id, filename):
1471
+ filepath = output_dir / filename
1472
+ if (
1473
+ not filepath.exists()
1474
+ or filepath.suffix.lower() == f".{target_format.value}"
1475
+ ):
1476
+ return "skipped", filename
1477
+
1478
+ new_filename = filepath.with_suffix(f".{target_format.value}").name
1479
+ new_filepath = output_dir / new_filename
1480
+
1481
+ cmd = [_get_ffmpeg_path(), "-y", "-i", str(filepath)]
1482
+ codec = {
1483
+ "m4a": "aac",
1484
+ "mp3": "libmp3lame",
1485
+ "flac": "flac",
1486
+ "opus": "libopus",
1487
+ }[target_format.value]
1488
+ cmd.extend(["-c:a", codec])
1489
+
1490
+ if target_format.value == "mp3":
1491
+ cmd.extend(["-q:a", "2"])
1492
+ elif target_format.value == "m4a":
1493
+ cmd.extend(["-b:a", "256k"])
1494
+ elif target_format.value == "opus":
1495
+ cmd.extend(["-b:a", "128k"])
1496
+
1497
+ cmd.extend(["-vn", str(new_filepath)])
1498
+
1499
+ try:
1500
+ subprocess.run(
1501
+ cmd,
1502
+ check=True,
1503
+ stdout=subprocess.DEVNULL,
1504
+ stderr=subprocess.DEVNULL,
1505
+ )
1506
+
1507
+ return "success", (track_id, new_filename, filepath)
1508
+ except Exception as e:
1509
+ return "error", f"{filename}: {e}"
1510
+
1108
1511
  with Progress(
1109
1512
  SpinnerColumn(),
1110
1513
  TextColumn("[progress.description]{task.description}"),
@@ -1115,63 +1518,42 @@ def migrate(
1115
1518
  ) as progress:
1116
1519
  task = progress.add_task("[bold cyan]Migrating...", total=len(rows))
1117
1520
 
1118
- for track_id, filename in rows:
1119
- filepath = output_dir / filename
1120
- if (
1121
- not filepath.exists()
1122
- or filepath.suffix.lower() == f".{target_format.value}"
1123
- ):
1124
- progress.advance(task)
1125
- continue
1126
-
1127
- new_filename = filepath.with_suffix(f".{target_format.value}").name
1128
- new_filepath = output_dir / new_filename
1129
-
1130
- cmd = [_get_ffmpeg_path(), "-y", "-i", str(filepath)]
1131
- codec = {
1132
- "m4a": "aac",
1133
- "mp3": "libmp3lame",
1134
- "flac": "flac",
1135
- "opus": "libopus",
1136
- }[target_format.value]
1137
- cmd.extend(["-c:a", codec])
1138
-
1139
- if target_format.value == "mp3":
1140
- cmd.extend(["-q:a", "2"])
1141
- elif target_format.value == "m4a":
1142
- cmd.extend(["-b:a", "256k"])
1143
- elif target_format.value == "opus":
1144
- cmd.extend(["-b:a", "128k"])
1145
-
1146
- cmd.extend(["-vn", str(new_filepath)])
1147
-
1148
- try:
1149
- subprocess.run(
1150
- cmd,
1151
- check=True,
1152
- stdout=subprocess.DEVNULL,
1153
- stderr=subprocess.DEVNULL,
1154
- )
1155
-
1156
- sync_manager.conn.execute(
1157
- "UPDATE tracks SET filename = ? WHERE track_id = ?",
1158
- (new_filename, track_id),
1159
- )
1160
- sync_manager.conn.commit()
1161
-
1162
- filepath.unlink()
1163
- migrated_count += 1
1164
- progress.console.print(f"[green][+][/green] Migrated: {new_filename}")
1165
- except Exception as e:
1166
- error_count += 1
1167
- progress.console.print(
1168
- f"[red][-][/red] Failed to migrate {filename}: {e}"
1169
- )
1521
+ with ThreadPoolExecutor(max_workers=workers) as executor:
1522
+ future_to_file = {
1523
+ executor.submit(worker, track_id, filename): filename
1524
+ for track_id, filename in rows
1525
+ }
1526
+ for future in as_completed(future_to_file):
1527
+ status, result = future.result()
1528
+ if status == "success":
1529
+ track_id, new_filename, old_filepath = result
1530
+ with sync_manager.conn:
1531
+ sync_manager.conn.execute(
1532
+ "UPDATE tracks SET filename = ? WHERE track_id = ?",
1533
+ (new_filename, track_id),
1534
+ )
1535
+ try:
1536
+ import os
1170
1537
 
1171
- progress.advance(task)
1538
+ os.remove(old_filepath)
1539
+ except Exception:
1540
+ pass
1541
+ migrated_count += 1
1542
+ progress.console.print(
1543
+ f"[black on green] SUCCESS [/black on green] Migrated: {new_filename}"
1544
+ )
1545
+ elif status == "error":
1546
+ error_count += 1
1547
+ progress.console.print(
1548
+ f"[black on red] ERROR [/black on red] Failed to migrate {result}"
1549
+ )
1550
+ progress.advance(task)
1172
1551
 
1173
1552
  console.print(
1174
- f"\n[bold green]Migration complete! Migrated {migrated_count} files.[/bold green] (Errors: {error_count})"
1553
+ Panel(
1554
+ f"[bold green]Migration complete! Migrated {migrated_count} files.[/bold green] (Errors: {error_count})",
1555
+ title="Done",
1556
+ )
1175
1557
  )
1176
1558
 
1177
1559
 
@@ -475,12 +475,14 @@ def _search_ytmusic(track):
475
475
  return best_url
476
476
 
477
477
 
478
- def embed_metadata(filepath, track, fetch_lyrics=False):
478
+ def embed_metadata(filepath, track, fetch_lyrics=False, resize_covers=False):
479
479
  import time
480
480
 
481
481
  for attempt in range(5):
482
482
  try:
483
- success = _embed_metadata_inner(filepath, track, fetch_lyrics)
483
+ success = _embed_metadata_inner(
484
+ filepath, track, fetch_lyrics, resize_covers
485
+ )
484
486
  if success:
485
487
  return True
486
488
  except PermissionError:
@@ -493,7 +495,7 @@ def embed_metadata(filepath, track, fetch_lyrics=False):
493
495
  return False
494
496
 
495
497
 
496
- def _embed_metadata_inner(filepath, track, fetch_lyrics=False):
498
+ def _embed_metadata_inner(filepath, track, fetch_lyrics=False, resize_covers=False):
497
499
  ext = filepath.suffix.lower()
498
500
  name = str(track.get("name", "Unknown"))
499
501
  artists = track.get("artists", [])
@@ -519,6 +521,21 @@ def _embed_metadata_inner(filepath, track, fetch_lyrics=False):
519
521
 
520
522
  cover_data = _get_cached_cover(track.get("cover_url"))
521
523
 
524
+ if cover_data and resize_covers:
525
+ try:
526
+ from PIL import Image
527
+ import io
528
+
529
+ img = Image.open(io.BytesIO(cover_data))
530
+ if img.mode != "RGB":
531
+ img = img.convert("RGB")
532
+ img.thumbnail((600, 600), Image.Resampling.LANCZOS)
533
+ out = io.BytesIO()
534
+ img.save(out, format="JPEG", quality=85)
535
+ cover_data = out.getvalue()
536
+ except Exception:
537
+ pass
538
+
522
539
  try:
523
540
  success = False
524
541
  if ext == ".m4a":
@@ -746,6 +763,7 @@ def download_and_tag(
746
763
  fetch_lyrics=False,
747
764
  ydl_opts=None,
748
765
  refresh_metadata=False,
766
+ resize_covers=False,
749
767
  ):
750
768
  title = sanitize_filename(track.get("name"))
751
769
  artists = track.get("artists", [])
@@ -757,7 +775,7 @@ def download_and_tag(
757
775
 
758
776
  if final_path_obj.exists():
759
777
  if refresh_metadata:
760
- if not embed_metadata(final_path_obj, track, fetch_lyrics):
778
+ if not embed_metadata(final_path_obj, track, fetch_lyrics, resize_covers):
761
779
  return "error", "Failed to write metadata (file might be locked)"
762
780
  return "success", final_path_obj.name
763
781
 
@@ -811,7 +829,9 @@ def download_and_tag(
811
829
  if final_path_obj.exists():
812
830
  if normalize:
813
831
  _apply_twopass_loudnorm(final_path_obj, format_flag)
814
- if not embed_metadata(final_path_obj, track, fetch_lyrics):
832
+ if not embed_metadata(
833
+ final_path_obj, track, fetch_lyrics, resize_covers
834
+ ):
815
835
  return "error", "Failed to write metadata (file might be locked)"
816
836
  _download_succeeded = True
817
837
  return "success", final_path_obj.name
@@ -833,6 +853,7 @@ def download_and_tag(
833
853
  yt_logger,
834
854
  fetch_lyrics,
835
855
  normalize,
856
+ resize_covers,
836
857
  )
837
858
  if result[0] in ("fallback_success", "success"):
838
859
  _download_succeeded = True
@@ -867,6 +888,7 @@ def download_and_tag(
867
888
  yt_logger,
868
889
  fetch_lyrics,
869
890
  normalize,
891
+ resize_covers,
870
892
  )
871
893
  if result[0] in ("fallback_success", "success"):
872
894
  _download_succeeded = True
@@ -883,7 +905,14 @@ def download_and_tag(
883
905
 
884
906
 
885
907
  def _soundcloud_fallback(
886
- track, base_filepath, format_flag, ydl, yt_logger, fetch_lyrics, normalize=False
908
+ track,
909
+ base_filepath,
910
+ format_flag,
911
+ ydl,
912
+ yt_logger,
913
+ fetch_lyrics,
914
+ normalize=False,
915
+ resize_covers=False,
887
916
  ):
888
917
  title = track.get("name", "Unknown")
889
918
  artists = track.get("artists", [])
@@ -913,7 +942,9 @@ def _soundcloud_fallback(
913
942
  if final_path_obj.exists():
914
943
  if normalize:
915
944
  _apply_twopass_loudnorm(final_path_obj, format_flag)
916
- if not embed_metadata(final_path_obj, track, fetch_lyrics):
945
+ if not embed_metadata(
946
+ final_path_obj, track, fetch_lyrics, resize_covers
947
+ ):
917
948
  return (
918
949
  "error",
919
950
  "Failed to write metadata (file might be locked)",
@@ -928,4 +928,4 @@ def get_lrclib_lyrics(track_name, artist_name, album_name=None):
928
928
  return res.get("syncedLyrics") or res.get("plainLyrics")
929
929
  except Exception:
930
930
  pass
931
- return None
931
+ return None
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sdm-pycli
3
- Version: 2.0.0
3
+ Version: 2.0.1
4
4
  Summary: A fast, zero-config CLI tool to download and sync playlists from Spotify, Apple Music, Tidal, YouTube, and SoundCloud.
5
5
  Author: Antares699
6
6
  License: MIT
@@ -22,6 +22,7 @@ Requires-Dist: typer>=0.12.0
22
22
  Requires-Dist: imageio-ffmpeg>=0.4.9
23
23
  Requires-Dist: ytmusicapi>=1.5.0
24
24
  Requires-Dist: spotapi>=1.2.0
25
+ Requires-Dist: Pillow>=9.0.0
25
26
  Dynamic: license-file
26
27
 
27
28
  # SDM - SDM Downloads Music
@@ -39,7 +40,7 @@ Recently, Spotify restricted their Web API, requiring developers to have a Premi
39
40
  - **Universal Support:** Spotify, Apple Music, Tidal, YouTube, and SoundCloud.
40
41
  - **Smart Syncing:** Two-way mirroring. Run `sdm sync` to fetch new tracks and clean up removed ones.
41
42
  - **Multi-Format:** Download in M4A (default), MP3, FLAC, or OPUS with native tags.
42
- - **Perfect Metadata:** Embeds Track, Artist, Album, Cover Art, Track/Disc Numbers, Genre, and Release Year.
43
+ - **Perfect Metadata:** Embeds Track, Artist, Album, Cover Art, Track/Disc Numbers, Genre, Release Year, and automatically generates `.m3u8` playlists.
43
44
  - **Advanced Processing:** Synced lyrics via LRCLIB, custom 2-pass EBU R128 (-14 LUFS) audio normalization algorithm for perfectly balanced studio-grade levels without dynamic range compression artifacts, and SponsorBlock trimming.
44
45
 
45
46
  ## Installation
@@ -126,13 +127,15 @@ sdm sync "C:\Users\You\Music\My Playlist"
126
127
  To import a local audio file into your playlist with official metadata and protect it from future sync deletions, run
127
128
 
128
129
  ```bash
129
- sdm inject [filePath] [trackUrl]
130
+ sdm inject [filePath] [trackUrl (Optional)]
130
131
  ```
131
132
 
133
+ If the `trackUrl` is omitted, `sdm` will launch an interactive search menu to help you find and apply metadata (including Last.fm enrichment and high-resolution cover art).
134
+
132
135
  Example:
133
136
 
134
137
  ```bash
135
- sdm inject "C:\Users\You\Downloads\song.mp3" https://open.spotify.com/track/0VjIjW4GlUZAMYd2vXMi3b
138
+ sdm inject "C:\Users\You\Downloads\song.mp3"
136
139
  ```
137
140
 
138
141
  ### Config
@@ -173,30 +176,32 @@ sdm search "Never Gonna Give You Up - Rick Astley"
173
176
 
174
177
  ### Stats
175
178
 
176
- To show statistics for your local library (such as track count, total size, and format distribution), run
179
+ To show comprehensive statistics for your local library (such as track count, total size, format distribution, Top Genres, Top Artists, and Decades), run
177
180
 
178
181
  ```bash
179
182
  sdm stats [directory]
180
183
  ```
181
184
 
185
+ This command also runs a Health Check, warning you if any files are missing cover art or have a bitrate below 128kbps. Add the `-v` or `--verbose` flag to print a detailed list of problematic files.
186
+
182
187
  Example:
183
188
 
184
189
  ```bash
185
- sdm stats "C:\Users\You\Music"
190
+ sdm stats "C:\Users\You\Music" -v
186
191
  ```
187
192
 
188
193
  ### Migrate
189
194
 
190
- To bulk convert a downloaded library to a different audio format, run
195
+ To bulk convert a downloaded library to a different audio format (multithreaded for significantly faster processing), run
191
196
 
192
197
  ```bash
193
- sdm migrate --dir [directory] [target_format]
198
+ sdm migrate --dir [directory] [target_format] -w [workers]
194
199
  ```
195
200
 
196
201
  Example:
197
202
 
198
203
  ```bash
199
- sdm migrate --dir "C:\Users\You\Music\FLAC Library" opus
204
+ sdm migrate --dir "C:\Users\You\Music\FLAC Library" opus -w 5
200
205
  ```
201
206
 
202
207
  ## Options & Flags
@@ -205,11 +210,13 @@ sdm migrate --dir "C:\Users\You\Music\FLAC Library" opus
205
210
  |---|---|
206
211
  | `-o, --output` | Save to a specific directory |
207
212
  | `-f, --format` | Audio format: `m4a`, `mp3`, `flac`, `opus` (default: `m4a`) |
208
- | `-w, --workers` | Number of concurrent downloads (default: `3`) |
213
+ | `-w, --workers` | Number of concurrent downloads or migrations (default: `3`) |
214
+ | `-v, --verbose` | Show detailed list of tracks with warnings during `stats` |
209
215
  | `--cleanup` | Run sync cleanup logic on a standard download to remove orphaned files |
210
216
  | `--index` | Manually override the track index number when injecting a file |
211
217
  | `--dir` | Target directory for the migrate and stats commands |
212
218
  | `--lyrics` | Fetch and embed synced lyrics from LRCLIB |
219
+ | `--resize-covers` | Resize high-res cover art to 600x600px to save storage space |
213
220
  | `--normalize` | Apply custom 2-pass EBU R128 (-14 LUFS) volume normalization |
214
221
  | `--sponsor-block` | Trim non-music sections from YouTube sources |
215
222
  | `--dry-run` | Simulate a sync/download without making changes |
@@ -217,6 +224,7 @@ sdm migrate --dir "C:\Users\You\Music\FLAC Library" opus
217
224
  | `--refresh-metadata` | Re-tag existing files with the latest metadata (alias: `--refresh`) |
218
225
  | `--cookies` | Pass browser cookies for age-restricted content |
219
226
  | `--lastfm-key` | Enable extensive track-level genres and wiki summaries via Last.fm API |
227
+ | `--version` | Show the version and exit |
220
228
 
221
229
  Example with flags:
222
230
 
@@ -6,3 +6,4 @@ typer>=0.12.0
6
6
  imageio-ffmpeg>=0.4.9
7
7
  ytmusicapi>=1.5.0
8
8
  spotapi>=1.2.0
9
+ Pillow>=9.0.0
File without changes
File without changes
File without changes