Skip to content

Commit

Permalink
Merge pull request #16 from c-okelly/bugfix/#8-and-#14-image-parsing
Browse files Browse the repository at this point in the history
Images fix
  • Loading branch information
c-okelly committed Sep 30, 2019
2 parents 9e5252b + 3222e59 commit 6e7a9ce
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/remote_decks/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,28 @@ def syncDecks():
deckDiff = diffAnkiDecks(remoteDeck, localDeck)
_syncNewData(deckDiff)

# Sync all media data
# In future this should only sync what has been removed
allDeckMedia = []

for deckKey in remoteData["remote-decks"].keys():
currentRemoteInfo = remoteData["remote-decks"][deckKey]

# Get Remote deck
remoteDeck = getRemoteDeck(currentRemoteInfo["url"])
# Get media and add to collection
deckMedia = remoteDeck.getMedia()
if deckMedia != None:
allDeckMedia.extend(deckMedia)

formattedMedia = ankiBridge.prepareMedia(allDeckMedia)

# Add Media
# TODO This need to be refactored back into org_to_anki
for i in formattedMedia:
ankiBridge.AnkiBridge.storeMediaFile(i.get("fileName"), i.get("data"))


def _syncNewData(deckDiff):

ankiBridge = getAnkiPluginConnector(remoteDefaultDeck)
Expand Down

0 comments on commit 6e7a9ce

Please sign in to comment.