Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
djrandom-py
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ale
djrandom-py
Commits
4d5112d5
Commit
4d5112d5
authored
13 years ago
by
ale
Browse files
Options
Downloads
Patches
Plain Diff
simplify preprocessing for echonest
parent
810d9cb8
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
server/djrandom/fingerprint/dedup.py
+11
-21
11 additions, 21 deletions
server/djrandom/fingerprint/dedup.py
with
11 additions
and
21 deletions
server/djrandom/fingerprint/dedup.py
+
11
−
21
View file @
4d5112d5
...
...
@@ -23,32 +23,22 @@ class DeDuper(object):
self
.
_engine
=
engine
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
a structure that fp.ingest() can deal with.
Taken from
'
fastingest.py
'
, with minor changes.
"""
c
=
json
.
loads
(
jsondata
)
if
"
code
"
not
in
c
:
return
{}
code
=
c
[
"
code
"
]
m
=
c
[
"
metadata
"
]
length
=
m
[
"
duration
"
]
version
=
m
[
"
version
"
]
artist
=
m
.
get
(
"
artist
"
,
None
)
title
=
m
.
get
(
"
title
"
,
None
)
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
c
=
json
.
loads
(
echoprint_fp
)
if
'
code
'
not
in
c
:
return
None
decoded
=
fp
.
decode_code_string
(
c
[
'
code
'
])
m
=
c
[
'
metadata
'
]
data
=
{
'
track_id
'
:
sha1
,
'
fp
'
:
decoded
,
'
length
'
:
m
[
'
duration
'
],
'
codever
'
:
'
%.2f
'
%
m
[
'
version
'
]}
return
data
def
dedupe
(
self
,
dry_run
=
True
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment