dsnopek / anki-sync-server

A personal Anki sync server (so you can sync against your own server rather than AnkiWeb)
GNU Affero General Public License v3.0
741 stars 95 forks source link

Anki Droid request deleted files and fails with downloadFiles() #50

Closed ninja33 closed 6 years ago

ninja33 commented 7 years ago

@Akendo I saw the issue #45 you raised for media sync. also noticed @cdpm provided a fix #46 for it. I got same problem as you mentioned in comment, deleted files from anki PC, then trying to sync by using ankidroid, the console says file missing.

seems it is still trying to download those media files which was already deleted.

any ideas? thanks.

INFO:root:CollectionThread[E:\ankiserver\collections\ninja33\collection.anki2]:Running downloadFiles(*[], **{})
ERROR:root:CollectionThread[E:\ankiserver\collections\ninja33\collection.anki2]: Unable to downloadFiles(*[], **{}): [Error 2] : u'E:\\ankiserver\\collections\\ninja33\\collection.media\\oxford-001700da-22a4a425-6ef26aaa-d6bad639-8f7b2b58.mp3'
Traceback (most recent call last):
  File "e:\python27\lib\site-packages\ankiserver-2.0.6-py2.7.egg\AnkiServer\threading.py", line 95, in _run
    ret = self.wrapper.execute(func, args, kw, return_queue)
  File "e:\python27\lib\site-packages\ankiserver-2.0.6-py2.7.egg\AnkiServer\collection.py", line 58, in execute
    ret = func(*args, **kw)
  File "e:\python27\lib\site-packages\ankiserver-2.0.6-py2.7.egg\AnkiServer\apps\sync_app.py", line 655, in run_func
    res = handler_method(**keyword_args)
  File "e:\python27\lib\site-packages\ankiserver-2.0.6-py2.7.egg\AnkiServer\apps\sync_app.py", line 248, in downloadFiles
    z.write(os.path.join(self.col.media.dir(), fname), str(cnt))
  File "e:\python27\lib\zipfile.py", line 1123, in write
    st = os.stat(filename)
WindowsError: [Error 2] : u'E:\\ankiserver\\collections\\ninja33\\collection.media\\oxford-001700da-22a4a425-6ef26aaa-d6bad639-8f7b2b58.mp3'
ninja33 commented 7 years ago

seems it's ankidroid problem listed in this issue: Bug report about media sync

ninja33 commented 7 years ago

This problem should be fixed by https://github.com/ankidroid/Anki-Android/commit/082360cf8ac95bc95ddd510a5291a4c11fde557c

for more detail, please check https://github.com/ankidroid/Anki-Android/pull/4521