Advertisement
dkonigsberg

metastrip

Jul 23rd, 2018
269
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.06 KB | None | 0 0
  1. # Find all files not matching certain music file extensions
  2. $ find . -type f -not -iname \*.mp3 -not -iname \*.m4a -not -iname \*.wma -not -iname \*.ogg -not -iname \*.flac
  3.  
  4. # Strip tags from MP3 files
  5. $ find . -iname \*.mp3 -exec id3convert -s {} \;
  6.  
  7. # Strip tags from M4A files
  8. $ find . -iname \*.m4a -exec AtomicParsley {} --metaEnema --overWrite \;
  9.  
  10. # Strip tags from WMA files (likely to work with other formats too)
  11. $ find . -iname \*.wma -exec bash -c "ffmpeg -i '{}' -c copy -map_metadata -1 /tmp/output.wma && mv /tmp/output.wma '{}'" \;
  12.  
  13. # Strip tags from FLAC files
  14. $ find . -iname \*.flac -exec metaflac --remove-all {} \;
  15.  
  16. # Strip tags from OGG files
  17. $ find . -iname \*.ogg -exec vorbiscomment -w -c /dev/null {} \;
  18.  
  19. # Find directories with two file types
  20. tmp=$(mktemp)
  21. find . -name '*.mp3' -o -name '*.flac' | sort >"$tmp"
  22. comm -12 <(<$tmp sed -n 's!/[^/]*\.mp3$!!p' | sort) \
  23.          <(<$tmp sed -n 's!/[^/]*\.flac$!!p' | sort) | uniq
  24. rm "$tmp"
  25.  
  26. # Fix permissions
  27. $ find . -type d -exec chmod a+rx {} \;
  28. $ find . -type f -exec chmod a+r {} \;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement