Py script for filtered deck: set name and add cards

I am able to create a filtered deck- with the given name.


However, trying to add cards with set_deck() gives an error:

w = mw.col.find_cards(“added:3”)
anki.errors.FilteredDeckError: Cards can’t be manually moved into a filtered deck.

Or, another option would be to set the filtered deck search query (ie “added:3”)

config = mw.col.decks.get_config(fid)
returns what is seen below, how do I set the search param and rebuild a filter deck via python script?

{‘autoAgain’: 0,
‘autoAlert’: 0,
‘autoAnswer’: 60,
‘autoplay’: True,
‘buryInterdayLearning’: False,
‘dyn’: False,
‘id’: 1,
‘interdayLearningMix’: 0,
‘lapse’: {‘delays’: [10.0],
‘leechAction’: 0,
‘leechFails’: 25,
‘minInt’: 1,
‘mult’: 0.0},
‘maxTaken’: 60,
‘mod’: 1643134279,
‘name’: ‘5-new’,
‘new’: {‘bury’: True,
‘delays’: [1.0, 10.0],
‘initialFactor’: 2500,
‘ints’: [1, 2, 0],
‘order’: 1,
‘perDay’: 50,
‘separate’: True},
‘newGatherPriority’: 0,
‘newMix’: 0,
‘newPerDayMinimum’: 0,
‘newSortOrder’: 0,
‘replayq’: True,
‘rev’: {‘bury’: False,
‘ease4’: 1.3,
‘fuzz’: 0.05,
‘hardFactor’: 1.2,
‘ivlFct’: 1.0,
‘maxIvl’: 90,
‘minSpace’: 1,
‘perDay’: 2000},
‘reviewOrder’: 0,
‘timer’: 1,
‘usn’: 0}

Check how it’s done here: anki/ at main · ankitects/anki · GitHub

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.