From 13fb06a693047d151e5890ce120643708603661d Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Mon, 6 Jun 2016 17:08:41 -0400 Subject: [PATCH] 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. --- cocoa/AppDelegate.m | 1 - core/me/scanner.py | 1 - core/scanner.py | 8 ++------ core/tests/scanner_test.py | 30 ------------------------------ 4 files changed, 2 insertions(+), 38 deletions(-) diff --git a/cocoa/AppDelegate.m b/cocoa/AppDelegate.m index 864645f0..c741fbff 100644 --- a/cocoa/AppDelegate.m +++ b/cocoa/AppDelegate.m @@ -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]; diff --git a/core/me/scanner.py b/core/me/scanner.py index 69fc2e21..edea14fb 100644 --- a/core/me/scanner.py +++ b/core/me/scanner.py @@ -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")), ] diff --git a/core/scanner.py b/core/scanner.py index 2397a084..e5bb84a1 100644 --- a/core/scanner.py +++ b/core/scanner.py @@ -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 = {} diff --git a/core/tests/scanner_test.py b/core/tests/scanner_test.py index dc1e8998..5be9b83d 100644 --- a/core/tests/scanner_test.py +++ b/core/tests/scanner_test.py @@ -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')