def _localimport(drive_id, channel_id, node_ids=None, update_progress=None, check_for_cancel=None):
drives = get_mounted_drives_with_channel_info()
drive = drives[drive_id]
# copy channel's db file then copy all the content files from storage dir
available_channel_ids = [c["id"] for c in drive.metadata["channels"]]
assert channel_id in available_channel_ids, "The given channel was not found in the drive."
try:
call_command(
"importchannel",
"local",
channel_id,
drive.datafolder,
update_progress=update_progress,
check_for_cancel=check_for_cancel
)
call_command(
"importcontent",
"local",
channel_id,
drive.datafolder,
node_ids=node_ids,
update_progress=update_progress,
check_for_cancel=check_for_cancel
)
except UserCancelledError:
try:
call_command("deletechannel", channel_id, update_progress=update_progress)
except CommandError:
pass
raise
评论列表
文章目录