woodruffw / shaq

A CLI client for Shazam
MIT License
105 stars 6 forks source link

False positives and duration argument #32

Open jkeen opened 2 months ago

jkeen commented 2 months ago

If I pass in a file that's 3m30s long and give a duration argument of 10s—it just analyzes the first 10s of the file, yeah? And if I pass in 30s for duration, does it analyze the first 30s, then?

Seems like a silly question, but I have sometimes gotten different results based on different durations I've passed in, and am wondering the logic behind it all or if there are any verification steps built in? Like, for a 3m30s song, I would imagine taking a sample from 0-20s and at different parts of the file to verify that result might be useful?

woodruffw commented 2 months ago

Not a stupid question! There's no logic behind it at all -- the --duration flag currently just takes the first N seconds of the input. If there are fewer than N seconds, I believe it truncates.

Guessing the "right" thing to do here is tricky -- some users might have a snippet of a song that starts at 00:00, whereas others might want to seek into a file and extract N seconds at some timepoint. I think the default should probably remain 00:00 but I wouldn't be opposed to an optional --start HH:MM:SS flag or similar that tells shaq to seek before extracting a duration.