NZB Drone Post-Processor, end of file gets cut off when moving across network

If anyone is interested, I put together this little script to find potentially corrupted files:

#!/usr/bin/python

import os
import sys

def checkfile(filename):
    command = "echo 'seek 95 1' | mplayer -slave -msglevel all=4 -benchmark -vo null -nosound \"" + filename + "\" 2>&1"
    output = os.popen(command).read()
    if output.lower().find('error') == -1:
        return True
    else:
        return False

if __name__ == "__main__":
    for filename in sys.argv[1:]:
        if checkfile(filename):
            print('OK|' + filename)
        else:
            print('ERROR|' + filename)

It uses mplayer to seek to 95% of the file and attempts to play it. If any errors are reported it prints out ERROR| followed by the filename, otherwise it prints out OK|.

You can use it either by doing:

checkfile.py *.mkv

Or if you want to scan for recently created files, this will find all files created in the last 90 days and check them (assuming the script is in your home directory and you are in your TV directory). Output will be written to /tmp/filecheck.txt

find . -ctime -90 -type f -iname "*.jpg" ! -iname "*.nfo" ! -iname "*.tbn" -exec  ~/checkfile.py \{\} \; > /tmp/filecheck.txt

Output will look something like this:

OK|./The Strain/Season 01/s01e03 Gone Smooth 720p WEB-DL.mkv
ERROR|./The Strain/Season 01/s01e07 For Services Rendered WEBDL-720p.mkv
OK|./The Strain/Season 01/s01e06 Occultation HDTV-720p.mkv

My stats after running this:

Total files: 1332
Corrupted: 85 (6.4%)