本文整理汇总了Python中elodie.filesystem.FileSystem.process_file方法的典型用法代码示例。如果您正苦于以下问题:Python FileSystem.process_file方法的具体用法?Python FileSystem.process_file怎么用?Python FileSystem.process_file使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类elodie.filesystem.FileSystem
的用法示例。
在下文中一共展示了FileSystem.process_file方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_process_video_with_album_then_title
# 需要导入模块: from elodie.filesystem import FileSystem [as 别名]
# 或者: from elodie.filesystem.FileSystem import process_file [as 别名]
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
示例2: test_process_file_invalid
# 需要导入模块: from elodie.filesystem import FileSystem [as 别名]
# 或者: from elodie.filesystem.FileSystem import process_file [as 别名]
def test_process_file_invalid():
filesystem = FileSystem()
temporary_folder, folder = helper.create_working_folder()
origin = os.path.join(folder,'photo.jpg')
shutil.copyfile(helper.get_file('invalid.jpg'), origin)
media = Photo(origin)
destination = filesystem.process_file(origin, temporary_folder, media, allowDuplicate=True)
assert destination is None
示例3: test_process_file_with_album_and_title_and_location
# 需要导入模块: from elodie.filesystem import FileSystem [as 别名]
# 或者: from elodie.filesystem.FileSystem import process_file [as 别名]
def test_process_file_with_album_and_title_and_location():
filesystem = FileSystem()
temporary_folder, folder = helper.create_working_folder()
origin = '%s/photo.jpg' % folder
shutil.copyfile(helper.get_file('with-album-and-title-and-location.jpg'), origin)
media = Photo(origin)
destination = filesystem.process_file(origin, temporary_folder, media, allowDuplicate=True)
origin_checksum = helper.checksum(origin)
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 '2015-12-Dec/Test Album/2015-12-05_00-59-26-photo-some-title.jpg' in destination, destination
示例4: test_process_file_plain
# 需要导入模块: from elodie.filesystem import FileSystem [as 别名]
# 或者: from elodie.filesystem.FileSystem import process_file [as 别名]
def test_process_file_plain():
filesystem = FileSystem()
temporary_folder, folder = helper.create_working_folder()
origin = '%s/photo.jpg' % folder
shutil.copyfile(helper.get_file('plain.jpg'), origin)
media = Photo(origin)
destination = filesystem.process_file(origin, temporary_folder, media, allowDuplicate=True)
origin_checksum = helper.checksum(origin)
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 '2015-12-Dec/Unknown Location/2015-12-05_00-59-26-photo.jpg' in destination, destination
示例5: test_process_file_with_album
# 需要导入模块: from elodie.filesystem import FileSystem [as 别名]
# 或者: from elodie.filesystem.FileSystem import process_file [as 别名]
def test_process_file_with_album():
filesystem = FileSystem()
temporary_folder, folder = helper.create_working_folder()
origin = os.path.join(folder,'photo.jpg')
shutil.copyfile(helper.get_file('with-album.jpg'), origin)
media = Photo(origin)
destination = filesystem.process_file(origin, temporary_folder, media, allowDuplicate=True)
origin_checksum = helper.checksum(origin)
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-12-Dec','Test Album','2015-12-05_00-59-26-photo.jpg')) in destination, destination