2010-01-01 20:11:34 +00:00
|
|
|
# Copyright 2010 Hardcoded Software (http://www.hardcoded.net)
|
2009-08-05 08:59:46 +00:00
|
|
|
#
|
|
|
|
# This software is licensed under the "HS" License as described in the "LICENSE" file,
|
|
|
|
# which should be included with this package. The terms are also available at
|
|
|
|
# http://www.hardcoded.net/licenses/hs_license
|
|
|
|
|
2010-01-19 11:28:15 +00:00
|
|
|
from hsutil.cocoa import signature
|
|
|
|
|
2010-02-03 10:55:53 +00:00
|
|
|
from core.app_cocoa_inter import PyDupeGuruBase
|
2009-12-30 10:37:57 +00:00
|
|
|
from core_me.app_cocoa import DupeGuruME
|
|
|
|
from core.scanner import (SCAN_TYPE_FILENAME, SCAN_TYPE_FIELDS, SCAN_TYPE_FIELDS_NO_ORDER,
|
2009-10-23 14:46:00 +00:00
|
|
|
SCAN_TYPE_TAG, SCAN_TYPE_CONTENT, SCAN_TYPE_CONTENT_AUDIO)
|
2009-06-01 09:55:11 +00:00
|
|
|
|
|
|
|
# Fix py2app imports which chokes on relative imports
|
2009-12-30 10:37:57 +00:00
|
|
|
from core_me import app_cocoa, data, fs, scanner
|
2009-06-01 09:55:11 +00:00
|
|
|
from hsmedia import aiff, flac, genres, id3v1, id3v2, mp4, mpeg, ogg, wma
|
|
|
|
|
2010-02-03 10:55:53 +00:00
|
|
|
class PyDupeGuru(PyDupeGuruBase):
|
2009-06-01 09:55:11 +00:00
|
|
|
def init(self):
|
|
|
|
self = super(PyDupeGuru,self).init()
|
2009-10-23 14:46:00 +00:00
|
|
|
self.app = DupeGuruME()
|
2009-06-01 09:55:11 +00:00
|
|
|
return self
|
|
|
|
|
|
|
|
def removeDeadTracks(self):
|
|
|
|
self.app.remove_dead_tracks()
|
|
|
|
|
|
|
|
def scanDeadTracks(self):
|
|
|
|
self.app.scan_dead_tracks()
|
|
|
|
|
|
|
|
#---Information
|
2010-01-19 11:28:15 +00:00
|
|
|
@signature('i@:')
|
2009-06-01 09:55:11 +00:00
|
|
|
def deadTrackCount(self):
|
|
|
|
return len(self.app.dead_tracks)
|
|
|
|
|
|
|
|
#---Properties
|
|
|
|
def setMinMatchPercentage_(self, percentage):
|
|
|
|
self.app.scanner.min_match_percentage = int(percentage)
|
|
|
|
|
|
|
|
def setScanType_(self, scan_type):
|
|
|
|
try:
|
|
|
|
self.app.scanner.scan_type = [
|
2009-10-23 14:46:00 +00:00
|
|
|
SCAN_TYPE_FILENAME,
|
|
|
|
SCAN_TYPE_FIELDS,
|
|
|
|
SCAN_TYPE_FIELDS_NO_ORDER,
|
|
|
|
SCAN_TYPE_TAG,
|
|
|
|
SCAN_TYPE_CONTENT,
|
|
|
|
SCAN_TYPE_CONTENT_AUDIO
|
2009-06-01 09:55:11 +00:00
|
|
|
][scan_type]
|
|
|
|
except IndexError:
|
|
|
|
pass
|
|
|
|
|
|
|
|
def setWordWeighting_(self, words_are_weighted):
|
|
|
|
self.app.scanner.word_weighting = words_are_weighted
|
|
|
|
|
|
|
|
def setMatchSimilarWords_(self, match_similar_words):
|
|
|
|
self.app.scanner.match_similar_words = match_similar_words
|
|
|
|
|
|
|
|
def enable_scanForTag_(self, enable, scan_tag):
|
|
|
|
if enable:
|
|
|
|
self.app.scanner.scanned_tags.add(scan_tag)
|
|
|
|
else:
|
|
|
|
self.app.scanner.scanned_tags.discard(scan_tag)
|
|
|
|
|
|
|
|
#---Registration
|
2010-01-13 08:30:10 +00:00
|
|
|
def appName(self):
|
|
|
|
return "dupeGuru Music Edition"
|
|
|
|
|