First of all, thanks to everyone involved for the work you are doing in developing such immensely helpful system as Anki (and derivatives). When I first discovered the program I was fascinated with the fact that now I can learn anything from geography to programing as all the previous SRSs I tried were severely limited in functionality.
Seconldy, I am writing to clarify the logic of media synchronization:
Anki will synchronize any sounds and images used by your notes. It will notice when media has been added or removed from your media folder, but will not notice if you have edited some existing files without adding or removing any. To get your edits noticed, you need to add or remove a file as well.
The reason I am asking is I found that, in fact, for media refresh between Anki Desktop and AnkiDroid to happen there is no need to add or remove a file.
Here is an example case:
Create a card containing picture of lime green color and press sync:
Sync Anki Desktop and subsequently sync AnkiDroid. Proceed to view the card. The display color is sun yellow:
Note that viewing the same card in AnkiWeb after picture update to sun yellow will still show lime green color. But, nevertheless, AnkiDroid displays sun yellow, so I assume the updated file is loaded to the server anyway.
Also note, that unlike any other media update, the file change (color from lime green to sun yellow) is not immediately visible through explorer in media folder (EX File Manager is used on screenshots, reproduced in FV File Explorer app as well). Just after the restart of a device can you see the sun yellow color (is there a possibility that AnkiDroid loads media into cache, and only at some point (in my situation, after the restart) dumps it into media folder?):
Please, explain whether I am missing something. And if not, then confirm that my assumption is correct (that is, editing a file without adding or removing any other media will prompt to load it to the server, and consequentially, to AnkiDroid and AnkiMobile)
The motivation for the post is ongoing improvement of Ultimate Geography deck. In particular, experimental deck with interactive map. The deck uses scripts from media folder. Since the first version of the deck was already released, for further improvement to work correctly we need to ensure that updated scripts are used across all the devices (think “scripts in media folder are synchronized successfully”)
Additionally tried to perform the same steps for _1.js script that inserts “v1” or “v2” text into card via DOM:
document.querySelector("body").prepend("v1 ");
// or
document.querySelector("body").prepend("v2 ");
What I figured out is that if I directly edit _1.js to insert “v2” instead of “v1”, sync Anki Desktop, then sync AnkiDroid - AnkiDroid will display “v1”, meaning the script is not synchronized.
On the other hand, if I create script “test.js”, make it insert “v2” and rename it into _1.js removing previous file version, AnkiDroid will display “v2”, meaning sync is successful.
So it seems that the sync does not work if you directly edit the file, but will if you create new file with edited original file content and then rename it into original file, removing previous version.
It might be a good idea to specify that by “editing” is meant opening the file and directly making changes to it. Creating new file and renaming it to existing one (while removing original version) is not considered “editing” and will prompt mentioned media sync.
“If you replace an existing file with a new file, Anki will recognise it’s a different file when syncing.” This should be good? If you have feedback about any other section of the manual, I’ll be glad to hear.
Looking at it again, you are absolutely right, editing is really non-ambiguous word. Making a pause and reconsidering the issue helped me understand that.
In your example you were replacing a file with a different file – which is not editing. That is adding and removing.
I assume we can agree that “adding and removing” can be summarized as “replacing”? It is probably what confused me - I haven’t thought about “replacing” as “adding and removing” at first (even though I literally described it as such :))
To avoid further confusions (and duplicated posts) might be considered the addition to docs of explicitly defined behavior of “replacing” and its implications on sync process. But that is completely up to you - active maintainers, to decide whether it is worth the hassle. If so, I will be glad to contribute to the docs.
Again, the issue is resolved, thanks to everyone involved.
Edit: Something along the lines " It will notice when media has been added, removed or replaced in your media folder".
It sounds like you understand the issue well, so if you think that would help clarify things, of course you are welcome to propose this yourself with a pull request on Github. No need to defer to the “active maintainers” – many hands make light work!