Closed a1waysbeta closed 11 months ago
@a1waysbeta Thanks for the issue and fixed it. Now check it.
Thank you very much for your update. The new version of the song label will appear garbled, the previous version will not.
Thank you very much for your update. The new version of the song label will appear garbled, the previous version will not.
@a1waysbeta Oh it's about the encoding type. I'll fix it. What software you used to view tags. mp3tag is showing all tags.
foobar2000
@a1waysbeta I worked on your tagging issue and I found that it's about your storefront's default language. It's delivering the credits information in your language. Those are beyond the latin-1
encoding support. latin-1
encoding is the encoding type that accepts to store a tag name to the m4a
file. It's OK with the tag value but not with the tag name. With the last update I gave, you got ?
because I fixed the code to replace the non-latin-1 characters. That's why you got ?
for the tag names and values. So, the options are,
So, I changed the code to allow user to manually select the preferred storefront language. If the user selected one has unsupported characters it will ignore them.
Thank you for the issue. dropcodes.
The manual selection mechanism is perfect.👍 A small question, some labels (like: Genre) have multiple values, can I change the line separation to; separation instead? Or keep only the first one before the genre label and delete the rest. Also, can the cover be embedded by default? Parameter-cn Skip the cover download directly.
@a1waysbeta -cn
parameter issue fixed. Check it.
When we talk about tags, tags reading method is different from one application to another. So, in foobar2000, it separates tags by the separator ;
. If you want only a one tag value, you can delete rest of lines.
Thank you very much, the new update is great! Where can I simply modify the code to retain only the first genre value?
@a1waysbeta I'll add some functions to the tagger
An error is to enter the URL directly in the terminal to download, like this: python manzana.py https://music.apple.com/cn/album/%E7%BB%83%E4%B9%A0/720247917? i=720247948, the error message after displaying that the download has been completed is as follows: `[10-11-23 15:08:33] [Manzana] INFO: Loading device... [10-11-23 15:08:33] [Manzana] INFO: Checking accessToken... [10-11-23 15:08:34] [Manzana] INFO: Checking mediaUserToken... [10-11-23 15:08:34] [Manzana] INFO: Checking passed urls... [10-11-23 15:08:34] [Manzana] INFO: Starting download process...
[10-11-23 15:08:34] [Manzana] INFO: Fetching API response...
[10-11-23 15:08:35] [Manzana] INFO: Getting webplayback... [10-11-23 15:08:36] [Manzana] INFO: Parsing song uri... [10-11-23 15:08:36] [Manzana] INFO: Checking decrypt keys... [10-11-23 15:08:36] [Manzana] INFO: Requesting decrypt keys... [10-11-23 15:08:37] [Manzana] INFO: Saving decrypt keys... [10-11-23 15:08:38] [Manzana] INFO: Downloading "01 - 练习"...
[10-11-23 15:08:38] [Manzana] INFO: Decrypting audio... [10-11-23 15:08:39] [Manzana] INFO: Muxing audio... [10-11-23 15:08:39] [Manzana] INFO: Tagging audio... ╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮ │ D:\Portable Soft\Downloads\Manzana Apple Music Downloader\manzana.py:88 in │
│ │
│ 85 │ cons.print(LOGO) │
│ 86 │ args = main() │
│ 87 │ config.get_config() │
│ ❱ 88 │ run(args) │
│ 89 │
│ │
│ D:\Portable Soft\Downloads\Manzana Apple Music Downloader\core\control.py:246 in run │
│ │
│ 243 │ │ │ │ │ │ │ if not st["isTagged"]: │
│ 244 │ │ │ │ │ │ │ │ logger.info("Tagging audio...") │
│ 245 │ │ │ │ │ │ │ │ │
│ ❱ 246 │ │ │ │ │ │ │ │ tag( │
│ 247 │ │ │ │ │ │ │ │ │ mux_fp, │
│ 248 │ │ │ │ │ │ │ │ │ track, │
│ 249 │ │ │ │ │ │ │ │ │ cover_data, │
│ │
│ D:\Portable Soft\Downloads\Manzana Apple Music Downloader\core\process\tagger.py:45 in tag │
│ │
│ 42 │ │ │ │ if key.startswith("----:com.apple.itunes:"): │
│ 43 │ │ │ │ │ value = [val.encode() for val in value] │
│ 44 │ │ │ │ │
│ ❱ 45 │ │ │ │ tags[key] = value │
│ 46 │ │ │ else: │
│ 47 │ │ │ │ if key.startswith("----:com.apple.itunes:"): │
│ 48 │ │ │ │ │ value = value.encode() │
│ │
│ C:\Users\alway\AppData\Local\Programs\Python\Python311\Lib\site-packages\mutagen_file.py:73 in │
│ setitem │
│ │
│ 70 │ │ │
│ 71 │ │ if self.tags is None: │
│ 72 │ │ │ self.add_tags() │
│ ❱ 73 │ │ self.tags[key] = value │
│ 74 │ │
│ 75 │ def delitem(self, key): │
│ 76 │ │ """Delete a metadata tag key. │
│ │
│ C:\Users\alway\AppData\Local\Programs\Python\Python311\Lib\site-packages\mutagen\mp4__init.py │
│ :372 in setitem │
│ │
│ 369 │ def setitem__(self, key, value): │
│ 370 │ │ if not isinstance(key, str): │
│ 371 │ │ │ raise TypeError("key has to be str") │
│ ❱ 372 │ │ self._render(key, value) │
│ 373 │ │ super(MP4Tags, self).setitem(key, value) │
│ 374 │ │
│ 375 │ @classmethod │
│ │
│ C:\Users\alway\AppData\Local\Programs\Python\Python311\Lib\site-packages\mutagen\mp4__init__.py │
│ :380 in _render │
│ │
│ 377 │ │ return b"moov.udta.meta.ilst" in atoms │
│ 378 │ │
│ 379 │ def _render(self, key, value): │
│ ❱ 380 │ │ atom_name = _key2name(key)[:4] │
│ 381 │ │ if atom_name in self.atoms: │
│ 382 │ │ │ render_func = self.atoms[atom_name][1] │
│ 383 │ │ │ render_args = self.atoms[atom_name][2:] │
│ │
│ C:\Users\alway\AppData\Local\Programs\Python\Python311\Lib\site-packages\mutagen\mp4__init__.py │
│ :213 in _key2name │
│ │
│ 210 │
│ 211 │
│ 212 def _key2name(key): │
│ ❱ 213 │ return key.encode("latin-1") │
│ 214 │
│ 215 │
│ 216 def _find_padding(atom_path): │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
UnicodeEncodeError: 'latin-1' codec can't encode characters in position 22-24: ordinal not in range(256)`
An error is to create a bat file. The content of the bat file is: python manzana.py "D:\Portable Soft\Downloads\Manzana Apple Music Downloader\url.txt" &pause. Double-click the bat file and display the following error after the download is completed: `[10-11-23 15:20:25] [Manzana] INFO: Loading device... [10-11-23 15:20:25] [Manzana] INFO: Checking accessToken... [10-11-23 15:20:25] [Manzana] INFO: Checking mediaUserToken... [10-11-23 15:20:26] [Manzana] INFO: Checking passed urls... [10-11-23 15:20:26] [Manzana] INFO: Starting download process...
[10-11-23 15:20:26] [Manzana] INFO: Fetching API response... ╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮ │ D:\Portable Soft\Downloads\Manzana Apple Music Downloader\manzana.py:88 in │
│ │
│ 85 │ cons.print(LOGO) │
│ 86 │ args = main() │
│ 87 │ config.get_config() │
│ ❱ 88 │ run(args) │
│ 89 │
│ │
│ D:\Portable Soft\Downloads\Manzana Apple Music Downloader\core\control.py:41 in run │
│ │
│ 38 │ │ │
│ 39 │ │ for url in urls: │
│ 40 │ │ │ cons.print(f"\n\t[italic bold]URL: {url}[/]\n") │
│ ❱ 41 │ │ │ data = aplm.get_info(url) │
│ 42 │ │ │ │
│ 43 │ │ │ for sub_data in data: │
│ 44 │ │ │ │ dn = sub_data.get("dir") │
│ │
│ D:\Portable Soft\Downloads\Manzana Apple Music Downloader\core\api\aplm.py:332 in get_info │
│ │
│ 329 │ │
│ 330 │ def get_info(self, url): │
│ 331 │ │ self.parse_url(url) │
│ ❱ 332 │ │ return [self.get_info()] │
│ 333 │ │
│ 334 │ def get_content(self, data): │
│ 335 │ │ id = data.get("id") │
│ │
│ D:\Portable Soft\Downloads\Manzana Apple Music Downloader\core\api\aplm.py:221 in get_info │
│ │
│ 218 │ │ │ return data │
│ 219 │ │ │
│ 220 │ │ if self.kind == "album": │
│ ❱ 221 │ │ │ data = album.parse_data( │
│ 222 │ │ │ │ self.get_api()["data"][0] │
│ 223 │ │ │ ) │
│ 224 │ │ elif self.kind == "music-video": │
│ │
│ D:\Portable Soft\Downloads\Manzana Apple Music Downloader\core\api\album.py:114 in parse_data │
│ │
│ 111 │ │ │ if rela["lyrics"].get("data"): │
│ 112 │ │ │ │ if rela["lyrics"]["data"][0].get("attributes"): │
│ 113 │ │ │ │ │ s.update( │
│ ❱ 114 │ │ │ │ │ │ lyrics.parse( │
│ 115 │ │ │ │ │ │ │ rela["lyrics"]["data"][0]["attributes"]["ttml"] │
│ 116 │ │ │ │ │ │ ) │
│ 117 │ │ │ │ │ ) │
│ │
│ D:\Portable Soft\Downloads\Manzana Apple Music Downloader\core\api\lyrics.py:38 in parse │
│ │
│ 35 │ │ │ │ begin = get_ts(s.get("begin")) │
│ 36 │ │ │ │ timeSyncedLyrics.append(f"[{begin}]{s.text}") │
│ 37 │ │ else: │
│ ❱ 38 │ │ │ begin = get_ts(line.get("begin")) │
│ 39 │ │ │ timeSyncedLyrics.append(f"[{begin}]{line.text}") │
│ 40 │ │
│ 41 │ return { │
│ │
│ D:\Portable Soft\Downloads\Manzana Apple Music Downloader\core\api\lyrics.py:5 in __get_ts │
│ │
│ 2 │
│ 3 def __get_ts(ts): │
│ 4 │ ts = str(ts).replace('s', '') │
│ ❱ 5 │ secs = float(ts.split(':')[-1]) │
│ 6 │ │
│ 7 │ if ":" in ts: │
│ 8 │ │ mins = ts.split(':')[-2] │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
ValueError: could not convert string to float: 'None'`