From 68426aaa6aa665da85c62b895134e557c215d2b2 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Tue, 30 Apr 2013 14:17:45 +0200 Subject: [PATCH] fix audio only files --- pandora_client/extract.py | 4 ++-- pandora_client/server.py | 3 --- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/pandora_client/extract.py b/pandora_client/extract.py index 03f3189..9fde8eb 100644 --- a/pandora_client/extract.py +++ b/pandora_client/extract.py @@ -156,7 +156,7 @@ def video_cmd(video, target, profile, info): audiobitrate = '22k' audiochannels = 1 - if info['video'] and 'display_aspect_ratio' in info['video'][0]: + if 'video' in info and info['video'] and 'display_aspect_ratio' in info['video'][0]: dar = AspectRatio(info['video'][0]['display_aspect_ratio']) fps = AspectRatio(info['video'][0]['framerate']) width = int(dar * height) @@ -232,7 +232,7 @@ def video_cmd(video, target, profile, info): else: video_settings = ['-vn'] - if info['audio']: + if 'audio' in info and info['audio']: if video_settings == ['-vn'] or not info['video']: n = 0 else: diff --git a/pandora_client/server.py b/pandora_client/server.py index d2f2730..efde2a9 100644 --- a/pandora_client/server.py +++ b/pandora_client/server.py @@ -128,9 +128,6 @@ class Server(Resource): if os.path.exists(f): response['oshash'] = oshash info = self.client.info(oshash) - if not 'video' in info: - print oshash, f, 'not media file skipped' - continue url = 'http://%s:%s/get/%s' % (request.host.host, request.host.port, oshash) output = '/tmp/%s.%s' % (oshash, self.client.profile) response['cmd'] = extract.video_cmd(url, output, self.client.profile, info)