diff --git a/website/artist.py b/website/artist.py index 596b1a6..c3903e0 100644 --- a/website/artist.py +++ b/website/artist.py @@ -11,7 +11,7 @@ def replacedict(keys,dbport): imgurl = info.get("image") #desc = info.get("info") - response = urllib.request.urlopen("http://localhost:" + str(dbport) + "/artistinfo?artist=" + urllib.parse.quote(keys["artist"])) + response = urllib.request.urlopen("http://[::1]:" + str(dbport) + "/artistinfo?artist=" + urllib.parse.quote(keys["artist"])) db_data = json.loads(response.read()) scrobbles = str(db_data["scrobbles"]) pos = "#" + str(db_data["position"]) @@ -29,7 +29,7 @@ def replacedict(keys,dbport): - response = urllib.request.urlopen("http://localhost:" + str(dbport) + "/charts/tracks?artist=" + urllib.parse.quote(keys["artist"])) + response = urllib.request.urlopen("http://[::1]:" + str(dbport) + "/charts/tracks?artist=" + urllib.parse.quote(keys["artist"])) db_data = json.loads(response.read()) if db_data["list"] != []: maxbar = db_data["list"][0]["scrobbles"] diff --git a/website/issues.py b/website/issues.py index 0f996be..18c3893 100644 --- a/website/issues.py +++ b/website/issues.py @@ -4,7 +4,7 @@ from htmlgenerators import artistLink def replacedict(keys,dbport): - response = urllib.request.urlopen("http://localhost:" + str(dbport) + "/issues") + response = urllib.request.urlopen("http://[::1]:" + str(dbport) + "/issues") db_data = json.loads(response.read()) i = 0 diff --git a/website/scrobbles.py b/website/scrobbles.py index 995c620..c36c132 100644 --- a/website/scrobbles.py +++ b/website/scrobbles.py @@ -11,7 +11,7 @@ def replacedict(keys,dbport): limitkeys = pickKeys(keys,"artist","title","associated") # Get scrobble data - response = urllib.request.urlopen("http://localhost:" + str(dbport) + "/scrobbles?" + keysToUrl(limitkeys,timekeys)) + response = urllib.request.urlopen("http://[::1]:" + str(dbport) + "/scrobbles?" + keysToUrl(limitkeys,timekeys)) db_data = json.loads(response.read()) scrobbles = db_data["list"] @@ -24,7 +24,7 @@ def replacedict(keys,dbport): elif keys.get("artist") is not None: limitstring += "by " + artistLink(keys.get("artist")) if keys.get("associated") is not None: - response = urllib.request.urlopen("http://localhost:" + str(dbport) + "/artistinfo?artist=" + urllib.parse.quote(keys["artist"])) + response = urllib.request.urlopen("http://[::1]:" + str(dbport) + "/artistinfo?artist=" + urllib.parse.quote(keys["artist"])) db_data = json.loads(response.read()) moreartists = db_data["associated"] if moreartists != []: diff --git a/website/start.py b/website/start.py index 88c3559..c2929c8 100644 --- a/website/start.py +++ b/website/start.py @@ -26,7 +26,8 @@ def replacedict(keys,dbport): # get chart data # artists - response = urllib.request.urlopen("http://localhost:" + str(dbport) + "/charts/artists") + print("REQUESTING " + "http://[::1]:" + str(dbport) + "/charts/artists") + response = urllib.request.urlopen("http://[::1]:" + str(dbport) + "/charts/artists") db_data = json.loads(response.read()) charts = db_data["list"][:max_show] topartist = charts[0]["artist"] @@ -40,7 +41,7 @@ def replacedict(keys,dbport): # tracks - response = urllib.request.urlopen("http://localhost:" + str(dbport) + "/charts/tracks") + response = urllib.request.urlopen("http://[::1]:" + str(dbport) + "/charts/tracks") db_data = json.loads(response.read()) charts = db_data["list"][:max_show] @@ -55,7 +56,7 @@ def replacedict(keys,dbport): # get scrobbles - response = urllib.request.urlopen("http://localhost:" + str(dbport) + "/scrobbles?max=50") + response = urllib.request.urlopen("http://[::1]:" + str(dbport) + "/scrobbles?max=50") db_data = json.loads(response.read()) scrobblelist = db_data["list"] scrobbletrackobjects = scrobblelist #ignore the extra time attribute, the format should still work @@ -70,23 +71,24 @@ def replacedict(keys,dbport): # get stats - response = urllib.request.urlopen("http://localhost:" +str(dbport) + "/numscrobbles?since=today") + response = urllib.request.urlopen("http://[::1]:" +str(dbport) + "/numscrobbles?since=today") stats = json.loads(response.read()) scrobbles_today = "" + str(stats["amount"]) + "" - response = urllib.request.urlopen("http://localhost:" +str(dbport) + "/numscrobbles?since=month") + response = urllib.request.urlopen("http://[::1]:" +str(dbport) + "/numscrobbles?since=month") stats = json.loads(response.read()) scrobbles_month = "" + str(stats["amount"]) + "" - response = urllib.request.urlopen("http://localhost:" +str(dbport) + "/numscrobbles?since=year") + response = urllib.request.urlopen("http://[::1]:" +str(dbport) + "/numscrobbles?since=year") stats = json.loads(response.read()) scrobbles_year = "" + str(stats["amount"]) + "" - response = urllib.request.urlopen("http://localhost:" +str(dbport) + "/numscrobbles") + response = urllib.request.urlopen("http://[::1]:" +str(dbport) + "/numscrobbles") stats = json.loads(response.read()) scrobbles_total = "" + str(stats["amount"]) + "" - + + t1.join() t2.join() t3.join() diff --git a/website/topartists.py b/website/topartists.py index b718a20..0f6e07a 100644 --- a/website/topartists.py +++ b/website/topartists.py @@ -11,7 +11,7 @@ def replacedict(keys,dbport): limitkeys = pickKeys(keys) # get chart data - response = urllib.request.urlopen("http://localhost:" + str(dbport) + "/charts/artists?" + keysToUrl(timekeys,limitkeys)) + response = urllib.request.urlopen("http://[::1]:" + str(dbport) + "/charts/artists?" + keysToUrl(timekeys,limitkeys)) db_data = json.loads(response.read()) charts = db_data["list"][:50] topartist = charts[0]["artist"] @@ -20,7 +20,7 @@ def replacedict(keys,dbport): imgurl = info.get("image") # get total amount of scrobbles - response = urllib.request.urlopen("http://localhost:" + str(dbport) + "/scrobbles?" + keysToUrl(timekeys,limitkeys)) + response = urllib.request.urlopen("http://[::1]:" + str(dbport) + "/scrobbles?" + keysToUrl(timekeys,limitkeys)) db_data = json.loads(response.read()) scrobblelist = db_data["list"] scrobbles = len(scrobblelist) diff --git a/website/toptracks.py b/website/toptracks.py index db1e1c8..5887d32 100644 --- a/website/toptracks.py +++ b/website/toptracks.py @@ -11,7 +11,7 @@ def replacedict(keys,dbport): limitkeys = pickKeys(keys,"artist") # get chart data - response = urllib.request.urlopen("http://localhost:" + str(dbport) + "/charts/tracks?" + keysToUrl(timekeys,limitkeys)) + response = urllib.request.urlopen("http://[::1]:" + str(dbport) + "/charts/tracks?" + keysToUrl(timekeys,limitkeys)) db_data = json.loads(response.read()) charts = db_data["list"][:50] limitstring = "" @@ -30,7 +30,7 @@ def replacedict(keys,dbport): # get total amount of scrobbles - response = urllib.request.urlopen("http://localhost:" + str(dbport) + "/scrobbles?" + keysToUrl(timekeys,limitkeys)) + response = urllib.request.urlopen("http://[::1]:" + str(dbport) + "/scrobbles?" + keysToUrl(timekeys,limitkeys)) db_data = json.loads(response.read()) scrobblelist = db_data["list"] scrobbles = len(scrobblelist) diff --git a/website/track.py b/website/track.py index a623eec..126282f 100644 --- a/website/track.py +++ b/website/track.py @@ -12,13 +12,13 @@ def replacedict(keys,dbport): imgurl = info.get("image") desc = info.get("info") - response = urllib.request.urlopen("http://localhost:" + str(dbport) + "/trackinfo?" + keysToUrl(limitkeys)) + response = urllib.request.urlopen("http://[::1]:" + str(dbport) + "/trackinfo?" + keysToUrl(limitkeys)) db_data = json.loads(response.read()) scrobblesnum = str(db_data["scrobbles"]) pos = "#" + str(db_data["position"]) - response = urllib.request.urlopen("http://localhost:" + str(dbport) + "/scrobbles?" + keysToUrl(limitkeys)) + response = urllib.request.urlopen("http://[::1]:" + str(dbport) + "/scrobbles?" + keysToUrl(limitkeys)) db_data = json.loads(response.read()) scrobbles = db_data["list"]