diff --git a/Makefile b/Makefile index 4f9ae04..650cb44 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,9 @@ CMD = blink bsearch burncpu duplicate-packets em encdir field forever \ - G gitnext gitundo goodpasswd histogram mtrr mirrorpdf neno \ - off pdfman pidcmd plotpipe puniq ramusage rand rclean rina rn \ - rrm shython sound-reload stdout swapout T timestamp tracefile \ - transpose upsidedown vid w4it-for-port-open whitehash \ - wifi-reload wssh ytv yyyymmdd + fxkill G gitnext gitundo goodpasswd histogram mtrr mirrorpdf \ + neno off pdfman pidcmd plotpipe puniq ramusage rand rclean \ + rina rn rrm shython sound-reload splitvideo stdout swapout T \ + timestamp tracefile transpose upsidedown vid \ + w4it-for-port-open whitehash wifi-reload wssh ytv yyyymmdd all: blink/blink.1 bsearch/bsearch.1 burncpu/burncpu.1 \ encdir/encdir.1 G/G.1 gitnext/gitnext.1 gitundo/gitundo.1 \ @@ -11,8 +11,8 @@ all: blink/blink.1 bsearch/bsearch.1 burncpu/burncpu.1 \ mirrorpdf/mirrorpdf.1 neno/neno.1 off/off.1 pdfman/pdfman.1 \ pidcmd/pidcmd.1 plotpipe/plotpipe.1 puniq/puniq.1 rand/rand.1 \ rina/rina.1 rn/rn.1 rrm/rrm.1 shython/shython.1 \ - sound-reload/sound-reload.1 stdout/stdout.1 \ - timestamp/timestamp.1 tracefile/tracefile.1 \ + sound-reload/sound-reload.1 splitvideo/splitvideo.1 \ + stdout/stdout.1 timestamp/timestamp.1 tracefile/tracefile.1 \ transpose/transpose.1 T/T.1 upsidedown/upsidedown.1 vid/vid.1 \ wifi-reload/wifi-reload.1 wssh/wssh.1 ytv/ytv.1 \ yyyymmdd/yyyymmdd.1 @@ -25,3 +25,5 @@ install: parallel eval ln -sf `pwd`/*/{} /usr/local/bin/{} ::: $(CMD) mkdir -p /usr/local/share/man/man1 parallel ln -sf `pwd`/{} /usr/local/share/man/man1/{/} ::: */*.1 + mkdir -p $(HOME)/.local/share/vlc/lua/extensions + ln -s `pwd`/splitvideo/dotlocal/share/vlc/lua/extensions/splitvideo.lua $(HOME)/.local/share/vlc/lua/extensions/splitvideo.lua diff --git a/encdir/encdir b/encdir/encdir index c433f9c..5cba7d9 100755 --- a/encdir/encdir +++ b/encdir/encdir @@ -27,7 +27,7 @@ Mount mydir.enc on mydir: =head1 AUTHOR -Copyright (C) 2017 Ole Tange, +Copyright (C) 2017-2020 Ole Tange, http://ole.tange.dk and Free Software Foundation, Inc. @@ -64,10 +64,12 @@ B if [ -z "$2" ] ; then fusermount -u $1 2>/dev/null - encfs `readlink -f $1.enc` `readlink -f $1` + # --public only works if root. Ignored otherwise. + encfs --public `readlink -f "$1".enc` `readlink -f "$1"` else fusermount -u `readlink -f $2` 2>/dev/null - encfs `readlink -f $1` `readlink -f $2` + # --public only works if root. Ignored otherwise. + encfs --public `readlink -f "$1"` `readlink -f "$2"` fi diff --git a/fxkill/fxkill b/fxkill/fxkill new file mode 100755 index 0000000..13d7b21 --- /dev/null +++ b/fxkill/fxkill @@ -0,0 +1,5 @@ +#!/bin/bash + +# Kill firefox content processes + +ps aux |G firefox contentproc childID -v grep |field 2 | xargs -r kill diff --git a/splitvideo/dotlocal/share/vlc/lua/extensions/splitvideo.lua b/splitvideo/dotlocal/share/vlc/lua/extensions/splitvideo.lua new file mode 100644 index 0000000..3833a52 --- /dev/null +++ b/splitvideo/dotlocal/share/vlc/lua/extensions/splitvideo.lua @@ -0,0 +1,84 @@ +--[[ +INSTALLATION (create directories if they donot exist): +- put the file in the VLC subdir /lua/extensions, by default: +* Windows (all users): %ProgramFiles%\VideoLAN\VLC\lua\extensions\ +* Windows (current user): %APPDATA%\VLC\lua\extensions\ +* Linux (all users): /usr/share/vlc/lua/extensions/ +* Linux (current user): ~/.local/share/vlc/lua/extensions/ +* Mac OS X (all users): /Applications/VLC.app/Contents/MacOS/share/lua/extensions/ +- Restart VLC. +- The extension can then be found in the menu: + View > Split video in two +- It requires 'splitvideo' from + https://gitlab.com/ole.tange/tangetools/tree/master/splitvideo + to be in $PATH +]]-- + +--[[ Extension description ]] + +function descriptor() + return { title = "SplitVideo" ; + version = "1.0" ; + author = "Ole Tange" ; + shortdesc = "Split video at the current time"; + description = "

Split Video

" + .. "When you're playing a file, use Split Video to " + .. "split the file into two files at the current time stamp. " ; + url = "https://gitlab.com/ole.tange/tangetools/tree/master/splitvideo" + } +end + +--[[ Hooks ]] + +-- Activation hook +function activate() + local filename,secs = filename_secs() ; + d = vlc.dialog("Split Video") ; + d:add_label("Split ".. filename .. " at " .. secs .. "?") ; + d:add_button("Split", splitvideo) ; + d:add_button("Cancel", close) ; + d:show() ; + vlc.msg.dbg("[Split Video] Activated") ; +end + +function filename_secs() + -- absolute filename and current play time in seconds + -- get the current playing file + local item = vlc.input.item() + -- extract its URI + local uri = item:uri() + -- decode %foo stuff from the URI + local filename = vlc.strings.decode_uri(uri) + -- remove 'file://' prefix which is 7 chars long + filename = string.sub(filename,8) + -- maybe: + vlc.msg.dbg("[SplitVideo/filename_secs] Filename " .. filename) + input = vlc.object.input() + local elapsed_secs = vlc.var.get(input, "time")/1000000 + + return filename,elapsed_secs +end + +function splitvideo() + local filename,secs = filename_secs() + -- shell quote the filename + file, _ = filename:gsub("([\002-\009\011-\026\\#?`(){}%[%]^*<>=~|; \"!$&'\130-\255])", "\\%1") + file, _ = file:gsub("\n", "'\n'") + os.execute("splitvideo " .. secs .. " " .. file) + close() +end + + +function deactivate() + -- Deactivation hook + vlc.msg.dbg("[SplitVideo] Deactivated") + vlc.deactivate() +end + +function close() + deactivate() +end + +-- This empty function is there, because vlc pested me otherwise +function meta_changed() +end diff --git a/splitvideo/splitvideo b/splitvideo/splitvideo new file mode 100755 index 0000000..d9d5233 --- /dev/null +++ b/splitvideo/splitvideo @@ -0,0 +1,233 @@ +#!/usr/bin/perl -w + +=pod + +=head1 NAME + +splitvideo - Split video at time stamp + + +=head1 SYNOPSIS + +B time videofile + + +=head1 DESCRIPTION + +B splits I at I