Giter Club home page Giter Club logo

anki-import-anki1-files's Introduction

Import .anki files

Rationale

A long time ago, there was Anki 1. It used a file format called ".anki". Very different from today's Anki2's ".anki2" format. You can still find on the web some old decks, shared a decade ago, in this format. This add-on allow to import them.

Warning

You should probably restart anki once you're done importing data. Importing .anki data essentially starts a copy of anki 2.0 which itself starts a copy of anki 1.0; that's not things you want to keep running and potentially interfering with your normal study. I can't guarantee there won't be any interference (especially in hooks)

Internal

The only new code is in aqt/importing.py, where I change the "onImport" function in order to deal with ".anki" file. If importing such a file is requested, it will import anki/importing/__init__.py, which itself will add all the required codebase. It essentially is a copy of the backend code and anki1 code, as it was before this feature was removed in all https://github.com/ankitects/anki/commit/1dce3eaaff649e2c1dbfd53bfe289cf42971045e#diff-c60e37732e601ec3d7f7e7146624b3a1 .

Technical

My best guess is that anki 1 was in python 2. Dropping the importer ensured that the code didn't have to be porter to python 3. I'm not certain, because tools exists to do the port.

Anyway, to get code from anki 1, anki 2.0 did used anki1 code to compute all cards. It actually simply opened this file as a collection and then used the function which ports collection from 1 to 2.0. I believe that there was no difference between decks and collection in anki 1; which might explain why it used anki 2.0 can import a deck and consider it as a collection.

TODO

Remove all part of the code not actually useful for anki

Links, licence and credits

Key Value
Copyright Arthur Milchior [email protected]
Based on Anki code by Damien Elmes [email protected]
License GNU GPL, version 3 or later; http://www.gnu.org/licenses/gpl.html
Source in https://github.com/Arthur-Milchior/anki-import-anki1-files
Addon number 175027074

anki-import-anki1-files's People

Contributors

arthur-milchior avatar twwn avatar

Stargazers

 avatar

Watchers

 avatar James Cloos avatar Matthias Haack avatar

anki-import-anki1-files's Issues

Error on Import

Im new to this community so i dont really know what to say. There is an error when importing a file

Import fehlgeschlagen. Die Fehlermeldung lautet:
Traceback (most recent call last):
File "aqt\importing.py", line 404, in on_done
File "concurrent\futures_base.py", line 432, in result
File "concurrent\futures_base.py", line 388, in __get_result
File "concurrent\futures\thread.py", line 57, in run
File "C:\Users*NAME*\AppData\Roaming\Anki2\addons21\175027074\anki\importing\anki1.py", line 17, in run
res = u.check(self.file)
File "C:\Users*NAME*\AppData\Roaming\Anki2\addons21\175027074\anki\upgrade.py", line 39, in check
res = self._fix(self.tmppath)
File "C:\Users*NAME*\AppData\Roaming\Anki2\addons21\175027074\anki\upgrade.py", line 108, in _fix
from oldanki import DeckStorage
ModuleNotFoundError: No module named 'oldanki'

Any way to fix this or is the file forever broken?
Best regards

Bombed out loading an old deck....

I'm returning to Anki after some time. I have an old deck that I'm wanting to pull in, but had this plugin recommended based o the number. Now with the plugin installed, I get this new error message. The version used to develop the old deck was 2.0.3.

==== Stack Trace provided by the app: ========================
Error
An error occurred. Please start Anki while holding down the shift key, which will temporarily disable the add-ons you have installed.
If the issue only occurs when add-ons are enabled, please use the Tools > Add-ons menu item to disable some add-ons and restart Anki, repeating until you discover the add-on that is causing the problem.
When you've discovered the add-on that is causing the problem, please report the issue to the add-on author.
Debug info:
Anki 2.1.54 (b6a7760c) Python 3.9.7 Qt 6.3.1 PyQt 6.3.1
Platform: Windows 10
Flags: frz=True ao=True sv=2
Add-ons, last update check: 2022-07-13 22:05:17

Traceback (most recent call last):
File "C:\Users\Administrator\AppData\Roaming\Anki2\addons21\175027074\anki\importing\anki1.py", line 29, in run
deck = u.upgrade()
File "C:\Users\Administrator\AppData\Roaming\Anki2\addons21\175027074\anki\upgrade.py", line 133, in upgrade
self._upgradeSchema()
File "C:\Users\Administrator\AppData\Roaming\Anki2\addons21\175027074\anki\upgrade.py", line 199, in _upgradeSchema
from anki.utils import minimizeHTML
ImportError: cannot import name 'minimizeHTML' from 'anki.utils' (unknown location)

Error on import

Errors out, unfortunately. Manually entering the .anki filename (since it's not shown when .anki is selected for "Files of type:", only when that is set to something else) and opening it only yields:

Traceback (most recent call last):
  File "~/.local/share/Anki2/addons21/175027074/anki/importing/anki1.py", line 27, in run
    deck = u.upgrade()
  File "~/.local/share/Anki2/addons21/175027074/anki/upgrade.py", line 128, in upgrade
    self._upgradeSchema()
  File "~/.local/share/Anki2/addons21/175027074/anki/upgrade.py", line 214, in _upgradeSchema
    _addSchema(db, False)
  File "~/.local/share/Anki2/addons21/175027074/anki/storage.py", line 81, in _addSchema
    """ % ({'v':SCHEMA_VERSION, 's':intTime(1000)}))
NameError: name 'SCHEMA_VERSION' is not defined

Using Anki 2.1.36 1e37e6ca and a new profile.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.