本文整理汇总了Python中elodie.media.photo.Photo.set_date_taken方法的典型用法代码示例。如果您正苦于以下问题:Python Photo.set_date_taken方法的具体用法?Python Photo.set_date_taken怎么用?Python Photo.set_date_taken使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类elodie.media.photo.Photo
的用法示例。
在下文中一共展示了Photo.set_date_taken方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_set_date_taken
# 需要导入模块: from elodie.media.photo import Photo [as 别名]
# 或者: from elodie.media.photo.Photo import set_date_taken [as 别名]
def test_set_date_taken():
temporary_folder, folder = helper.create_working_folder()
origin = "%s/photo.jpg" % folder
shutil.copyfile(helper.get_file("plain.jpg"), origin)
photo = Photo(origin)
status = photo.set_date_taken(datetime.datetime(2013, 9, 30, 7, 6, 5))
assert status == True, status
photo_new = Photo(origin)
metadata = photo_new.get_metadata()
date_taken = metadata["date_taken"]
shutil.rmtree(folder)
assert date_taken == (2013, 9, 30, 7, 6, 5, 0, 273, 0), metadata["date_taken"]
示例2: test_set_date_taken_with_missing_datetimeoriginal
# 需要导入模块: from elodie.media.photo import Photo [as 别名]
# 或者: from elodie.media.photo.Photo import set_date_taken [as 别名]
def test_set_date_taken_with_missing_datetimeoriginal():
# When datetimeoriginal (or other key) is missing we have to add it gh-74
# https://github.com/jmathai/elodie/issues/74
temporary_folder, folder = helper.create_working_folder()
origin = '%s/photo.jpg' % folder
shutil.copyfile(helper.get_file('no-exif.jpg'), origin)
photo = Photo(origin)
status = photo.set_date_taken(datetime.datetime(2013, 9, 30, 7, 6, 5))
assert status == True, status
photo_new = Photo(origin)
metadata = photo_new.get_metadata()
date_taken = metadata['date_taken']
shutil.rmtree(folder)
assert date_taken == (2013, 9, 30, 7, 6, 5, 0, 273, 0), metadata['date_taken']