2016-06-02 02:12:27 +00:00
|
|
|
# Copyright 2016 Hardcoded Software (http://www.hardcoded.net)
|
2009-08-05 08:59:46 +00:00
|
|
|
#
|
2015-01-03 21:33:16 +00:00
|
|
|
# This software is licensed under the "GPLv3" License as described in the "LICENSE" file,
|
2009-08-05 08:59:46 +00:00
|
|
|
# which should be included with this package. The terms are also available at
|
2015-01-03 21:33:16 +00:00
|
|
|
# http://www.gnu.org/licenses/gpl-3.0.html
|
2009-08-05 08:59:46 +00:00
|
|
|
|
2012-02-27 15:12:36 +00:00
|
|
|
from hscommon.trans import trget
|
2009-06-01 09:55:11 +00:00
|
|
|
|
2012-01-16 15:30:45 +00:00
|
|
|
from core.scanner import ScanType
|
2016-06-02 02:12:27 +00:00
|
|
|
from core_me.app import DupeGuru as DupeGuruME
|
2013-08-18 14:48:02 +00:00
|
|
|
from .app import PyDupeGuruBase
|
2009-06-01 09:55:11 +00:00
|
|
|
|
2012-02-27 15:12:36 +00:00
|
|
|
tr = trget('ui')
|
|
|
|
|
2012-01-16 15:30:45 +00:00
|
|
|
class PyDupeGuru(PyDupeGuruBase):
|
|
|
|
def __init__(self):
|
|
|
|
self._init(DupeGuruME)
|
|
|
|
|
|
|
|
#---Properties
|
|
|
|
def setMinMatchPercentage_(self, percentage: int):
|
2016-06-02 01:56:18 +00:00
|
|
|
self.model.options['min_match_percentage'] = percentage
|
2012-01-16 15:30:45 +00:00
|
|
|
|
|
|
|
def setScanType_(self, scan_type: int):
|
|
|
|
try:
|
2016-06-02 01:56:18 +00:00
|
|
|
self.model.options['scan_type'] = [
|
2012-01-16 15:30:45 +00:00
|
|
|
ScanType.Filename,
|
|
|
|
ScanType.Fields,
|
|
|
|
ScanType.FieldsNoOrder,
|
|
|
|
ScanType.Tag,
|
|
|
|
ScanType.Contents,
|
|
|
|
ScanType.ContentsAudio,
|
|
|
|
][scan_type]
|
|
|
|
except IndexError:
|
|
|
|
pass
|
|
|
|
|
|
|
|
def setWordWeighting_(self, words_are_weighted: bool):
|
2016-06-02 01:56:18 +00:00
|
|
|
self.model.options['word_weighting'] = words_are_weighted
|
2012-01-16 15:30:45 +00:00
|
|
|
|
|
|
|
def setMatchSimilarWords_(self, match_similar_words: bool):
|
2016-06-02 01:56:18 +00:00
|
|
|
self.model.options['match_similar_words'] = match_similar_words
|
2012-01-16 15:30:45 +00:00
|
|
|
|
|
|
|
def enable_scanForTag_(self, enable: bool, scan_tag: str):
|
2016-06-02 01:56:18 +00:00
|
|
|
if 'scanned_tags' not in self.model.options:
|
|
|
|
self.model.options['scanned_tags'] = set()
|
2012-01-16 15:30:45 +00:00
|
|
|
if enable:
|
2016-06-02 01:56:18 +00:00
|
|
|
self.model.options['scanned_tags'].add(scan_tag)
|
2012-01-16 15:30:45 +00:00
|
|
|
else:
|
2016-06-02 01:56:18 +00:00
|
|
|
self.model.options['scanned_tags'].discard(scan_tag)
|