本文整理汇总了Python中elodie.media.photo.Photo.set_location方法的典型用法代码示例。如果您正苦于以下问题:Python Photo.set_location方法的具体用法?Python Photo.set_location怎么用?Python Photo.set_location使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类elodie.media.photo.Photo
的用法示例。
在下文中一共展示了Photo.set_location方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_set_metadata_on_arw
# 需要导入模块: from elodie.media.photo import Photo [as 别名]
# 或者: from elodie.media.photo.Photo import set_location [as 别名]
def test_set_metadata_on_arw():
temporary_folder, folder = helper.create_working_folder()
photo_file = helper.get_file('photo.arw')
origin = '%s/photo.arw' % folder
if not photo_file:
photo_file = helper.download_file('photo.arw', folder)
if not photo_file or not os.path.isfile(photo_file):
raise SkipTest('arw file not downlaoded')
shutil.copyfile(photo_file, origin)
photo = Photo(origin)
origin_metadata = photo.get_metadata()
status = photo.set_location(11.1111111111, 99.9999999999)
assert status == True, status
photo_new = Photo(origin)
metadata = photo_new.get_metadata()
shutil.rmtree(folder)
assert metadata['date_taken'] == helper.time_convert((2007, 4, 8, 17, 41, 18, 6, 98, 0)), metadata['date_taken']
assert helper.isclose(metadata['latitude'], 11.1111111111), metadata['latitude']
assert helper.isclose(metadata['longitude'], 99.9999999999), metadata['longitude']
示例2: test_set_metadata_on_rw2
# 需要导入模块: from elodie.media.photo import Photo [as 别名]
# 或者: from elodie.media.photo.Photo import set_location [as 别名]
def test_set_metadata_on_rw2():
raise SkipTest('gh-94 Writing to RW2 images is not supported')
temporary_folder, folder = helper.create_working_folder()
photo_file = helper.get_file('photo.rw2')
origin = '%s/photo.rw2' % folder
if not photo_file:
photo_file = helper.download_file('photo.rw2', folder)
if not photo_file or not os.path.isfile(photo_file):
raise SkipTest('rw2 file not downlaoded')
shutil.copyfile(photo_file, origin)
photo = Photo(origin)
origin_metadata = photo.get_metadata()
status = photo.set_location(11.1111111111, 99.9999999999)
assert status == True, status
photo_new = Photo(origin)
metadata = photo_new.get_metadata()
shutil.rmtree(folder)
assert metadata['date_taken'] == helper.time_convert((2014, 11, 19, 23, 7, 44, 2, 323, 0)), metadata['date_taken']
assert helper.isclose(metadata['latitude'], 11.1111111111), metadata['latitude']
assert helper.isclose(metadata['longitude'], 99.9999999999), metadata['longitude']
示例3: test_set_location
# 需要导入模块: from elodie.media.photo import Photo [as 别名]
# 或者: from elodie.media.photo.Photo import set_location [as 别名]
def test_set_location():
raise SkipTest('gh-31, precision is lost in conversion from decimal to dms')
temporary_folder, folder = helper.create_working_folder()
origin = '%s/photo.jpg' % folder
shutil.copyfile(helper.get_file('plain.jpg'), origin)
photo = Photo(origin)
origin_metadata = photo.get_metadata()
# Verify that original photo has no location information
assert origin_metadata['latitude'] is None, origin_metadata['latitude']
assert origin_metadata['longitude'] is None, origin_metadata['longitude']
status = photo.set_location(11.1111111111, 99.9999999999)
assert status == True, status
photo_new = Photo(origin)
metadata = photo_new.get_metadata()
shutil.rmtree(folder)
# @TODO: understand why the decimal to degree conversion loses accuracy
assert metadata['latitude'] == 11.1111111111, metadata['latitude']
assert metadata['longitude'] == 99.9999999999, metadata['longitude']
示例4: test_set_location
# 需要导入模块: from elodie.media.photo import Photo [as 别名]
# 或者: from elodie.media.photo.Photo import set_location [as 别名]
def test_set_location():
temporary_folder, folder = helper.create_working_folder()
origin = '%s/photo.jpg' % folder
shutil.copyfile(helper.get_file('plain.jpg'), origin)
photo = Photo(origin)
origin_metadata = photo.get_metadata()
# Verify that original photo has different location info that what we
# will be setting and checking
assert not helper.isclose(origin_metadata['latitude'], 11.1111111111), origin_metadata['latitude']
assert not helper.isclose(origin_metadata['longitude'], 99.9999999999), origin_metadata['longitude']
status = photo.set_location(11.1111111111, 99.9999999999)
assert status == True, status
photo_new = Photo(origin)
metadata = photo_new.get_metadata()
shutil.rmtree(folder)
assert helper.isclose(metadata['latitude'], 11.1111111111), metadata['latitude']
assert helper.isclose(metadata['longitude'], 99.9999999999), metadata['longitude']
示例5: _test_photo_type_set
# 需要导入模块: from elodie.media.photo import Photo [as 别名]
# 或者: from elodie.media.photo.Photo import set_location [as 别名]
def _test_photo_type_set(type, date):
temporary_folder, folder = helper.create_working_folder()
photo_name = 'photo.{}'.format(type)
photo_file = helper.get_file(photo_name)
origin = '{}/{}'.format(folder, photo_name)
if not photo_file:
photo_file = helper.download_file(photo_name, folder)
if not photo_file or not os.path.isfile(photo_file):
raise SkipTest('{} file not downlaoded'.format(type))
shutil.copyfile(photo_file, origin)
photo = Photo(origin)
origin_metadata = photo.get_metadata()
status = photo.set_location(11.1111111111, 99.9999999999)
assert status == True, status
photo_new = Photo(origin)
metadata = photo_new.get_metadata()
shutil.rmtree(folder)
assert metadata['date_taken'] == helper.time_convert(date), '{} date {}'.format(type, metadata['date_taken'])
assert helper.isclose(metadata['latitude'], 11.1111111111), '{} lat {}'.format(type, metadata['latitude'])
assert helper.isclose(metadata['longitude'], 99.9999999999), '{} lon {}'.format(type, metadata['latitude'])