Skip to content

Instantly share code, notes, and snippets.

@Superbil
Last active October 6, 2022 18:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Superbil/860b906fa3370a55201a73d2b6396dd9 to your computer and use it in GitHub Desktop.
Save Superbil/860b906fa3370a55201a73d2b6396dd9 to your computer and use it in GitHub Desktop.
Update default videos to open by player
#!/usr/bin/env zsh
## Update exts
# Author: Superbil
# website: https://gist.github.com/Superbil/860b906fa3370a55201a73d2b6396dd9
# Use duti to setup player
#
# Usage update_exts.sh <bundle_id>
#
# Check argv
if [ $# -eq 0 ]; then
echo "No arguments supplied, setup player bundle_id"
exit 1
fi
if [ -z "$1" ]; then
echo "Input bundle_id is emptry string"
exit 1
fi
PLAYER_BUNDLE_ID=$1
EXTS=( 3GP ASF AVI FLV M4V MKV MOV MP4 MPEG MPG MPG2 MPG4 RMVB WMV MTS WEBM )
if (( $+commands[duti] )); then
for ext in ${EXTS[@]}
do
duti -vs $PLAYER_BUNDLE_ID $ext all
duti -vs $PLAYER_BUNDLE_ID $(echo $ext | tr "[:upper:]" "[:lower:]") all
done
else
echo "duti not install!"
fi
@Superbil
Copy link
Author

Superbil commented Oct 6, 2022

old version https://github.com/Superbil/dotfiles/blob/master/mpv/.config/mpv/update_exts.sh
IINA bundle ID com.colliderli.iina
mpv bundle ID io.mpv

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment