Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
38 changes: 19 additions & 19 deletions Cachyos/Scripts/Android/android-optimize.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ cmd_compile() {
local mode="${1:-speed-profile}" target="${2:-all}"
log "Compiling ($target) mode=$mode..."
case "$target" in
all) ash cmd package compile -m "$mode" -a ;;
system) ash pm list packages -s | cut -f2 -d: | xargs -n1 -P4 -I{} $ADB cmd package compile -m speed -f "{}" ;;
select)
for app in com.android.chrome com.google.android.youtube com.twitter.android com.instagram.android; do
ash cmd package compile -m speed -f "$app" &>/dev/null || true
done
;;
all) ash cmd package compile -m "$mode" -a ;;
system) ash pm list packages -s | cut -f2 -d: | xargs -n1 -P4 -I{} $ADB cmd package compile -m speed -f "{}" ;;
select)
for app in com.android.chrome com.google.android.youtube com.twitter.android com.instagram.android; do
ash cmd package compile -m speed -f "$app" &>/dev/null || true
done
;;
esac
log "Compilation complete"
}
Expand Down Expand Up @@ -102,16 +102,16 @@ EOF

[[ $# -eq 0 ]] && usage
case "$1" in
all)
mode="${2:-safe}"
cmd_clean
cmd_compile speed-profile all
cmd_settings android-settings.txt "$mode"
cmd_doze "$mode"
;;
compile) cmd_compile "${2:-speed-profile}" "${3:-all}" ;;
clean) cmd_clean ;;
settings) cmd_settings "${2:-android-settings.txt}" "${3:-safe}" ;;
doze) cmd_doze "${2:-safe}" ;;
*) usage ;;
all)
mode="${2:-safe}"
cmd_clean
cmd_compile speed-profile all
cmd_settings android-settings.txt "$mode"
cmd_doze "$mode"
;;
compile) cmd_compile "${2:-speed-profile}" "${3:-all}" ;;
clean) cmd_clean ;;
settings) cmd_settings "${2:-android-settings.txt}" "${3:-safe}" ;;
doze) cmd_doze "${2:-safe}" ;;
*) usage ;;
esac
100 changes: 50 additions & 50 deletions Cachyos/Scripts/Android/cachie.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,56 +22,56 @@ cachie() {
read -s cachiee
while true; do
case $cachiee in
1)
echo -ne "${G}Enter value:${F} "
read -s sys_storage_threshold_percentage
settings put global sys_storage_threshold_percentage $sys_storage_threshold_percentage
echo ""
echo "Done!"
;;
2)
echo -ne "${G}Enter Value:${F} "
read -s sys_storage_threshold_max_bytes
settings put global sys_storage_threshold_max_bytes $sys_storage_threshold_max_bytes
echo ""
echo "Done!"
;;
3)
echo -ne "${G}Enter Value:${F} "
read -s sys_storage_full_threshold_bytes
settings put global sys_storage_full_threshold_bytes $sys_storage_full_threshold_bytes
echo ""
echo "Done!"
;;
4)
echo -ne "${G}Enter value:${F} "
read -s sys_storage_cache_percentage
settings put global sys_storage_cache_percentage $sys_storage_cache_percentage
echo ""
echo "Done!"
;;
5)
echo -ne "${G}Enter value:${F} "
read -s sys_storage_cache_max_bytes
settings put global sys_storage_cache_max_bytes $sys_storage_cache_max_bytes
echo ""
echo "Done!"
;;
6)
cachl() {
settings delete global sys_storage_threshold_percentage
settings delete global sys_storage_threshold_max_bytes
settings delete global sys_storage_full_threshold_bytes
settings delete global sys_storage_cache_percentage
settings delete global sys_storage_cache_max_bytes
}
cachl >/dev/null 2>&1
echo ""
echo "Done!"
;;
*)
echo "Invalid option."
;;
1)
echo -ne "${G}Enter value:${F} "
read -s sys_storage_threshold_percentage
settings put global sys_storage_threshold_percentage $sys_storage_threshold_percentage
echo ""
echo "Done!"
;;
2)
echo -ne "${G}Enter Value:${F} "
read -s sys_storage_threshold_max_bytes
settings put global sys_storage_threshold_max_bytes $sys_storage_threshold_max_bytes
echo ""
echo "Done!"
;;
3)
echo -ne "${G}Enter Value:${F} "
read -s sys_storage_full_threshold_bytes
settings put global sys_storage_full_threshold_bytes $sys_storage_full_threshold_bytes
echo ""
echo "Done!"
;;
4)
echo -ne "${G}Enter value:${F} "
read -s sys_storage_cache_percentage
settings put global sys_storage_cache_percentage $sys_storage_cache_percentage
echo ""
echo "Done!"
;;
5)
echo -ne "${G}Enter value:${F} "
read -s sys_storage_cache_max_bytes
settings put global sys_storage_cache_max_bytes $sys_storage_cache_max_bytes
echo ""
echo "Done!"
;;
6)
cachl() {
settings delete global sys_storage_threshold_percentage
settings delete global sys_storage_threshold_max_bytes
settings delete global sys_storage_full_threshold_bytes
settings delete global sys_storage_cache_percentage
settings delete global sys_storage_cache_max_bytes
}
cachl >/dev/null 2>&1
echo ""
echo "Done!"
;;
*)
echo "Invalid option."
;;
esac
break
done
Expand Down
146 changes: 73 additions & 73 deletions Cachyos/Scripts/Android/media-optimizer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -314,24 +314,24 @@ process_image() {

# First try to optimize in original format
case "$ext" in
jpg | jpeg)
optimize_jpeg "$file" "$tmpfile" "$MEDIA_OPT_WEBP_QUALITY"
result=$?
;;
png)
optimize_png "$file" "$tmpfile" "$([[ $MEDIA_OPT_QUALITY == *"lossy"* ]] && echo 1 || echo 0)"
result=$?
;;
gif | svg | webp)
# Just copy for now, we'll handle conversion to WebP next
cp "$file" "$tmpfile"
result=0
;;
*)
log_err "Unsupported format: $ext"
rm -f "$tmpfile"
return 1
;;
jpg | jpeg)
optimize_jpeg "$file" "$tmpfile" "$MEDIA_OPT_WEBP_QUALITY"
result=$?
;;
png)
optimize_png "$file" "$tmpfile" "$([[ $MEDIA_OPT_QUALITY == *"lossy"* ]] && echo 1 || echo 0)"
result=$?
;;
gif | svg | webp)
# Just copy for now, we'll handle conversion to WebP next
cp "$file" "$tmpfile"
result=0
;;
*)
log_err "Unsupported format: $ext"
rm -f "$tmpfile"
return 1
;;
esac

if [[ $result -ne 0 ]]; then
Expand Down Expand Up @@ -577,62 +577,62 @@ main() {
# Parse command-line arguments
while [[ $# -gt 0 ]]; do
case "$1" in
-h | --help)
usage
;;
-q | --quality)
MEDIA_OPT_QUALITY="$2"
shift 2
;;
-j | --jobs)
MEDIA_OPT_THREADS="$2"
shift 2
;;
-r | --recursive)
MEDIA_OPT_RECURSIVE=1
shift
;;
-b | --backup)
MEDIA_OPT_BACKUP=1
shift
;;
-n | --no-backup)
MEDIA_OPT_BACKUP=0
shift
;;
-p | --replace)
MEDIA_OPT_REPLACE=1
shift
;;
-w | --webp-quality)
MEDIA_OPT_WEBP_QUALITY="$2"
shift 2
;;
-v | --video)
MEDIA_OPT_PROCESS_VIDEOS=1
shift
;;
-d | --dedupe)
MEDIA_OPT_DEDUPE=1
shift
;;
--debug)
MEDIA_OPT_DEBUG=1
shift
;;
-*)
log_err "Unknown option: $1"
usage
;;
*)
if [[ -z $target_dir ]]; then
target_dir="$1"
else
log_err "Multiple directories specified. Please specify only one directory."
-h | --help)
usage
fi
shift
;;
;;
-q | --quality)
MEDIA_OPT_QUALITY="$2"
shift 2
;;
-j | --jobs)
MEDIA_OPT_THREADS="$2"
shift 2
;;
-r | --recursive)
MEDIA_OPT_RECURSIVE=1
shift
;;
-b | --backup)
MEDIA_OPT_BACKUP=1
shift
;;
-n | --no-backup)
MEDIA_OPT_BACKUP=0
shift
;;
-p | --replace)
MEDIA_OPT_REPLACE=1
shift
;;
-w | --webp-quality)
MEDIA_OPT_WEBP_QUALITY="$2"
shift 2
;;
-v | --video)
MEDIA_OPT_PROCESS_VIDEOS=1
shift
;;
-d | --dedupe)
MEDIA_OPT_DEDUPE=1
shift
;;
--debug)
MEDIA_OPT_DEBUG=1
shift
;;
-*)
log_err "Unknown option: $1"
usage
;;
*)
if [[ -z $target_dir ]]; then
target_dir="$1"
else
log_err "Multiple directories specified. Please specify only one directory."
usage
fi
shift
;;
esac
done

Expand Down
Loading
Loading