Remove (dup id) brackets from names

This commit is contained in:
2022-09-14 01:17:26 +02:00
parent 59da6583b0
commit 8f724a9f0c

View File

@@ -1,6 +1,6 @@
import discogs_client, json, re, urllib.request, os import discogs_client, json, re, urllib.request, os
client = discogs_client.Client('ExampleApplication/0.1', user_token="QwqnxQajRTDmDtmFgDBJCJjbAcyLFzYwPUbuLHrd") client = discogs_client.Client('ExampleApplication/0.1', user_token="")
discogs_id = int(input("Enter Discogs ID: ")) discogs_id = int(input("Enter Discogs ID: "))
band = client.artist(discogs_id) band = client.artist(discogs_id)
@@ -18,7 +18,7 @@ def resolve_ref(match):
print(f"Resolving {match.group()} => ", end="") print(f"Resolving {match.group()} => ", end="")
ref = client.artist(int(match.group()[2:-1])) ref = client.artist(int(match.group()[2:-1]))
print(f"{ref.name}") print(f"{ref.name}")
return ref.name return ref.name.split(" (")[0]
def sanitize_path(path): def sanitize_path(path):
return path.replace(" ", "_") return path.replace(" ", "_")
@@ -54,7 +54,7 @@ for member in band.members:
member = { member = {
'id': member.id, 'id': member.id,
'bandId': discogs_id, 'bandId': discogs_id,
'name': member.name, 'name': member.name.split(" (")[0],
'description': profile, 'description': profile,
'imageIdentifier': image_path, 'imageIdentifier': image_path,
'enabled': 0 'enabled': 0