我的NAS备份了妻子和iPhone的图片和视频。我有一个单独的Debian框,用于将这些文件同步到其中,我正在尝试开发一个Python脚本来接收这些文件夹,根据它们是照片还是视频,它们是我还是我的妻子来组织它们,然后生成用于我可以随意刻录到Blurays和/或DVD。我在Windows笔记本电脑上开发了Python3脚本,并且能够使用UDCD格式的pycdlib制作ISO。脚本完成后,我将打开ISO并按需要查看文件的组织方式。当我移至Debian框时,仍创建了ISO,并创建了ISO中的目录,但似乎未添加任何文件。 ISO的大小太小,在装入ISO进行检查时看不到任何图片或视频文件。我尝试过以相同的结果切换到Rock Ridge,然后是Joliet,然后是Rock Ridge和Joliet的结合,仍然没有爱。
我想念什么?我正在发布遍历文件和a link to the full script for the curious.
的循环bluray_max = 23000000000
dvd_max = 4617000000
max_iso_size = dvd_max
current_iso = 1
current_total_size = 0
iso_photo = pycdlib.PyCdlib()
iso_photo.new(joliet=True, rock_ridge="1.09")
for root, dirnames, filenames in walk(path.join(tmp_dir, "photos")):
for directory in dirnames:
direct = "/" + directory.upper()
iso_photo.add_directory(
direct,
joliet_path=f'/{directory}',
rr_name=directory)
for file in filenames:
if r"photos\Gage" in root:
iso_photo.add_file(
path.join(root, file),
f'/GAGE/{file};3',
joliet_path=f'/Gage/{file}',
rr_name=file)
elif r"photos\Callen" in root:
iso_photo.add_file(
path.join(root, file),
f'/CALLEN/{file};3',
joliet_path=f'/Callen/{file}',
rr_name=file)
current_total_size += path.getsize(path.join(root, file))
if current_total_size >= max_iso_size:
iso_photo.write(path.join(
iso_location,
"photos_" + str(current_iso) + ".iso"))
iso_photo.close()
current_total_size = 0
current_iso += 1
iso_photo = pycdlib.PyCdlib()
iso_photo.new(joliet=True, rock_ridge="1.09")
for root, dirnames in walk(path.join(tmp_dir, "photos")):
for directory in dirnames:
direct = "/" + directory.upper()
iso_photo.add_directory(
direct,
joliet_path=f'/{directory}',
rr_name=directory)