diff --git a/import_raw.py b/import_raw.py index ec25c4b..ed51215 100755 --- a/import_raw.py +++ b/import_raw.py @@ -27,6 +27,7 @@ def get_raw(client): { 'conditions': [ {'key': 'filename', 'value': '.cr2', 'operator': ''}, + {'key': 'filename', 'value': '.pef', 'operator': ''}, {'key': 'filename', 'value': '.nef', 'operator': ''}, ], 'operator': '|' @@ -45,7 +46,7 @@ def get_raw(client): 'range': [o, o+chunk] })['data']['items'] o += chunk - files = [f for f in files if f['extension'].lower() in ('cr2', 'nef')] + files = [f for f in files if f['extension'].lower() in ('cr2', 'nef', 'pef')] return files def raw_exists(client, oshash): diff --git a/mosireen.py b/mosireen.py index fbd1d1f..16872ba 100644 --- a/mosireen.py +++ b/mosireen.py @@ -3,15 +3,17 @@ custom parse_path for pandora_client to parse musereen archive paths in the form - YYYY/MM_YYYY/DD_MM_YYYY/Location 1/Location 2/Subject 1/Cinematographer/Subject 2(optional)/MVI_2036.MOV + YYYY/MM_YYYY/DD_MM_YYYY/Location 1/Location 2/Event/Cinematographer/Topic 2(optional)/MVI_2036.MOV ''' import re import ox import os +sync_extensions = ['.nef', '.cr2', '.pef'] + def example_path(client): - return '\t' + 'YYYY/MM_YYYY/DD_MM_YYYY/Location 1/Location 2/Subject 1/Shooter/Subject 2(optional)/MVI_2036.MOV' + return '\t' + 'YYYY/MM_YYYY/DD_MM_YYYY/Location 1/Location 2/Event/Shooter/Topic 2(optional)/MVI_2036.MOV' def parse_path(client, path, context): ''' @@ -27,24 +29,34 @@ def parse_path(client, path, context): info = m.groupdict() date = '%s-%s-%s' % (info['year'], info['month'], info['day']) if info['tilday']: - date = '%s-%s-%s - %s-%s-%s' % (info['year'], info['month'], info['day'], info['tilyear'],info['tilmonth'],info['tilday']) + date = '%s-%s-%s - %s-%s-%s' % (info['year'], info['month'], info['day'], info['tilyear'], info['tilmonth'], info['tilday']) for key in info: if info[key]: info[key] = info[key].replace('_', ' ') topic = info['subject1'].split(",") if info['subject2']: - topic+=info['subject2'].split(",") + topic += info['subject2'].split(",") title = "%s, %s (%s)" % (info['subject1'], info['subject2'], date) else: title = "%s (%s)" % (info['subject1'], date) - title = "%s %s at %s, %s" % (title, - info['shooter'],info['location2'],info['location1']) + + while date.endswith('-NA'): + date = date[:-3] + title = "%s %s at %s, %s" % (title, info['shooter'], info['location2'], info['location1']) + title = title.replace(' ', ' ').strip() + title = title.replace(' ', ' ').strip() + + topic = [t.strip() for t in topic] + shooter = [s.strip() for s in info['shooter'].split(',')] + + location = '%s, %s' % (info['location2'], info['location1']) + location = location.strip() r = { - 'cinematographer': info['shooter'].split(', '), + 'cinematographer': shooter, 'date': date, - 'location': '%s, %s' % (info['location2'], info['location1']), + 'location': location, 'title': title, 'topic': topic } @@ -60,8 +72,19 @@ def ignore_file(client, path): ''' filename = os.path.basename(path) if filename.startswith('._') \ - or filename in ('.DS_Store',) \ + or filename in ( + '.DS_Store', 'Thumbs.db', + 'CINDEX.TMP', 'THUMB.TDT', 'THUMB.TID' + ) \ or filename.endswith('~') \ + or 'Autosave Vault' in path \ + or 'CLIPINF/' in path \ + or 'Final Cut Pro Thumbnail Data' in path \ + or os.path.splitext(filename.lower())[-1] in ( + '.thm', '.rtf', '.sfk', '.fcp', '.xmp', '.prproj', + '.ctg', '.cpi', '.bdm', '.mpl', '.html', '.txt', + '.doc', '.xml', '.psd', '.pds', + ) \ or not os.path.exists(path) \ or os.stat(path).st_size == 0: return True