Skip to content

Commit

Permalink
Qbittorrent mod: Add clean file note
Browse files Browse the repository at this point in the history
  • Loading branch information
GilbN committed Dec 20, 2022
1 parent 6c07a6f commit 6aa2647
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 30 deletions.
31 changes: 16 additions & 15 deletions docker-mods/qbittorrent/root/etc/cont-init.d/98-themepark
Original file line number Diff line number Diff line change
Expand Up @@ -97,34 +97,35 @@ sed_file(){
printf 'Stylesheet set to %s on %s\n\n' "${TP_THEME}" "$1"
}

clean_html() {
clean_file() {
perl -i -pe 's/QBT_TR?\(//' "$1"
perl -i -pe 's/\)QBT_TR\[CONTEXT=.*?\]//' "$1"
}

# Adding stylesheets
echo '---------------------------------------'
echo '| Adding the stylesheet to html files |'
echo '---------------------------------------'
if ! grep -q "${TP_DOMAIN}/css/base" /themepark/public/index.html; then
# Adding stylesheets
echo '---------------------------------------'
echo '| Adding the stylesheet to html files |'
echo '---------------------------------------'
sed_file /themepark/public/index.html
clean_html /themepark/public/index.html
clean_file /themepark/public/index.html

# Clean JS files
find /themepark -type f -iname "*.js" | while read fname
do
clean_html $fname
done
fi

if ! grep -q "${TP_DOMAIN}/css/base" /themepark/private/index.html; then
find /themepark/private -type f -iname "*.html" | while read fname
do
sed_file $fname
clean_html $fname
done
fi

# Clean all files
printf 'Cleaning files in /themepark for any translation text...\n\n
--------------------------------------------------------------------------
| !!! RESTART THE CONTAINER IF THIS IS THE FIRST TIME CLEANING FILES !!! |
--------------------------------------------------------------------------\n\n'
find /themepark -type f \( ! -iname "*.svg" \) | while read fname
do
clean_file $fname
done

if ! grep -q "WebUI\\\RootFolder" "${APP_FILEPATH}"; then
echo '--------------------------------------'
echo '| Adding WebUI\RootFolder=/themepark |'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,34 +82,35 @@ sed_file(){
printf 'Stylesheet set to %s on %s\n\n' "${TP_THEME}" "$1"
}

clean_html() {
clean_file() {
perl -i -pe 's/QBT_TR?\(//' "$1"
perl -i -pe 's/\)QBT_TR\[CONTEXT=.*?\]//' "$1"
}

# Adding stylesheets
echo '---------------------------------------'
echo '| Adding the stylesheet to html files |'
echo '---------------------------------------'
if ! grep -q "${TP_DOMAIN}/css/base" /themepark/public/index.html; then
# Adding stylesheets
echo '---------------------------------------'
echo '| Adding the stylesheet to html files |'
echo '---------------------------------------'
sed_file /themepark/public/index.html
clean_html /themepark/public/index.html
clean_file /themepark/public/index.html

# Clean JS files
find /themepark -type f -iname "*.js" | while read fname
do
clean_html $fname
done
fi

if ! grep -q "${TP_DOMAIN}/css/base" /themepark/private/index.html; then
find /themepark/private -type f -iname "*.html" | while read fname
do
sed_file $fname
clean_html $fname
done
fi

# Clean all files
printf 'Cleaning files in /themepark for any translation text...\n\n
--------------------------------------------------------------------------
| !!! RESTART THE CONTAINER IF THIS IS THE FIRST TIME CLEANING FILES !!! |
--------------------------------------------------------------------------\n\n'
find /themepark -type f \( ! -iname "*.svg" \) | while read fname
do
clean_file $fname
done

if ! grep -q "WebUI\\\RootFolder" "${APP_FILEPATH}"; then
echo '--------------------------------------'
echo '| Adding WebUI\RootFolder=/themepark |'
Expand Down

0 comments on commit 6aa2647

Please sign in to comment.