mirror of
https://github.com/ankitects/anki.git
synced 2025-09-21 15:32:23 -04:00
set syncName after full download
This commit is contained in:
parent
7dd57887d0
commit
9259718fd5
1 changed files with 8 additions and 1 deletions
|
@ -25,6 +25,7 @@ import zlib, re, urllib, urllib2, socket, simplejson, time, shutil
|
||||||
import os, base64, httplib, sys, tempfile, httplib, types
|
import os, base64, httplib, sys, tempfile, httplib, types
|
||||||
from datetime import date
|
from datetime import date
|
||||||
import anki, anki.deck, anki.cards
|
import anki, anki.deck, anki.cards
|
||||||
|
from anki.db import sqlite
|
||||||
from anki.errors import *
|
from anki.errors import *
|
||||||
from anki.models import Model, FieldModel, CardModel
|
from anki.models import Model, FieldModel, CardModel
|
||||||
from anki.facts import Fact, Field
|
from anki.facts import Fact, Field
|
||||||
|
@ -32,7 +33,7 @@ from anki.cards import Card
|
||||||
from anki.stats import Stats, globalStats
|
from anki.stats import Stats, globalStats
|
||||||
from anki.history import CardHistoryEntry
|
from anki.history import CardHistoryEntry
|
||||||
from anki.stats import globalStats
|
from anki.stats import globalStats
|
||||||
from anki.utils import ids2str, hexifyID
|
from anki.utils import ids2str, hexifyID, checksum
|
||||||
from anki.media import mediaRefs
|
from anki.media import mediaRefs
|
||||||
from anki.lang import _
|
from anki.lang import _
|
||||||
from hooks import runHook
|
from hooks import runHook
|
||||||
|
@ -1037,6 +1038,12 @@ and cards.id in %s""" % ids2str([c[0] for c in cards])))
|
||||||
# if we were successful, overwrite old deck
|
# if we were successful, overwrite old deck
|
||||||
os.unlink(path)
|
os.unlink(path)
|
||||||
os.rename(tmpname, path)
|
os.rename(tmpname, path)
|
||||||
|
# reset the deck name
|
||||||
|
c = sqlite.connect(path)
|
||||||
|
c.execute("update decks set syncName = ?",
|
||||||
|
[checksum(path.encode("utf-8"))])
|
||||||
|
c.commit()
|
||||||
|
c.close()
|
||||||
finally:
|
finally:
|
||||||
runHook("fullSyncFinished")
|
runHook("fullSyncFinished")
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue