How are content file URLs determined?

So we have Kolibri running with a Postgres database and a Redis cache engine if that matters.

We are trying to write a custom report that will list all Courses / Videos for a given channel, and list the URL to the video file. I am having trouble ultimately figuring out how to write a database query that does such. For example, I know that a file may reside at:

So I know the “123456789” comes from the local_file_id from the content_file table. And I know how to get the file extension. And the file really is in that folder in the storage directory. But for the life of me I have no idea where the “8/b/” part is coming from. Can someone assist in determining where that data is coming from?

Is the “8/b” coming from the first two characters in the file name / first two in the local_file_id?

Yes, the function that generates this is here: