[fix_charset] Fixed accented e; [import_src] Now properly converts all text formats to UTF-8

This commit is contained in:
ayakael 2019-02-10 15:11:42 -05:00
parent 9d5e1271a4
commit 555677a1ed
No known key found for this signature in database
GPG key ID: DF4ED0DE242BD38A
3 changed files with 14 additions and 1 deletions

View file

@ -16,6 +16,8 @@ fix_charset() {
sed -i 's/\xc2\x92/\x27/g' "${file}"
sed -i 's/\xc2\x85/\x2e\x2e\x2e/g' "${file}"
sed -i 's/\xc2\x96/\x2d/g' "${file}"
sed -i 's/\xe9/\xc3\xa9/g' "${file}"
sed -i 's/\xc9/\xc3\x89/g' "${file}"
done
return 0
}

View file

@ -65,7 +65,7 @@ import_images() {
for path in ${pathList[@]}; do
case $(sed 's|.*\.||' <<< ${path}) in
(jpg) echo "Copying cover image"; convert "${path}" "${GIT_DIR}/.import/${SOURCE}/${discidList}/img.png" ;;
(*) local DEST="${GIT_DIR}/.import/${SOURCE}/${discidList}/img.$(sed 's|.*\.||' <<< ${path})"; echo "Copying ${path} to ${DEST}"; cp --no-preserve=mode "${path}" "${DEST}" ;;
(cue|accurip|log|flac) local DEST="${GIT_DIR}/.import/${SOURCE}/${discidList}/img.$(sed 's|.*\.||' <<< ${path})"; echo "Copying ${path} to ${DEST}"; cp --no-preserve=mode "${path}" "${DEST}" ;;
esac
done
}

View file

@ -94,6 +94,17 @@ import_src() {
local EXIT=$?
[[ $? -eq 0 ]] || return 5
# Convert tags and cue to utf-8 with bom
local txtExtensionsList=(tags cue)
for txtExtensions in ${txtExtensionsList[@]}; do
local pathList=("${GIT_DIR}/${IMAGEID}.${txtExtensions}" ${pathList[@]})
done
fix_charset ${pathList[@]}
for path in ${pathList[@]}; do
iconv -t UTF-8//IGNORE "${path}" > "${path}.iconv"
mv "${path}.iconv" "${path}"
done
add_bom ${pathList[@]}
# Remove metadata and move img.flac to GIT_DIR