I was working on some code I didn't originally write that looped over a directory recursively and took audio fingerprints of files, then saved them in a SQLite database. I pasted the code in, then gave orders like "Rewrite this to use pathlib." to which it happily did.
Okay, next I notice it uses a .glob of "*.*" and so that makes me a bit suspicious.
"Will this code work for audio files without extensions?" Nope. It fixes it.
Okay, now I notice the original code builds up all the fingerprints in memory, then adds to the database. So I order it:
> Add files to the database as we go, and print progress every thousand files
Boom, just as I would have done it.
Then I note that we don't seem to have good indexes, and it's like you're right! and puts an index on the audio fingerprint field.
Then I ask it to save more info than just the file path, and it adds the size of the file.
Then of course, I tell it:
> This is remarkably slow, how can we significantly speed it up?
To which it replies:
> Here's an example implementation using multiprocessing:
Awesome, it works!
Oh, here's an error I got when I ran it when the audio fingerprinting library errored, handle that.
Paste in the error, it fixes it.
The thing is, I would have no problem with doing any of this stuff at all, it just made it so incredibly much faster, and if it does something you don't like, you can so easily correct it.
Hope this helps you understand how I use it!