Not a member of Pastebin yet?
                        Sign Up,
                        it unlocks many cool features!                    
                - #-------------------------------------------------------------------------------
 - # Name: samsuck
 - # Purpose: Some Samsung TVs cannot play past 2H:3M:19S on MP4 files using
 - # the built-in media player.
 - # This script will convert every MP4 file in the specified
 - # directory (and sub-directories) to a Samsung TV compatible
 - # MKV file.
 - #
 - # Usage: 1. Create samsuck.py in the same directory as mkvmerge.exe
 - # 2. Paste this entire script in samsuck.py
 - # 3. Change 3 variables below to suit your needs
 - # 4. Run script.
 - # 5. Enjoy watching the movie past 2H:3M:19S
 - #
 - # Requires: Python 2.7 OR 3.2 and MKVToolNix
 - #
 - # Author: Tjerk Slaghek
 - # Donations: paypal [email protected]
 - #
 - # Created: 17-02-2012
 - # Copyright: (c) Tjerk 2012
 - # Licence: WTFPL
 - #-------------------------------------------------------------------------------
 - #!/usr/bin/env python
 - import os
 - import sys
 - #CHANGE THESE 3 VARIABLES TO SUIT YOUR NEEDS:
 - #this directory and ALL subdirectories will be searched
 - # USE DOUBLE BACKSLASH Z:\\DOWNLOADS\\PRON\\
 - rootDir = 'V:\\torrents\\'
 - #True = delete the original MP4 file after converting
 - deleteOriginalFilesAfterConverting = True
 - #False = skip already converted files
 - overwriteAlreadyConvertedFiles = False
 - #-----------------------THOU SHALL NOT PASS THIS LINE---------------------------
 - # (unless you know what your are doing)
 - def main():
 - for root, subFolders, files in os.walk(rootDir):
 - for file in files:
 - inputFile = os.path.join(root,file)
 - print (inputFile)
 - if (inputFile.endswith(".mp4")):
 - templist = inputFile.rsplit('\\',1)
 - templist[-1] = ("\\MKV_" + templist[-1])
 - templist = ''.join(templist).rsplit('.',1)
 - templist[-1] = ".mkv"
 - outputFile = ''.join(templist)
 - print ("inputFile: " + inputFile)
 - print ("outputFile: " + outputFile)
 - if (overwriteAlreadyConvertedFiles):
 - deleteCommand = 'del "' + outputFile + "\""
 - print ("deleteCommand: " + deleteCommand)
 - os.system(deleteCommand)
 - if (not os.path.isfile(outputFile)):
 - commandToBeExecuted = ('"mkvmerge.exe -o "' + outputFile + '" --compression -1:none "' + inputFile + '"')
 - print ("commandToBeExecuted: " + commandToBeExecuted)
 - os.system(commandToBeExecuted)
 - if (deleteOriginalFilesAfterConverting):
 - deleteCommand = ('del "' + inputFile + "\"")
 - print ("deleteCommand: " + deleteCommand)
 - os.system(deleteCommand)
 - else:
 - print ("ERROR: File already exists: " + outputFile)
 - print ("Finished!")
 - pass
 - if __name__ == '__main__':
 - main()
 
Advertisement
 
                    Add Comment                
                
                        Please, Sign In to add comment