yuchen-lea / org-media-note

Taking interactive notes when watching videos or listening to audios in org-mode.
GNU General Public License v3.0
243 stars 35 forks source link

Opening Youtube videos stored as a bibkey #19

Closed nanjigen closed 3 years ago

nanjigen commented 3 years ago

Possibly due to me not following the documentation correctly, I am having some difficulty get a Youtube video to play from a videocite link, or by using o l from the org-media hydra when the cursor is on a org-ref cite link:

  [[videocite:videotest#0:01:28]]
cite:videotest

If the bibkey references a local file, the videocite: link works, but not for a youtube video. Neither local nor remote videos are detected when attempting o l over the cite link.

All bib entries are generated with Zotero.

Thanks, the project is serving me greatly

yuchen-lea commented 3 years ago

I'm not sure what you are trying to do. If you want to play online videos, use o o (org-media-note-mpv-play-online-video) instead of o l, then input the youtube url. Since youtube is not available in China, I take this for test, and it works: https://www.bilibili.com/video/BV16t411n7vJ .

videocite: link only supports local files now. Is the online url stored in bib file? Please show me an example bib entry of online video.

nanjigen commented 3 years ago

Hi @yuchen-lea

This is an example youtube bib entry, generated with zotero:

@video{rapidliquid2018,
  title = {Big Mood},
  editor = {{Rapid Liquid}},
  date = {2018-11-28},
  url = {https://www.youtube.com/watch?v=rs92BVVOjws},
  urldate = {2021-03-24},
  abstract = {hey good bois out there, in this video im gonna show you how big mood is celebrated properly. Relatable stuff coming up next ;) },
  editortype = {director}
}

You can see the url present with the youtube-link. An ideal use case would be the addition of a video to bib as url. After some notetaking, I realize that the video is worth keeping and so I org-attach and add the url to bib entry such that the links still act on a bibkey but instead find a local file if there is one

yuchen-lea commented 3 years ago
  1. Does o o (org-media-note-mpv-play-online-video) work for online youtube videos?
  2. Is this a better way: when o o, try to play the online video, whose url is stored in bib url field. If not found, input the url manually.
nanjigen commented 3 years ago
  1. Yes it works perfectly
  2. I think this could work. What I had in mind was that in the case that the bib entry had a file path as well as a url entry, it would fail over to the file path. This way, org-media-note doesn't care about anything but bibkey and org-ref handles the link. However with testing it seems that as org-ref was not built with videos in mind, when it does not find a .pdf in the file path it will fail over to the stored url, negating the desired automatic effect.

This means that yes, we will need to manually use o o or o l to retrieve the remote or local file (we must do extra work to remember...)

yuchen-lea commented 3 years ago

Now opening local and online file is merged. This will try the following in order:

  1. find local file in bib entry
  2. find url in bib entry
  3. find local file in attach dir
  4. ask you to find local file or open online url manually

Have a try and let me know how's it going ;)

nanjigen commented 3 years ago

Hi Yuchen, sorry for the wait

So I've done some testing and this is what I'm observing so far: o open file will not detect that the note is an org-ref note. I have :CUSTOM-ID: in the properties drawer with the bibkey, but this doesn't seem to effect smart-play from figuring out I want to open from bib entry. So, I have to make videocite links manually.

When I do make videocite link manually, it will not play url videos. Only bib entry where file path is a local video. Also when I click these videocite links, the video will play, but i insert timestamp will insert org-attach link instead of videocite based link.

I think this violates the above order

Thank you for your time

yuchen-lea commented 3 years ago

Here you have 2 problems, let's look at them one by one:

  1. cannot open online video in an org-ref note
    • This works well in my environment. Check the value of (org-media-note-ref-cite-p) under your org-ref note, this should be t.
    • Then edebug function org-media-note-mpv-smart-play, check the value of media-url-by-key , this should be the url of video file.
  2. cannot open cite link if it's an online video instead of local video
    • I forgot to update the org-media-note-media-cite-link-follow function, this should work after updating to bc283c5.
    • If it still doesn't work, edebug on org-media-note-media-cite-link-follow and click the link, see what happens.

Due to the network connection, playing online videos in mpv fails sometime in my environment. As long as (mpv-start video-url) works for you, all things should be fine.