예제 #1
0
def find_matches(
    db, samples, Fs=fingerprint.DEFAULT_FS, filename=None, print_output=True
):
    hashes = fingerprint.fingerprint(
        samples, Fs=Fs, print_output=False  # Force omit prints here
    )
    return return_matches(db, hashes, filename, print_output)
                    continue

            print(colored('   new song, going to analyze..', 'green'))

            hashes = set()
            channel_amount = len(audio['channels'])

            for channeln, channel in enumerate(audio['channels']):
                msg = '   fingerprinting channel %d/%d'
                print(
                    colored(msg, attrs=['dark']) %
                    (channeln + 1, channel_amount))

                channel_hashes = fingerprint.fingerprint(
                    channel,
                    Fs=audio['Fs'],
                    plots=config['fingerprint.show_plots'])
                channel_hashes = set(channel_hashes)

                msg = '   finished channel %d/%d, got %d hashes'
                print(
                    colored(msg, attrs=['dark']) %
                    (channeln + 1, channel_amount, len(channel_hashes)))

                hashes |= channel_hashes

            msg = '   finished fingerprinting, got %d unique hashes'

            values = []
            for hash, offset in hashes:
                values.append((song_id, hash, offset))
예제 #3
0
 def find_matches(samples, Fs=fingerprint.DEFAULT_FS):
   hashes = fingerprint.fingerprint(samples, Fs=Fs)
   return return_matches(hashes)
예제 #4
0
                    continue

            print(colored("   new song, going to analyze..", "green"))

            hashes = set()
            channel_amount = len(audio["channels"])

            for channeln, channel in enumerate(audio["channels"]):
                msg = "   fingerprinting channel %d/%d"
                print(
                    colored(msg, attrs=["dark"]) %
                    (channeln + 1, channel_amount))

                channel_hashes = fingerprint.fingerprint(
                    channel,
                    Fs=audio["Fs"],
                    plots=config["fingerprint.show_plots"],
                )
                channel_hashes = set(channel_hashes)

                msg = "   finished channel %d/%d, got %d hashes"
                print(
                    colored(msg, attrs=["dark"]) %
                    (channeln + 1, channel_amount, len(channel_hashes)))

                hashes |= channel_hashes

            msg = "   finished fingerprinting, got %d unique hashes"

            values = []
            for hash, offset in hashes:
def find_matches(
    db, samples, logger, Fs=fingerprint.DEFAULT_FS, filename=None
):
    hashes = fingerprint.fingerprint(samples, Fs=Fs)
    return return_matches(db, hashes, logger, filename)
                if hash_count > 0:
                    print(f"already exist {readonly_filename}")
                    continue

            print("new song, analyze...")
            print(readonly_filename)

            hashes = set()
            channel_amount = len(audio['channels'])

            for channel_n, channel in enumerate(audio['channels']):
                print(
                    f"fingerprinting channel {channel_n + 1} of {channel_amount}"
                )

                channel_hashes = fingerprint.fingerprint(channel,
                                                         Fs=audio['Fs'])
                channel_hashes = set(channel_hashes)

                print(
                    f"fingerprinting channel {channel_n + 1} of {channel_amount}, got {len(channel_hashes)} hashes"
                )

                hashes |= channel_hashes

            values = []
            for hash, offset in hashes:
                values.append((song_id, hash, offset))

            print(f"storing {len(values)} hashes in db")

            print(values)