Optimize Library indexing for iCloud Drive directories

I’ve been experimenting with storing media in iCloud Drive, as noted here previously. I’ve made an observation that could help improve the Library indexing experience.

We all know Apple does not support streaming, so that means content needs to be downloaded to the disk before it can play; this is fine.

Infuse on iOS/iPadOS has the ability to add an iCloud Drive directory by choosing “Add Files,” then under the “Saved Shares” heading, choose “Add…,” then finally choose “Add Local Folder,” which then opens iOS’/iPadOS’ Files app, and that gives access to the underlying iCloud Drive filesystem where you can choose a directory. The content available under the chosen directory can then be indexed and metadata built for it, where Infuse then shows the added content as Library items.

However, the problem with that is Infuse tries to download all those files in iCloud Drive as part of the indexing process, assumedly so it can detect the kind of file it is so it can display stuff like “HDR” or “4K” and decide what codec to use for playback. This is a problem because if there are several TBs of data stored in iCloud Drive, attempting to download all this content upfront to a device like an iPhone or iPad will almost certainly result in the storage filling up; not to mention, I just don’t realistically see this ever completing.

Infuse should detect that the share being added is from iCloud Drive, and instead of trying to download the files during the indexing process upfront to determine the file information mentioned, it simply skips this part and lets the content be indexed “superficially.” The only time that file information should be retrieved is the moment a user actually tries to play one of the files, which would then initiate the file download from iCloud Drive, at which point the file would be available locally and then Infuse can figure out that additional file information. Think of it as lazy loading.

I write this because I can see that Infuse adds the files to the Library very quickly, almost certainly just based on the file name and parent directories (“superficially,” as I referred to it), but then it never finishes indexing, because it attempts to download every single file (you can see this in the Files app), which is just not happening when there is, for example, up to 14TB of data in iCloud and the iPhone only has 512GB of local storage. Not to mention, it’s an unreasonable operation to have to download that much data for just a few KBs of metadata overall.

This addition in logic would really make hosting media from iCloud Drive a lot more viable.