Created
          May 1, 2013 06:32 
        
      - 
      
- 
        Save pope/5494029 to your computer and use it in GitHub Desktop. 
    A simple script to rename the mp4s in a directory into something that Plex likes. YMMV.
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | for i in *.mp4; do | |
| ffprobe "$i" 2>&1 | awk -v i="$i" ' | |
| BEGIN { FS=": " } | |
| /title/ { title=$2 } | |
| /artist/ { artist=$2 } | |
| /track/ { sub(/\/12/,"",$2); track=$2 } | |
| /album/ { sub(/^.*Pt\. /,"",$2); season=$2 } | |
| END { | |
| printf("mv \"%s\" \"%s - s%02de%02d - %s.mp4\"\n", i, artist, season, track, title) | |
| }' | |
| done | bash | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment