Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # mediainfo get videos by resolution 20240121043425
- lsvideoheight_core() {
- # $1 = height
- # $2 = current file name
- mediainfo_result=$(mediainfo "$2" |egrep "(Complete name|Height.*: $1)");
- mediainfo_height=$(echo "$mediainfo_result" | tail -n 1 )
- if ( [[ $mediainfo_height == *"$1"* ]] ); # if video height matches
- then { echo "$mediainfo_result" | head -n 1 | grep "$2" |sed -r "s/^.*: //g"; }; fi # remove everything except the file path
- }
- lsvideoheight() {
- # iterate though multiple files
- argument_count=1; # skip height argument
- for filenames in "$@"; # not using "${@:2}" for sh compatibility
- do { if (test $argument_count -ge 1 ); then lsvideoheight_core "$1" "$filenames"; fi;
- argument_count=$(( argument_count + 1 ));
- }
- done
- }
- ls4320p() { lsvideoheight "2 160" "$@"; } # 8K
- ls2160p() { lsvideoheight "2 160" "$@"; } # 4K
- ls1440p() { lsvideoheight "1 440" "$@"; } # QHD / WQHD
- ls1080p() { lsvideoheight "1 080" "$@"; } # Full HD
- ls720p() { lsvideoheight "720" "$@"; } # HD
- ls480p() { lsvideoheight "480" "$@"; } # HQ ("high quality") / SD ("standard definition")
- # aliases
- alias ls8K=ls4320p;
- alias ls4K=ls2160p;
- alias lsQHD=ls1440p;
- alias lsFHD=ls1080p;
- alias lsHD=ls720p;
- # no alias for 480p because the abbreviations "HQ" and "SD" have ambiguous meanings such as "SD card".
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement