kelciour / movies2anki

Convert movies with subtitles to watch them with Anki. Inspired by subs2srs
GNU Affero General Public License v3.0
302 stars 28 forks source link

Generate Mobile Cards error (FFmpeg not found?) #7

Closed aleksejrs closed 6 months ago

aleksejrs commented 5 years ago

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
kelciour commented 5 years ago

Yes, it looks like it coudn't find FFmpeg, but the strange thing is that it should have given you an warning when you tried to use "Generate Mobile Video Cards..." option (Please install FFmpeg...).

Does it happen again when you restart Anki? And after you restart Anki press Ctrl+Shift+; to open up Debug Console, type the following commands and press Ctrl+Enter. What is the output? In your case it should be /usr/bin/ffmpeg.

from distutils.spawn import find_executable
print(find_executable("ffmpeg"))
aleksejrs commented 5 years ago

Yes, and the command works:

>>> from distutils.spawn import find_executable
... print(find_executable("ffmpeg"))
/usr/bin/ffmpeg
kelciour commented 5 years ago

Please use Anki - Tools - Add-ons - Open Add-ons Folder... and replace player.py in the movies2anki folder with the updated version downloaded from this gist. It should fix this issue.

aleksejrs commented 5 years ago

It seems to work, thanks.

aleksejrs commented 5 years ago

When selecting File → Switch Profile in a session where I generated mobile cards:

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 "aqt/main.py", line 250, in unloadProfile
  File "anki/hooks.py", line 26, in runHook
  File "/home/fc/.local/share/Anki2/addons/movies2anki/player.py", line 595, in stopWorker
    mw.worker.cancel()
  File "/home/fc/.local/share/Anki2/addons/movies2anki/player.py", line 431, in cancel
    self.fp.terminate()
  File "subprocess.py", line 1462, in terminate
  File "subprocess.py", line 1457, in send_signal
OSError: [Errno 3] No such process
kelciour commented 5 years ago

Thanks! I've updated the gist to fix it.

aleksejrs commented 5 years ago

It works.

kelciour commented 6 months ago

I'll close it as it's about Anki 2.0 and I created a new issue #28 to maybe fix the error message if File → Switch Profile was used while generating mobile cards.