Maybe a faster solution would be to compare the dirname of the file's uri to dirnames of already found covers and use ones that you already decided to use for this directory.
Instead of querying the filesystem, query the database or even cache a list of found covers while scanning.
Maybe a faster solution would be to compare the dirname of the file's uri to dirnames of already found covers and use ones that you already decided to use for this directory.
Instead of querying the filesystem, query the database or even cache a list of found covers while scanning.