From f9885084f28c3048278dbbb054e3c8180d87393f Mon Sep 17 00:00:00 2001 From: William McBrine Date: Fri, 30 May 2014 14:31:00 -0400 Subject: [PATCH] Allow for missing SourceSize and CaptureDate in ToGo. --- plugins/togo/templates/npl.tmpl | 12 ++++++++++-- plugins/togo/togo.py | 10 ++++++---- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/plugins/togo/templates/npl.tmpl b/plugins/togo/templates/npl.tmpl index 9b5904a..a484a74 100644 --- a/plugins/togo/templates/npl.tmpl +++ b/plugins/togo/templates/npl.tmpl @@ -126,12 +126,20 @@ function toggle(source) { #end if #end if - $row['SourceSize']
+ + #if 'SourceSize' in $row + $row['SourceSize'] + #end if +
#if 'Duration' in $row $row['Duration'] #end if - $row['CaptureDate'] + + #if 'CaptureDate' in $row + $row['CaptureDate'] + #end if + #end if #end for diff --git a/plugins/togo/togo.py b/plugins/togo/togo.py index 2fe2f3e..2d644a1 100644 --- a/plugins/togo/togo.py +++ b/plugins/togo/togo.py @@ -182,16 +182,18 @@ class ToGo(Plugin): if value: entry[key] = value - rawsize = entry['SourceSize'] - entry['SourceSize'] = metadata.human_size(rawsize) + if 'SourceSize' in entry: + rawsize = entry['SourceSize'] + entry['SourceSize'] = metadata.human_size(rawsize) if 'Duration' in entry: dur = getint(entry['Duration']) / 1000 entry['Duration'] = ( '%d:%02d:%02d' % (dur / 3600, (dur % 3600) / 60, dur % 60) ) - entry['CaptureDate'] = time.strftime('%b %d, %Y', - time.localtime(int(entry['CaptureDate'], 16))) + if 'CaptureDate' in entry: + entry['CaptureDate'] = time.strftime('%b %d, %Y', + time.localtime(int(entry['CaptureDate'], 16))) url = entry['Url'] if url in basic_meta: -- 2.11.4.GIT