option to avoid media dir creation

This commit is contained in:
Damien Elmes 2012-05-28 17:18:12 +09:00
parent 7a0f18d2c7
commit af97497747
2 changed files with 4 additions and 2 deletions

View file

@ -45,7 +45,7 @@ class _Collection(object):
self.server = server
self._lastSave = time.time()
self.clearUndo()
self.media = MediaManager(self)
self.media = MediaManager(self, server)
self.models = ModelManager(self)
self.decks = DeckManager(self)
self.tags = TagManager(self)

View file

@ -17,8 +17,10 @@ class MediaManager(object):
regexps = ("(?i)(\[sound:([^]]+)\])",
"(?i)(<img[^>]+src=[\"']?([^\"'>]+)[\"']?[^>]*>)")
def __init__(self, col):
def __init__(self, col, server):
self.col = col
if server:
return
# media directory
self._dir = re.sub("(?i)\.(anki2)$", ".media", self.col.path)
# convert dir to unicode if it's not already