Samik081 / beets-beatport4

Beatport API v4 compatible beets plugin
MIT License
26 stars 2 forks source link

no match for release with more than 10 tracks ? #8

Closed flovanc closed 1 year ago

flovanc commented 1 year ago

hello, am i alone to have unmatched track for release with more than 10 tracks ?


/home/xxxx/rclone/multimedia/music/bylabel/BPitch Control/(2000) Paul Kalkbrenner - Superimpose (13 items)

Tagging:
    Paul Kalkbrenner - Superimpose
URL:
    https://beatport.com/release/superimpose/12245
(Similarity: 87.9%) (tracks, year, unmatched tracks) (Beatport, Digital, 2001, Bpitch, BPC016)
 * Krank
 * Feature Me    -> Feature Me  (index)
 * La Force      -> La Force  (index)
 * Seaquest      -> Seaquest  (index)
 * Accès Rapide  -> Acces Rapide  (index)
 * Wasser        -> Wasser  (index)
 * Mono Play     -> Mono Play (index)
 * Far Away      -> Far away  (index)
 * Radius      -> Radius  (index)
 * Tag 407      -> Tag 407 (index)
Unmatched tracks (3):
 ! Rubin    (#11) (6:07)
 ! Kurz     (#12) (3:41)
 ! Gia 2000 (#13) (5:08)
[A]pply, More candidates, Skip, Use as-is, as Tracks, Group albums,
Enter search, enter Id, aBort? 
Samik081 commented 1 year ago

Hey @flovanc, thank you for spotting this issue! I confirm, that's not only you, I've successfully recreated this output. I will be taking a look at this soon :)

Samik081 commented 1 year ago

Hey @flovanc, unfortunately, looks like it's a Beatport related issue :/ For every track in this release, the number field is 1. The workaround for this kind of issues could be to try indexing the tracks by their order they appear in the /release/{id} response, but I am not sure if they actually return them in the correct order there. Basically, that's what the number fshould be for :(

I will check it and if it could work, I will try to implement a workaround in case of Beatport returns 1 for every track, like in this case.

Btw. have you had similar issues as this? I am wondering if this is something that often happens in their API..

This is an example JSON response for track #10 Tag 407 (you can try it yourself at Beatport docs page: https://api.beatport.com/v4/docs/catalog/releases/%7Bid%7D/, https://api.beatport.com/v4/docs/catalog/tracks/%7Bid%7D/):

{
  "artists": [
    {
      "id": 6261,
      "image": {
        "id": 3067956,
        "uri": "https://geo-media.beatport.com/image_size/590x404/58527dfb-9686-4187-a5ab-202d3d2a8cbf.jpg",
        "dynamic_uri": "https://geo-media.beatport.com/image_size/{w}x{h}/58527dfb-9686-4187-a5ab-202d3d2a8cbf.jpg"
      },
      "name": "Paul Kalkbrenner",
      "slug": "paul-kalkbrenner",
      "url": "https://api.beatport.com/v4/catalog/artists/6261/"
    }
  ],
  "audio_format": null,
  "available_worldwide": true,
  "bpm": 68,
  "catalog_number": "BPC016",
  "current_status": {
    "id": 10,
    "name": "General Content",
    "url": "https://api.beatport.com/v4/auxiliary/current-status/10/"
  },
  "desc": "",
  "enabled": true,
  "encode_status": "CONVERTED",
  "encoded_date": "2005-04-26T00:00:00-06:00",
  "exclusive": false,
  "exclusive_period": {
    "days": 0,
    "description": "Not exclusive",
    "id": 1,
    "url": "https://api.beatport.com/v4/auxiliary/exclusive-period/1/"
  },
  "free_downloads": [],
  "free_download_start_date": null,
  "free_download_end_date": null,
  "genre": {
    "id": 6,
    "name": "Techno (Peak Time / Driving)",
    "slug": "techno-peak-time-driving",
    "url": "https://api.beatport.com/v4/catalog/genres/6/"
  },
  "hidden": false,
  "id": 34236,
  "image": {
    "id": 2475285,
    "uri": "https://geo-media.beatport.com/image_size/1500x250/897710df-8642-45f8-9041-c532fba29061.png",
    "dynamic_uri": "https://geo-media.beatport.com/image_size/{w}x{h}/897710df-8642-45f8-9041-c532fba29061.png"
  },
  "is_available_for_streaming": true,
  "is_classic": false,
  "isrc": null,
  "key": {
    "camelot_number": 11,
    "camelot_letter": "B",
    "chord_type": {
      "id": 2,
      "name": "Major",
      "url": "https://api.beatport.com/v4/catalog/chord-types/2/"
    },
    "id": 23,
    "is_sharp": false,
    "is_flat": false,
    "letter": "A",
    "name": "A Major",
    "url": "https://api.beatport.com/v4/catalog/keys/23/"
  },
  "label_track_identifier": "",
  "length": "5:17",
  "length_ms": 317640,
  "mix_name": "Original Mix",
  "name": "Tag 407",
  "new_release_date": "2001-03-19",
  "number": 1,
  "pre_order": false,
  "pre_order_date": null,
  "price": {
    "code": "EUR",
    "symbol": "€",
    "value": 1.29,
    "display": "€1.29"
  },
  "publish_date": "2001-03-19",
  "publish_status": "published",
  "release": {
    "id": 12245,
    "name": "Superimpose",
    "image": {
      "id": 7424225,
      "uri": "https://geo-media.beatport.com/image_size/500x500/44467669-3cdd-4dcd-a7ad-3519bb59e798.jpg",
      "dynamic_uri": "https://geo-media.beatport.com/image_size/{w}x{h}/44467669-3cdd-4dcd-a7ad-3519bb59e798.jpg"
    },
    "label": {
      "id": 788,
      "name": "Bpitch",
      "image": {
        "id": 21010970,
        "uri": "https://geo-media.beatport.com/image_size/500x500/bdb0f8b1-90e4-479f-84b0-cf2ee8429bbb.jpg",
        "dynamic_uri": "https://geo-media.beatport.com/image_size/{w}x{h}/bdb0f8b1-90e4-479f-84b0-cf2ee8429bbb.jpg"
      },
      "slug": "bpitch"
    },
    "slug": "superimpose"
  },
  "remixers": [],
  "sale_type": {
    "id": 1,
    "name": "purchase",
    "url": "https://api.beatport.com/v4/auxiliary/sale-types/1/"
  },
  "sample_url": "https://geo-samples.beatport.com/track/931185f0-5b43-4f10-a496-c0d00184b2d3.LOFI.mp3",
  "sample_start_ms": 127056,
  "sample_end_ms": 247056,
  "slug": "tag-407",
  "sub_genre": null,
  "was_ever_exclusive": false,
  "is_hype": false
}
flovanc commented 1 year ago

yes but every release whit more than 10 tracks unmatch , even those with good track id .

`/home/xxxx/rclone/multimedia/music/bylabel/BPitch`` Control/(2007) Modeselektor - Happy Birthday! (18 items)

Correcting tags from:
    Modeselektor - Happy Birthday!
To:
    Modeselektor, Thom Yorke - Happy Birthday
URL:
    https://beatport.com/release/happy-birthday/72912
(Similarity: 91.0%) (artist, unmatched tracks, tracks) (Beatport, Digital, 2007, Bpitch, BPC159)
 * Happy Birthday!           -> Happy Birthday
 * Godspeed
 * 2000007                   -> 2000007 feat. TTC (title)
 * Let Your Love Grow        -> Let Your Love Grow (Moderat feat. Paul St. Hilaire) (title)
 * Em Ocean
 * Suckerpin
 * Edgar
 * Hyper Hyper               -> Hyper Hyper feat. Otto Von Schirach (title)
 * B.M.I.
 * The Dark Side of the Frog -> The Dark Side Of The Frog
Unmatched tracks (8):
 ! The Dark Side of the Sun      (#11) (3:34)
 ! Déboutonner                   (#12) (4:23)
 ! The Black Block               (#13) (5:41)
 ! The First Rebirth             (#14) (4:39)
 ! The White Flash               (#15) (4:49)
 ! Late Check-Out                (#16) (0:38)
 ! The Wedding Toccata Theme     (#17) (3:53)
 ! (I Can't Sleep) Without Music (#18) (3:32)
[A]pply, More candidates, Skip, Use as-is, as Tracks, Group albums,
Enter search, enter Id, aBort? ``

Headers
{
  "allow": "GET, PUT, PATCH, DELETE, HEAD, OPTIONS",
  "alt-svc": "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000",
  "content-encoding": "gzip",
  "content-type": "application/json",
  "date": "Wed, 18 Jan 2023 13:30:22 GMT",
  "referrer-policy": "same-origin",
  "server": "envoy",
  "vary": "Origin, Authorization",
  "via": "1.1 google",
  "x-content-type-options": "nosniff",
  "x-envoy-upstream-service-time": "134",
  "x-frame-options": "DENY"
}
Response: 200 ()
{
  "artists": [
    {
      "id": 6256,
      "image": {
        "id": 21243757,
        "uri": "https://geo-media.beatport.com/image_size/590x404/90cd1eff-2699-4d0b-b5b1-89b0eaa6f442.jpg",
        "dynamic_uri": "https://geo-media.beatport.com/image_size/{w}x{h}/90cd1eff-2699-4d0b-b5b1-89b0eaa6f442.jpg"
      },
      "name": "Modeselektor",
      "slug": "modeselektor",
      "url": "https://api.beatport.com/v4/catalog/artists/6256/"
    }
  ],
  "audio_format": null,
  "available_worldwide": true,
  "bpm": 100,
  "catalog_number": "BPC159",
  "current_status": {
    "id": 10,
    "name": "General Content",
    "url": "https://api.beatport.com/v4/auxiliary/current-status/10/"
  },
  "desc": "REPLACEMENT",
  "enabled": true,
  "encode_status": "CONVERTED",
  "encoded_date": "2007-09-07T07:44:53-06:00",
  "exclusive": false,
  "exclusive_period": {
    "days": 0,
    "description": "Not exclusive",
    "id": 1,
    "url": "https://api.beatport.com/v4/auxiliary/exclusive-period/1/"
  },
  "free_downloads": [],
  "free_download_start_date": null,
  "free_download_end_date": null,
  "genre": {
    "id": 38,
    "name": "Trap / Wave",
    "slug": "trap-wave",
    "url": "https://api.beatport.com/v4/catalog/genres/38/"
  },
  "hidden": false,
  "id": 375410,
  "image": {
    "id": 2123451,
    "uri": "https://geo-media.beatport.com/image_size/1500x250/f99f849b-ae54-434e-8969-d95919ac8876.png",
    "dynamic_uri": "https://geo-media.beatport.com/image_size/{w}x{h}/f99f849b-ae54-434e-8969-d95919ac8876.png"
  },
  "is_available_for_streaming": true,
  "is_classic": false,
  "isrc": null,
  "key": {
    "camelot_number": 3,
    "camelot_letter": "B",
    "chord_type": {
      "id": 2,
      "name": "Major",
      "url": "https://api.beatport.com/v4/catalog/chord-types/2/"
    },
    "id": 15,
    "is_sharp": false,
    "is_flat": true,
    "letter": "D",
    "name": "Db Major",
    "url": "https://api.beatport.com/v4/catalog/keys/15/"
  },
  "label_track_identifier": "",
  "length": "3:34",
  "length_ms": 214813,
  "mix_name": "Original Mix",
  "name": "The Dark Side Of The Sun feat. Puppetmastaz",
  "new_release_date": "2007-09-10",
  "number": 11,
  "pre_order": false,
  "pre_order_date": null,
  "price": {
    "code": "EUR",
    "symbol": "€",
    "value": 1.29,
    "display": "€1.29"
  },
  "publish_date": "2007-09-10",
  "publish_status": "published",
  "release": {
    "id": 72912,
    "name": "Happy Birthday",
    "image": {
      "id": 7448734,
      "uri": "https://geo-media.beatport.com/image_size/500x500/3689da16-7c5d-42a6-837f-5f0ef3030e00.jpg",
      "dynamic_uri": "https://geo-media.beatport.com/image_size/{w}x{h}/3689da16-7c5d-42a6-837f-5f0ef3030e00.jpg"
    },
    "label": {
      "id": 788,
      "name": "Bpitch",
      "image": {
        "id": 21010970,
        "uri": "https://geo-media.beatport.com/image_size/500x500/bdb0f8b1-90e4-479f-84b0-cf2ee8429bbb.jpg",
        "dynamic_uri": "https://geo-media.beatport.com/image_size/{w}x{h}/bdb0f8b1-90e4-479f-84b0-cf2ee8429bbb.jpg"
      },
      "slug": "bpitch"
    },
    "slug": "happy-birthday"
  },
  "remixers": [],
  "sale_type": {
    "id": 1,
    "name": "purchase",
    "url": "https://api.beatport.com/v4/auxiliary/sale-types/1/"
  },
  "sample_url": "https://geo-samples.beatport.com/track/0a62740f-35ca-4491-bb5c-361c9675ceaa.LOFI.mp3",
  "sample_start_ms": 85925,
  "sample_end_ms": 205925,
  "slug": "the-dark-side-of-the-sun-feat-puppetmastaz",
  "sub_genre": null,
  "was_ever_exclusive": true,
  "is_hype": false
}
Samik081 commented 1 year ago

You are absolutely right, this was the other issue. It was about invalid perPage query parameter for release tracks, which should be per_page instead. Because of this, Beatport returned only 10 tracks in a response. I have fixed that in https://github.com/Samik081/beets-beatport4/commit/58092cac458a1787763946984f0c507d3acf20c5

Please, upgrade to v0.3.2 and see if it works for you :)

flovanc commented 1 year ago

it Works 😉