Browse Source

latest hacks

master
Jeffrey Paul 2 years ago
parent
commit
b93b7d52f7
  1. 12
      20200627.videosort/makefile.archive
  2. 11
      20200627.videosort/sort.sh
  3. 22
      bin/rename-videos-by-mtime

12
20200627.videosort/makefile.archive

@ -0,0 +1,12 @@
SNEAK_KEY_ID := 5539AD00DE4C42F3AFE11575052443F4DF2A55C2
check:
gpg SHASUMS.sig && shasum -c SHASUMS
par:
par2 create -v -u -m2000 -rm250000 iphone.stills.par2 *.gpg
gen:
rm -f .DS_Store SHASUMS
find . -type f -exec shasum {} \; | tee SHASUMS
gpg -u $(SNEAK_KEY_ID) -a --output SHASUMS.sig --detach-sig SHASUMS

11
20200627.videosort/sort.sh

@ -0,0 +1,11 @@
#!/bin/bash
for FN in *.MOV *.MP4 *.MTS *.mov *.mp4; do
MTIME="$(stat -f "%Sm" "$FN")"
# eg "Sep 13 05:02:26 2019"
NP="$(date -j -f "%b %d %T %Y" "$MTIME" "+%Y/%Y-%m/%Y-%m-%d")"
if [[ -e "$FN" ]]; then
mkdir -p "$NP"
mv "$FN" "$NP"
fi
done

22
bin/rename-videos-by-mtime

@ -0,0 +1,22 @@
#!/bin/bash
set -x
for FN in *.MOV *.MP4 *.MTS *.mov *.mp4; do
if [[ -e "$FN" ]]; then
MTIME="$(stat -f "%Sm" "$FN")"
if [[ ! -z "$MTIME" ]]; then
# eg "Sep 13 05:02:26 2019"
NP="$(date -j -f "%b %d %T %Y" "$MTIME" "+%Y-%m-%dT%H%M%S")"
EXT="${FN##*.}"
LOWEREXT="$(echo "$EXT" | tr 'A-Z' 'a-z')"
TARGET="$NP.$LOWEREXT"
if [[ -e "$FN" ]]; then
if [[ ! -e "$TARGET" ]]; then
mv "$FN" "$TARGET"
echo mv "$FN" "$TARGET"
fi
fi
fi
fi
done
Loading…
Cancel
Save