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
d23a2d93
Commit
d23a2d93
authored
13 years ago
by
ale
Browse files
Options
Downloads
Patches
Plain Diff
add a --apply option (default to dry run, no files removed) for the deduper
parent
6d0d09b6
Branches
Branches containing commit
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
+7
-5
7 additions, 5 deletions
server/djrandom/fingerprint/dedup.py
with
7 additions
and
5 deletions
server/djrandom/fingerprint/dedup.py
+
7
−
5
View file @
d23a2d93
...
...
@@ -51,10 +51,11 @@ class DeDuper(object):
if
title
:
data
[
"
track
"
]
=
title
return
data
def
dedupe
(
self
):
def
dedupe
(
self
,
dry_run
=
True
):
self
.
_ingest
()
self
.
_scan_for_dupes
()
self
.
_cleanup
()
if
not
dry_run
:
self
.
_cleanup
()
def
_ingest
(
self
):
self
.
codes
=
{}
...
...
@@ -220,15 +221,16 @@ class DeDuper(object):
Session
.
commit
()
def
run_deduper
(
db_url
):
def
run_deduper
(
db_url
,
dry_run
):
init_db
(
db_url
)
dup
=
DeDuper
()
dup
.
dedupe
()
dup
.
dedupe
(
dry_run
)
def
main
():
parser
=
optparse
.
OptionParser
()
parser
.
add_option
(
'
--db_url
'
)
parser
.
add_option
(
'
--apply
'
,
action
=
'
store_true
'
)
daemonize
.
add_standard_options
(
parser
)
utils
.
read_config_defaults
(
parser
,
os
.
getenv
(
'
DJRANDOM_CONF
'
,
'
/etc/djrandom.conf
'
))
...
...
@@ -239,7 +241,7 @@ def main():
parser
.
error
(
'
Too many arguments
'
)
daemonize
.
daemonize
(
opts
,
run_deduper
,
(
opts
.
db_url
,))
(
opts
.
db_url
,
not
opts
.
apply
))
if
__name__
==
'
__main__
'
:
...
...
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