Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add videos by python Geanki #132

Open
MayconMartins983 opened this issue Apr 15, 2024 · 1 comment
Open

Add videos by python Geanki #132

MayconMartins983 opened this issue Apr 15, 2024 · 1 comment

Comments

@MayconMartins983
Copy link

Good evening, does anyone have any suggestions or know how I could add videos via the geanki library in Python? I tried to create using the code below but the video does not appear. I’ve already tried using just {{PathVideo}}, the video loads with the MPV but the video has to be in the indicated path, I wanted the video to be already inside this file when exporting the .apkg file to send to other people.

`# Crie um modelo de carta
modelo_carta = genanki.Model(
1607392319,
'Modelo de Carta Simples',
fields=[
{'name': 'Frente'},
{'name': 'Verso'},
{'name': 'video'}
],
templates=[
{
'name': 'Carta Padrão',
'qfmt': '
{{Frente}}
',
'afmt': '

{{FrontSide}}
{{Verso}}
',
},
])

# Crie um deck
deck = genanki.Deck(
    2059400110,
    'A meu Deck Anki')

# Crie uma carta
carta = genanki.Note(
    model=modelo_carta,
    fields=['The book is on the table', 'O livro está na mesa', "videos/cut_10_17.87_to_22.559.mp4"])

# Adicione a carta ao deck
deck.add_note(carta)

# Exporte o deck para um arquivo .apkg
genanki.Package(deck).write_to_file('meu_deck_anki2.apkg')`
@cooligus
Copy link

cooligus commented Jun 15, 2024

You should see this

It seems to be broken because according to README command my_package.media_files.append(pathToFile) should work. It actually works, but only for images

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants