kelciour / movies2anki Goto Github PK
View Code? Open in Web Editor NEWConvert movies with subtitles to watch them with Anki. Inspired by subs2srs
License: GNU Affero General Public License v3.0
Convert movies with subtitles to watch them with Anki. Inspired by subs2srs
License: GNU Affero General Public License v3.0
Hi, thanks for developing the Add-on, I just wonder if you could fix the broken images from the anki add-on webpage and
also, adding the explanation in the read me about the difference between the button Movie and Phrases that you commented some time ago to a user.
For phrases, the add-on will only use timings from the subtitles to generate cards, i.e. everything that doesn't have subtitles will be ignored like the start of the video or scene changes where usually no one speaks and there are no subtitles.
For movie, the add-on will change the subtitles' timings to make them continuous to be able to watch the video from start to finish without missing anything, i.e. the end time of each line in the subtitles will be changed to match the start time of the next line.
I think it would be more user-friendly, specially for the newer users. thanks
Hello,
I did everything as it should be but I still cant get it to work.
When I click on "go" and I choose "desktop" as my directory , the folder is there but when the process is to the end the folder is empty, the folder which should contain all files which are going to be moved in home/anki/user/collection.media
Thanks in advance...
Using a vagrant linux on a Mac, I'm able to get GUI up and set parameters, but when I hit Go or Preview nothing happens.
On Mac itself, I have some QT incompatibilities and can't even get the GUI up.
Is there a simple command line way I can use this without QT ?
Or how would I modify this to do that?
Maybe use a temporary folder location for encoding.
Cutting files is too slow. Why not set a timestamp instead?
Like this: https://forums.ankiweb.net/t/start-playing-audio-from-a-timestamp/5315
Unable to split the subtitles properly when i import youtube automatic captioning.
But Manual uploading of subtitles is normal.
Example: https://www.youtube.com/watch?v=En8Tz2RzubE
Script for downloading subtitles: https://greasyfork.org/en/scripts/5368-youtube-subtitle-downloader-v28
Traceback (most recent call last):
File "aqt.taskman", line 142, in _on_closures_pending
File "aqt.taskman", line 86, in <lambda>
File "aqt.taskman", line 106, in wrapped_done
File "aqt.operations", line 260, in wrapped_done
File "/.local/share/Anki2/addons21/472573498/reviewing_utils.py", line 198, in _show_card
mw.reviewer._showQuestion()
File "aqt.reviewer", line 378, in _showQuestion
File "aqt.sound", line 150, in play_tags
File "aqt.sound", line 209, in _play_next_if_idle
File "/.local/share/Anki2/addons21/939347702/player.py", line 286, in queueExternalAV
queueExternal(path)
File "/.local/share/Anki2/addons21/939347702/player.py", line 301, in queueExternal
ret = playVideoClip(path.filename if av_player else path)
File "/.local/share/Anki2/addons21/939347702/player.py", line 267, in playVideoClip
args += ["--aid={}".format(aid)]
UnboundLocalError: local variable 'aid' referenced before assignment
movies2anki's config contains:
"preferred languages": "english",
The .conf file loaded by MPV contains:
sid=3
aid=2
alang=eng
MPV output:
(+) Audio --aid=1 (*) 'español' (ac3 6ch 48000Hz)
Audio --aid=2 'english' (ac3 6ch 48000Hz)
Subs --sid=1 (*) 'español forzado' (subrip)
Subs --sid=2 'español' (subrip)
(+) Subs --sid=3 'english' (subrip)
Subs --sid=4 --slang=mkv
A random older version from this year's backup plays the English stream.
After attempting to create a couple decks on my windows anki, the audio stalls and the flashcard deck loads in very slowly and flickers through the deck. When I click out of the review session the audio will finish for the card that was last flipped to.
I uninstall the add-on and the review works as normal. But the cards themselves are messed up. The text repeats on loop.
This problem occurred after using auto-generated subtitles from a VTT subtitle file.
I tried deleting everything including my anki folder and starting over, but the problem keeps occurring now when I install the add-on.
Как насчёт их поддержки? Чтобы не перекодировать.
It happens if main Anki window is not focused.
Getting that error when trying to install movies2anki in my Linux computer
Traceback (most recent call last):
File "movies2anki.py", line 15, in <module>
from PyQt4 import QtCore, QtGui
ImportError: No module named PyQt4
Zorin OS 16 (focal)
Some files have a different volume. I couldn't get a file-specific configuration file to work.
Hello, I have reviewed the previous issues and followed your suggestions. but the problem still persists.
Python 3.9.15 Qt 5.15.2 PyQt 5.15.5
Platform: Windows-10-10.0.19045
Traceback (most recent call last):
File "C:\Users\monster\AppData\Roaming\Anki2\addons21\939347702\player.py", line 841, in run
raise CalledProcessError(retcode, cmd_debug)
subprocess.CalledProcessError: Command '['"C:\\Program Files (x86)\\ffmpeg\\bin\\ffmpeg.exe" "-y" "-ss" "0:01:18.120" "-i" "C:/Users/monster/Desktop/S01E03 - Heart of Ice.mp4" "-t" "3.586" "-af" "afade=t=in:st=0.000:d=0.100,afade=t=out:st=3.486:d=0.100" "-map" "0:v:0" "-map" "0:a:0" "-ac" "2" "-vf" "scale=\'min(-2,iw)\':\'min(320,ih)\',setsar=1" "-pix_fmt" "yuv420p" "-sn" "-map_metadata" "-1" "-c:v" "libx264" "-profile:v" "main" "-level:v" "3.1" "-movflags" "+faststart" "C:\\Users\\monster\\AppData\\Local\\Temp\\anki_temp\\S01E03_-_Heart_of_Ice_0.01.18.120-0.01.21.706.wemb"']' returned non-zero exit status 4294967274.
===Add-ons (active)===
(add-on provided name [Add-on folder, installed at, version, is config changed])
Add Hyperlink ['318752047', 2023-06-18T14:39, 'None', '']
Advanced Browser ['874215009', 2023-10-21T17:34, 'None', '']
AwesomeTTS - Add speech to your flashcards ['1436550454', 2024-04-15T17:06, 'None', '']
Batch Editing ['291119185', 2023-10-26T03:38, 'None', '']
Edit Field During Review Cloze ['385888438', 2024-01-03T10:19, '6.18', mod]
Editor Scripts Symbols ['2065559429', 2022-07-25T20:48, 'None', '']
Image Editor ['307397307', 2022-09-08T07:09, 'None', '']
Image Occlusion Enhanced ['1374772155', 2022-04-09T10:15, 'None', '']
Review Heatmap ['1771074083', 2022-06-30T04:43, 'None', '']
The KING of Button Add-ons ['374005964', 2024-01-27T13:19, 'None', mod]
Watch Foreign Language Movies with Anki movies2anki subs2srs ['939347702', 2024-04-29T21:36, 'None', mod]
===IDs of active AnkiWeb add-ons===
1374772155 1436550454 1771074083 2065559429 291119185 307397307 318752047 374005964 385888438 874215009 939347702
===Add-ons (inactive)===
(add-on provided name [Add-on folder, installed at, version, is config changed])
'' ['Pop-up Dictionary', 0, 'None', '']
BetterSearch ['1052724801', 2024-03-06T19:25, 'None', '']
DeepL Translator ['972129549', 2024-04-26T23:11, '1.0.0', mod]
Paste Images As WebP ['1151815987', 2024-04-23T13:42, 'None', mod]
Review Hotmouse ['1928346827', 2024-01-03T08:51, '2.8', mod]
Review Lookup ['1745211643', 2022-06-22T10:12, 'None', '']
Study Time Stats ['1247171202', 2024-02-24T19:59, 'None', '']
Zoom24 - Keep zoom level after reboot Fixed by Shige ['1923741581', 2024-05-02T04:23, 'None', mod]
Очень понравилось идея изучения языков при помощи этой программы, но не получается установить её до конца.
Я далёк от программирования, но вроде разобрался и установил через терминал все необходимые дополнения, на последнем 5 этапе запуска "python movies2anki.py" выдаёт ошибку и не находит файл.
В своей криворукости я не сомневаюсь и уверен что что то я делаю не правильно.
Был бы очень благодарен если подскажете что именно.
macOS High Sierra 10.13.6
https://github.com/ankitects/anki/releases/tag/23.10beta6
The Qt5 compatibility code is now off by default, which may break some add-ons that haven't been updated to support Qt6 in the last 2 years. If you find any have broken, please report the issues to the add-on author, and start Anki after setting the env var ENABLE_QT5_COMPAT to 1 to temporarily restore the compatibility code.
Can't load plugin:
When loading 'Watch Foreign Language Movies with Anki':
Traceback (most recent call last):
File "/usr/share/anki/aqt/addons.py", line 80, in loadAddons
import(dir)
File "/home/hostname/.local/share/Anki2/addons21/939347702/init.py", line 1, in
from . import movies2anki
File "/home/hostname/.local/share/Anki2/addons21/939347702/movies2anki.py", line 35, in
import pysubs2
File "/home/hostname/.local/share/Anki2/addons21/939347702/vendor/pysubs2/init.py", line 1, in
from .ssafile import SSAFile
File "/home/hostname/.local/share/Anki2/addons21/939347702/vendor/pysubs2/ssafile.py", line 2, in
from collections import MutableSequence, OrderedDict
ImportError: cannot import name 'MutableSequence' from 'collections' (/usr/lib/python3.10/collections/init.py)
Are there any plans to port this project to Python 3? Esp. wrt official Python 2.7 support ending next year, and many major projects dropping it by 2020 as well.
When i export .apkg file on win10, the .mp3 is not exported, but img is Normal export.
What's going on here?
When "Split Long Phrases" is 5, the first two are merged:
1
00:00:33,791 --> 00:00:35,291
Woohoo!
2
00:00:35,333 --> 00:00:37,083
Ya-haa!
3
00:00:37,125 --> 00:00:40,500
Hurry, friends!
Time for another adventure!
When it's 1, supposedly nothing is being merged that is not in the same chunk.
I don't want it to merge multiple short complete sentences into a single hard item.
How to output screenshots?
I added file-1.mp4
… file-3.mp4
, restarted Anki, then added file-4.mp4
… file-6.mp4
and file-% .mp4
Anki 2.1.22 (0ecc189a) Python 3.8.1 Qt 5.14.1 PyQt 5.14.1
Platform: Linux
Flags: frz=True ao=True sv=1
Add-ons, last update check: 2022-01-15 13:36:32
Add-ons possibly involved: Watch Foreign Language Movies with Anki
Caught exception:
Traceback (most recent call last):
File "/home/anki/.local/share/Anki2/addons21/939347702/movies2anki.py", line 1574, in start
self.startSingleMode()
File "/home/anki/.local/share/Anki2/addons21/939347702/movies2anki.py", line 1705, in startSingleMode
self.model.save_settings()
File "/home/anki/.local/share/Anki2/addons21/939347702/movies2anki.py", line 695, in save_settings
config.set('main', 'recent_deck_names', ",".join(reversed(self.recent_deck_names)))
File "/home/anki/.local/share/Anki2/addons21/939347702/configparser.py", line 1198, in set
super().set(section, option, value)
File "/home/anki/.local/share/Anki2/addons21/939347702/configparser.py", line 892, in set
value = self._interpolation.before_set(self, section, option,
File "/home/anki/.local/share/Anki2/addons21/939347702/configparser.py", line 401, in before_set
raise ValueError("invalid interpolation syntax in %r at "
ValueError: invalid interpolation syntax in 'file-%,file-6,file-5,file-4,file-3' at position 5
I actually want to split small videos into pieces to use in ordinary cards, so I don't need to split a big TV series episode at the time (which also wouldn't work on my smartphone).
Using a search query would be even more useful, for using a separate card to configure that.
Maybe you know a program that could do that on GNU/Linux?
I can't generate cards with the movies2anki - subs2srs setting. Here's the full error message from Anki:
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 on the add-on support site.
Debug info:
Anki 2.1.43 (0fbae6bc) Python 3.8.6 Qt 5.14.2 PyQt 5.14.2
Platform: Mac 10.16
Flags: frz=True ao=True sv=2
Add-ons, last update check: 2021-04-18 23:35:38
Add-ons possibly involved: Watch Foreign Language Movies with Anki
Caught exception:
Traceback (most recent call last):
File "/Users/tom/Library/Application Support/Anki2/addons21/939347702/movies2anki.py", line 1158, in run
call(cmd)
File "anki/utils.py", line 278, in call
File "subprocess.py", line 854, in init
File "subprocess.py", line 1583, in _execute_child
File "posixpath.py", line 152, in dirname
TypeError: expected str, bytes or os.PathLike object, not NoneType
Sometimes importing causes a hexadecimal number to be appended, which makes the addon ignore the note type, which is just confusing.
So....does this Anki plugin no longer work or what...? I'm guessing not since I see no new reviews on YouTube or comments that are more recent than a year or two ago... I get to the end of installing all the different stuff through Terminal and I get this error code. I can't prompt Movies2anki plugin to open. Anybody...?
Pad Timings: 750.
Gap between Phrases: 0
[ ] Split Long Phrases
(*) Phrases
https://www.youtube.com/watch?v=Axsm6x3Cij8
1
00:00:10,260 --> 00:00:13,800
Wie viel Uhr ist es?
2
00:00:13,920 --> 00:00:17,380
Es ist ein Uhr.
3
00:00:17,380 --> 00:00:20,820
Es ist zwei Uhr.
4
00:00:21,000 --> 00:00:24,980
Es ist drei Uhr.
and so on.
The first two subtitles are merged into
Wie viel Uhr ist es?
Es ist ein Uhr.
A few pairs of subtitles further in the file are also merged.
Some videos have "hardsubs" in them, which could be removed by cropping, but there is no such feature in this add-on. MPV-like players have such features, but what is the best way to do it?
subs2srs has a similar feature: "Crop Bottom: A crop may be applied to the bottom of the snapshot. This might to useful for removing hard subbed subtitles."
Debian GNU/Linux testing
Anki
Version 2.0.52
Qt 4.8.1 PyQt 4.9.1
FFmpeg is /usr/bin/ffmpeg
When I choose "Generate Mobile Video Cards…
", the following message appears, with a "Close
" button. When I press the Close
button, a progress window appears with the name of the oldest video I have added, and "0%
". There is no additional CPU load.
An error occurred in an add-on.
Please post on the add-on forum:
https://anki.tenderapp.com/discussions/add-ons
Traceback (most recent call last):
File "/home/fc/.local/share/Anki2/addons/movies2anki/player.py", line 464, in run
self.fp = subprocess.Popen(cmd.encode(sys.getfilesystemencoding()), shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE, startupinfo = info)
File "subprocess.py", line 679, in __init__
File "subprocess.py", line 1249, in _execute_child
OSError: [Errno 2] No such file or directory
Images in the readme file are broken
This is only a suggestion, because I've seen only a couple sources of .ass subtitles with any names specified, and I don't even know of a good way to replace/update the movies2anki cards I already have.
https://thedoctorteam.ru/project/mlp/season-1/friendship-is-magic-part-1/original
https://media.thedoctor.team/videos/season1/1x01_EngSubtitles.ass
In this example, the Style column contains the name of the character to color the text a character-specific color. "Somepony" is not a specific character, but "Default" is a narrator in that context.
Tags like "subtitlecharacter::Twilight" or "SubtitleStyle::Twilight" could be used for https://github.com/Rct567/FrequencyMan to put them in different targets and learn some voices separately.
[V4+ Styles]
Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
Style: Default,Arial,30,&H00FFFFFF,&H000000FF,&H00000000,&H00000000,0,0,0,0,100,100,0,0,1,2,2,2,10,10,20,1
Style: Twilight,Arial,30,&H00FFFFFF,&H000000FF,&H009C1B9F,&H00000000,0,0,0,0,100,100,0,0,1,1,2,2,10,10,20,1
Style: Somepony,Arial,30,&H00FFFFFF,&H000000FF,&H007D7E80,&H00000000,0,0,0,0,100,100,0,0,1,1,2,2,10,10,20,1
[Events]
Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
Dialogue: 0,0:00:08.08,0:00:11.57,Default,Default,0,0,0,,Once upon a time, in a magical land of Equestria...
Dialogue: 0,0:01:23.58,0:01:27.64,Default,Default,0,0,0,,The elder sister took on responsibility for both sun and moon....
Dialogue: 0,0:01:27.84,0:01:31.30,Twilight,Default,0,0,0,,...and harmony has been maintained in Equestria for generations since.
Dialogue: 0,0:01:34.65,0:01:39.14,Twilight,Default,0,0,0,,Hm... Elements of Harmony. I know I've heard of those before.
Dialogue: 0,0:01:39.94,0:01:41.06,Twilight,Default,0,0,0,,But where?
Dialogue: 0,0:02:21.88,0:02:23.97,Somepony,Default,0,0,0,,There you are, Twilight!
Dialogue: 0,0:02:23.97,0:02:27.47,Somepony,Default,0,0,0,,Moondancer is having a little get-together in the west castle courtyard.
Dialogue: 0,0:02:27.66,0:02:28.78,Somepony,Default,0,0,0,,You wanna come?
Dialogue: 0,0:02:28.89,0:02:33.16,Twilight,Default,0,0,0,,Oh, sorry girls. I gotta lot of studying to catch up on.
Dialogue: 0,0:02:35.86,0:02:38.30,Somepony,Default,0,0,0,,Does that pony do anything except study?
Dialogue: 0,0:02:39.32,0:02:42.07,Somepony,Default,0,0,0,,I think she's more interested in books than friends.
For one, .webm
is missing. Anki 2.1 seems to be using a system list, but it has no WebM, either (so there is no way to see WebM files in the list).
WebVTT is a subtitle file format based on SRT (so they are very similar). It is supported by Web browsers and used by YouTube.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.