diff options
author | Olivier Tilloy <olivier@tilloy.net> | 2010-01-21 00:20:20 +0100 |
---|---|---|
committer | Olivier Tilloy <olivier@tilloy.net> | 2010-01-21 00:20:20 +0100 |
commit | 034c4d00395e4b1716d9996133f7b43f409ebcf4 (patch) | |
tree | 91f191e3053aba6bc580581d74cc6d333b4d0ad1 /src | |
parent | f0dea80f17d7c78892b393c58f76743febc2846e (diff) | |
download | pyexiv2-034c4d00395e4b1716d9996133f7b43f409ebcf4.tar.gz |
Removed some unused legacy code.
Diffstat (limited to 'src')
-rwxr-xr-x | src/examples.py | 2 | ||||
-rw-r--r-- | src/exiv2wrapper.cpp | 95 | ||||
-rw-r--r-- | src/exiv2wrapper.hpp | 26 | ||||
-rw-r--r-- | src/exiv2wrapper_python.cpp | 10 | ||||
-rwxr-xr-x | src/pyexiv2/main.py | 1 | ||||
-rw-r--r-- | src/pyexiv2/tag.py | 77 |
6 files changed, 2 insertions, 209 deletions
diff --git a/src/examples.py b/src/examples.py index c9e1843..1a36758 100755 --- a/src/examples.py +++ b/src/examples.py @@ -1,4 +1,4 @@ -#!//usr/bin/python +#!/usr/bin/python # -*- coding: utf-8 -*- from pyexiv2 import ImageMetadata, ExifTag, IptcTag, XmpTag diff --git a/src/exiv2wrapper.cpp b/src/exiv2wrapper.cpp index be9a1f9..8782b23 100644 --- a/src/exiv2wrapper.cpp +++ b/src/exiv2wrapper.cpp @@ -227,37 +227,6 @@ private: }; // class FindIptcdatum -/*void Image::setIptcTag(std::string key, std::string value, unsigned int index=0) -{ - CHECK_METADATA_READ - - unsigned int indexCounter = index; - Exiv2::IptcKey iptcKey = Exiv2::IptcKey(key); - Exiv2::IptcMetadata::iterator dataIterator = _iptcData.findKey(iptcKey); - while ((indexCounter > 0) && (dataIterator != _iptcData.end())) - { - dataIterator = std::find_if(++dataIterator, _iptcData.end(), - FindIptcdatum(iptcKey.tag(), iptcKey.record())); - --indexCounter; - } - if (dataIterator != _iptcData.end()) - { - // The tag at given index already exists, override it - dataIterator->setValue(value); - } - else - { - // Either index is greater than the index of the last repetition - // of the tag, or the tag does not exist yet. - // In both cases, it is created. - Exiv2::Iptcdatum iptcDatum(iptcKey); - iptcDatum.setValue(value); - int state = _iptcData.add(iptcDatum); - if (state == 6) - throw Exiv2::Error(NON_REPEATABLE); - } -}*/ - void Image::setIptcTagValues(std::string key, boost::python::list values) { CHECK_METADATA_READ @@ -420,70 +389,6 @@ boost::python::list Image::previews() } -/* -boost::python::tuple Image::getThumbnailData() -{ - CHECK_METADATA_READ - - Exiv2::Thumbnail::AutoPtr thumbnail = _exifData.getThumbnail(); - if (thumbnail.get() != 0) - { - std::string format(_exifData.thumbnailFormat()); - // Copy the data buffer in a string. Since the data buffer can - // contain null char ('\x00'), the string cannot be simply - // constructed like that: - // std::string data((char*) dataBuffer.pData_); - // because it would be truncated after the first occurence of a - // null char. Therefore, it has to be copied char by char. - Exiv2::DataBuf dataBuffer = _exifData.copyThumbnail(); - char* charData = (char*) dataBuffer.pData_; - long dataLen = dataBuffer.size_; - // First allocate the memory for the whole string... - std::string data(dataLen, ' '); - // ... then fill it with the raw jpeg data. - for(long i = 0; i < dataLen; ++i) - { - data[i] = charData[i]; - } - return boost::python::make_tuple(format, data); - } - else - throw Exiv2::Error(THUMB_ACCESS); -} - -void Image::setThumbnailData(std::string data) -{ - CHECK_METADATA_READ - - const Exiv2::byte* dataBuf = (const Exiv2::byte*) data.c_str(); - _exifData.setJpegThumbnail(dataBuf, data.size()); -} - -void Image::deleteThumbnail() -{ - CHECK_METADATA_READ - - _exifData.eraseThumbnail(); -} - -void Image::dumpThumbnailToFile(const std::string path) -{ - CHECK_METADATA_READ - - int result = _exifData.writeThumbnail(path); - if (result == 8) - throw Exiv2::Error(NO_THUMBNAIL); -} - -void Image::setThumbnailFromJpegFile(const std::string path) -{ - CHECK_METADATA_READ - - _exifData.setJpegThumbnail(path); -} -*/ - - ExifTag::ExifTag(const std::string& key, Exiv2::Exifdatum* datum, Exiv2::ExifData* data): _key(key) { if (datum != 0 && data != 0) diff --git a/src/exiv2wrapper.hpp b/src/exiv2wrapper.hpp index 65853bc..a1c28df 100644 --- a/src/exiv2wrapper.hpp +++ b/src/exiv2wrapper.hpp @@ -211,33 +211,9 @@ public: // Throw an exception if the tag was not set. void deleteXmpTag(std::string key); - // Read and write access to the thumbnail embedded in the image. - - // Read-only ATM. + // Read access to the thumbnail embedded in the image. boost::python::list previews(); - // Return a tuple containing the format of the thumbnail ("TIFF" or - // "JPEG") and the thumbnail raw data as a string buffer. - // Throw an exception if the thumbnail data cannot be accessed. - //boost::python::tuple getThumbnailData(); - - // Set the thumbnail of the image. The parameter is the thumbnail raw - // jpeg data as a string buffer. - //void setThumbnailData(std::string data); - - // Delete the thumbnail embedded in the image. - //void deleteThumbnail(); - - // Write the thumbnail to an image file. - // A filename extension is appended to the given path according to the - // image type of the thumbnail, so it should not include an extension. - // Throw an exception if the image does not contain a thumbnail. - //void dumpThumbnailToFile(const std::string path); - - // Set the image contained in the jpeg file passed as a parameter as - // the thumbnail of the image. - //void setThumbnailFromJpegFile(const std::string path); - private: std::string _filename; Exiv2::Image::AutoPtr _image; diff --git a/src/exiv2wrapper_python.cpp b/src/exiv2wrapper_python.cpp index 2a64f3d..694416d 100644 --- a/src/exiv2wrapper_python.cpp +++ b/src/exiv2wrapper_python.cpp @@ -127,16 +127,6 @@ BOOST_PYTHON_MODULE(libexiv2python) .def("deleteXmpTag", &Image::deleteXmpTag) .def("previews", &Image::previews) - -// .def("getThumbnailData", &Image::getThumbnailData) -// .def("setThumbnailData", &Image::setThumbnailData) -// .def("deleteThumbnail", &Image::deleteThumbnail) -// .def("dumpThumbnailToFile", &Image::dumpThumbnailToFile) -// .def("setThumbnailFromJpegFile", &Image::setThumbnailFromJpegFile) - -// .def("getComment", &Image::getComment) -// .def("setComment", &Image::setComment) -// .def("clearComment", &Image::clearComment) ; } diff --git a/src/pyexiv2/main.py b/src/pyexiv2/main.py index de6a8b6..62dfdf2 100755 --- a/src/pyexiv2/main.py +++ b/src/pyexiv2/main.py @@ -31,7 +31,6 @@ from pyexiv2.metadata import ImageMetadata if __name__ == '__main__': - import sys args = sys.argv if len(args) != 2: diff --git a/src/pyexiv2/tag.py b/src/pyexiv2/tag.py deleted file mode 100644 index e5c71a7..0000000 --- a/src/pyexiv2/tag.py +++ /dev/null @@ -1,77 +0,0 @@ -# -*- coding: utf-8 -*- - -# ****************************************************************************** -# -# Copyright (C) 2006-2010 Olivier Tilloy <olivier@tilloy.net> -# -# This file is part of the pyexiv2 distribution. -# -# pyexiv2 is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# pyexiv2 is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with pyexiv2; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA. -# -# Author: Olivier Tilloy <olivier@tilloy.net> -# -# ****************************************************************************** - - -class MetadataTag(object): - - """ - A generic metadata tag. - It is meant to be subclassed to implement specific tag types behaviours. - - @ivar key: a unique key that identifies the tag - @type key: C{str} - @ivar name: the short internal name that identifies the tag within - its scope - @type name: C{str} - @ivar label: a human readable label for the tag - @type label: C{str} - @ivar description: a description of the function of the tag - @type description: C{str} - @ivar type: the data type name - @type type: C{str} - @ivar raw_value: the raw value of the tag as provided by exiv2 - @type raw_value: C{str} - @ivar metadata: reference to the containing metadata if any - @type metadata: L{pyexiv2.ImageMetadata} - """ - - def __init__(self, key, name, label, description, type, value): - self.key = key - self.name = name - # FIXME: all attributes that may contain a localized string should be - # unicode. - self.label = label - self.description = description - self.type = type - self.raw_value = value - self.metadata = None - - def __str__(self): - """ - Return a string representation of the value of the tag suitable to pass - to libexiv2 to set it. - - @rtype: C{str} - """ - return self.raw_value - - def __repr__(self): - """ - Return a string representation of the tag for debugging purposes. - - @rtype: C{str} - """ - return '<%s [%s] = %s>' % (self.key, self.type, self.raw_value) |