From 3b3506c507666419a2a844d44c53df2b31c3eeac 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 0ca33c8..d89aec7 100644 --- a/plugins/togo/templates/npl.tmpl +++ b/plugins/togo/templates/npl.tmpl @@ -106,12 +106,20 @@ Pull from $escape($tname) #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 8dbda07..c0b43a5 100644 --- a/plugins/togo/togo.py +++ b/plugins/togo/togo.py @@ -176,16 +176,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