Media changes only partially sync’d

I used voice synthesis and shell scripting to generate audio for hundreds of notes and add the sound references to those notes. Imported that into the deck and it said hundreds of notes updated, zero new.

Did check database and then check media. None of the new files were shown as unused, nor as missing.

Exited the desktop, opened the iPad, and did a sync. Media log showed downloading many files. Started studying and when one of those came up, there was no audio. Tapped edit, and the audio field was blank—yet media check does not say that file is unused. Typed in the sound ref, and saved the change. The file was found and played.

So: sync downloaded the file, but not the change in the note. Yet media check didn’t say the file is unused. This happened with more than one note, but my import file has only one note without audio, and it is neither of these.

I know that the sync completed when I exited the desktop, from watching the log.

Looked a bit more. The file imported has only ONE empty audio field. The desktop Anki it was imported into has at least five in the first 250 notes. So the import got most but not all of the newly added fields. But media check is not showing those five or more MP3 files as unused. The number of audio fields changed and files added is almost 800.

Sync to Ankiweb and then down to iPad is not updating the new audio fields, but it does download the new files and then fails to say they are unused.

Possible explanation: There were many near-duplicate notes. The key fields in the file are integers, but the duplicates differed in that the thousands digit was followed by a comma in the older version. The older versions did not get the recent changes, so they still had the audio field empty. Since the key field is not displayed on any card, when an old one was presented, it looked the same as a new one but without the audio.

Were you updating existing notes? If I recall correctly, media files are only imported when a card is first added.

Yes, but consider that note 2,345 is in the database and not in the input file. Note 2345 is in the input file. Both contain the same Dutch word. When I put [sound:nl_boeken.mp3] in the audio field of 2345 and import, that doesn’t change 2,345. So when “boeken” is displayed with no audio, that made me think something was wrong.

The MP3 file was sync’d but wasn’t cited on some of the cards that came up. Even though they were created months ago, the were still new. (I create more notes every day than I study.)

The reason 2,345 and kin were there is because early in the year, my spreadsheet was outputting that format. I changed it later, but didn’t realize the field is text and not numeric.