コード例 #1
0
ファイル: Program.cs プロジェクト: perivar/FindSimilarCore
        private static void ProcessDir(string dbPath, string directoryPath, double skipDurationAboveSeconds, Verbosity verbosity, string debugDirectoryPath)
        {
            if (Directory.Exists(directoryPath))
            {
                // use LiteDb
                var model         = new FindSimilarLiteDBService(dbPath);
                var fingerprinter = new SoundFingerprinter(model, debugDirectoryPath);

                // use SQLite
                // var fingerprinter = new SoundFingerprinter(dbPath, debugDirectoryPath);

                fingerprinter.FingerprintDirectory(Path.GetFullPath(directoryPath), skipDurationAboveSeconds, verbosity);
            }
            else
            {
                if (verbosity > 0)
                {
                    Console.Error.WriteLine("The directory '{0}' cannot be found.", directoryPath);
                }
            }
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: perivar/FindSimilarCore
        private static void MatchFile(string dbPath, string filePath, int thresholdVotes, int maxTracksToReturn, Verbosity verbosity, string debugDirectoryPath)
        {
            if (File.Exists(filePath))
            {
                var fingerprinter = new SoundFingerprinter(dbPath, debugDirectoryPath);
                var results       = fingerprinter.GetBestMatchesForSong(Path.GetFullPath(filePath), thresholdVotes, maxTracksToReturn, verbosity);

                Console.WriteLine("Found {0} similar tracks", results.Count());

                // results.BestMatch.Track
                foreach (var result in results)
                {
                    // the track title holds the full filename
                    FileInfo fileInfo = new FileInfo(result.Track.Title);

                    Console.WriteLine("{0}, confidence {1}, coverage {2}, est. coverage {3}", fileInfo.FullName, result.Confidence, result.Coverage, result.EstimatedCoverage);
                }
            }
            else
            {
                Console.Error.WriteLine("The file '{0}' cannot be found.", filePath);
            }
        }