From 652e68373fc2704c78e6d205bd21ba7ff1e52162 Mon Sep 17 00:00:00 2001 From: gryf Date: Thu, 30 Nov 2006 11:38:17 +0000 Subject: [PATCH] * Added helper module with functions for scanning different data types. --- filetypeHelper.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 filetypeHelper.py diff --git a/filetypeHelper.py b/filetypeHelper.py new file mode 100644 index 0000000..6dce90f --- /dev/null +++ b/filetypeHelper.py @@ -0,0 +1,33 @@ +# This Python file uses the following encoding: utf-8 +""" +functions for treat different files with different way +""" + +import string +import os +import popen2 + +def guess_video(path): + info = popen2.popen4('midentify "' + path + '"')[0].readlines() + video_format = '' + audio_codec = '' + video_codec = '' + video_x = '' + video_y = '' + for line in info: + l = line.split('=') + val = l[1].split('\n')[0] + if l[0] == 'ID_VIDEO_FORMAT': + video_format = val + elif l[0] == 'ID_AUDIO_CODEC': + audio_codec = val + elif l[0] == 'ID_VIDEO_CODEC': + video_codec = val + elif l[0] == 'ID_VIDEO_WIDTH': + video_x = val + elif l[0] == 'ID_VIDEO_HEIGHT': + video_y = val + return (video_format,video_codec,audio_codec,video_x,video_y) + +def guess_image(path): + pass