HOZHENWAI / Beets-Plugin_VGMdb

A small plugin to collect metadata from VGMdb and manage a VGMdb collection
13 stars 2 forks source link

does this work with Flac? I get errors #1

Closed u2716 closed 2 years ago

u2716 commented 2 years ago

Hi , thanks for this plugin. it seems the only vgmdb plugin working to me. but itseems working just with mp3 files. I tried with 3 flac albums and all caused errors, even trying with manual id. log:


VGMplug: Title satinize: Kimetsu no yaiba vol.1 -> Kimetsu no yaiba vol 1
VGMplug: Title satinize: Kimetsu no yaiba vol.1 -> Kimetsu no yaiba vol 1
VGMplug: Something really wrong happened
Traceback (most recent call last):
  File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/requests/models.py", line 910, in json
    return complexjson.loads(self.text, **kwargs)
  File "/data/data/com.termux/files/usr/lib/python3.10/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "/data/data/com.termux/files/usr/lib/python3.10/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/data/data/com.termux/files/usr/lib/python3.10/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/beetsplug/VGMplug.py", line 111, in _search_vgmdbinfo
    items = req.json()
  File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/requests/models.py", line 917, in json
    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: [Errno Expecting value] <!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en-US"> <![endif]-->
<!--[if IE 7]>    <html class="no-js ie7 oldie" lang="en-US"> <![endif]-->
<!--[if IE 8]>    <html class="no-js ie8 oldie" lang="en-US"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en-US"> <!--<![endif]-->
<head>
<meta http-equiv="refresh" content="0">

<title>vgmdb.info | 502: Bad gateway</title>
<meta charset="UTF-8" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta name="robots" content="noindex, nofollow" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<link rel="stylesheet" id="cf_styles-css" href="/cdn-cgi/styles/main.css" />

<script>
(function(){if(document.addEventListener&&window.XMLHttpRequest&&JSON&&JSON.stringify){var e=function(a){var c=document.getElementById("error-feedback-survey"),d=document.getElementById("error-feedback-success"),b=new XMLHttpRequest;a={event:"feedback clicked",properties:{errorCode:502,helpful:a,version:1}};b.open("POST","https://sparrow.cloudflare.com/api/v1/event");b.setRequestHeader("Content-Type","application/json");b.setRequestHeader("Sparrow-Source-Key","c771f0e4b54944bebf4261d44bd79a1e");
b.send(JSON.stringify(a));c.classList.add("feedback-hidden");d.classList.remove("feedback-hidden")};document.addEventListener("DOMContentLoaded",function(){var a=document.getElementById("error-feedback"),c=document.getElementById("feedback-button-yes"),d=document.getElementById("feedback-button-no");"classList"in a&&(a.classList.remove("feedback-hidden"),c.addEventListener("click",function(){e(!0)}),d.addEventListener("click",function(){e(!1)}))})}})();
</script>

</head>
<body>
<div id="cf-wrapper">

    <div id="cf-error-details" class="p-0">
        <header class="mx-auto pt-10 lg:pt-6 lg:px-8 w-240 lg:w-full mb-8">
            <h1 class="inline-block sm:block sm:mb-2 font-light text-60 lg:text-4xl text-black-dark leading-tight mr-2">

              <span class="cf-error-type">Error</span>
              <span class="cf-error-code">502</span>
            </h1>
            <span class="inline-block sm:block font-mono text-15 lg:text-sm lg:leading-relaxed">Ray ID: 71319e69cf1073b7 &bull;</span>
            <span class="inline-block sm:block font-mono text-15 lg:text-sm lg:leading-relaxed">2022-05-29 19:25:56 UTC</span>
            <h2 class="text-gray-600 leading-1.3 text-3xl font-light">Bad gateway</h2>
        </header>

        <div class="my-8 bg-gradient-gray">
            <div class="w-240 lg:w-full mx-auto">
                <div class="clearfix md:px-8">

<div id="cf-browser-status" class=" relative w-1/3 md:w-full py-15 md:p-0 md:py-8 md:text-left md:border-solid md:border-0 md:border-b md:border-gray-400 overflow-hidden float-left md:float-none text-center">
  <div class="relative mb-10 md:m-0">
    <span class="cf-icon-browser block md:hidden h-20 bg-center bg-no-repeat"></span>
    <span class="cf-icon-ok w-12 h-12 absolute left-1/2 md:left-auto md:right-0 md:top-0 -ml-6 -bottom-4"></span>
  </div>
  <span class="md:block w-full truncate">You</span>
  <h3 class="md:inline-block mt-3 md:mt-0 text-2xl text-gray-600 font-light leading-1.3">Browser</h3>
  <span class="leading-1.3 text-2xl text-green-success">Working</span>
</div>

<div id="cf-cloudflare-status" class=" relative w-1/3 md:w-full py-15 md:p-0 md:py-8 md:text-left md:border-solid md:border-0 md:border-b md:border-gray-400 overflow-hidden float-left md:float-none text-center">
  <div class="relative mb-10 md:m-0">
    <span class="cf-icon-cloud block md:hidden h-20 bg-center bg-no-repeat"></span>
    <span class="cf-icon-ok w-12 h-12 absolute left-1/2 md:left-auto md:right-0 md:top-0 -ml-6 -bottom-4"></span>
  </div>
  <span class="md:block w-full truncate">Marseille</span>
  <h3 class="md:inline-block mt-3 md:mt-0 text-2xl text-gray-600 font-light leading-1.3">Cloudflare</h3>
  <span class="leading-1.3 text-2xl text-green-success">Working</span>
</div>

<div id="cf-host-status" class="cf-error-source relative w-1/3 md:w-full py-15 md:p-0 md:py-8 md:text-left md:border-solid md:border-0 md:border-b md:border-gray-400 overflow-hidden float-left md:float-none text-center">
  <div class="relative mb-10 md:m-0">
    <span class="cf-icon-server block md:hidden h-20 bg-center bg-no-repeat"></span>
    <span class="cf-icon-error w-12 h-12 absolute left-1/2 md:left-auto md:right-0 md:top-0 -ml-6 -bottom-4"></span>
  </div>
  <span class="md:block w-full truncate">vgmdb.info</span>
  <h3 class="md:inline-block mt-3 md:mt-0 text-2xl text-gray-600 font-light leading-1.3">Host</h3>
  <span class="leading-1.3 text-2xl text-red-error">Error</span>
</div>

                </div>

            </div>
        </div>

        <div class="w-240 lg:w-full mx-auto mb-8 lg:px-8">
            <div class="clearfix">
                <div class="w-1/2 md:w-full float-left pr-6 md:pb-10 md:pr-0 leading-relaxed">
                    <h2 class="text-3xl font-normal leading-1.3 mb-4">What happened?</h2>
                    <p>The web server reported a bad gateway error.</p>
                </div>

                <div class="w-1/2 md:w-full float-left leading-relaxed">
                    <h2 class="text-3xl font-normal leading-1.3 mb-4">What can I do?</h2>
                    <p class="mb-6">Please try again in a few minutes.</p>
                </div>
            </div>

        </div>

        <div class="feedback-hidden py-8 text-center" id="error-feedback">
    <div id="error-feedback-survey" class="footer-line-wrapper">
        Was this page helpful?
        <button class="border border-solid bg-white cf-button cursor-pointer ml-4 px-4 py-2 rounded" id="feedback-button-yes" type="button">Yes</button>
        <button class="border border-solid bg-white cf-button cursor-pointer ml-4 px-4 py-2 rounded" id="feedback-button-no" type="button">No</button>
    </div>
    <div class="feedback-success feedback-hidden" id="error-feedback-success">
        Thank you for your feedback!
    </div>
</div>

        <div class="cf-error-footer cf-wrapper w-240 lg:w-full py-10 sm:py-4 sm:px-8 mx-auto text-center sm:text-left border-solid border-0 border-t border-gray-300">
  <p class="text-13">
    <span class="cf-footer-item sm:block sm:mb-1">Cloudflare Ray ID: <strong class="font-semibold">71319e69cf1073b7</strong></span>
    <span class="cf-footer-separator sm:hidden">&bull;</span>
    <span class="cf-footer-item sm:block sm:mb-1"><span>Your IP</span>: 94.37.177.55</span>
    <span class="cf-footer-separator sm:hidden">&bull;</span>
    <span class="cf-footer-item sm:block sm:mb-1"><span>Performance &amp; security by</span> <a rel="noopener noreferrer" href="https://www.cloudflare.com/5xx-error-landing" id="brand_link" target="_blank">Cloudflare</a></span>

  </p>
</div><!-- /.error-footer -->

    </div>
</div>
</body>
</html>

: 0
Evaluating 5 candidates. ```
HOZHENWAI commented 2 years ago

well, basically, somebody created an api for vgmdb.net which can be accessed from vgmdb.info . This website is sometimes down hence the 502 bad gateway error.

Try again later and it may work.

But, the long term solution is to integrate the request directly to vgmdb.net . This is actually planned, but as I didn't see much use, I had other projects to work on.

I'll get back to it next weekend.

HOZHENWAI commented 2 years ago

To answer your questions, yes it works with flac. Beets do the work of managing the files and it support flac.

u2716 commented 2 years ago

thank you very much for the rapid response. have a good day :)

u2716 commented 2 years ago

thanks it works fine now. but I get a few problems. first: in the filenames, " gets replaced with . the same happens for a point at the end of the filename, which gets replaced with . but it's not a big problem since the metadata are filled correctly and that's what I care the most.

u2716 commented 2 years ago

second problem: i get errors with a few of my albums, both with manual vgmdb id and automatic.

manual vgmdb id:


VGMplug: Querying VgmDB for release 86128
Candidate: (None,) - KIMETSU NO YAIBA TV ANIMATION SERIES VOLUME 1 SPECIAL CD (vgmdb-86128)
Computing track assignment...
...done.
Traceback (most recent call last):
  File "/data/data/com.termux/files/usr/bin/beet", line 8, in <module>
    sys.exit(main())
  File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/beets/ui/__init__.py", line 1285, in main
    _raw_main(args)
  File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/beets/ui/__init__.py", line 1272, in _raw_main
    subcommand.func(lib, suboptions, subargs)
  File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/beets/ui/commands.py", line 973, in import_func
    import_files(lib, paths, query)
  File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/beets/ui/commands.py", line 943, in import_files
    session.run()
  File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/beets/importer.py", line 340, in run
    pl.run_parallel(QUEUE_SIZE)
  File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/beets/util/pipeline.py", line 446, in run_parallel
    raise exc_info[1].with_traceback(exc_info[2])
  File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/beets/util/pipeline.py", line 311, in run
    out = self.coro.send(msg)
  File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/beets/util/pipeline.py", line 170, in coro
    task = func(*(args + (task,)))
  File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/beets/importer.py", line 1400, in user_query
    task.choose_match(session)
  File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/beets/importer.py", line 859, in choose_match
    choice = session.choose_match(self)
  File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/beets/ui/commands.py", line 743, in choose_match
    post_choice = choice.callback(self, task)
  File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/beetsplug/VGMplug.py", line 49, in insert_manual_id
    _add_candidate(task.items, candidates, self.album_for_id(search_id))
  File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/beets/autotag/match.py", line 375, in _add_candidate
    dist = distance(items, info, mapping)
  File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/beets/autotag/match.py", line 175, in distance
    dist.add_string('artist', likelies['artist'], album_info.artist)
  File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/beets/autotag/hooks.py", line 539, in add_string
    dist = string_dist(str1, str2)
  File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/beets/autotag/hooks.py", line 260, in string_dist
    str2 = str2.lower()
AttributeError: 'tuple' object has no attribute 'lower'```
u2716 commented 2 years ago

automatic:


VGMplug: Title satinize: KIMETSU NO YAIBA TV ANIMATION SERIES VOLUME TWO SPECIAL CD -> KIMETSU NO YAIBA TV ANIMATION SERIES VOLUME TWO SPECIAL CD
VGMplug: Title satinize: KIMETSU NO YAIBA TV ANIMATION SERIES VOLUME TWO SPECIAL CD -> KIMETSU NO YAIBA TV ANIMATION SERIES VOLUME TWO SPECIAL CD
VGMplug: Found 1 albums on VGMdb for query: KIMETSU NO YAIBA TV ANIMATION SERIES VOLUME TWO SPECIAL CD
VGMplug: Querying VgmDB for release 116834
Sending event: albuminfo_received
Candidate: (None,) - KIMETSU NO YAIBA TV ANIMATION SERIES ENTERTAINMENT DISTRICT ARC VOLUME TWO SPECIAL CD (vgmdb-116834)
Computing track assignment...
...done.
Traceback (most recent call last):
  File "/data/data/com.termux/files/usr/bin/beet", line 8, in <module>
    sys.exit(main())
  File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/beets/ui/__init__.py", line 1285, in main
    _raw_main(args)
  File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/beets/ui/__init__.py", line 1272, in _raw_main
    subcommand.func(lib, suboptions, subargs)
  File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/beets/ui/commands.py", line 973, in import_func
    import_files(lib, paths, query)
  File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/beets/ui/commands.py", line 943, in import_files
    session.run()
  File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/beets/importer.py", line 340, in run           pl.run_parallel(QUEUE_SIZE)
  File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/beets/util/pipeline.py", line 446, in run_parallel
    raise exc_info[1].with_traceback(exc_info[2])         File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/beets/util/pipeline.py", line 311, in run
    out = self.coro.send(msg)
  File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/beets/util/pipeline.py", line 193, in coro
    func(*(args + (task,)))
  File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/beets/importer.py", line 1376, in lookup_candidates
    task.lookup_candidates()
  File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/beets/importer.py", line 660, in lookup_candidates
    autotag.tag_album(self.items, search_ids=self.search_ids)
  File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/beets/autotag/match.py", line 466, in tag_album
    _add_candidate(items, candidates, matched_candidate)
  File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/beets/autotag/match.py", line 375, in _add_candidate
    dist = distance(items, info, mapping)
  File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/beets/autotag/match.py", line 175, in distance
    dist.add_string('artist', likelies['artist'], album_info.artist)
  File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/beets/autotag/hooks.py", line 539, in add_string
    dist = string_dist(str1, str2)
  File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/beets/autotag/hooks.py", line 260, in string_dist
    str2 = str2.lower()
AttributeError: 'tuple' object has no attribute 'lower'```
u2716 commented 2 years ago

maybe the problem is "(None,)" in Candidate: (None,) - KIMETSU NO YAIBA TV ANIMATION SERIES ENTERTAINMENT DISTRICT ARC VOLUME TWO SPECIAL CD (vgmdb-116834) ?

HOZHENWAI commented 2 years ago

I'll look it up.

HOZHENWAI commented 2 years ago

Well, found the issues. For the specific example you've shown me, there are no performers, composers or arrangers information. But in fact, the vgmdb.net information is overloaded with information. But if you were to check vgmdn.info (the api I'm currently using), most of the information is missing. Ergo, the api is not that complete.

There is a quick fix solution that is to simply replace the default artist before replacement to "" instead of None.

By default, we are going performers -> composers -> for artist information. The search for the artist is stopped once we find one satistfying information. What's your opinion on what should be the "artist" of the album (for example KIMETSU NO YAIBA TV ANIMATION SERIES VOLUME 1 SPECIAL CD)?

I'll quick fix that tomorrow.

HOZHENWAI commented 2 years ago

Btw, have you found beets with my plugin to be somewhat slow?

u2716 commented 2 years ago

hey, thanks for giving a look.regarding the question who should be the artist, personally I'd go composers->performers , because there are many cases of album with many anime characters as performers,where each one has his song. for example: http://vgmdb.info/album/43809 going performers->composers, it tags as artist of album and of track "Maaya Uchida",who sings in just one song, while every track is composed,arranged and made lyrics by "ZAQ", who is the true album artist imo. another example: http://vgmdb.info/album/90076 it has like 30 tracks, and only 1 or 2 with vocals. going performs-> composer it tags as album artist "Asami Seto",who sings in one song only, while the album artist imo should be the composer of all tracks "fox capture plan'. other example: http://vgmdb.info/album/106627 same thing. composer "Hiroyuki Sawano" should be tagged as true album artist, as spotify says.

regarding the question who should be the artist of KIMETSU NO YAIBA TV ANIMATION SERIES VOLUME 1 SPECIAL CD, it should be always the composer, ie Yuki Kajiura. in this case (and some others,example https://vgmdb.net/album/86799) it gets called " BGM" in vgmdb.net, not parsed by the api sadly. In some other cases(https://vgmdb.net/album/86128 or https://vgmdb.net/album/77854 ) it is presented as "all composed by"/"all music composed by", also this field is not present in the api.

u2716 commented 2 years ago

regarding the speed of the plugin, it seems good to me. it is just a bit slower than MusicBrainz research, but nothing crazy. I didn't notice it before you told me.So it should be fine.

HOZHENWAI commented 2 years ago

I'm going to close this discussion, I fixed the bug and changed the artist priority. Thank you for your inputs. It's always good to know someone has a use ( and I get bugtester :) )