scene release to discogs release
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
929B

  1. #!/usr/bin/env -S jq -fMr
  2. def format_as_deezer_record_type($format):
  3. $format | ascii_upcase |
  4. if . == "SINGLE-WEB" then
  5. "single"
  6. elif . == "CDS" then
  7. "single"
  8. elif . == "CDM" then
  9. "single"
  10. elif . == "CDEP" then
  11. "ep"
  12. elif . == "EP-WEB" then
  13. "ep"
  14. elif . == "EP" then
  15. "ep"
  16. elif . == "WEB" then
  17. "album"
  18. elif . == "2CD" then
  19. "album"
  20. elif . == "CD" then
  21. "album"
  22. else
  23. null
  24. end;
  25. if .total == 1 then
  26. [._scene_release_name, .data[0].cover_xl ]
  27. elif .total > 1 then
  28. ._scene_release_name as $rls |
  29. format_as_deezer_record_type(._format) as $record_type |
  30. if $record_type != null then
  31. # alternate to empty if there is no matching record type
  32. .data | map(select(.record_type == $record_type))[0]//empty | [$rls, .cover_xl]
  33. else
  34. empty
  35. end
  36. else
  37. empty
  38. end | @tsv