Remove ContentsAusio scan type

It had few uses and had a confusing name. People though it did fuzzy
audio data matching, which it does not.
This commit is contained in:
Virgil Dupras 2016-06-06 17:08:41 -04:00
parent 61b219ff43
commit 13fb06a693
4 changed files with 2 additions and 38 deletions

View File

@ -80,7 +80,6 @@ http://www.gnu.org/licenses/gpl-3.0.html
VTIsIntIn *vtScanTypeIsFuzzy = [[[VTIsIntIn alloc] initWithValues:i reverse:NO] autorelease];
[NSValueTransformer setValueTransformer:vtScanTypeIsFuzzy forName:@"vtScanTypeIsFuzzy"];
i = [NSMutableIndexSet indexSetWithIndex:4];
[i addIndex:5];
VTIsIntIn *vtScanTypeIsNotContent = [[[VTIsIntIn alloc] initWithValues:i reverse:YES] autorelease];
[NSValueTransformer setValueTransformer:vtScanTypeIsNotContent forName:@"vtScanTypeMusicIsNotContent"];
VTIsIntIn *vtScanTypeIsTag = [[[VTIsIntIn alloc] initWithValues:[NSIndexSet indexSetWithIndex:3] reverse:NO] autorelease];

View File

@ -21,7 +21,6 @@ class ScannerME(ScannerBase):
ScanOption(ScanType.FieldsNoOrder, tr("Filename - Fields (No Order)")),
ScanOption(ScanType.Tag, tr("Tags")),
ScanOption(ScanType.Contents, tr("Contents")),
ScanOption(ScanType.ContentsAudio, tr("Audio Contents")),
]

View File

@ -26,7 +26,6 @@ class ScanType:
Tag = 3
Folders = 4
Contents = 5
ContentsAudio = 6
#PE
FuzzyBlock = 10
@ -78,11 +77,8 @@ class Scanner:
for f in j.iter_with_progress(files, tr("Read size of %d/%d files")):
f.size # pre-read, makes a smoother progress if read here (especially for bundles)
files = [f for f in files if f.size >= self.size_threshold]
if self.scan_type in {ScanType.Contents, ScanType.ContentsAudio, ScanType.Folders}:
sizeattr = 'audiosize' if self.scan_type == ScanType.ContentsAudio else 'size'
return engine.getmatches_by_contents(
files, sizeattr, partial=self.scan_type == ScanType.ContentsAudio, j=j
)
if self.scan_type in {ScanType.Contents, ScanType.Folders}:
return engine.getmatches_by_contents(files, sizeattr='size', partial=False, j=j)
else:
j = j.start_subjob([2, 8])
kw = {}

View File

@ -306,36 +306,6 @@ def test_tag_scan_non_ascii(fake_fileexists):
raise AssertionError()
eq_(len(r), 1)
def test_audio_content_scan(fake_fileexists):
s = Scanner()
s.scan_type = ScanType.ContentsAudio
f = [no('foo'), no('bar'), no('bleh')]
f[0].md5 = 'foo'
f[1].md5 = 'bar'
f[2].md5 = 'bleh'
f[0].md5partial = 'foo'
f[1].md5partial = 'foo'
f[2].md5partial = 'bleh'
f[0].audiosize = 1
f[1].audiosize = 1
f[2].audiosize = 1
r = s.get_dupe_groups(f)
eq_(len(r), 1)
eq_(len(r[0]), 2)
def test_audio_content_scan_compare_sizes_first(fake_fileexists):
class MyFile(no):
@property
def md5partial(file):
raise AssertionError()
s = Scanner()
s.scan_type = ScanType.ContentsAudio
f = [MyFile('foo'), MyFile('bar')]
f[0].audiosize = 1
f[1].audiosize = 2
eq_(len(s.get_dupe_groups(f)), 0)
def test_ignore_list(fake_fileexists):
s = Scanner()
f1 = no('foobar')