File: show_iptc.py

package info (click to toggle)
libiptcdata 1.0.2%2Blibtool01-2
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 2,916 kB
  • ctags: 978
  • sloc: sh: 9,445; ansic: 4,092; xml: 2,798; makefile: 123; python: 62; sed: 16
file content (24 lines) | stat: -rw-r--r-- 528 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#small example program to print out IPTC data from a file

import sys

import iptcdata

try:
    f = iptcdata.open(sys.argv[1])
except IndexError:
    print "show_iptc.py filename"

if (len(f.datasets) == 0):
    print "No IPTC data!"
    sys.exit(0)

for ds in f.datasets:
    print "Tag: %d\nRecord: %d" % (ds.record, ds.tag)
    print "Title: %s" % (ds.title)
    descr = iptcdata.get_tag_description(record=ds.record, tag=ds.tag)
    print "Description: %s" % (descr)
    print "Value: %s" % (ds.value)
    print

f.close()