🐛 Fix has_files quirks
This commit is contained in:
parent
53e8590da6
commit
eb9e319cb0
@ -12,7 +12,7 @@ user_folder=$4
|
||||
#else
|
||||
# user_folder='frontend/user'
|
||||
#fi
|
||||
check_files=$(find "${user_folder}${rom_path}" -maxdepth 1 -not -type d -and -not -name '.*' -exec basename {} \; | sort)
|
||||
check_files=$(find "${user_folder}/${rom_path}" -maxdepth 1 -not -type d -and -not -name '.*' -exec basename {} \; | sort)
|
||||
|
||||
# Clear out old hashes
|
||||
if [ "${full_scan}" = "true" ]; then
|
||||
@ -28,7 +28,7 @@ rm -Rf "${user_folder}/hashes/${rom_path}/tmp/"
|
||||
process_zip () {
|
||||
mkdir -p "${user_folder}/hashes/${rom_path}/tmp"
|
||||
echo "unzipping ${file}"
|
||||
unzip -j -q "${user_folder}${rom_path}/${file}" -d "${user_folder}/hashes/${rom_path}/tmp"
|
||||
unzip -j -q "${user_folder}/${rom_path}/${file}" -d "${user_folder}/hashes/${rom_path}/tmp"
|
||||
rm "${user_folder}/hashes/${rom_path}/tmp/"*.{txt,nfo,xml,readme,README} &> /dev/null || :
|
||||
echo "hashing ${file}"
|
||||
firstfile=( "${user_folder}/hashes/${rom_path}/tmp/"* )
|
||||
@ -41,7 +41,7 @@ process_zip () {
|
||||
process_7z () {
|
||||
mkdir -p "${user_folder}/hashes/${rom_path}/tmp"
|
||||
echo "unzipping ${file}"
|
||||
7z e "${user_folder}${rom_path}/${file}" -o"${user_folder}/hashes/${rom_path}/tmp"
|
||||
7z e "${user_folder}/${rom_path}/${file}" -o"${user_folder}/hashes/${rom_path}/tmp"
|
||||
rm "${user_folder}/hashes/${rom_path}/tmp/"*.{txt,nfo,xml,readme,README} &> /dev/null || :
|
||||
find "${user_folder}/hashes/${rom_path}/tmp/" -empty -type d -delete
|
||||
echo "hashing ${file}"
|
||||
@ -64,14 +64,14 @@ process_nes () {
|
||||
if [ $file_type == 'zip' ]; then
|
||||
mkdir -p "${user_folder}/hashes/${rom_path}/tmp"
|
||||
echo "unzipping ${file}"
|
||||
unzip -j -q "${user_folder}${rom_path}/${file}" -d "${user_folder}/hashes/${rom_path}/tmp"
|
||||
unzip -j -q "${user_folder}/${rom_path}/${file}" -d "${user_folder}/hashes/${rom_path}/tmp"
|
||||
rm "${user_folder}/hashes/${rom_path}/tmp/"*.{txt,nfo,xml,readme,README} &> /dev/null || :
|
||||
file_to_sha="${user_folder}/hashes/${rom_path}/tmp/"*
|
||||
elif [ $file_type == 'x-7z-compressed' ]; then
|
||||
echo "unzipping ${file}"
|
||||
mkdir -p "${user_folder}/hashes/${rom_path}/tmp"
|
||||
echo "unzipping ${file}"
|
||||
7z x "${user_folder}${rom_path}/${file}" -o"${user_folder}/hashes/${rom_path}/tmp"
|
||||
7z x "${user_folder}/${rom_path}/${file}" -o"${user_folder}/hashes/${rom_path}/tmp"
|
||||
rm "${user_folder}/hashes/${rom_path}/tmp/"*.{txt,nfo,xml,readme,README} &> /dev/null || :
|
||||
file_to_sha="${user_folder}/hashes/${rom_path}/tmp/"*
|
||||
else
|
||||
@ -94,7 +94,7 @@ process_name () {
|
||||
process_chd () {
|
||||
echo "processing ${file}"
|
||||
mkdir -p "${user_folder}/hashes/${rom_path}/tmp"
|
||||
chdman extractcd -i "${user_folder}${rom_path}/${file}" -o "${user_folder}/hashes/${rom_path}/tmp/FILE.cue"
|
||||
chdman extractcd -i "${user_folder}/${rom_path}/${file}" -o "${user_folder}/hashes/${rom_path}/tmp/FILE.cue"
|
||||
# Check if file has a track 2
|
||||
if grep -q "TRACK 02" "${user_folder}/hashes/${rom_path}/tmp/FILE.cue"; then
|
||||
echo "${file} is multi track need to split"
|
||||
@ -161,7 +161,7 @@ process_bin () {
|
||||
process_zip_by_name () {
|
||||
mkdir -p "${user_folder}/hashes/${rom_path}/tmp"
|
||||
echo "unzipping ${file}"
|
||||
unzip -j -q "${user_folder}${rom_path}/${file}" -d "${user_folder}/hashes/${rom_path}/tmp"
|
||||
unzip -j -q "${user_folder}/${rom_path}/${file}" -d "${user_folder}/hashes/${rom_path}/tmp"
|
||||
echo "hashing ${file}"
|
||||
sum=$(sha1sum "${user_folder}/hashes/${rom_path}/tmp/${file%.*}."* | awk '{print $1;exit}')
|
||||
rm -R "${user_folder}/hashes/${rom_path}/tmp/"
|
||||
@ -186,10 +186,10 @@ for file in $check_files; do
|
||||
elif [[ "${file_extension,,}" = @(img|cue|ccd|disk*|sub) ]]; then
|
||||
echo "Filetype ${file_extension} not supported"
|
||||
elif [ $rom_type == 'nes' ]; then
|
||||
file_type=$(file -b --mime-type "${user_folder}${rom_path}/${file}" | awk -F'/' '{print $2}')
|
||||
file_type=$(file -b --mime-type "${user_folder}/${rom_path}/${file}" | awk -F'/' '{print $2}')
|
||||
process_nes
|
||||
else
|
||||
file_type=$(file -b --mime-type "${user_folder}${rom_path}/${file}" | awk -F'/' '{print $2}')
|
||||
file_type=$(file -b --mime-type "${user_folder}/${rom_path}/${file}" | awk -F'/' '{print $2}')
|
||||
if [ $file_type == 'zip' ]; then
|
||||
process_zip
|
||||
elif [ $file_type == 'x-7z-compressed' ]; then
|
||||
|
Loading…
Reference in New Issue
Block a user