jellyfin / jellyfin-mpv-shim

MPV Cast Client for Jellyfin
Other
1.61k stars 93 forks source link

Support for Censor Script to censor a fragement of a video #260

Open kooolarpan opened 2 years ago

kooolarpan commented 2 years ago

What is Censor Script?

Censor is a lua script that is used to skip a fragment of a video with the help of timestamps that is manually listed inside the folder "names" with the respective filename of the video with the txt extension.

It is used to skip over parts of videos you don't want (others) to view.

download and installation

download only "censor" folder and its contents. put the "censor" folder(along with files in it i.e "names" folder and "main.lua") in the "scripts" folder inside mpv configuration folder.

link to the script: https://github.com/zenyd/mpv-scripts/tree/master/censor

Usage: imagine you want to skip the intro which begins on timestamp 0:2:30 and lasts until timestamp 0:4:00 your anime is called Attack on Titan - 03.mkv. So you create a text file named Attack on Titan - 03.txt inside the names folder. Now open the just created file and paste 0:02:30 0:04:00 inside it. Save and exit. If you open the anime Attack on Titan - 03.mkv it should now skip to the timestamp 0:04:00 after the playtime reaches 0:02:30. If you now also wanted to skip the ending you would add one more line to the text file with contents like this 0:21:00 0:22:00 source of usage - zenyd (https://github.com/zenyd/mpv-scripts/issues/30#issuecomment-872418598)

Issue: As the file is named according to the video name, jellyfin mpv shim can't recognize it.

iwalton3 commented 2 years ago

Try updating the script to read the media title instead of the file name: https://github.com/jellyfin/jellyfin-mpv-shim/issues/214

kooolarpan commented 2 years ago

I am not familiar with Lua Scripting.

kooolarpan commented 2 years ago

changing fromlocal filename = mp.get_property('filename/no-ext', nil)

to local filename = mp.get_property('media-title')

Doesn't work.

iwalton3 commented 2 years ago

What about force-media-title? That is the property that I actually set to cause MPV to show the right title.

But it also looks like it uses the file loaded event which may fire before that gets set. I know you can listen to properties being set to maybe it could wait until the forced title is set?