From f7352c489dce80fbc3a1ae532b205726098f8ab4 Mon Sep 17 00:00:00 2001 From: Siraaj Khandkar Date: Fri, 22 Nov 2019 15:55:23 -0500 Subject: [PATCH] Add video catalog building and playing --- home/.xbindkeysrc | 4 ++++ home/bin/video_catalog_play | 8 ++++++++ home/bin/video_catalog_update | 14 ++++++++++++++ home/lib/login_variables.sh | 4 +++- 4 files changed, 29 insertions(+), 1 deletion(-) create mode 100755 home/bin/video_catalog_play create mode 100755 home/bin/video_catalog_update diff --git a/home/.xbindkeysrc b/home/.xbindkeysrc index 5eca4dc..3df0a9b 100644 --- a/home/.xbindkeysrc +++ b/home/.xbindkeysrc @@ -109,3 +109,7 @@ # Search mpd lib and play selection "mpplay" Mod4+p + +# Search video catalog and play selection +"video_catalog_play" + Mod4+v diff --git a/home/bin/video_catalog_play b/home/bin/video_catalog_play new file mode 100755 index 0000000..a22b1ac --- /dev/null +++ b/home/bin/video_catalog_play @@ -0,0 +1,8 @@ +#! /bin/sh + +set -e + +LINES=60 + +file=$(khomenu -l "$LINES" < "$FILE_VIDEO_CATALOG") +mpv "$file" diff --git a/home/bin/video_catalog_update b/home/bin/video_catalog_update new file mode 100755 index 0000000..8a1acc3 --- /dev/null +++ b/home/bin/video_catalog_update @@ -0,0 +1,14 @@ +#! /bin/sh + +set -e + +find "$DIR_VIDEO" \ + -type f \ + -print0 \ +| xargs \ + -0 \ + -P "$(nproc)" \ + -I{} \ + sh -c 'printf "%s %s\n" $(mimetype -b "{}") "{}"' \ +| awk '/^video/ {sub($1 " +", ""); print}' \ +> "$FILE_VIDEO_CATALOG" diff --git a/home/lib/login_variables.sh b/home/lib/login_variables.sh index 403a89b..f219bad 100644 --- a/home/lib/login_variables.sh +++ b/home/lib/login_variables.sh @@ -2,11 +2,13 @@ export PATH=$HOME/bin:/snap/bin:/sbin:/usr/sbin:$PATH export EDITOR=vim export VISUAL=$EDITOR export DIR_GITHUB="${HOME}/Archives/Software/src/repos/remote/github.com" -export DIR_YOUTUBE="${HOME}/Archives/Videos/Web/youtube.com" +export DIR_VIDEO="${HOME}/Archives/Videos" +export DIR_YOUTUBE="${DIR_VIDEO}/Web/youtube.com" export DIR_NOTES="$HOME/Documents/Notes" export DIR_LOG="$HOME/var/log" export DIR_LOG_MPD="$DIR_LOG/mpd" export FILE_LOG_MPD="$DIR_LOG_MPD/mpd.log" +export FILE_VIDEO_CATALOG="$DIR_VIDEO/catalog" # .Net Core export DOTNET_ROOT=$HOME/.dotnet -- 2.20.1