def test_update_time_on_video(): temporary_folder, folder = helper.create_working_folder() temporary_folder_destination, folder_destination = helper.create_working_folder() origin = "%s/video.mov" % folder shutil.copyfile(helper.get_file("video.mov"), origin) video = Video(origin) metadata = video.get_metadata() reset_hash_db() status = elodie.update_time(video, origin, "2000-01-01 12:00:00") restore_hash_db() video_processed = Video(origin) metadata_processed = video_processed.get_metadata() shutil.rmtree(folder) shutil.rmtree(folder_destination) assert status == True, status assert metadata["date_taken"] != metadata_processed["date_taken"] assert metadata_processed["date_taken"] == helper.time_convert((2000, 1, 1, 12, 0, 0, 5, 1, 0)), metadata_processed[ "date_taken" ]
def test_set_location(): if not can_edit_exif(): raise SkipTest('avmetareadwrite executable not found') temporary_folder, folder = helper.create_working_folder() origin = '%s/video.mov' % folder shutil.copyfile(helper.get_file('video.mov'), origin) video = Video(origin) origin_metadata = video.get_metadata() # Verify that original video 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 = video.set_location(11.1111111111, 99.9999999999) assert status == True, status video_new = Video(origin) metadata = video_new.get_metadata() shutil.rmtree(folder) assert helper.isclose(metadata['latitude'], 11.1111111111), metadata['latitude'] assert helper.isclose(metadata['longitude'], 99.9999999999), metadata['longitude']
def test_process_video_with_album_then_title(): if not can_edit_exif(): raise SkipTest('avmetareadwrite executable not found') filesystem = FileSystem() temporary_folder, folder = helper.create_working_folder() origin = os.path.join(folder,'movie.mov') shutil.copyfile(helper.get_file('video.mov'), origin) origin_checksum = helper.checksum(origin) media = Video(origin) media.set_album('test_album') media.set_title('test_title') destination = filesystem.process_file(origin, temporary_folder, media, allowDuplicate=True) destination_checksum = helper.checksum(destination) shutil.rmtree(folder) shutil.rmtree(os.path.dirname(os.path.dirname(destination))) assert origin_checksum is not None, origin_checksum assert origin_checksum != destination_checksum, destination_checksum assert helper.path_tz_fix(os.path.join('2015-01-Jan','test_album','2015-01-19_12-45-11-movie-test_title.mov')) in destination, destination
def test_set_location(): if not can_edit_exif(): raise SkipTest('avmetareadwrite executable not found') raise SkipTest('gh-31, precision is lost in conversion from decimal to dms') temporary_folder, folder = helper.create_working_folder() origin = '%s/video.mov' % folder shutil.copyfile(helper.get_file('video.mov'), origin) video = Video(origin) origin_metadata = video.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 = video.set_location(11.1111111111, 99.9999999999) assert status == True, status video_new = Video(origin) metadata = video_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']
def test_video_extensions(): video = Video() extensions = video.extensions assert 'avi' in extensions assert 'm4v' in extensions assert 'mov' in extensions assert 'm4v' in extensions assert '3gp' in extensions valid_extensions = Video.get_valid_extensions() assert extensions == valid_extensions, valid_extensions
def test_set_location(): if not can_edit_exif(): raise SkipTest('avmetareadwrite executable not found') raise SkipTest( 'gh-31, precision is lost in conversion from decimal to dms') temporary_folder, folder = helper.create_working_folder() origin = '%s/video.mov' % folder shutil.copyfile(helper.get_file('video.mov'), origin) video = Video(origin) origin_metadata = video.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 = video.set_location(11.1111111111, 99.9999999999) assert status == True, status video_new = Video(origin) metadata = video_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']
def test_set_location(): temporary_folder, folder = helper.create_working_folder() origin = '%s/video.mov' % folder shutil.copyfile(helper.get_file('video.mov'), origin) video = Video(origin) origin_metadata = video.get_metadata() # Verify that original video 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 = video.set_location(11.1111111111, 99.9999999999) assert status == True, status video_new = Video(origin) metadata = video_new.get_metadata() shutil.rmtree(folder) assert helper.isclose(metadata['latitude'], 11.1111111111), metadata['latitude'] assert helper.isclose(metadata['longitude'], 99.9999999999), metadata['longitude']
def test_update_location_on_video(): temporary_folder, folder = helper.create_working_folder() temporary_folder_destination, folder_destination = helper.create_working_folder( ) origin = '%s/video.mov' % folder shutil.copyfile(helper.get_file('video.mov'), origin) video = Video(origin) metadata = video.get_metadata() helper.reset_dbs() status = elodie.update_location(video, origin, 'Sunnyvale, CA') helper.restore_dbs() video_processed = Video(origin) metadata_processed = video_processed.get_metadata() shutil.rmtree(folder) shutil.rmtree(folder_destination) assert status == True, status assert metadata['latitude'] != metadata_processed['latitude'] assert helper.isclose(metadata_processed['latitude'], 37.36883), metadata_processed['latitude'] assert helper.isclose(metadata_processed['longitude'], -122.03635), metadata_processed['longitude']
def test_update_time_on_video(): temporary_folder, folder = helper.create_working_folder() temporary_folder_destination, folder_destination = helper.create_working_folder( ) origin = '%s/video.mov' % folder shutil.copyfile(helper.get_file('video.mov'), origin) video = Video(origin) metadata = video.get_metadata() helper.reset_dbs() status = elodie.update_time(video, origin, '2000-01-01 12:00:00') helper.restore_dbs() video_processed = Video(origin) metadata_processed = video_processed.get_metadata() shutil.rmtree(folder) shutil.rmtree(folder_destination) assert status == True, status assert metadata['date_taken'] != metadata_processed['date_taken'] assert metadata_processed['date_taken'] == helper.time_convert( (2000, 1, 1, 12, 0, 0, 5, 1, 0)), metadata_processed['date_taken']
def test_process_video_with_album_then_title(): filesystem = FileSystem() temporary_folder, folder = helper.create_working_folder() origin = os.path.join(folder, 'movie.mov') shutil.copyfile(helper.get_file('video.mov'), origin) origin_checksum = helper.checksum(origin) media = Video(origin) media.set_album('test_album') media.set_title('test_title') destination = filesystem.process_file(origin, temporary_folder, media, allowDuplicate=True) destination_checksum = helper.checksum(destination) shutil.rmtree(folder) shutil.rmtree(os.path.dirname(os.path.dirname(destination))) assert origin_checksum is not None, origin_checksum assert origin_checksum != destination_checksum, destination_checksum assert helper.path_tz_fix( os.path.join('2015-01-Jan', 'test_album', '2015-01-19_12-45-11-movie-test_title.mov') ) in destination, destination
def test_set_title(): if not can_edit_exif(): raise SkipTest('avmetareadwrite executable not found') temporary_folder, folder = helper.create_working_folder() origin = '%s/video.mov' % folder shutil.copyfile(helper.get_file('video.mov'), origin) video = Video(origin) origin_metadata = video.get_metadata() status = video.set_title('my video title') assert status == True, status video_new = Video(origin) metadata = video_new.get_metadata() shutil.rmtree(folder) assert metadata['title'] == 'my video title', metadata['title']
def test_set_date_taken(): if not can_edit_exif(): raise SkipTest('avmetareadwrite executable not found') temporary_folder, folder = helper.create_working_folder() origin = '%s/video.mov' % folder shutil.copyfile(helper.get_file('video.mov'), origin) video = Video(origin) status = video.set_date_taken(datetime.datetime(2013, 9, 30, 7, 6, 5)) assert status == True, status video_new = Video(origin) metadata = video_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']
def test_update_location_on_video(): temporary_folder, folder = helper.create_working_folder() temporary_folder_destination, folder_destination = helper.create_working_folder() origin = "%s/video.mov" % folder shutil.copyfile(helper.get_file("video.mov"), origin) video = Video(origin) metadata = video.get_metadata() reset_hash_db() status = elodie.update_location(video, origin, "Sunnyvale, CA") restore_hash_db() video_processed = Video(origin) metadata_processed = video_processed.get_metadata() shutil.rmtree(folder) shutil.rmtree(folder_destination) assert status == True, status assert metadata["latitude"] != metadata_processed["latitude"] assert helper.isclose(metadata_processed["latitude"], 37.36883), metadata_processed["latitude"] assert helper.isclose(metadata_processed["longitude"], -122.03635), metadata_processed["longitude"]
def test_set_title(): temporary_folder, folder = helper.create_working_folder() origin = '%s/video.mov' % folder shutil.copyfile(helper.get_file('video.mov'), origin) video = Video(origin) origin_metadata = video.get_metadata() status = video.set_title('my video title') assert status == True, status video_new = Video(origin) metadata = video_new.get_metadata() shutil.rmtree(folder) assert metadata['title'] == 'my video title', metadata['title']
def test_set_title_non_ascii(): temporary_folder, folder = helper.create_working_folder() origin = '%s/video.mov' % folder shutil.copyfile(helper.get_file('video.mov'), origin) video = Video(origin) origin_metadata = video.get_metadata() unicode_title = u'形声字 / 形聲字' status = video.set_title(unicode_title) assert status == True, status video_new = Video(origin) metadata = video_new.get_metadata() shutil.rmtree(folder) assert metadata['title'] == unicode_title, metadata['title']
def test_set_album(): temporary_folder, folder = helper.create_working_folder() origin = '%s/video.mov' % folder shutil.copyfile(helper.get_file('video.mov'), origin) video = Video(origin) metadata = video.get_metadata() assert metadata['album'] is None, metadata['album'] status = video.set_album('Test Album') assert status == True, status video_new = Video(origin) metadata_new = video_new.get_metadata() shutil.rmtree(folder) assert metadata_new['album'] == 'Test Album', metadata_new['album']
def test_set_date_taken(): temporary_folder, folder = helper.create_working_folder() origin = '%s/video.mov' % folder shutil.copyfile(helper.get_file('video.mov'), origin) video = Video(origin) status = video.set_date_taken(datetime.datetime(2013, 9, 30, 7, 6, 5)) assert status == True, status video_new = Video(origin) metadata = video_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']
def test_get_date_taken(): raise SkipTest('gh-32 this test fails on travisci') video = Video(helper.get_file('video.mov')) date_taken = video.get_date_taken() assert date_taken == (2015, 1, 19, 12, 45, 11, 0, 19, 0), date_taken
def test_get_date_taken(): video = Video(helper.get_file('video.mov')) date_taken = video.get_date_taken() assert date_taken == (2015, 1, 19, 12, 45, 11, 0, 19, 0), date_taken
def test_get_camera_model(): video = Video(helper.get_file('video.mov')) model = video.get_camera_model() assert model == 'iPhone 5', model
def test_get_coordinate(): video = Video(helper.get_file('video.mov')) coordinate = video.get_coordinate() assert coordinate == 38.189299999999996, coordinate
def test_get_exiftool_attributes(): video = Video(helper.get_file('video.mov')) exif = video.get_exiftool_attributes() assert exif is not None, exif assert exif is not False, exif
def test_is_not_valid(): video = Video(helper.get_file('text.txt')) assert not video.is_valid()
def test_get_coordinate_longitude(): video = Video(helper.get_file('video.mov')) coordinate = video.get_coordinate('longitude') assert coordinate == -119.9558, coordinate
def test_get_exif(): video = Video(helper.get_file('video.mov')) exif = video.get_exif() assert exif is not None, exif
def test_is_valid(): video = Video(helper.get_file('video.mov')) assert video.is_valid()
def test_get_coordinate_latitude(): video = Video(helper.get_file('video.mov')) coordinate = video.get_coordinate('latitude') assert coordinate == 38.189299999999996, coordinate
def test_empty_album(): video = Video(helper.get_file('video.mov')) assert video.get_album() is None
def test_get_coordinate_latitude(): video = Video(helper.get_file('video.mov')) coordinate = video.get_coordinate('latitude') assert coordinate == 38.1893, coordinate
def test_get_exiftool_attributes(): audio = Video(helper.get_file('audio.m4a')) exif = audio.get_exiftool_attributes() assert exif is not None, exif assert exif is not False, exif
def can_edit_exif(): video = Video() return video.get_avmetareadwrite()
def test_get_camera_make(): video = Video(helper.get_file('video.mov')) print(video.get_metadata()) make = video.get_camera_make() assert make == 'Apple', make