@@ -31,6 +31,12 @@ public class DeDuplicateFileCommand : ICommand
3131 IsRequired = false ,
3232 EnvironmentVariable = "DEDUPLICATE_ACCURACY" ) ]
3333 public int Accuracy { get ; set ; } = 98 ;
34+
35+ [ CommandOption ( "acoustfingerprint-accuracy" ,
36+ Description = "Acoust Fingerprint matching accuracy, 99% is recommended, 98% and lower can mismatch real fast, think of remixes etc" ,
37+ IsRequired = false ,
38+ EnvironmentVariable = "DEDUPLICATE_ACOUSTFINGERPRINT_ACCURACY" ) ]
39+ public int AcoustFingerprintAccuracy { get ; set ; } = 99 ;
3440
3541 [ CommandOption ( "extensions" , 'e' ,
3642 Description = "Extensions to keep, in order, first found extension is kept (extensions must be without '.')" ,
@@ -62,10 +68,14 @@ public class DeDuplicateFileCommand : ICommand
6268 EnvironmentVariable = "DEDUPLICATE_CHECK_ALBUM_EXTENSIONS" ) ]
6369 public bool CheckAlbumExtensions { get ; set ; } = false ;
6470
71+ [ CommandOption ( "check-album-extensions-acoustfingerprint" ,
72+ Description = "Similar to --check-extensions with the difference of better support for multi-drive / MergerFS Setups, --check-extensions checks the full path, this option checks per album" ,
73+ IsRequired = false ,
74+ EnvironmentVariable = "DEDUPLICATE_CHECK_ALBUM_EXTENSIONS_ACOUSTFINGERPRINT" ) ]
75+ public bool CheckAlbumExtensionsAcoustFingerprint { get ; set ; } = false ;
76+
6577 public async ValueTask ExecuteAsync ( IConsole console )
6678 {
67- var handler = new DeDuplicateFileCommandHandler ( ConnectionString ) ;
68-
6979 if ( Accuracy <= 50 )
7080 {
7181 Console . WriteLine ( "50% or lower accuracy is not recommended..." ) ;
@@ -76,14 +86,39 @@ public async ValueTask ExecuteAsync(IConsole console)
7686 Console . WriteLine ( "Maximum accuracy is 99%" ) ;
7787 return ;
7888 }
89+ if ( AcoustFingerprintAccuracy > 100 )
90+ {
91+ Console . WriteLine ( "Maximum acoust fingerprint accuracy is 100%" ) ;
92+ return ;
93+ }
94+ if ( AcoustFingerprintAccuracy <= 80 )
95+ {
96+ Console . WriteLine ( "80% or lower acoust fingerprint accuracy is not recommended..." ) ;
97+ return ;
98+ }
99+
100+ var handler = new DeDuplicateFileCommandHandler ( ConnectionString ) ;
101+ handler . Delete = Delete ;
102+ handler . Accuracy = Accuracy ;
103+ handler . Extensions = Extensions ;
104+ handler . CheckExtensions = CheckExtensions ;
105+ handler . CheckVersions = CheckVersions ;
106+ handler . CheckAlbumDuplicates = CheckAlbumDuplicates ;
107+ handler . CheckAlbumExtensions = CheckAlbumExtensions ;
108+ handler . AcoustFingerprintAccuracy = Math . Round (
109+ Math . Max ( AcoustFingerprintAccuracy / 100D ,
110+ AcoustFingerprintAccuracy == 100 ? 1 : AcoustFingerprintAccuracy / 100D ) ,
111+ 2 , MidpointRounding . AwayFromZero ) ;
79112
113+ handler . CheckAlbumExtensionsAcoustFingerprint = CheckAlbumExtensionsAcoustFingerprint ;
114+
80115 if ( string . IsNullOrWhiteSpace ( Artist ) )
81116 {
82- await handler . CheckDuplicateFilesAsync ( Delete , Accuracy , Extensions , CheckExtensions , CheckVersions , CheckAlbumDuplicates , CheckAlbumExtensions ) ;
117+ await handler . CheckDuplicateFilesAsync ( ) ;
83118 }
84119 else
85120 {
86- await handler . CheckDuplicateFilesAsync ( Artist , Delete , Accuracy , Extensions , CheckExtensions , CheckVersions , CheckAlbumDuplicates , CheckAlbumExtensions ) ;
121+ await handler . CheckDuplicateFilesAsync ( Artist ) ;
87122 }
88123 }
89124}
0 commit comments