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-07-13 06:08:18 +00:00
|
|
|
from hscommon.cocoa import signature
|
2010-01-19 11:28:15 +00:00
|
|
|
|
2010-02-05 19:10:54 +00:00
|
|
|
from core.app_cocoa_inter import PyDupeGuruBase, PyDetailsPanel
|
2009-12-30 10:37:57 +00:00
|
|
|
from core_me.app_cocoa import DupeGuruME
|
2010-08-14 17:52:23 +00:00
|
|
|
from core.scanner import ScanType
|
2009-06-01 09:55:11 +00:00
|
|
|
|
2010-03-01 12:15:27 +00:00
|
|
|
# Fix py2app imports which chokes on relative imports and other stuff
|
2010-08-18 09:37:18 +00:00
|
|
|
import core_me.app_cocoa, core_me.data, core_me.fs, core_me.scanner
|
|
|
|
import hsaudiotag.aiff, hsaudiotag.flac, hsaudiotag.genres, hsaudiotag.id3v1,\
|
|
|
|
hsaudiotag.id3v2, hsaudiotag.mp4, hsaudiotag.mpeg, hsaudiotag.ogg, hsaudiotag.wma
|
2010-07-13 06:08:18 +00:00
|
|
|
from hsaudiotag import aiff, flac, genres, id3v1, id3v2, mp4, mpeg, ogg, wma
|
2010-08-18 09:37:18 +00:00
|
|
|
import hsutil.conflict
|
|
|
|
import core.engine, core.fs, core.app
|
2010-08-15 12:42:55 +00:00
|
|
|
import xml.etree.ElementPath
|
2010-03-01 12:15:27 +00:00
|
|
|
import gzip
|
2010-08-18 09:37:18 +00:00
|
|
|
import aem.kae
|
|
|
|
import appscript.defaultterminology
|
2009-06-01 09:55:11 +00:00
|
|
|
|
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()
|
2010-02-07 14:26:50 +00:00
|
|
|
self.py = DupeGuruME()
|
2009-06-01 09:55:11 +00:00
|
|
|
return self
|
|
|
|
|
|
|
|
def removeDeadTracks(self):
|
2010-02-07 14:26:50 +00:00
|
|
|
self.py.remove_dead_tracks()
|
2009-06-01 09:55:11 +00:00
|
|
|
|
|
|
|
def scanDeadTracks(self):
|
2010-02-07 14:26:50 +00:00
|
|
|
self.py.scan_dead_tracks()
|
2009-06-01 09:55:11 +00:00
|
|
|
|
|
|
|
#---Information
|
2010-01-19 11:28:15 +00:00
|
|
|
@signature('i@:')
|
2009-06-01 09:55:11 +00:00
|
|
|
def deadTrackCount(self):
|
2010-02-07 14:26:50 +00:00
|
|
|
return len(self.py.dead_tracks)
|
2009-06-01 09:55:11 +00:00
|
|
|
|
|
|
|
#---Properties
|
|
|
|
def setMinMatchPercentage_(self, percentage):
|
2010-02-07 14:26:50 +00:00
|
|
|
self.py.scanner.min_match_percentage = int(percentage)
|
2009-06-01 09:55:11 +00:00
|
|
|
|
|
|
|
def setScanType_(self, scan_type):
|
|
|
|
try:
|
2010-02-07 14:26:50 +00:00
|
|
|
self.py.scanner.scan_type = [
|
2010-08-14 17:52:23 +00:00
|
|
|
ScanType.Filename,
|
|
|
|
ScanType.Fields,
|
|
|
|
ScanType.FieldsNoOrder,
|
|
|
|
ScanType.Tag,
|
|
|
|
ScanType.Contents,
|
|
|
|
ScanType.ContentsAudio,
|
2009-06-01 09:55:11 +00:00
|
|
|
][scan_type]
|
|
|
|
except IndexError:
|
|
|
|
pass
|
|
|
|
|
|
|
|
def setWordWeighting_(self, words_are_weighted):
|
2010-02-07 14:26:50 +00:00
|
|
|
self.py.scanner.word_weighting = words_are_weighted
|
2009-06-01 09:55:11 +00:00
|
|
|
|
|
|
|
def setMatchSimilarWords_(self, match_similar_words):
|
2010-02-07 14:26:50 +00:00
|
|
|
self.py.scanner.match_similar_words = match_similar_words
|
2009-06-01 09:55:11 +00:00
|
|
|
|
|
|
|
def enable_scanForTag_(self, enable, scan_tag):
|
|
|
|
if enable:
|
2010-02-07 14:26:50 +00:00
|
|
|
self.py.scanner.scanned_tags.add(scan_tag)
|
2009-06-01 09:55:11 +00:00
|
|
|
else:
|
2010-02-07 14:26:50 +00:00
|
|
|
self.py.scanner.scanned_tags.discard(scan_tag)
|
2009-06-01 09:55:11 +00:00
|
|
|
|
|
|
|
#---Registration
|
2010-01-13 08:30:10 +00:00
|
|
|
def appName(self):
|
|
|
|
return "dupeGuru Music Edition"
|
|
|
|
|