I think this functionality is useful for users, and also potentially a saving for AnkiWeb’s storage and transfers.
The add-on adds a filter, such that media on suspended or new cards could be optionally removed from syncing. This makes for example my 6.5 GB collection with 200,000 files, sync less than 10% of those files to AnkiWeb and to my mobile devices.
There are a number of users using this feature to improve syncing to mobile devices for large collections, for example from sentence banks. Those users have been stuck on older versions of Anki 2.1 because monkey-patching the media sync isn’t possible in the RS back-end.
I’d like to have some discussion about what we could do to enable this functionality in a non-fragile way. Current thoughts are to either add a hook to the ChangeTracker which could enable the old add-on functionality. Or perhaps we could consider making similar functionality part of core Anki?
Media syncing does not have access to the collection, and I’m not sure the plumbing required to enable this workflow would be worth the extra code complexity I’m afraid. One way you could work around it is to have your add-on move the unwanted files to a subfolder instead, and redirect references to them in mediasrv.py - they would be invisible when syncing, but would show up for review. If you wanted check media to continue to work, you’d need to automatically move them back and forth when that command was run.
Thanks for the answer. Moving the files is what we’ve been considering.
Would it be feasible to pass a list of allowed or disallowed filenames to sync? I think we could compute that before running the sync, so the media back-end wouldn’t need to know anything about the collection.
Please ignore my last request, since using the option to move unwanted files was easy enough to support.
I’m having some trouble with the mediasrv patch. Paths going to _anki like collection.media_anki\toolbar.css seem to be going through there, but my card’s media doesn’t seem to be served in the same way. Any clues?
_anki/ is intended for serving program-related assets. I don’t think there is a hook at the moment for catching/transforming requests, but I’d be happy to accept a PR that adds one. A simple approach (that would not allow for dynamically generated content) would be to run the hook directly above
One of the great features of DEVONThink is the ability to choose which databases sync, and which devices they sync to. None of which is done centrally but on each device. For ex: I have a database that contains several gig of movie clips for my job. I don’t want those on my iPhone but it syncs between both my macs.
Maybe having Anki offer the ability to flag which high level Decks gets sync’d with the server is a good step in that direction. Anki would also need a way to remove a deck from the server that was still on a device.
Very old versions of Anki actually functioned in this way, but it added extra complexity, and does not really make sense with the current data format where things like tags and note types are shared among decks.