GithubHelp home page GithubHelp logo

lingqankisync's Introduction

lingqankisync's People

Contributors

codacy-badger avatar sviatoslav-lebediev avatar thags avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

lingqankisync's Issues

Typo in LingqAPI.py

The add-on currently doesn't seem to sync back properly to lingq, although you can pull vocabulary from the LingQ website.

I believe the error lies in this string

    def __init__(self, apiKey, languageCode):
        self.apiKey = apiKey
        self.languageCode = languageCode
        self._baseUrl = f"https://www.lingq.com/api/v3/{languageCode}/cards/"
        self.unformatedLingqs = []
        self.lingqs = []

I think if you simply remove the / on the end of cards, it will resolve

    def __init__(self, apiKey, languageCode):
        self.apiKey = apiKey
        self.languageCode = languageCode
        self._baseUrl = f"https://www.lingq.com/api/v3/{languageCode}/cards"
        self.unformatedLingqs = []
        self.lingqs = []

Dependency unavailable

Hi, I added the add-on via the normal mechanism and restarted anki. It's the only add-on I have.

When loading '⁨Lingq Anki Sync⁩':
⁨Traceback (most recent call last):
  File "aqt.addons", line 247, in loadAddons
  File "/home/abby/.var/app/net.ankiweb.Anki/data/Anki2/addons21/594879777/__init__.py", line 1, in <module>
    from .popUpWindow import UI
  File "/home/abby/.var/app/net.ankiweb.Anki/data/Anki2/addons21/594879777/popUpWindow.py", line 6, in <module>
    from .UIActionHandler import ActionHandler
  File "/home/abby/.var/app/net.ankiweb.Anki/data/Anki2/addons21/594879777/UIActionHandler.py", line 1, in <module>
    from .Converter import ConvertAnkiCardsToLingqs, ConvertLingqsToAnkiCards
  File "/home/abby/.var/app/net.ankiweb.Anki/data/Anki2/addons21/594879777/Converter.py", line 4, in <module>
    from Models.Lingq import Lingq
ModuleNotFoundError: No module named 'Models'

⁩My system info is:

Anki 2.1.60 (76d88073) Python 3.9.15 Qt 6.4.2 PyQt 6.4.0
Platform: Linux-5.15.0-69-generic-x86_64-with-glibc2.35
Flags: frz=True ao=True sv=2    

Anki was installed via flatpak.
I've looked into this directory "/.../net.ankiweb.Anki/.../594879777/" and ./Models/ and it's .py files on your github exist there.

Sync from anki to lingq

We can currently add cards to a deck imported from lingq. We need to be able to sync the "known status" from anki back to lingq.

This will require some arbitrary decisions on what intervals equal what lingq status (0,1,2,3,4).

Resolve some tech debt

  • General clean up.
  • Refactor a lot of stuff (create some classes, try to organize into folders, create a handler for actions that need do things on both the anki and lingq side).
  • create tests

[Tip] LingQ cannot modify review time through the review API

lingqAnkiSync/readme.md

Lines 186 to 201 in b479154

#### 1. Set card reviewed
`https://www.lingq.com/api/v2/{languageCode}/cards/{primaryKey}/review/`
Tells lingq that the card has been reviewed via srs on the date this is sent. Will update lingqs srs_due_date.
It seems like this needs to be called instead of changing the due date manually with the patch request.
Returns an object showing the new srs_due_date and status_changed_date:
```json
{
"srs_due_date": date,
"status_changed_date": date
}
```

I tried to modify the scheduling time through https://www.lingq.com/api/v2/ja/cards/508507061/review/, and I found that even if I don't fill in srs_due_date and status_changed_date, the scheduling is still based on the current time (including time zone information), which is determined by the card's status and extended_status.

image
  • If status=0, the scheduling time is 1 day.
  • If status=1, the scheduling time is 3 days.
  • If status=2, the scheduling time is 7 days.
  • If status=3, the scheduling time is 15 days.
  • If status=3 and extended_status=3, then the scheduling time is 5000 days.

On import set due date as a range instead of a set date

Basically want to be able to have cards set to review staggered instead of so many in one day.

If importing 12k Lingqs and all of them are "known" then all of them will be set to review in 40 days. This could be a random range instead. So instead of 40 days it could be anywhere from 40 days to 40 + x days.

429 Client Error

Hi folks,

The add-on has been working swimmingly for a couple of months on my end, but I'm now getting this error when trying to sync:

429 Client Error: Too Many Requests for url: https://www.lingq.com/api/v2/fi/cards/452013826/

I tried deleting the card referenced in the URL, but the error just happens again with a different card. I've tried to sync about five times in the past 12 hours.

Any thoughts?

AttributeError

Hi,
thank you for this very useful addon. I recently started getting the following error, after pressing "Import LinQs from Linq.com"

Traceback (most recent call last):
  File "C:\Users\ercan\AppData\Roaming\Anki2\addons21\594879777\popUpWindow.py", line 93, in <lambda>
    action.triggered.connect(lambda: UI().run())
  File "C:\Users\ercan\AppData\Roaming\Anki2\addons21\594879777\popUpWindow.py", line 19, in __init__
    QPushButton("Import"), QDialogButtonBox.AcceptRole)
AttributeError: type object 'QDialogButtonBox' has no attribute 'AcceptRole'

My System info is the following:

Anki 23.12.1 (1a1d4d54)  (ao)
Python 3.9.15 Qt 6.6.1 PyQt 6.6.1
Platform: Windows-10-10.0.19045

Thank you very much

BUG: Import from LINQ seems to be broken.

Steps to reproduce

  1. Menu Tools -> Import LingQs
  2. Immediate error pops up

image

Seems like this might be a regression related to the upgrade to pyqt 6?

Debug Log:

Anki 23.12.1 (1a1d4d54) (src) (ao)
Python 3.11.8 Qt 6.6.2 PyQt 6.6.1
Platform: Linux-6.8.2-zen1-1-zen-x86_64-with-glibc2.39

Traceback (most recent call last):
  File "/home/notnight/.local/share/Anki2/addons21/594879777/popUpWindow.py", line 93, in <lambda>
    action.triggered.connect(lambda: UI().run())
                                     ^^^^
  File "/home/notnight/.local/share/Anki2/addons21/594879777/popUpWindow.py", line 19, in __init__
    QPushButton("Import"), QDialogButtonBox.AcceptRole)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: type object 'QDialogButtonBox' has no attribute 'AcceptRole'

===Add-ons (active)===
(add-on provided name [Add-on folder, installed at, version, is config changed])
Lingq Anki Sync ['594879777', 2023-12-25T14:25, 'None', '']
More Overview Stats 21 ['738807903', 2021-07-30T13:13, 'None', '']
PassFail 2 Remove the Easy and Hard buttons ['876946123', 2023-01-23T18:59, 'None', '']
Review Heatmap ['1771074083', 2022-06-29T19:43, 'None', '']

===IDs of active AnkiWeb add-ons===
1771074083 594879777 738807903 876946123

===Add-ons (inactive)===
(add-on provided name [Add-on folder, installed at, version, is config changed])

issue when installing

Hi, when I try to install the addon and I restart it, it shows me this message :

"Traceback (most recent call last):
File "aqt/addons.py", line 230, in loadAddons
File "/Users/pierreg/Library/Application Support/Anki2/addons21/594879777/init.py", line 1, in
from .popUpWindow import UI
File "/Users/pierreg/Library/Application Support/Anki2/addons21/594879777/popUpWindow.py", line 6, in
from .UIActionHandler import ActionHandler
File "/Users/pierreg/Library/Application Support/Anki2/addons21/594879777/UIActionHandler.py", line 1, in
from .Converter import ConvertAnkiCardsToLingqs, ConvertLingqsToAnkiCards
File "/Users/pierreg/Library/Application Support/Anki2/addons21/594879777/Converter.py", line 7, in
def ConvertAnkiCardsToLingqs(ankiCards: list[AnkiCard], statusToInterval: dict[int:int]) -> list[Lingq]:
TypeError: 'type' object is not subscriptable"

mac OS Big sur 11.7.4
Anki version : 2.1.49
Python 3.8.6 Qt 5.14.2 PyQt 5.14.2

On the anki addon link --> Supported Anki versions: 2.1.6-2.1.16+ (Updated 2023-03-20)

Thanks.

Not Syncing with Anki to update reviews

I made an account with Github just to discuss the issue. English not my first language, sorry for grammar.

404 Client Error: Not Found for url: https://www.lingq.com/api/v3/de/cards//476673789/

Has a double " // " naturally after "cards"

Please update, I love the idea of this add-on. It just fails to work ultimately. Not sure how to code but I'd fix it if I could.

The url when submitted to LIngQ manually doesn't show a valid page either.

However, when https://www.lingq.com/api/v3/de/cards/ is requested, the page opens as follows

{"count":4477,"next":"https://www.lingq.com/api/v3/de/cards/?page=2","previous":null,"results":[{"pk":131962322,"url":"https://www.lingq.com/api/v3/de/cards/131962322/","term":"funktioniert","fragment":"...eure Schwestern auch So funktioniert dieses Konzept von Bau...","importance":2,"status":3,"extended_status":3,"last_reviewed_correct":null,"srs_due_date":"2037-06-10T11:54:37.676364","notes":"","audio":null,"words":["funktioniert"],"tags":

What is there's a way to code the endless possibilities after ...cards/ ; so that it requests regardless of the page or 9 digits. I read that requesting the info is the way this add-on works with LingQ. Not that I know how coding works, just an idea of how it can maybe be solved. I feel like the " // " is a result of it not being able to pull the info for that line.

Update: I just read how the code works and am certain that is the issue. Perhaps when developed, thousands of cards wasn't considered hah. I do see you put how to add the "add page" code on the forum. If you can update that into the code, I feel like that would make this add-on useful.

Thank you for your regards, I hope to see it updated soon:)

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.