Skip to content
Snippets Groups Projects
Commit c1bd992f authored by ale's avatar ale
Browse files

Merge branch 'master' of https://git.autistici.org/djrandom

parents 8c0ebe4a 4d5112d5
Branches
No related tags found
No related merge requests found
...@@ -24,32 +24,22 @@ class DeDuper(object): ...@@ -24,32 +24,22 @@ class DeDuper(object):
self._engine = engine self._engine = engine
self._resolver = Resolver() self._resolver = Resolver()
def _generate_code_json(self, jsondata, track_id): def _generate_code_json(self, echoprint_fp, sha1):
"""Parse the JSON string output of echoprint-codegen, and return """Parse the JSON string output of echoprint-codegen, and return
a structure that fp.ingest() can deal with. a structure that fp.ingest() can deal with.
Taken from 'fastingest.py', with minor changes. Taken from 'fastingest.py', with minor changes.
""" """
c = json.loads(jsondata) c = json.loads(echoprint_fp)
if "code" not in c: if 'code' not in c:
return {} return None
code = c["code"] decoded = fp.decode_code_string(c['code'])
m = c["metadata"] m = c['metadata']
length = m["duration"] data = {'track_id': sha1,
version = m["version"] 'fp': decoded,
artist = m.get("artist", None) 'length': m['duration'],
title = m.get("title", None) 'codever': '%.2f' % m['version']}
release = m.get("release", None)
decoded = fp.decode_code_string(code)
data = {"track_id": track_id,
"fp": decoded,
"length": length,
"codever": "%.2f" % version}
if artist: data["artist"] = artist
if release: data["release"] = release
if title: data["track"] = title
return data return data
def dedupe(self, dry_run=True): def dedupe(self, dry_run=True):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment