GithubHelp home page GithubHelp logo

Comments (19)

Calvin-Xu avatar Calvin-Xu commented on June 5, 2024 1

Thank you!

from memento.

Calvin-Xu avatar Calvin-Xu commented on June 5, 2024 1

Thank you so much. It is so amazing that this is completely fixed now. This bug almost made me give up using Memento, but the quality of the application and the pace at which development is proceeding gave me a lot of hope.

I think Memento is a very polished and complete package at this point, and I would be excited by whatever you might be planning that’s in the pipeline. Thanks so much for this amazing work.

from memento.

ripose-jp avatar ripose-jp commented on June 5, 2024

I think I noticed once when this happened that no subtitle seemed to be visually selected in the subtitle list when the card was being added.

This is intended behavior. {context} only adds what's selected in the subtitle list. I can't reproduce this bug unless I deselect everything like you describe.

Error with {audio-media}

I can't reproduce this on Linux with Anki 2.1.15 or Windows with Anki 2.1.47, but I can reproduce this easily on macOS with Anki 2.1.47 given the video you posted.

Now here's the interesting part of this bug, it's not reproducible in a development environment. That is to say, if you compile Memento following the "macOS" instructions in the README as opposed to the "macOS App Bundle" instructions. There's no difference in source code between these two versions other than how MeCab is initialized. The most meaningful difference is that the macOS version will link to Homebrew installed libraries, while the app bundle version will link to libraries inside the app bundle. If I modify the build a little bit to make it so the app bundle target only links to Homebrew libraries, the bug is still reproducible, so the included libraries are not the problem.

The bug is no longer reproducible if you go to the Memento application, right click, click "Show Package Contents", and then launch the Memento executable by clicking it (it's located in Contents/MacOS/Memento). This leads me to believe that the problem is not in the code, but rather how macOS treats .app files.

My first guess would be that temp files are protected and that only the process that creates them (Memento) can read and write them, while other processes (Anki/AnkiConnect) cannot read or write them. That can't be the case though, since {screenshot-video} works most of the time.

I'm not sure why this happens yet, but given everything I've seen so far, it seems like it's probably not an issue with the code, but with how macOS is treating .app files.

Error with {screenshot-video}

I can't reproduce this, but given what happens with {audio-media}, it's not hard to believe its happening for the same reasons, just less frequently.

from memento.

Calvin-Xu avatar Calvin-Xu commented on June 5, 2024

This is intended behavior. {context} only adds what's selected in the subtitle list. I can't reproduce this bug unless I deselect everything like you describe.

I don't remember deselecting the current subtitle myself, but as I have not been able to reproduce what happened either, it was most likely a mistake on my part.

The bug is no longer reproducible if you go to the Memento application, right click, click "Show Package Contents", and then launch the Memento executable by clicking it (it's located in Contents/MacOS/Memento). This leads me to believe that the problem is not in the code, but rather how macOS treats .app files.

This does indeed solve the issue. I suppose for the time being I will be launching the executable directly. Thank you!

On a side note, is the current recommended platform Arch with KDE Plasma?

from memento.

ripose-jp avatar ripose-jp commented on June 5, 2024

On a side note, is the current recommended platform Arch with KDE Plasma?

95% of Memento was developed on Gentoo Linux with KDE Plasma, so that's what it was optimized for. That said, Memento will work equally well on any distro running Plasma like most Qt applications. Arch is a good choice because I maintain an AUR package for it.

from memento.

Calvin-Xu avatar Calvin-Xu commented on June 5, 2024

As an interesting side effect, previously when trying to take a screenshot in Memento (mpv default keybinding s), mpv reports Error writing screenshot!. Launching the executable directly, it is able to take a screenshot & write it to ~.

from memento.

ripose-jp avatar ripose-jp commented on June 5, 2024

I've fixed the problems with {audio-media} not working with streamed media. The problem was that the encoder instance of mpv that {audio-media} uses was not pointing to the youtube-dl executable in Memento's config directory. This could potentially be a problem on other OSes, but that would require someone setting their ytdl_hook-ytdl_path manually to use some different version of youtube-dl, then use a site that the youtube-dl executable in the user's PATH doesn't support. Since something like this isn't likely to happen, I consider it to be a low priority bug for other OSes.

I've updated the macOS binaries on the Releases page and added a note about it if you'd like to update.

Regarding the bug with {screenshot-video}, I've created close to 100 cards trying to debug to {audio-media} bug and haven't been able to reproduce it. If I can't reproduce it, I can't fix it. Since this issue seems to cover multiple problems, I'll leave it up to you if you want to leave it open, or open a new issue for {screenshot-video} if you find a way to reliably reproduce it.

As an interesting side effect, previously when trying to take a screenshot in Memento (mpv default keybinding v), mpv reports Error writing screenshot!

That can be fixed by adding screenshot-directory=~/ in your mpv.conf. It likely has to do with Memento not having write permissions wherever mpv is trying to write screenshots. I'll think about changing the default screenshot directory on macOS to avoid this happening by default.

from memento.

Calvin-Xu avatar Calvin-Xu commented on June 5, 2024

Thank you a lot! So if I understand the message correctly, launching the executable instead of .app is still desirable for this release? I think I will close the issue afterward.

from memento.

ripose-jp avatar ripose-jp commented on June 5, 2024

No. As long as you properly setup youtube-dl as described in the README, you should be able to use the .app like normal.

from memento.

Calvin-Xu avatar Calvin-Xu commented on June 5, 2024

Although rare, this is still happening to me on macOS master 3bf32a2 (latest self-compiled). I have been playing videos from a local SMB share, so perhaps it could be particular to my use case. Since other people do not seem to experience it much currently, I think this might be a low priority issue and I can fix broken cards manually. But I feel it might be prudent to reopen this issue in case someone else might encounter it later & corroborate with more information from different use cases.

[Errno 2] No such file or directory: '/private/var/folders/31/xkn6lwrs7_382lqhy5f9wzbc0000gn/T/memento.UJwOqG.jpg'
[Errno 2] No such file or directory: '/private/var/folders/31/xkn6lwrs7_382lqhy5f9wzbc0000gn/T/memento.zUANtS.aac'

from memento.

ripose-jp avatar ripose-jp commented on June 5, 2024

The previously problem with {audio-media} was that it couldn't find youtube-dl on macOS, but the current problem seems to be a race condition of some sort. At this point, I believe the issue with {audio-media}, {screenshot} and {screenshot-video} are all caused by the same thing. I'll look at everything I think it could be.

Just to give me a better idea of where this is happening, was the screenshot and audio missing from the same card or separate cards?

from memento.

Calvin-Xu avatar Calvin-Xu commented on June 5, 2024

Thanks! The particular instance I pasted had both screenshot and audio missing from the same card. But I have also observed cards where just one is missing and of course most of the time it works perfectly.

from memento.

ripose-jp avatar ripose-jp commented on June 5, 2024

Could you apply this patch to Memento, compile it, and tell me if the problem still happens? patch.txt
It changes the life of temp files to until Memento exits instead of deleting them when AnkiConnect sends a response. Looking at the code for AnkiConnect, I don't think it will work, but it's the most obvious thing to try.

You can apply a patch to git project with

git apply /path/to/patch.txt

This is a difficult problem to debug, so don't feel like there is any rush.

from memento.

Calvin-Xu avatar Calvin-Xu commented on June 5, 2024

Thank you. I’ve compiled and tested the patched version. I added 50 cards and have not had a failed one yet (usually it was about 1 in every 20). I'll keep testing with normal usage over the next few days.

I can confirm the change in the lifecycle behavior of the screenshot and audio files. They do persist until Memento exits.

from memento.

ripose-jp avatar ripose-jp commented on June 5, 2024

v0.5.1-1-beta has been released and it contains the patch addressing this issue. If you think the problem was fixed, feel free to close the issue or if it's still happening, let me know.

from memento.

Calvin-Xu avatar Calvin-Xu commented on June 5, 2024

Thanks. I've been testing with the previous patch, and on 0.5.1-1 and v0.5.1-2. The race condition issue seems to be fixed.

In the process, I think I found the issue that causes {audio-media} to be empty (instead of being populated with the [Errno 2] value). This seems to be entirely unrelated to AnkiConnect and is instead an issue in the MpvAdapter:

Screenshot: '/private/var/folders/31/xkn6lwrs7_382lqhy5f9wzbc0000gn/T/memento.FiXIrd.jpg'
Could not get sub-start property (7%) A-V:  0.000 Cache: 172s/150MB
Could not get sub-end property

This happens less frequently than the [Errno 2] condition. Deleting the failed card and adding again usually solves the issue.

As this issue has involved three problems by now, I would listen to your judgement as to whether to keep this issue open, or close it and pursue this one separately.

from memento.

ripose-jp avatar ripose-jp commented on June 5, 2024

That last one was a really easy one to fix. It should really only happen if you add a card, then immediately press play, then have the subtitle change before it starts encoding the audio. There should only be a several hundred millisecond window where this can happen, so no wonder I never ran into it.

Anyway, I've pushed a fix to master. Unless there's anything else, I think this issue is probably solved. Thanks for all your help with this stuff.

from memento.

Roxiun avatar Roxiun commented on June 5, 2024

@ripose-jp
Hi so I'm getting this issue with audio media (screenshots work perfectly)

I'm using this script: https://codeberg.org/kochi/zoro-mpv (without the virtual environment because of #141

This script seems to use mp.set_property("stream-open-filename", files[1]) to open the url it has parased which may have something to do with the issue.

The issue only arises when using this script and not if I manually am opening the stream url.

from memento.

ripose-jp avatar ripose-jp commented on June 5, 2024

Your issue sounds only tangentially related to this one. Open a new issue so I can track it. This one is already solved.

from memento.

Related Issues (20)

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.