#!/usr/bin/env python
# Copyright Todd Korody 2007
# Licensed under the GPLv2
# http://www.gnu.org/copyleft/gpl.html
import core, sys, os
from optparse import OptionParser
class WriteOut:
"Class to pass to Find_Dup to make generic between GTK and console"
def __init__(self):
self.i = 1
def write(self,filename,bitrate,length,size):
print filename + " " + str(bitrate / 1000) + "Kbps, " + str(int(length)) + "secs, " + str(round(size/1048576.,2)) + "MB"
def write_seperator(self):
print "--------------------------------------------------"
parser = OptionParser()
parser = OptionParser(usage="%prog [-h] [-f] [-c] [-r] [-p] [mp3/ogg/flac directory] [mp3/ogg/flac directory] [mp3/ogg/flac directory]", version="%prog 2.3")
parser.add_option("-f", "--filesize", dest="filesize", action="store_true",
help="Compare FileSizes (Not Recommended)")
parser.add_option("-r", "--recursive", action="store_true", help="Recurse Into All Directories")
parser.add_option("-c", "--count", dest="count", action="store_true",
help="Count Files that have 0 letters things in common as hits")
parser.add_option("-p", "--paranoid", action="store_true", dest="paranoid",
help="Parnoid Mode (Will Increase False Positives)")
(options, args) = parser.parse_args()
output = WriteOut()
find = core.DMMCore(output)
if options.paranoid == True:
print "Paranoid On"
find.set_rate(0.3)
if options.recursive == True:
print "Recursive On"
find.set_recursive(True)
if options.count == True:
print "Count On"
find.set_count(True)
if options.filesize == True:
print "Filesize Checking On"
find.set_filesize(True)
if args == []:
print "Error you need at least one directory to search"
sys.exit(1)
for direc in args:
if not os.path.isdir(direc):
print direc + " is an INVALID directory!"
sys.exit(1)
find.add_dir(os.path.realpath(direc))
print "Possible Duplicates Are:"
find.run(output)