From e1b313d2a426924e8b7abc09c251d8b277439bb8 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Tue, 18 Jan 2011 15:22:13 +0530 Subject: [PATCH] osx print/dont upload if encode failed, only encode if we get info from file --- pandora_client/__init__.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pandora_client/__init__.py b/pandora_client/__init__.py index b6412a3..3c0dbc7 100644 --- a/pandora_client/__init__.py +++ b/pandora_client/__init__.py @@ -25,6 +25,8 @@ default_media_cache = os.environ.get('oxMEDIA', os.path.expanduser('~/.ox/media' def encode(filename, prefix, profile): info = utils.avinfo(filename) + if not 'oshash' in info: + return None oshash = info['oshash'] frames = [] for pos in utils.video_frame_positions(info['duration']): @@ -364,8 +366,11 @@ class API(object): def uploadVideo(self, filename, data, profile): if DEBUG: - print filename + print filename.encode('utf-8') i = encode(filename, self.media_cache, profile) + if not i: + print "failed" + return #upload frames form = ox.MultiPartForm()