Skip to content
This repository has been archived by the owner on Aug 29, 2021. It is now read-only.

Commit

Permalink
lqr_wpset: more agressive label_tags_discard matching
Browse files Browse the repository at this point in the history
  • Loading branch information
mk-fg committed Aug 21, 2011
1 parent dd8fe33 commit 37639e7
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions lqr_wpset.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@
from gtk import gdk
import os, sys, collections

import re
re_type = type(re.compile(''))

from gimpfu import *
import gimp

Expand Down Expand Up @@ -77,9 +80,14 @@ def process_tags(path):
if isinstance(meta[label], collections.Sequence)\
and len(meta[label]) == 1: meta[label] = meta[label][0]
meta[label] = unicode(meta[label]).strip()
if meta[label] in label_tags_discard:
del meta[label]
raise KeyError
for tag in label_tags_discard:
if isinstance(tag, re_type):
if tag.search(meta[label]):
del meta[label]
raise KeyError
elif tag in meta[label]:
del meta[label]
raise KeyError
except KeyError: pass
else: break
return meta
Expand Down Expand Up @@ -324,8 +332,8 @@ def lqr_wpset(path):
if not isinstance(ts, datetime) else ts).strftime(ts_format)),
('set', [], lambda ts: datetime.now().strftime(ts_format)) ]

# Stuff that should never appear in the label
label_tags_discard = set(['SONY DSC', 'OLYMPUS DIGITAL CAMERA'])
# Stuff that should never appear in the label (searched there), can be a compiled regex
label_tags_discard = set(['SONY DSC', 'DIGITAL CAMERA'])


### Gimp plugin boilerplate
Expand Down

0 comments on commit 37639e7

Please sign in to comment.