yuchen-lea / org-media-note

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

bug: screenshot a youtube link contains `?` regex symbol, and then you cannot open that file #49

Closed pedro-nonfree closed 6 months ago

pedro-nonfree commented 7 months ago

Now testing the great screenshot feature. Works great, but I just have a problem (which I propose a fix in an upcoming PR)

I have the following org-file-apps config (which I show you an extract so you get an idea) [1]. That config says to open .jpg files with eom external application (The Eye of MATE Image Viewer).

My workflow is, ok, I got an screenshot and then I would like to make a zoom clicking on the image, but as the image contains as ? in the path (for the case of youtube). It is opened with dired with a buffer such as:

  /home/user:
  wildcard watch?v=68zOvCLwcL8-0_05_58.jpg
  -rw-r--r-- 1 user user 132K Feb 14 12:09 watch?v=68zOvCLwcL8-0_05_58.jpg

That happens with a file link such as file:/home/user/watch?v=68zOvCLwcL8-0_05_58.jpg

With a corrected link such as file:/home/user/watch-v=68zOvCLwcL8-0_05_58.jpg (just replacing ? with -) fixes the problem

[1]

(setq org-file-apps
      '(("\\.ods\\'"     . "localc %s")
        ("\\.odt\\'"     . "lowriter %s")
        ("\\.xls\\'"     . "localc %s")
        ("\\.xlsx\\'"    . "localc %s")
        ;;("\\.csv\\'"   . "localc %s")
        ("\\.midi\\'"    . "vlc %s")
        ;; (...)
        ("\\.png\\'"     . "eom %s")
        ("\\.jpg\\'"     . "eom %s")
        ("\\.jpeg\\'"    . "eom %s")
        ;; (...)
        (directory       . "thunar %s")
        (auto-mode       . emacs)))
pedro-nonfree commented 7 months ago

I see it could affect other regex such as *, etc. but from now I am fine this way

yuchen-lea commented 6 months ago

Thank you! As I seldom use online videos, I hadn't noticed before.

The default naming convention has been updated. Now, for online videos, the screenshot name is generated from the title rather than the URL. For example, a screenshot from https://www.youtube.com/watch?v=68zOvCLwcL8 would have a name similar to Is_Laufey_jazz_-0_00_10.jpg rather than watch?v=68zOvCLwcL8-0_05_58.jpg.

If you don't like the default rule, you can now customize it using org-media-note--screenshot-name-format-function! This function takes four parameters, see the default naming function org-media-note--screenshot-name-format-function-default for details.

yuchen-lea commented 6 months ago

@pedro-nonfree I've recently enhanced support for online video, with the primary improvement being the importation of subtitles for online videos. Although Youtube doesn't offer the option to select subtitles directly in the minibuffer like Bilibili does, you can still manually select and import VTT subtitles downloaded by yt-dlp. Welcome to try it out.