~ubuntu-branches/ubuntu/natty/phatch/natty

« back to all changes in this revision

Viewing changes to phatch/actions/write_tag.py

  • Committer: Bazaar Package Importer
  • Author(s): Piotr Ożarowski
  • Date: 2009-09-25 23:22:12 UTC
  • mfrom: (1.1.6 upstream) (4.1.5 sid)
  • Revision ID: james.westby@ubuntu.com-20090925232212-tpdypfah7cupooz5
Tags: 0.2.1-4
Add mlocate as an alternative dependency to locate (Closes: #548251)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Phatch - Photo Batch Processor
 
2
# Copyright (C) 2007-2008 www.stani.be
 
3
#
 
4
# This program is free software: you can redistribute it and/or modify
 
5
# it under the terms of the GNU General Public License as published by
 
6
# the Free Software Foundation, either version 3 of the License, or
 
7
# (at your option) any later version.
 
8
#
 
9
# This program is distributed in the hope that it will be useful,
 
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
# GNU General Public License for more details.
 
13
#
 
14
# You should have received a copy of the GNU General Public License
 
15
# along with this program.  If not, see http://www.gnu.org/licenses/
 
16
#
 
17
# Phatch recommends SPE (http://pythonide.stani.be) for editing python files.
 
18
 
 
19
# Embedded icon is designed by Alexandre Moore (http://nuovext.pwsp.net/).
 
20
 
 
21
# Follows PEP8
 
22
 
 
23
import os
 
24
from core import ct, models
 
25
from lib.reverse_translation import _t
 
26
 
 
27
 
 
28
class Action(models.Action):
 
29
    """Defined variables: <filename> <type> <folder> <width> <height>"""
 
30
 
 
31
    label = _t('Write Tag')
 
32
    author = 'Stani'
 
33
    email = 'spe.stani.be@gmail.com'
 
34
    version = '0.1'
 
35
    tags = [_t('metadata')]
 
36
    __doc__ = _t('Write new value to a tag')
 
37
 
 
38
    def interface(self, fields):
 
39
        fields[_t('Tag (Exif, Iptc)')]= self.ExifItpcField(
 
40
            'Exif_Image_Copyright', choices=self.EXIF_IPTC)
 
41
        fields[_t('Value')] = self.CharField('Phatch')
 
42
 
 
43
    def apply(self, photo, setting, cache):
 
44
        info = photo.info
 
45
        tag = self.get_field('Tag (Exif, Iptc)', info)
 
46
        value = self.get_field('Value', info).strip()
 
47
        if value == '':
 
48
            value = None
 
49
        info[tag] = value
 
50
        return photo
 
51
 
 
52
    icon = \
 
53
'x\xda\x01\x9d\x0bb\xf4\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x000\x00\
 
54
\x00\x000\x08\x06\x00\x00\x00W\x02\xf9\x87\x00\x00\x00\x04sBIT\x08\x08\x08\
 
55
\x08|\x08d\x88\x00\x00\x0bTIDATh\x81\xed\x99{l\x1c\xc7}\xc7?3\xb3{{{\x0f\x1e\
 
56
I\xf1xTH\xeba\xf1!\x1b\xb6i\xd7\x8dT\xcb\x8a\xa4\xd8\xb1\xdc\xc6\x0c\xd0F1\
 
57
\x10\x05\r\x9c\x18q\x1d\xe5\xa1\x00A\x11\xa0\r\xd0\xc8\xfe\xa3\xad\x9b\xa6F\
 
58
\xff\x88\x9d\xc4\t\x1c\t\x01\xea\xa2F\xdc\xbav`D\xae\x8d\xc2v\x15\xc7\xb2e:\
 
59
\xb6\xa9 z0\x92H\x8a\x14\xc9\xe3\xfb\x1e\xbb;\xd3?\xf6\x8e\xbc\x17i\xa1i\xaa\
 
60
\x06\xf0\x00\x83\xdb\x9d\x99\x9d\xfd~\x7f\xbf\xef\xfc\xe6w\xb3\xc2\x18\xc3\
 
61
\xefr\x91W\x1a\xc0oZ\xde\'p\xa5\xcb\xfb\x04\xaet\xb1\xae4\x00\x80G\x1f}T\xbc\
 
62
\xfc\xf2S\xee\xc7\xf7m\xef\xe9\xeal\xb99\xe2D\xfe\xe0_\x9fz\xf3\xe1\x07\x1e\
 
63
\xf8\xfe\xd0{={E\x08\xdc{\xef\xbdr\xd7\xae\xa6d\xba=\xbe1\xd3\xde|\xeb\x9dw\
 
64
\xc6w~\xe2\xee\xfd\xdb\\\xd7Z\x1fq\xac\xb81\xc2\x9c?\xb7\xf9\x18\xf0\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xa5\
 
106
\xd5\xd0\xd2\x12gtt\x9e\xd1\xd1\x05l[244\xc1\xd6\xadm<\xf9/o\xd3\xd3\xbb\x8e\
 
107
o>\xf4\x12\x9f\xb8\xfb:\xee\xff\xfc\x07y\xec\xbb\xc7I69$\x13Q>|\xdb\x16\x9e}\
 
108
\xe6\x97\x1cz\xe0\x0e\xfa\xfa2\x14\xf2\x01_<\xf0\x14\xd7_\xdf\xc1\xee==\xdc\
 
109
\xfe\x91\xde\x86\xd67\x1a\xb4\x0e\x08\xb4\x8f\x0e|,\xdb&\x08\x0cR\n{M\x02\
 
110
\xc7\x8f\x9f\x1c\xcdfo\xf8U{\xc6\xee\xaftT*\xe5\xd2\xdd\xd3\xc6\xf1\xd7F\x18\
 
111
\x1c\x1c\xe3\xcf\xee\xdf\xceL6\xc7\x8f\x7f\xfc.MI\x87\x07\x1e\xbc\x83o\xfc\
 
112
\xd5\xf347\xc7\x18\x19\x99\'\x1e\x8b\xd0\xdd\x9d&\xd3\x91\xe2\xf4\xa9)@\x12\
 
113
\x8b9\x1cz\xf0\x0fY\\,\xe2y\x86\xa6&\xb7\x1e\xbc\te\xa3u\x80\xd6>Z{\x04\xda\
 
114
\'\xea*ry\x0f!\xaa1\xd7\x11\x10B\xe4\'\xc6\x97\xde\xea\xdb\x1a\xab  \x90Rp\
 
115
\xed\xb5\x19\x9e\xf8\xa7A>\xb4k3\x1d\x1dM\xa4R.1\xd7\xe6\xae\x81k\xd8q\xebfv\
 
116
\xef\xb9\x9a\x97^\xfa5\x1b64\xf3\xd1\x81k\xe8\xecjF\x08\xc15\xd7tT\x81\x8c\
 
117
\xc7\xa35\x16\xa7\x04^\xa2\x8d\t\x81\x07>Z\xfb\x04\x81\x0f\x02\x9a\x92\t\x16\
 
118
\x17\x17\x90B\xaeM\xe0\xb9\xe7\x9e\xd3G\x8e|\xeb\xe7;\x8d\xf8\xb4\xa8\xd9[6l\
 
119
let\xf4\x04\xcf?\x7f\x8ab1`\xff\xfe\xdf\xa3\xa77\x8d\xb2\x14B(\xee\xff\xfc\
 
120
\x0e\xb46tt$+\x80Q\rr\x95\x90l\x8c\xc0\xe8\x12x\xed\x13\x04\x1eZ{\x08a\xe1DS\
 
121
XV\x84\xb1\x8b\x93(\x19\xabZ\xb7\rO%N\x9c8wzq\xb1>\xcewv6\xd3\xdd\xdd\xc6\
 
122
\xf7\x7f\xf0I\x12I\x97\xcf~\xe6\t0\x82\xbe\xde\x0c ioo\xa2\xa3#U\xf1\\u\x88\
 
123
\xad\xaf\xa5\xdc\xdf\x08\x8c\xd1h\xed\x95$\x13V)m\x9ch3J\xd9H)\x98\x9b+R,\
 
124
\xfajM\x0f\x00\xa4\xd3\x99\xb9\x89\xf1\x02\x89D9b\t\xc0\xe0\xba\x0e\xf9\x82O\
 
125
"\x11\xe5s\x9f\xdb\xc1\xa6M\xeb\xf8\xdew^\xa1\xbb\']c\xddZ\xcb7\xb2>\x15\x96\
 
126
\xd7\xe1\x82\rV4\xafd\x04\xc7I!K\x8a\xc9\xe7\x0cJj\x8aE\xbf\xea%\r\td2\x19\
 
127
\x91\xcfi0"\xcc\xa8J\xe9\xb0m[\x14\xf2>\xbe\x0f\x8e#\xb9\xfd\xf6>\xfa\xfb\
 
128
\xbbhoO\xac\x02\xfa\xbd\xc0\x87aR\x9bP\xf3e\xd9X\x96K$\x92D*+\x1co\xe0\xec\
 
129
\xd9\x19\xa2\xae@\n\xbb\xea\x05\r%\xe48\x96c0\x04U1?$\x90\xcf\xfb\xf8~HHJE{{\
 
130
\x13\xf5\xb2\xa8\x94\x9f\xaai_\xd9\xa0\x96#M\xe0\x11\x04\xc5\x10\xbc\x1d\'\
 
131
\xe2\xa4\x90\xca\xc2\x18\xc1\xdc\x9c\xe6\xc4\x1bSLN\x8d\xb3eK\x07\xcaR\xef\
 
132
\xed\x01\xc7\xb1\x9dX\\S\xc8\x1bb\xf12GA"\x11\xe5\xc0\x17v\x97\xa4u\xb9\x87z\
 
133
522\x84\xe0M\x18at\xe0\xa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01\xc5\
 
147
b\x91\x88c\xd1\xdc\xac\xe9\xed\x8b\x95r\x9d\xf2X\x13zU\x07a\x042\xfe\xf2\xce\
 
148
k\x8cF\x08\x85\x13m\xc6\xb2\xa2\xcb\xcf\x19#\x18\x1b\xf3\xb1\xec\x02\xb1\xd8\
 
149
Ux~.;==\xbd6\x01@"\x04\xae\xab\x18\xbf\xe8C\x05\x01\xad\r\x85\x82a~\xcec~>\
 
150
\xa0X\x0cp\x1cMk\xabCs\x8bE$\x12\xa9=\x9a\xc3\x18\x831\xba\x02\xb8W\xba\xf6\
 
151
\xd1:@\x08I\xc4n\xc2\xb2]\xa4\x0c\xd7\x8e\xd1\xe0y01\x110qi\x8c\r\x1b2H\xa9\
 
152
\x98\xc9\x16\xa7\x96\x96\x96\x96_\xd0\x90@\x10h1~Q\x00633E>\xe0\x19\xa6&5##\
 
153
\x8b\xe4\x96\x14JA<)imq\x88\x95R\x93|\xceP\xf6l\xa5\xaf\x0c\x06\xa3M\xe9W\
 
154
\xa3\x8d\xc6h\x816\x80\x91H\xe9\xa0\xac8\xc6(\x82@\xe3\xfb\x05|?$\n\x86h\xd4\
 
155
\xa3\xbb\xbb\x85T*F>\'\xf4+\xaf\x9c\xfa\xcf\x90dX\x1a\x1e-n\xdd\xba\xd5\x9e\
 
156
\x99\x99\xb1\x0f\x1e\xbc\x7f\xf3\x1d{{\x06\x9b\x9a\xa4J$5\xa9T\x14)\x97\xd7O\
 
157
8\x81\x087\xb5\x15\xa5\x84\xfd\xe1}\xf5_\xc3eJ%\xfd\x1b\x13`J\xfa\xd7\xda\
 
158
\x074RF\x88D\x12(\xcb\xa9H\xb5!\x9f\x83W\x7f\x96}\xfa\xee\xbb\xbf\xfa\xf5\
 
159
\xc9\xc9\xc9\xb7\xd7\xf4\xc0\xc9\x93\'=\xc0\xfb\xd1\x8f\x1e+vu\xa5D*UA\xd2T^\
 
160
\x84q\x1d@\xd7-\xea\x9a\xf1"\\\xb8a\xd2\xe6\xa3\xb5o\x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