Video Standardization and Compression
Origin
Overview
Step 1: Setup and Retrieving Files
class fileObject:
source = ""
resolution = -1 # Check metadata
newFilename = ""
year = 0000
season = -1
episode = -1
endEpisode = -1
series = ""
episodeName = ""
def __init__(self, filepath, subtitles):
self.filepath = filepath
self.fullpath = os.path.abspath(filepath)
self.filename = os.path.basename(filepath)
self.parentFold = os.path.dirname(filepath)
self.extension = os.path.splitext(filepath)[1].strip() # Ex: .mkv
self.subtitles = subtitles
# Extra feature to remove files that start with ._ In addition to listing all files
def cleaningUp():
acceptedExt = [".mkv", ".mov", ".mp4", '.wmv', '.m4v', '.avi', '.flv', '.srt', '.ass', '.ssa', '.sub']
print("Starting Function to remove all files with a ._ Starting")
fileList = []
for root, dirs, files in os.walk(containingDir):
for name in files:
for x in acceptedExt:
if x in name:
fileList.append(os.path.join(root, name))
if name[0:2] == "._":
os.remove(os.path.join(root, name))
print("Removing file "+ name)
return fileList
def main():
os.chdir(containingDir)
fileList = cleaningUp()
for f in fileList:
absCurFilePath = os.path.abspath(f)
if isVideoFile(f):
myCurFile = extraction(absCurFilePath)
fileRecords.append(myCurFile)
else:
pass
Step 2: Creating new Filename
Step 3: Information Extraction
Step 4: Clean up
Step 5: Writting to database
Step 6: Video Conversion
Step 7: Clean up
Final Version
Last updated