示例#1
0
def rip_with_makemkv(movieName):
    '''
        I am going to make some assumptions for round 1.  I am going to assume you want an english only disk
        without subs.  I am going to remove all 3D and special tracks.
    '''
    
    settings = {    'cache'            :    1024,
                    'minLength'        :    3601,
                    'discAccess'       :    'true'  #examples are all lowercase
                }
             
    #To get disk info
    discInfo = subprocess.check_output([ arconfig.MAKEMKVCON, '-r', 'info', 'disc:%s' % arconfig.MAKEMKV_DISC_NUM ])
    
    if re.search('"Failed to open disc"', discInfo):
        return False
    
    #To rip disk and eject once finished
    movieTime(0)
    subprocess.call([ arconfig.MAKEMKVCON, '--minlength=%d' %settings['minLength'], '-r', '--decrypt', '--directio=%s' %settings['discAccess'], 'mkv', 
                            'disc:%s' % arconfig.MAKEMKV_DISC_NUM, 'all', arconfig.RIP_LOCATION], stdout=subprocess.PIPE)
    movieTime(1)
    dbWrite(movieTime(2, 'makemkv'))
    tmp = subprocess.call([ 'eject', '-s', arconfig.BLURAY_DEVICE ])
    
    if tmp == 1:
        dbWrite('Failed to rip with makemkv', True)
        return False
        
    '''[ TO DO ] Currently I am going to assume that the first track is the track we want, I will add better control once 
    I figure out all the options to makemkvcon'''
   
    ripMovieName = glob(arconfig.RIP_LOCATION + '*t00.mkv')[0]
    
    return ripMovieName
示例#2
0
def convert_with_handbrake(movieLocation):
    '''
        I figure you don't NEED this unless you want the compression factor.  DVD's will take a max of 9 gigs and since I am a quality w***e
        I am going to keep them as close to normal as possible.  Will leave an option for you to override if you feel like it.
    '''
    
    settings = {    'input'         :   movieLocation,
                    'output'        :   os.path.join(arconfig.CONVERT_LOCATION,os.path.split(movieLocation)[-1]),
                    'backupAudio'   :   'ac3,dts,dtshd',
                    'fallbackAudio' :   'ffac3',
                    'videoEncode'   :   'x264',
                    'videoQuality'  :   '20',
                    'advancedEncode':   'level=4.1',
                    'audioTrack'    :   '1',
                    'x264-profile'  :   'high'
               }

    
    movieTime(0)
    tmp =  subprocess.call([ arconfig.HANDBRAKE_CLI, '-i', settings['input'], '-o', settings['output'], '--markers', '--audio', settings['audioTrack'], 
                            '--aencoder', 'copy', '--audio-copy-mask', settings['backupAudio'], '--audio-fallback', settings['fallbackAudio'], 
                            '--encoder', settings['videoEncode'], '--x264-profile', settings['x264-profile'], '--two-pass', '--turbo'])
    
    if tmp == 0:
        os.remove(movieLocation)    #No need to keep the ripped version if this worked.
    else:
        dbWrite('Failed to convert via handbrake', True)
        return False
    
    movieTime(1)
    dbWrite(movieTime(2, 'handbrake'))
    
    return os.path.join(arconfig.CONVERT_LOCATION,os.path.split(movieLocation)[-1])