Skip to content

Commit

Permalink
marc's TOC fix
Browse files Browse the repository at this point in the history
  • Loading branch information
kbuffington committed Feb 16, 2020
1 parent 7ac7a0b commit db7be21
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
18 changes: 17 additions & 1 deletion src/helpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@ namespace mb
{ "", "-" }
};

Release parser(json release, size_t handle_count)
Release parser(json release, size_t handle_count, pfc::stringp discid)
{
Release r;
r.is_various = false;
r.discid = discid;

get_artist_credit(release, r.album_artist, r.albumartistid);

Expand All @@ -43,6 +44,21 @@ namespace mb
json tracks = media.value("tracks", json::array());
if (complete || tracks.size() == handle_count)
{
if (r.discid.get_length())
{
bool found = false;
auto discs = media.value("discs", json::array());
for (auto& disc : discs)
{
if (to_str(disc["id"]).equals(r.discid))
{
found = true;
break;
}
}
if (!found) continue;
}

if (!complete) r.partial_lookup_matches++;

str8 format = to_str(media["format"]);
Expand Down
2 changes: 1 addition & 1 deletion src/helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ namespace mb
"Pseudo-Release"
};

Release parser(json release, size_t handle_count);
Release parser(json release, size_t handle_count, pfc::stringp discid = "");
bool is_uuid(pfc::stringp mbid);
size_t get_status_index(pfc::stringp str);
size_t get_type_index(pfc::stringp str);
Expand Down
3 changes: 1 addition & 2 deletions src/request_thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ namespace mb
json releases = j.value("releases", json::array());
for (const auto& release : releases)
{
Release r = parser(release, handle_count);
r.discid = discid;
Release r = parser(release, handle_count, discid);
if (r.tracks.size())
{
m_release_list.emplace_back(r);
Expand Down

0 comments on commit db7be21

Please sign in to comment.