1
0
Fork 0
dotfiles/home/programs/scripts/strip-metadata

30 lines
807 B
Text
Raw Normal View History

2024-03-08 19:15:18 +00:00
#!/usr/bin/env nu
def main [path: string] {
glob $path | each { |item|
match ($item | path parse | get extension | str downcase) {
"jpg" | "jpeg" | "png" => {
2024-09-26 15:19:52 +00:00
do -i {
xattr -d com.apple.metadata:kMDItemWhereFroms $item
xattr -d com.apple.metadata:kMDItemComment $item
}
2024-03-08 19:15:18 +00:00
exiftool -all= -overwrite_original_in_place $item
},
"mp4" => {
let tmp_item = $"($item)_out.mp4"
2024-09-26 15:19:52 +00:00
do -i {
xattr -d com.apple.metadata:kMDItemWhereFroms $item
xattr -d com.apple.metadata:kMDItemComment $item
}
2024-03-08 19:15:18 +00:00
ffmpeg -i $item -map_metadata -1 -c:v copy -c:a copy $tmp_item
rm $item
mv $tmp_item $item
},
_ => {
error make { msg: 'Unsupported file extension' }
}
}
}
}