Skip to content

Commit

Permalink
feat: 7z gives priority to native commands
Browse files Browse the repository at this point in the history
  • Loading branch information
DDSRem committed Jan 6, 2025
1 parent 2f73a58 commit 3126e2a
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions all_in_one.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1915,7 +1915,8 @@ function __unzip_metadata() {
if ! check_metadata_size "${1}"; then
exit 1
fi
if [[ "${OSNAME}" = "macos" ]]; then
if [[ "${OSNAME}" = "macos" ]] || command -v 7z > /dev/null 2>&1; then
INFO "使用宿主机 7z 命令解压"
if [ "${1}" == "config.mp4" ] || [ "${1}" == "config.new.mp4" ]; then
if [ ! -d "${MEDIA_DIR}" ]; then
mkdir -p "${MEDIA_DIR}"
Expand All @@ -1932,14 +1933,20 @@ function __unzip_metadata() {
cd "${MEDIA_DIR}/xiaoya" || return 1
fi
INFO "当前解压工作目录:$(pwd)"
7z x -aoa -mmt=16 "${MEDIA_DIR}/temp/${1}"
if ! 7z x -aoa -mmt=16 "${MEDIA_DIR}/temp/${1}"; then
ERROR "解压元数据失败!"
exit 1
fi
else
if [ "${1}" == "config.mp4" ] || [ "${1}" == "config.new.mp4" ]; then
extra_parameters="--workdir=/media"
else
extra_parameters="--workdir=/media/xiaoya"
fi
pull_run_glue 7z x -aoa -mmt=16 "/media/temp/${1}"
if ! pull_run_glue 7z x -aoa -mmt=16 "/media/temp/${1}"; then
ERROR "解压元数据失败!"
exit 1
fi
fi

}
Expand Down Expand Up @@ -2104,18 +2111,25 @@ function unzip_appoint_xiaoya_emby_jellyfin() {
if ! check_metadata_size "${1}"; then
exit 1
fi
if [[ "${OSNAME}" = "macos" ]]; then
if [[ "${OSNAME}" = "macos" ]] || command -v 7z > /dev/null 2>&1; then
INFO "使用宿主机 7z 命令解压"
if [ ! -d "${MEDIA_DIR}/xiaoya" ]; then
mkdir -p "${MEDIA_DIR}/xiaoya"
auto_chown "${MEDIA_DIR}/xiaoya"
chmod 777 "${MEDIA_DIR}/xiaoya"
fi
cd "${MEDIA_DIR}/xiaoya" || return 1
INFO "当前解压工作目录:$(pwd)"
7z x -aoa -mmt=16 "${MEDIA_DIR}/temp/${1}" "${2}/*" -o"${MEDIA_DIR}/xiaoya"
if ! 7z x -aoa -mmt=16 "${MEDIA_DIR}/temp/${1}" "${2}/*" -o"${MEDIA_DIR}/xiaoya"; then
ERROR "解压元数据失败!"
exit 1
fi
else
extra_parameters="--workdir=/media/xiaoya"
pull_run_glue 7z x -aoa -mmt=16 "/media/temp/${1}" "${2}/*" -o/media/xiaoya
if ! pull_run_glue 7z x -aoa -mmt=16 "/media/temp/${1}" "${2}/*" -o/media/xiaoya; then
ERROR "解压元数据失败!"
exit 1
fi
fi

}
Expand Down Expand Up @@ -2216,6 +2230,7 @@ function unzip_appoint_xiaoya_emby_jellyfin() {
metadata_unziper "${1}" "115/${UNZIP_FOLD}"
else
ERROR "此文件暂时不支持解压指定元数据!"
exit 1
fi

INFO "设置目录权限..."
Expand Down

0 comments on commit 3126e2a

Please sign in to comment.