当前位置: 首页>>代码示例>>Python>>正文


Python FileSystem.process_file方法代码示例

本文整理汇总了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
开发者ID:GonzaloAlvarez,项目名称:elodie,代码行数:27,代码来源:filesystem_test.py

示例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
开发者ID:scudderfish,项目名称:elodie,代码行数:13,代码来源:filesystem_test.py

示例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
开发者ID:wallrat,项目名称:elodie,代码行数:21,代码来源:filesystem_test.py

示例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
开发者ID:wallrat,项目名称:elodie,代码行数:21,代码来源:filesystem_test.py

示例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
开发者ID:scudderfish,项目名称:elodie,代码行数:21,代码来源:filesystem_test.py


注:本文中的elodie.filesystem.FileSystem.process_file方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。