Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add workaround for when a package includes a restoration #238

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions ingestfile
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,13 @@ _ask_digitization_logs(){
[[ ! -z "${FILES}" ]] && _writeingestlog "digitization_logs: ${FILES}\n"
}

_ask_restoration(){
_report -qn "Drag in any restoration master: "
read -e -a RESTORATION_FILE
[[ "${RESTORATION_FILE[0]}" = "q" ]] && exit 0
[[ ! -z "${RESTORATION_FILE}" ]] && _writeingestlog "restoration: ${RESTORATION_FILE}\n"
}

# spreadsheet fields are currently CUNY-specific
_parse_spreadsheet(){
DIGITIZATIONLOG=$(_maketemp)
Expand Down Expand Up @@ -492,6 +499,7 @@ fi
_setup_package
if [[ "${MODE}" == "audio" ]] ; then
_ask_digitization_logs
_ask_restoration
_ask_photos "${MEDIAID}"
if [[ -f ${FILES} ]] ; then
_parse_spreadsheet
Expand Down Expand Up @@ -561,6 +569,7 @@ fi
# MICROSERVICES BEFORE PROCESSING
if [[ "${MODE}" == "preservation" ]] ; then
_ask_digitization_logs
_ask_restoration
if [[ "${INPUT#*.}" = "mkv" ]] ; then
"${SCRIPTDIR}/makemkvchapters" "${INPUT}"
else
Expand Down Expand Up @@ -616,17 +625,25 @@ FROM=$(_get_filesystem "${INPUT}")
TO=$(_get_filesystem "${OBJECTSDIR}/")
if [ "${FROM}" == "${TO}" -a "${CLEANUPDECISION}" == "Remove source file after successful ingest" ] ; then
_report -dt "Because ${INPUT} and ${OBJECTSDIR} are on the same filesystem and preservation mode is enabled we will mv rather than rsync."
_run_critical mv -v -n "${INPUT}" "${OBJECTSDIR}/"
_run_critical mv -v -n "${INPUT[@]}" "${OBJECTSDIR}/"
if [ ! "${#FILES[@]}" = 0 ] ; then
_run_critical mv -v -n "${FILES[@]}" "${LOGDIR}/"
fi
if [ ! "${#RESTORATION_FILE[@]}" = 0 ] ; then
_mkdir2 "${OBJECTSDIR}/restoration"
_run_critical mv -v -n "${RESTORATION_FILE[@]}" "${OBJECTSDIR}/restoration/"
fi
else
_report -dt "STATUS Copying the original file to library storage at ${OBJECTSDIR}."
LOGFILE="${LOGDIR}/rsync_$(_get_iso8601_c)_$(basename ${0})_${VERSION}.txt"
"${SCRIPTDIR}/migratefiles" -l "${LOGFILE}" -o "${OBJECTSDIR}" "${INPUT}"
"${SCRIPTDIR}/migratefiles" -l "${LOGFILE}" -o "${OBJECTSDIR}" "${INPUT[@]}"
if [ ! "${#FILES[@]}" = 0 ] ; then
_run_critical rsync -rt --progress --log-file="${LOGDIR}/rsync_$(_get_iso8601_c)_$(basename $0)_${VERSION}.txt" "${FILES[@]}" "${LOGDIR}/"
fi
if [ ! "${#RESTORATION_FILE[@]}" = 0 ] ; then
_mkdir2 "${OBJECTSDIR}/restoration"
_run_critical rsync -rt --progress --log-file="${LOGDIR}/rsync_$(_get_iso8601_c)_$(basename $0)_${VERSION}.txt" "${RESTORATION_FILE[@]}" "${OBJECTSDIR}/restoration/"
fi
fi

# set makederivopts
Expand Down
11 changes: 9 additions & 2 deletions mmfunctions
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ OBJECTS_FIND_EXCLUSIONS=(! -name ".*")
OBJECTS_FIND_EXCLUSIONS+=(! -path "*/access/*")
OBJECTS_FIND_EXCLUSIONS+=(! -path "*/service/*")
OBJECTS_FIND_EXCLUSIONS+=(! -path "*/trimmed_materials/*")
OBJECTS_FIND_EXCLUSIONS+=(! -path "*/restoration/*")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this line is kept in, then it is unable to make access file from restoration because it does not recognize the input. Tested it without this line and then it worked. :)


# load configuration file
if [ -f "${TEMP_MMCONFIG}" ] ; then
Expand Down Expand Up @@ -997,8 +998,14 @@ _find_input (){
fi
ISOBJECT="Y"
INPUTFILES=$(_maketemp)
if [[ -d "${1}/objects/restoration" ]] ; then
LOOKHERE="${1}/objects/restoration"
_report -dt "This package contains a restoration, using that for processing."
else
LOOKHERE="${1}/objects"
fi
# find av files in a directory and output to a temp list
find "${1}/objects" -type f -size +0 "${OBJECTS_FIND_EXCLUSIONS[@]}" | while read file ; do
find "${LOOKHERE}" -type f -size +0 "${OBJECTS_FIND_EXCLUSIONS[@]}" | while read file ; do
streamcount=$(ffprobe -loglevel quiet "$file" -show_entries format=nb_streams -of default=nw=1:nk=1)
duration_ts=$(ffprobe -loglevel quiet "$file" -show_entries stream=duration_ts -of default=nw=1:nk=1)
if [[ "$streamcount" > 0 && "${duration_ts}" != 1 ]] ; then
Expand Down Expand Up @@ -1033,7 +1040,7 @@ _find_input (){
fi
fi
else
_report -wt "A valid source file isn't found in ${1}/objects."
_report -wt "A valid source file isn't found in ${LOOKHERE}."
_writeerrorlog "_find_input" "A valid source file was not found, so the script could not proceed."
exit 1
fi
Expand Down