Skip to content

Commit

Permalink
Upd: normalize language field
Browse files Browse the repository at this point in the history
  • Loading branch information
jcorporation committed Jan 29, 2024
1 parent 0e81946 commit f2fd2eb
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -218,12 +218,19 @@ normalize_fields() {
sed -i -e "s/^#STATE:.*/#STATE:$STATE_UPPER/" "$F"
fi
# language
local LANGUAGE_LINE=""
LANGUAGE_LINE=$(get_m3u_field "$F" "LANGUAGE")
local NEW_LANGUAGE=""
local LANGUAGE=""
LANGUAGE=$(get_m3u_field "$F" "LANGUAGE")
local LANGUAGE_UPPER
LANGUAGE_UPPER=$(ucwords "$LANGUAGE")
LANGUAGE_UPPER=$(trim "$LANGUAGE_UPPER")
if [ "$LANGUAGE" != "$LANGUAGE_UPPER" ]
while read -r -d, LANGUAGE
do
[ "$LANGUAGE" = "" ] && continue
[ "$LANGUAGE" = "&" ] && continue
LANGUAGE=$(ucwords "$LANGUAGE")
NEW_LANGUAGE="$NEW_LANGUAGE, $LANGUAGE"
done < <(sed 's/, /,/g' <<< "$LANGUAGE_LINE,")
NEW_LANGUAGE="${NEW_LANGUAGE:2}"
if [ "$LANGUAGE_LINE" != "$NEW_LANGUAGE" ]
then
echo "$F: $LANGUAGE -> $LANGUAGE_UPPER"
sed -i -e "s/^#LANGUAGE:.*/#LANGUAGE:$LANGUAGE_UPPER/" "$F"
Expand Down

0 comments on commit f2fd2eb

Please sign in to comment.