Spyke

Posts

shellscripting·Shell ScriptingbyWillieShen

Compression and FFmpeg commands changed and expanded

__pv() {
  if command -v pv >/dev/null 2>&1; then
    pv
  else
    cat
  fi
}

compress_single() {
  local msg='Usage: compress_single [-h|--help]
compress_single [-t|--tar] [-n|--no-tar] [-p|--pad PAD] COMMAND SOURCE [TARGET]
If TARGET is not provided and PAD is provided, SOURCE concatenating PAD is used.
No tar is used by default.'
  local tar=0
  local pad=''
  local target=''
  while [ "$#" -gt 0 ]; do
    case "$1" in
      -h | --help)
        echo "$msg"
        return 0
        ;;
      -t | --tar)
        tar=1
        shift
        ;;
      -n | --no-tar)
        tar=0
        shift
        ;;
      -p | --pad)
        if [ "$#" -lt 2 ]; then
          echo "$msg" >&2
          return 1
        fi
        pad="$2"
        shift 2
        ;;
      --)
        shift
        break
        ;;
      *)
        break
        ;;
    esac
  done
  if [ "$#" -eq 3 ]; then
    target="$3"
  elif [ "$#" -eq 2 ] && [ -n "$pad" ]; then
    target="${2}${pad}"
  else
    echo "$msg" >&2
    return 1
  fi
  if [ "$tar" -eq 1 ]; then
    (
      set -o pipefail
      tar -cf - "$2" | __pv | $1 | __pv >"$target"
    )
  else
    (
      set -o pipefail
      $1 "$2" | __pv >"$target"
    )
  fi
}

compress_split() {
  # shellcheck disable=2016
  local msg='Usage: compress_split [-h|--help]
compress_split [-t|--tar] [-n|--no-tar] [-p|--pad PAD] [-b BYTES|--bytes BYTES] COMMAND SOURCE [TARGET]
If TARGET is not provided and PAD is provided, SOURCE concatenating PAD is used.
No tar is used by default.
If BYTES is not provided, $SPLIT_SIZE is used if set and 4000M is used otherwise.'
  local bytes
  local pad=''
  local target=''
  if [ -n "${SPLIT_SIZE:-}" ]; then
    bytes="$SPLIT_SIZE"
  else
    bytes="4000M"
  fi
  local tar=0
  while [ "$#" -gt 0 ]; do
    case "$1" in
      -h | --help)
        echo "$msg"
        return 0
        ;;
      -t | --tar)
        tar=1
        shift
        ;;
      -n | --no-tar)
        tar=0
        shift
        ;;
      -p | --pad)
        if [ "$#" -lt 2 ]; then
          echo "$msg" >&2
          return 1
        fi
        pad="$2"
        shift 2
        ;;
      -b | --bytes)
        if [ "$#" -lt 2 ]; then
          echo "$msg" >&2
          return 1
        fi
        bytes="$2"
        shift 2
        ;;
      --)
        shift
        break
        ;;
      *)
        break
        ;;
    esac
  done
  if [ "$#" -eq 3 ]; then
    target="$3"
  elif [ "$#" -eq 2 ] && [ -n "$pad" ]; then
    target="${2}${pad}"
  else
    echo "$msg" >&2
    return 1
  fi
  if [ "$tar" -eq 1 ]; then
    (
      set -o pipefail
      tar -cf - "$2" | __pv | $1 | __pv | split -b "$bytes" -d -a 3 - "$target.part."
    )
  else
    (
      set -o pipefail
      $1 "$2" | __pv | split -b "$bytes" -d -a 3 - "$target.part."
    )
  fi
}

bz2_single() {
  compress_single --tar --pad '.tar.bz2' 'bzip2 -9 -c' "$@"
}

gz_single() {
  compress_single --tar --pad '.tar.gz' 'gzip -9 -c' "$@"
}

xz_single() {
  compress_single --tar --pad '.tar.xz' 'xz -9 -c' "$@"
}

zst_single() {
  compress_single --tar --pad '.tar.zst' 'zstd --ultra -22 -c' "$@"
}

tar_single() {
  compress_single --no-tar --pad '.tar' 'tar -cf -' "$@"
}

zip_single() {
  compress_single --no-tar --pad '.zip' 'zip -r -9 -' "$@"
}

7z_single() {
  compress_single --no-tar --pad '.7z' '7z a -mx=9 -so' "$@"
}

7z_non_solid_single() {
  compress_single --no-tar --pad '.7z' '7z a -mx=9 -ms=off -so' "$@"
}

bz2_split() {
  compress_split --tar --pad '.tar.bz2' 'bzip2 -9 -c' "$@"
}

gz_split() {
  compress_split --tar --pad '.tar.gz' 'gzip -9 -c' "$@"
}

xz_split() {
  compress_split --tar --pad '.tar.xz' 'xz -9 -c' "$@"
}

zst_split() {
  compress_split --tar --pad '.tar.zst' 'zstd --ultra -22 -c' "$@"
}

tar_split() {
  compress_split --no-tar --pad '.tar' 'tar -cf -' "$@"
}

zip_split() {
  compress_split --no-tar --pad '.zip' 'zip -r -9 -' "$@"
}

7z_split() {
  compress_split --no-tar --pad '.7z' '7z a -mx=9 -so' "$@"
}

7z_non_solid_split() {
  compress_split --no-tar --pad '.7z' '7z a -mx=9 -ms=off -so' "$@"
}

bz2_single_delete() {
  compress_single --tar --pad '.tar.bz2' 'bzip2 -9 -c' "$@" && rm -rf "$1"
}

gz_single_delete() {
  compress_single --tar --pad '.tar.gz' 'gzip -9 -c' "$@" && rm -rf "$1"
}

xz_single_delete() {
  compress_single --tar --pad '.tar.xz' 'xz -9 -c' "$@" && rm -rf "$1"
}

zst_single_delete() {
  compress_single --tar --pad '.tar.zst' 'zstd --ultra -22 -c' "$@" && rm -rf "$1"
}

tar_single_delete() {
  compress_single --no-tar --pad '.tar' 'tar -cf -' "$@" && rm -rf "$1"
}

zip_single_delete() {
  compress_single --no-tar --pad '.zip' 'zip -r -9 -' "$@" && rm -rf "$1"
}

7z_single_delete() {
  compress_single --no-tar --pad '.7z' '7z a -mx=9 -so' "$@" && rm -rf "$1"
}

7z_non_solid_single_delete() {
  compress_single --no-tar --pad '.7z' '7z a -mx=9 -ms=off -so' "$@" && rm -rf "$1"
}

bz2_split_delete() {
  compress_split --tar --pad '.tar.bz2' 'bzip2 -9 -c' "$@" && rm -rf "$1"
}

gz_split_delete() {
  compress_split --tar --pad '.tar.gz' 'gzip -9 -c' "$@" && rm -rf "$1"
}

xz_split_delete() {
  compress_split --tar --pad '.tar.xz' 'xz -9 -c' "$@" && rm -rf "$1"
}

zst_split_delete() {
  compress_split --tar --pad '.tar.zst' 'zstd --ultra -22 -c' "$@" && rm -rf "$1"
}

tar_split_delete() {
  compress_split --no-tar --pad '.tar' 'tar -cf -' "$@" && rm -rf "$1"
}

zip_split_delete() {
  compress_split --no-tar --pad '.zip' 'zip -r -9 -' "$@" && rm -rf "$1"
}

7z_split_delete() {
  compress_split --no-tar --pad '.7z' '7z a -mx=9 -so' "$@" && rm -rf "$1"
}

7z_non_solid_split_delete() {
  compress_split --no-tar --pad '.7z' '7z a -mx=9 -ms=off -so' "$@" && rm -rf "$1"
}

bz2_single_here() {
  (
    shopt -s nullglob
    for f in *; do
      compress_single --tar --pad '.tar.bz2' 'bzip2 -9 -c' "$f" "$@" && rm -- "$f"
    done
  )
}

gz_single_here() {
  (
    shopt -s nullglob
    for f in *; do
      compress_single --tar --pad '.tar.gz' 'gzip -9 -c' "$f" "$@" && rm -- "$f"
    done
  )
}

xz_single_here() {
  (
    shopt -s nullglob
    for f in *; do
      compress_single --tar --pad '.tar.xz' 'xz -9 -c' "$f" "$@" && rm -- "$f"
    done
  )
}

zst_single_here() {
  (
    shopt -s nullglob
    for f in *; do
      compress_single --tar --pad '.tar.zst' 'zstd --ultra -22 -c' "$f" "$@" && rm -- "$f"
    done
  )
}

tar_single_here() {
  (
    shopt -s nullglob
    for f in *; do
      compress_single --no-tar --pad '.tar' 'tar -cf -' "$f" "$@" && rm -- "$f"
    done
  )
}

zip_single_here() {
  (
    shopt -s nullglob
    for f in *; do
      compress_single --no-tar --pad '.zip' 'zip -r -9 -' "$f" "$@" && rm -- "$f"
    done
  )
}

7z_single_here() {
  (
    shopt -s nullglob
    for f in *; do
      compress_single --no-tar --pad '.7z' '7z a -mx=9 -so' "$f" "$@" && rm -- "$f"
    done
  )
}

7z_non_solid_single_here() {
  (
    shopt -s nullglob
    for f in *; do
      compress_single --no-tar --pad '.7z' '7z a -mx=9 -ms=off -so' "$f" "$@" && rm -- "$f"
    done
  )
}

bz2_split_here() {
  (
    shopt -s nullglob
    for f in *; do
      compress_split --tar --pad '.tar.bz2' 'bzip2 -9' "$f" "$@" && rm -- "$f"
    done
  )
}

gz_split_here() {
  (
    shopt -s nullglob
    for f in *; do
      compress_split --tar --pad '.tar.gz' 'gzip -9' "$f" "$@" && rm -- "$f"
    done
  )
}

xz_split_here() {
  (
    shopt -s nullglob
    for f in *; do
      compress_split --tar --pad '.tar.xz' 'xz -9' "$f" "$@" && rm -- "$f"
    done
  )
}

zst_split_here() {
  (
    shopt -s nullglob
    for f in *; do
      compress_split --tar --pad '.tar.zst' 'zstd --ultra -22 -c' "$f" "$@" && rm -- "$f"
    done
  )
}

tar_split_here() {
  (
    shopt -s nullglob
    for f in *; do
      compress_split --no-tar --pad '.tar' 'tar -cf -' "$f" "$@" && rm -- "$f"
    done
  )
}

zip_split_here() {
  (
    shopt -s nullglob
    for f in *; do
      compress_split --no-tar --pad '.zip' 'zip -r -9 -' "$f" "$@" && rm -- "$f"
    done
  )
}

7z_split_here() {
  (
    shopt -s nullglob
    for f in *; do
      compress_split --no-tar --pad '.7z' '7z a -mx=9 -so' "$f" "$@" && rm -- "$f"
    done
  )
}

7z_non_solid_split_here() {
  (
    shopt -s nullglob
    for f in *; do
      compress_split --no-tar --pad '.7z' '7z a -mx=9 -ms=off -so' "$f" "$@" && rm -- "$f"
    done
  )
}

bz2_single_files() {
  (
    shopt -s globstar nullglob
    for f in **/*; do
      test -f "$f" || continue
      compress_single --tar --pad '.tar.bz2' 'bzip2 -9 -c' "$f" "$@" && rm -- "$f"
    done
  )
}

gz_single_files() {
  (
    shopt -s globstar nullglob
    for f in **/*; do
      test -f "$f" || continue
      compress_single --tar --pad '.tar.gz' 'gzip -9 -c' "$f" "$@" && rm -- "$f"
    done
  )
}

xz_single_files() {
  (
    shopt -s globstar nullglob
    for f in **/*; do
      test -f "$f" || continue
      compress_single --tar --pad '.tar.xz' 'xz -9 -c' "$f" "$@" && rm -- "$f"
    done
  )
}

zst_single_files() {
  (
    shopt -s globstar nullglob
    for f in **/*; do
      test -f "$f" || continue
      compress_single --tar --pad '.tar.zst' 'zstd --ultra -22 -c' "$f" "$@" && rm -- "$f"
    done
  )
}

tar_single_files() {
  (
    shopt -s globstar nullglob
    for f in **/*; do
      test -f "$f" || continue
      compress_single --no-tar --pad '.tar' 'tar -cf -' "$f" "$@" && rm -- "$f"
    done
  )
}

zip_single_files() {
  (
    shopt -s globstar nullglob
    for f in **/*; do
      test -f "$f" || continue
      compress_single --no-tar --pad '.zip' 'zip -r -9 -' "$f" "$@" && rm -- "$f"
    done
  )
}

7z_single_files() {
  (
    shopt -s globstar nullglob
    for f in **/*; do
      test -f "$f" || continue
      compress_single --no-tar --pad '.7z' '7z a -mx=9 -so' "$f" "$@" && rm -- "$f"
    done
  )
}

7z_non_solid_single_files() {
  (
    shopt -s globstar nullglob
    for f in **/*; do
      test -f "$f" || continue
      compress_single --no-tar --pad '.7z' '7z a -mx=9 -ms=off -so' "$f" "$@" && rm -- "$f"
    done
  )
}

bz2_split_files() {
  (
    shopt -s globstar nullglob
    for f in **/*; do
      test -f "$f" || continue
      compress_split --tar --pad '.tar.bz2' 'bzip2 -9' "$f" "$@" && rm -- "$f"
    done
  )
}

gz_split_files() {
  (
    shopt -s globstar nullglob
    for f in **/*; do
      test -f "$f" || continue
      compress_split --tar --pad '.tar.gz' 'gzip -9' "$f" "$@" && rm -- "$f"
    done
  )
}

xz_split_files() {
  (
    shopt -s globstar nullglob
    for f in **/*; do
      test -f "$f" || continue
      compress_split --tar --pad '.tar.xz' 'xz -9' "$f" "$@" && rm -- "$f"
    done
  )
}

zst_split_files() {
  (
    shopt -s globstar nullglob
    for f in **/*; do
      test -f "$f" || continue
      compress_split --tar --pad '.tar.zst' 'zstd --ultra -22 -c' "$f" "$@" && rm -- "$f"
    done
  )
}

tar_split_files() {
  (
    shopt -s globstar nullglob
    for f in **/*; do
      test -f "$f" || continue
      compress_split --no-tar --pad '.tar' 'tar -cf -' "$f" "$@" && rm -- "$f"
    done
  )
}

zip_split_files() {
  (
    shopt -s globstar nullglob
    for f in **/*; do
      test -f "$f" || continue
      compress_split --no-tar --pad '.zip' 'zip -r -9 -' "$f" "$@" && rm -- "$f"
    done
  )
}

7z_split_files() {
  (
    shopt -s globstar nullglob
    for f in **/*; do
      test -f "$f" || continue
      compress_split --no-tar --pad '.7z' '7z a -mx=9 -so' "$f" "$@" && rm -- "$f"
    done
  )
}

7z_non_solid_split_files() {
  (
    shopt -s globstar nullglob
    for f in **/*; do
      test -f "$f" || continue
      compress_split --no-tar --pad '.7z' '7z a -mx=9 -ms=off -so' "$f" "$@" && rm -- "$f"
    done
  )
}

extract_all_and() {
  local erar=0
  local ezip=0
  local e7z=0
  local etargz=0
  local etgz=0
  local egz=0
  local etarbz2=0
  local etbz2=0
  local ebz2=0
  local etarxz=0
  local etxz=0
  local exz=0
  local etarzst=0
  local etzst=0
  local ezst=0
  while [ "$#" -gt 0 ]; do
    case "$1" in
      --erar | --exclude-rar)
        erar=1
        shift
        ;;
      --ezip | --exclude-zip)
        ezip=1
        shift
        ;;
      --e7z | --exclude-7z)
        e7z=1
        shift
        ;;
      --etargz | --exclude-targz)
        etargz=1
        shift
        ;;
      --etgz | --exclude-tgz)
        etgz=1
        shift
        ;;
      --egz | --exclude-gz)
        egz=1
        shift
        ;;
      --etarbz2 | --exclude-tarbz2)
        etarbz2=1
        shift
        ;;
      --etbz2 | --exclude-tbz2)
        etbz2=1
        shift
        ;;
      --ebz2 | --exclude-bz2)
        ebz2=1
        shift
        ;;
      --etarxz | --exclude-tarxz)
        etarxz=1
        shift
        ;;
      --etxz | --exclude-txz)
        etxz=1
        shift
        ;;
      --exz | --exclude-xz)
        exz=1
        shift
        ;;
      --etarzst | --exclude-tarzst)
        etarzst=1
        shift
        ;;
      --etzst | --exclude-tzst)
        etzst=1
        shift
        ;;
      --ezst | --exclude-zst)
        ezst=1
        shift
        ;;
      --)
        shift
        break
        ;;
      *)
        break
        ;;
    esac
  done
  [ "$#" -lt 2 ] && return 1
  (
    shopt -s globstar nullglob
    for f in "$1" "$1"/**/*; do
      [[ -f $f ]] || continue
      local file=${f##*/}
      local dir=${f%/*}
      [[ $dir == "$f" ]] && dir=.
      local un=''
      local -a cmd=()
      case $file in
        *.rar)
          [ "$erar" -eq 1 ] && continue
          un=${file%.rar}
          cmd=(unrar x)
          ;;
        *.zip)
          [ "$ezip" -eq 1 ] && continue
          un=${file%.zip}
          cmd=(unzip)
          ;;
        *.7z)
          [ "$e7z" -eq 1 ] && continue
          un=${file%.7z}
          cmd=(7z x)
          ;;
        *.tar.gz)
          [ "$etargz" -eq 1 ] && continue
          un=${file%.tar.gz}
          cmd=(tar -xzf)
          ;;
        *.tgz)
          [ "$etgz" -eq 1 ] && continue
          un=${file%.tgz}
          cmd=(tar -xzf)
          ;;
        *.gz)
          [ "$egz" -eq 1 ] && continue
          un=${file%.gz}
          cmd=(gzip -d)
          ;;
        *.tar.bz2)
          [ "$etarbz2" -eq 1 ] && continue
          un=${file%.tar.bz2}
          cmd=(tar -xjf)
          ;;
        *.tbz2)
          [ "$etbz2" -eq 1 ] && continue
          un=${file%.tbz2}
          cmd=(tar -xjf)
          ;;
        *.bz2)
          [ "$ebz2" -eq 1 ] && continue
          un=${file%.bz2}
          cmd=(bzip2 -d)
          ;;
        *.tar.xz)
          [ "$etarxz" -eq 1 ] && continue
          un=${file%.tar.xz}
          cmd=(tar -xJf)
          ;;
        *.txz)
          [ "$etxz" -eq 1 ] && continue
          un=${file%.txz}
          cmd=(tar -xJf)
          ;;
        *.xz)
          [ "$exz" -eq 1 ] && continue
          un=${file%.xz}
          cmd=(xz -d)
          ;;
        *.tar.zst)
          [ "$etarzst" -eq 1 ] && continue
          un=${file%.tar.zst}
          cmd=(tar -xf --zstd)
          ;;
        *.tzst)
          [ "$etzst" -eq 1 ] && continue
          un=${file%.tzst}
          cmd=(tar -xf --zstd)
          ;;
        *.zst)
          [ "$ezst" -eq 1 ] && continue
          un=${file%.zst}
          cmd=(zst -d)
          ;;
        *)
          continue
          ;;
      esac
      (
        cd "$dir" &&
          "${cmd[@]}" "$file" &&
          rm -- "$file" &&
          "${@:2}" "$un" &&
          rm -rf -- "$un"
      )
    done
  )
}

extract_all() {
  extract_all_and "$@" false
}

extract_all_and_bz2() {
  local -a args=()
  while [ "$#" -gt 0 ]; do
    case "$1" in
      -p | --pad)
        if [ "$#" -lt 2 ]; then
          return 1
        fi
        args+=("$1" "$2")
        shift 2
        ;;
      --)
        shift
        break
        ;;
      *)
        break
        ;;
    esac
  done
  extract_all_and "$@" bz2_single "${args[@]}"
}

extract_all_and_gz() {
  local -a args=()
  while [ "$#" -gt 0 ]; do
    case "$1" in
      -p | --pad)
        if [ "$#" -lt 2 ]; then
          return 1
        fi
        args+=("$1" "$2")
        shift 2
        ;;
      --)
        shift
        break
        ;;
      *)
        break
        ;;
    esac
  done
  extract_all_and "$@" gz_single "${args[@]}"
}

extract_all_and_xz() {
  local -a args=()
  while [ "$#" -gt 0 ]; do
    case "$1" in
      -p | --pad)
        if [ "$#" -lt 2 ]; then
          return 1
        fi
        args+=("$1" "$2")
        shift 2
        ;;
      --)
        shift
        break
        ;;
      *)
        break
        ;;
    esac
  done
  extract_all_and "$@" xz_single "${args[@]}"
}

extract_all_and_zst() {
  local -a args=()
  while [ "$#" -gt 0 ]; do
    case "$1" in
      -p | --pad)
        if [ "$#" -lt 2 ]; then
          return 1
        fi
        args+=("$1" "$2")
        shift 2
        ;;
      --)
        shift
        break
        ;;
      *)
        break
        ;;
    esac
  done
  extract_all_and "$@" zst_single "${args[@]}"
}

extract_all_and_tar() {
  local -a args=()
  while [ "$#" -gt 0 ]; do
    case "$1" in
      -p | --pad)
        if [ "$#" -lt 2 ]; then
          return 1
        fi
        args+=("$1" "$2")
        shift 2
        ;;
      --)
        shift
        break
        ;;
      *)
        break
        ;;
    esac
  done
  extract_all_and "$@" tar_single "${args[@]}"
}

extract_all_and_zip() {
  local -a args=()
  while [ "$#" -gt 0 ]; do
    case "$1" in
      -p | --pad)
        if [ "$#" -lt 2 ]; then
          return 1
        fi
        args+=("$1" "$2")
        shift 2
        ;;
      --)
        shift
        break
        ;;
      *)
        break
        ;;
    esac
  done
  extract_all_and "$@" zip_single "${args[@]}"
}

extract_all_and_7z() {
  local -a args=()
  while [ "$#" -gt 0 ]; do
    case "$1" in
      -p | --pad)
        if [ "$#" -lt 2 ]; then
          return 1
        fi
        args+=("$1" "$2")
        shift 2
        ;;
      --)
        shift
        break
        ;;
      *)
        break
        ;;
    esac
  done
  extract_all_and "$@" 7z_single "${args[@]}"
}

extract_all_and_7z_non_solid() {
  local -a args=()
  while [ "$#" -gt 0 ]; do
    case "$1" in
      -p | --pad)
        if [ "$#" -lt 2 ]; then
          return 1
        fi
        args+=("$1" "$2")
        shift 2
        ;;
      --)
        shift
        break
        ;;
      *)
        break
        ;;
    esac
  done
  extract_all_and "$@" 7z_non_solid_single "${args[@]}"
}

extract_all_and_bz2_split() {
  local -a args=()
  while [ "$#" -gt 0 ]; do
    case "$1" in
      -p | --pad)
        if [ "$#" -lt 2 ]; then
          return 1
        fi
        args+=("$1" "$2")
        shift 2
        ;;
      -b | --bytes)
        if [ "$#" -lt 2 ]; then
          return 1
        fi
        args+=("$1" "$2")
        shift 2
        ;;
      --)
        shift
        break
        ;;
      *)
        break
        ;;
    esac
  done
  extract_all_and "$@" bz2_split "${args[@]}"
}

extract_all_and_gz_split() {
  local -a args=()
  while [ "$#" -gt 0 ]; do
    case "$1" in
      -p | --pad)
        if [ "$#" -lt 2 ]; then
          return 1
        fi
        args+=("$1" "$2")
        shift 2
        ;;
      -b | --bytes)
        if [ "$#" -lt 2 ]; then
          return 1
        fi
        args+=("$1" "$2")
        shift 2
        ;;
      --)
        shift
        break
        ;;
      *)
        break
        ;;
    esac
  done
  extract_all_and "$@" gz_split "${args[@]}"
}

extract_all_and_xz_split() {
  local -a args=()
  while [ "$#" -gt 0 ]; do
    case "$1" in
      -p | --pad)
        if [ "$#" -lt 2 ]; then
          return 1
        fi
        args+=("$1" "$2")
        shift 2
        ;;
      -b | --bytes)
        if [ "$#" -lt 2 ]; then
          return 1
        fi
        args+=("$1" "$2")
        shift 2
        ;;
      --)
        shift
        break
        ;;
      *)
        break
        ;;
    esac
  done
  extract_all_and "$@" xz_split "${args[@]}"
}

extract_all_and_tar_split() {
  local -a args=()
  while [ "$#" -gt 0 ]; do
    case "$1" in
      -p | --pad)
        if [ "$#" -lt 2 ]; then
          return 1
        fi
        args+=("$1" "$2")
        shift 2
        ;;
      -b | --bytes)
        if [ "$#" -lt 2 ]; then
          return 1
        fi
        args+=("$1" "$2")
        shift 2
        ;;
      --)
        shift
        break
        ;;
      *)
        break
        ;;
    esac
  done
  extract_all_and "$@" tar_split "${args[@]}"
}

extract_all_and_zip_split() {
  local -a args=()
  while [ "$#" -gt 0 ]; do
    case "$1" in
      -p | --pad)
        if [ "$#" -lt 2 ]; then
          return 1
        fi
        args+=("$1" "$2")
        shift 2
        ;;
      -b | --bytes)
        if [ "$#" -lt 2 ]; then
          return 1
        fi
        args+=("$1" "$2")
        shift 2
        ;;
      --)
        shift
        break
        ;;
      *)
        break
        ;;
    esac
  done
  extract_all_and "$@" zip_split "${args[@]}"
}

extract_all_and_7z_split() {
  local -a args=()
  while [ "$#" -gt 0 ]; do
    case "$1" in
      -p | --pad)
        if [ "$#" -lt 2 ]; then
          return 1
        fi
        args+=("$1" "$2")
        shift 2
        ;;
      --)
        shift
        break
        ;;
      *)
        break
        ;;
    esac
  done
  extract_all_and "$@" 7z_split "${args[@]}"
}

extract_all_and_7z_non_solid_split() {
  local -a args=()
  while [ "$#" -gt 0 ]; do
    case "$1" in
      -p | --pad)
        if [ "$#" -lt 2 ]; then
          return 1
        fi
        args+=("$1" "$2")
        shift 2
        ;;
      --)
        shift
        break
        ;;
      *)
        break
        ;;
    esac
  done
  extract_all_and "$@" 7z_non_solid_split "${args[@]}"
}

remove_extension() {
  sed -E 's/^(.+)\.[^.]+$/\1/'
}

get_extension() {
  sed -E '/^\.?[^.]+$/d; s/^.+\.([^.]*)$/\1/'
}

ls_extension() {
  find . -type f | sed -n 's/.*\(\.[^.\/]*\)$/\1/p' | sort -u
}

ffmpeg_av1() {
  if [ "$#" -lt 3 ]; then
    return
  fi
  local new=""
  new="${4:-"$(echo "$3" | remove_extension)_ffmpeg_av1_$1_$2.mkv"}"
  if ! ffmpeg -n -i "$4" -c:v libsvtav1 -preset "$1" -crf "$2" -an "$new"; then
    rm -f -- "$new"
    return 1
  fi
}

ffmpeg_av1_lossless() {
  if [ "$#" -eq 0 ]; then
    return
  fi
  local new="${2:-"$(echo "$1" | remove_extension)_ffmpeg_av1_lossless.mkv"}"
  if ! ffmpeg -n -i "$1" -c:v libsvtav1 -svtav1-params lossless=1 -preset -2 -an "$new"; then
    rm -f -- "$new"
    return 1
  fi
}

ffmpeg_av1_opus() {
  if [ "$#" -lt 4 ]; then
    return
  fi
  local new=""
  new="${5:-"$(echo "$4" | remove_extension)_ffmpeg_av1_$1_$2"}"
  local ba=()
  if [ "$3" -ne 0 ]; then
    ba=("-c:a" "libopus" "-vbr:a" "1" "-b:a" "${3}k")
    new="${new}_opus_${3}k.mkv"
  else
    ba=("-an")
    new="${new}.mkv"
  fi
  if ! ffmpeg -n -i "$4" -c:v libsvtav1 -preset "$1" -crf "$2" "${ba[@]}" "$new"; then
    rm -f -- "$new"
    return 1
  fi
}

ffmpeg_av1_lossless_flac() {
  if [ "$#" -eq 0 ]; then
    return
  fi
  local new="${2:-"$(echo "$1" | remove_extension)_ffmpeg_av1_lossless_flac.mkv"}"
  if ! ffmpeg -n -i "$1" -c:v libsvtav1 -svtav1-params lossless=1 -preset -2 -c:a flac "$new"; then
    rm -f -- "$new"
    return 1
  fi
}

ffmpeg_opus() {
  if [ "$#" -lt 2 ]; then
    return
  fi
  local new="${3:-"$(echo "$2" | remove_extension)_ffmpeg_opus_${1}k.opus"}"
  if ! ffmpeg -n -i "$2" -c:a libopus -vbr:a 1 -b:a "${1}k" "$new"; then
    rm -f -- "$new"
    return 1
  fi
}

ffmpeg_flac() {
  if [ "$#" -eq 0 ]; then
    return
  fi
  local new="${2:-"$(echo "$1" | remove_extension)_ffmpeg_flac.flac"}"
  if ! ffmpeg -n -i "$1" -c:a flac "$new"; then
    rm -f -- "$new"
    return 1
  fi
}

ffmpeg_segment() {
  if [ "$#" -lt 2 ]; then
    return
  fi
  ffmpeg -n -i "$2" -c copy -map 0 -segment_time "$1" -f segment -reset_timestamps 1 "${3:-"$(echo "$2" | remove_extension)_ffmpeg_%04d.$(echo "$2" | get_extension)"}"
}

ffmpeg_concat_auto() {
  local -a files=()
  if [ "$#" -eq 0 ]; then
    for f in *; do
      test -f "$f" && files+=("$f")
    done
  else
    files=("$@")
  fi
  ffmpeg -n -f concat -safe 0 -i <(printf "file '$PWD/%s'\n" "${files[@]}") -c copy "$(echo "${files[0]}" | remove_extension | sed -E 's/_ffmpeg_[0-9]+$//').$(echo "${files[0]}" | get_extension)"
}

ffmpeg_concat() {
  if [ "$#" -lt 2 ]; then
    return
  fi
  ffmpeg -n -f concat -safe 0 -i <(printf "file '$PWD/%s'\n" "${@:2}") -c copy "$1"
}

echo_non_ffmpeg() {
  while IFS= read -r -d '' f; do
    case "$f" in
      *ffmpeg_*) ;;
      *)
        echo "$f"
        ;;
    esac
  done < <(find . -type f -print0)
}

remove_non_ffmpeg() {
  while IFS= read -r -d '' f; do
    case "$f" in
      *ffmpeg_*) ;;
      *)
        rm -f -- "$f"
        ;;
    esac
  done < <(find . -type f -print0)
}

echo_ffmpeg() {
  while IFS= read -r -d '' f; do
    case "$f" in
      *ffmpeg_*)
        echo "$f"
        ;;
      *) ;;
    esac
  done < <(find . -type f -print0)
}

remove_ffmpeg() {
  while IFS= read -r -d '' f; do
    case "$f" in
      *ffmpeg_*)
        rm -f -- "$f"
        ;;
      *) ;;
    esac
  done < <(find . -type f -print0)
}

jxl_lossy() {
  if [ "$#" -lt 2 ]; then
    return
  fi
  local new="${3:-"$(echo "$2" | remove_extension).jxl"}"
  if ! cjxl -j 0 -e 10 -d "$1" "$2" "$new"; then
    rm -f -- "$new"
    return 1
  fi
}

jxl_lossless() {
  if [ "$#" -eq 0 ]; then
    return
  fi
  local new="${2:-"$(echo "$1" | remove_extension).jxl"}"
  if ! cjxl -j 1 -e 10 -d 0 "$1" "$new"; then
    rm -f -- "$new"
    return 1
  fi
}

multimedia_convert() {
  (
    shopt -s globstar nullglob
    for f in **/*; do
      [[ -f $f ]] || continue
      local file=${f##*/}
      local dir=${f%/*}
      [[ $dir == "$f" ]] && dir=.
      case ${file,,} in
        *_ffmpeg_av1_*_*_opus_*.mkv | *_ffmpeg_av1_lossless_flac*.mkv)
          continue
          ;;
        *.ico | *.flac | *.gif | *.opus)
          local ext="${file##*.}"
          ext="${ext,,}"
          if [[ ${file##*.} != "$ext" ]]; then
            if [[ -e "${f%.*}.${ext}" ]]; then
              printf 'Skipping: output exists: %s\n' "$f" >&2
              continue
            fi
            mv -- "$f" "${f%.*}.${ext}"
          fi
          ;;
        *.jpg | *.jpeg | *.png)
          local jxl="${file%.*}.jxl"
          if [[ -e "$dir/$jxl" ]]; then
            printf 'Skipping: output exists: %s\n' "$f" >&2
            continue
          fi
          (
            cd "$dir" &&
              jxl_lossy 1 "./$file" "./$jxl" &&
              rm -- "$file"
          )
          ;;
        *.avif | *.bmp | *.heic | *.heif | *.jp2 | *.tif | *.webp)
          local png="${file%.*}.png"
          if [[ -e "$dir/$png" ]]; then
            printf 'Skipping: intermediate png exists: %s\n' "$f" >&2
            continue
          fi
          local jxl="${file%.*}.jxl"
          if [[ -e "$dir/$jxl" ]]; then
            printf 'Skipping: output exists: %s\n' "$f" >&2
            continue
          fi
          (
            if cd "$dir"; then
              magick "./$file" "./$png" &&
                jxl_lossy 1 "./$png" "./$jxl" &&
                rm -- "$file"
              rm -f -- "$png"
            fi
          )
          ;;
        *.3gp | *.mov | *.vob | *.wmv)
          (
            cd "$dir" &&
              ffmpeg_av1_opus 4 40 24 "./$file" &&
              rm -- "$file"
          )
          ;;
        *.avi | *.mkv | *.mp4 | *.mts | *.webm)
          (
            cd "$dir" &&
              ffmpeg_av1_opus 4 32 72 "./$file" &&
              rm -- "$file"
          )
          ;;
        *.aac | *.mp3 | *.m4a | *.ogg)
          (
            cd "$dir" &&
              ffmpeg_opus 96 "./$file" &&
              rm -- "$file"
          )
          ;;
        *.wav)
          (
            cd "$dir" &&
              ffmpeg_flac "./$file" &&
              rm -- "$file"
          )
          ;;
        *)
          continue
          ;;
      esac
    done
  )
}
View original on lemmy.world
2
callofdutymobile·Call of Duty MobilebyWillieShen

Loadouts

Multiplayer

  • .50 GS-1A2A7A8A9A
  • 3-Line Rifle-1D2E4B5A8A
  • AGR 556-1C2B4A6C8C
  • AK117-1C2A4A8B9A
  • AK47-1C2C4A8A9A
  • AS VAL-2B3A4B8C9A semi automatic
  • AS VAL-2C4B6C8A9A automatic
  • ASM10-1C2D4A8A9A
  • Arctic.50-2A4B5A8C9C
  • BAL-27-1C2C4A6F8A
  • BK57-1C2C3A4B9C
  • BP50-1D2C4B6C8B laser
  • BP50-1D2C4B8B9H no laser
  • Bruen MK9-2B3A4A5E8B
  • CBR4-1A2B4A5E9A
  • Chopper-1E2C5A7G8A
  • Cronen Squall-1C2B4A6A8B
  • DL Q33-1B2A4A5A8A
  • DR-H-1C2B4A8C9A
  • Dingo-1C2C4B7D9C
  • EM2-1B2C4A8B9C
  • FSS Hurricane-1D2B4C5B7K
  • HS0405-1F4A5E6B9A
  • HVK-30-1C2A3A8C9A red dot
  • HVK-30-1C2A4C8C9A no optics
  • Hades-1B2B7A8A9C suppressed
  • Hades-2B4D7A8A9C not suppressed
  • ICR-1-2C4A5A8D9A
  • ISO-2D3A4A8B9A
  • JAK-12-1C2A5A6B + dragon breath
  • KN-44-1C2B4A5A8B
  • KRM-262-1C2A4A5E6A
  • L-CAR 9-2C4A7A8C9C + gung ho
  • LAG 53-1C3A5A8A9B
  • LC10-2F4E7B8F9F
  • LW3-Tundra-1A2B5A8A9E
  • Lachmann-556-1C2A4C6C8C
  • Locus-2A4B5A8C9C
  • M13-1C2B3A4A8D
  • M16-1C2B3A7C9B
  • M21 EBR-1D2C4D7D8B
  • M4LMG-1C3A4D5A6C low mobility, suppressed
  • M4LMG-3A4A5A6C9A high mobility, not suppressed
  • MAC-10-1B2A6B7B8B hipfire
  • MAC-10-1B2E4B7B8B ads
  • MG42-1E2A4B5A8D not suppressed
  • MG42-1F2C3T4D8D 4.4x scope, suppressed
  • MG42-1F2D5A8D9A no optics, suppressed
  • MW11-1E2A5F6A7A + gung ho + underkill
  • Maddox-2A3A4D8A9B
  • Man-O-War-1B2A3A5B8C
  • NA-45-1C4C5A7D8C
  • Oden-1D2A4A5A9A high mobility
  • Oden-1D2C4A5A9A high range
  • Oden-1D4A5A6C7D subsonic ammo, FMJ
  • Oden-1D4A6C7C9A subsonic ammo, no FMJ
  • PKM-1C2B3A5A8B red dot
  • PKM-1C2B4A5A8B no optics
  • PP19 Bizon-1A2B4C8B9A
  • PPSh-41-1E2B5F6A7B hipfire
  • Pharo-1C2B6A7G8C
  • QQ9-1C2C4A6C8C
  • QXR-1C2C4A5I8A ads
  • QXR-1C2C5I6A8A hipfire
  • R9-0-1G2B6C8A9A
  • RAAL MG-1C3A4B5A8A
  • RAM-7-1A2B4B5A8A no optics
  • RAM-7-2B3A4B5A8A red dot
  • Razorback-1C2A3A5I9A
  • Rytec AMR-1B2C4C5A9A
  • SKS-1B4C5A8A9A
  • SO-14-1C3E4A5A9B
  • Sten-1E2E4E6F7C
  • Striker-1F2B5E6A8B
  • Striker-1F2C6C8B9A ads
  • Switchblade X9-1C2C4A8A9A
  • Swordfish-1A3P4A5A8C
  • TEC-9-1G2F6B7B8F
  • Type 19-1D2A4A8B9C
  • Type 25-1C2C3A4A9E
  • Type 63-2A4F5A8B9C
  • USS 9-1C2D4A8C9A
  • VMP-2D4C5H8A9B ads
  • VMP-2D4C5H8A9C hipfire
  • XM4-1A2G3A8F9E
  • XPR-50-1A2C4B5A8C no optics
  • XPR-50-2B3F4B5A8C optics

Battle Royale

  • AK117-1C2C4D6C8B
  • DL Q33-1C2A4C6A8C
  • Hades-2B6C7A8A9C
  • HDR-1B2A4A5B6A
  • MG42-1E2C4D8C9A
  • PKM-2B4B6C8A9A
  • RAAL MG-1C2B3A5E8A
  • RPD-2D5E6C7A9C
  • Rytec AMR-1D2C4C5E8B
  • SVD-1D2B4C5E8B
View original on lemmy.world
1
shellscripting·Shell ScriptingbyWillieShen

Added zstd, 7z, and 7z non-solid support to compression and extraction bash functions

__pv() {
  if command -v pv >/dev/null 2>&1; then
    pv
  else
    cat
  fi
}

compress_single() {
  local msg='Usage: compress_single [-h|--help]
compress_single [-t|--tar] [-n|--no-tar] [-p|--pad PAD] COMMAND SOURCE [TARGET]
If TARGET is not provided and PAD is provided, SOURCE concatenating PAD is used.
No tar is used by default.'
  local tar=0
  local pad=''
  local target=''
  while [ "$#" -gt 0 ]; do
    case "$1" in
      -h | --help)
        echo "$msg"
        return 0
        ;;
      -t | --tar)
        tar=1
        shift
        ;;
      -n | --no-tar)
        tar=0
        shift
        ;;
      -p | --pad)
        if [ "$#" -lt 2 ]; then
          echo "$msg" >&2
          return 1
        fi
        pad="$2"
        shift 2
        ;;
      --)
        shift
        break
        ;;
      *)
        break
        ;;
    esac
  done
  if [ "$#" -eq 3 ]; then
    target="$3"
  elif [ "$#" -eq 2 ] && [ -n "$pad" ]; then
    target="${2}${pad}"
  else
    echo "$msg" >&2
    return 1
  fi
  if [ "$tar" -eq 1 ]; then
    (
      set -o pipefail
      tar -cf - "$2" | __pv | $1 | __pv >"$target"
    )
  else
    (
      set -o pipefail
      $1 "$2" | __pv >"$target"
    )
  fi
}

compress_split() {
  # shellcheck disable=2016
  local msg='Usage: compress_split [-h|--help]
compress_split [-t|--tar] [-n|--no-tar] [-p|--pad PAD] [-b BYTES|--bytes BYTES] COMMAND SOURCE [TARGET]
If TARGET is not provided and PAD is provided, SOURCE concatenating PAD is used.
No tar is used by default.
If BYTES is not provided, $SPLIT_SIZE is used if set and 4000M is used otherwise.'
  local bytes
  local pad=''
  local target=''
  if [ -n "${SPLIT_SIZE:-}" ]; then
    bytes="$SPLIT_SIZE"
  else
    bytes="4000M"
  fi
  local tar=0
  while [ "$#" -gt 0 ]; do
    case "$1" in
      -h | --help)
        echo "$msg"
        return 0
        ;;
      -t | --tar)
        tar=1
        shift
        ;;
      -n | --no-tar)
        tar=0
        shift
        ;;
      -p | --pad)
        if [ "$#" -lt 2 ]; then
          echo "$msg" >&2
          return 1
        fi
        pad="$2"
        shift 2
        ;;
      -b | --bytes)
        if [ "$#" -lt 2 ]; then
          echo "$msg" >&2
          return 1
        fi
        bytes="$2"
        shift 2
        ;;
      --)
        shift
        break
        ;;
      *)
        break
        ;;
    esac
  done
  if [ "$#" -eq 3 ]; then
    target="$3"
  elif [ "$#" -eq 2 ] && [ -n "$pad" ]; then
    target="${2}${pad}"
  else
    echo "$msg" >&2
    return 1
  fi
  if [ "$tar" -eq 1 ]; then
    (
      set -o pipefail
      tar -cf - "$2" | __pv | $1 | __pv | split -b "$bytes" -d -a 3 - "$target.part."
    )
  else
    (
      set -o pipefail
      $1 "$2" | __pv | split -b "$bytes" -d -a 3 - "$target.part."
    )
  fi
}

bz2_single() {
  compress_single --tar --pad '.tar.bz2' 'bzip2 -9 -c' "$@"
}

gz_single() {
  compress_single --tar --pad '.tar.gz' 'gzip -9 -c' "$@"
}

xz_single() {
  compress_single --tar --pad '.tar.xz' 'xz -9 -c' "$@"
}

zst_single() {
  compress_single --tar --pad '.tar.zst' 'zstd --ultra -22 -c' "$@"
}

tar_single() {
  compress_single --no-tar --pad '.tar' 'tar -cf -' "$@"
}

zip_single() {
  compress_single --no-tar --pad '.zip' 'zip -r -9 -' "$@"
}

7z_single() {
  compress_single --no-tar --pad '.7z' '7z a -mx=9 -so' "$@"
}

7z_non_solid_single() {
  compress_single --no-tar --pad '.7z' '7z a -mx=9 -ms=off -so' "$@"
}

bz2_split() {
  compress_split --tar --pad '.tar.bz2' 'bzip2 -9 -c' "$@"
}

gz_split() {
  compress_split --tar --pad '.tar.gz' 'gzip -9 -c' "$@"
}

xz_split() {
  compress_split --tar --pad '.tar.xz' 'xz -9 -c' "$@"
}

zst_split() {
  compress_split --tar --pad '.tar.zst' 'zstd --ultra -22 -c' "$@"
}

tar_split() {
  compress_split --no-tar --pad '.tar' 'tar -cf -' "$@"
}

zip_split() {
  compress_split --no-tar --pad '.zip' 'zip -r -9 -' "$@"
}

7z_split() {
  compress_split --no-tar --pad '.7z' '7z a -mx=9 -so' "$@"
}

7z_non_solid_split() {
  compress_split --no-tar --pad '.7z' '7z a -mx=9 -ms=off -so' "$@"
}

bz2_single_all() {
  (
    shopt -s nullglob
    for f in *; do
      compress_single --tar --pad '.tar.bz2' 'bzip2 -9 -c' "$f" "$@" && rm -- "$f"
    done
  )
}

gz_single_all() {
  (
    shopt -s nullglob
    for f in *; do
      compress_single --tar --pad '.tar.gz' 'gzip -9 -c' "$f" "$@" && rm -- "$f"
    done
  )
}

xz_single_all() {
  (
    shopt -s nullglob
    for f in *; do
      compress_single --tar --pad '.tar.xz' 'xz -9 -c' "$f" "$@" && rm -- "$f"
    done
  )
}

zst_single_all() {
  (
    shopt -s nullglob
    for f in *; do
      compress_single --tar --pad '.tar.zst' 'zstd --ultra -22 -c' "$f" "$@" && rm -- "$f"
    done
  )
}

tar_single_all() {
  (
    shopt -s nullglob
    for f in *; do
      compress_single --no-tar --pad '.tar' 'tar -cf -' "$f" "$@" && rm -- "$f"
    done
  )
}

zip_single_all() {
  (
    shopt -s nullglob
    for f in *; do
      compress_single --no-tar --pad '.zip' 'zip -r -9 -' "$f" "$@" && rm -- "$f"
    done
  )
}

7z_single_all() {
  (
    shopt -s nullglob
    for f in *; do
      compress_single --no-tar --pad '.7z' '7z a -mx=9 -so' "$f" "$@" && rm -- "$f"
    done
  )
}

7z_non_solid_single_all() {
  (
    shopt -s nullglob
    for f in *; do
      compress_single --no-tar --pad '.7z' '7z a -mx=9 -ms=off -so' "$f" "$@" && rm -- "$f"
    done
  )
}

bz2_split_all() {
  (
    shopt -s nullglob
    for f in *; do
      compress_split --tar --pad '.tar.bz2' 'bzip2 -9' "$f" "$@" && rm -- "$f"
    done
  )
}

gz_split_all() {
  (
    shopt -s nullglob
    for f in *; do
      compress_split --tar --pad '.tar.gz' 'gzip -9' "$f" "$@" && rm -- "$f"
    done
  )
}

xz_split_all() {
  (
    shopt -s nullglob
    for f in *; do
      compress_split --tar --pad '.tar.xz' 'xz -9' "$f" "$@" && rm -- "$f"
    done
  )
}

zst_split_all() {
  (
    shopt -s nullglob
    for f in *; do
      compress_split --tar --pad '.tar.zst' 'zstd --ultra -22 -c' "$f" "$@" && rm -- "$f"
    done
  )
}

tar_split_all() {
  (
    shopt -s nullglob
    for f in *; do
      compress_split --no-tar --pad '.tar' 'tar -cf -' "$f" "$@" && rm -- "$f"
    done
  )
}

zip_split_all() {
  (
    shopt -s nullglob
    for f in *; do
      compress_split --no-tar --pad '.zip' 'zip -r -9 -' "$f" "$@" && rm -- "$f"
    done
  )
}

7z_split_all() {
  (
    shopt -s nullglob
    for f in *; do
      compress_split --no-tar --pad '.7z' '7z a -mx=9 -so' "$f" "$@" && rm -- "$f"
    done
  )
}

7z_non_solid_split_all() {
  (
    shopt -s nullglob
    for f in *; do
      compress_split --no-tar --pad '.7z' '7z a -mx=9 -ms=off -so' "$f" "$@" && rm -- "$f"
    done
  )
}

extract_all_and() {
  local erar=0
  local ezip=0
  local e7z=0
  local etargz=0
  local etgz=0
  local egz=0
  local etarbz2=0
  local etbz2=0
  local ebz2=0
  local etarxz=0
  local etxz=0
  local exz=0
  local etarzst=0
  local etzst=0
  local ezst=0
  while [ "$#" -gt 0 ]; do
    case "$1" in
      --erar | --exclude-rar)
        erar=1
        shift
        ;;
      --ezip | --exclude-zip)
        ezip=1
        shift
        ;;
      --e7z | --exclude-7z)
        e7z=1
        shift
        ;;
      --etargz | --exclude-targz)
        etargz=1
        shift
        ;;
      --etgz | --exclude-tgz)
        etgz=1
        shift
        ;;
      --egz | --exclude-gz)
        egz=1
        shift
        ;;
      --etarbz2 | --exclude-tarbz2)
        etarbz2=1
        shift
        ;;
      --etbz2 | --exclude-tbz2)
        etbz2=1
        shift
        ;;
      --ebz2 | --exclude-bz2)
        ebz2=1
        shift
        ;;
      --etarxz | --exclude-tarxz)
        etarxz=1
        shift
        ;;
      --etxz | --exclude-txz)
        etxz=1
        shift
        ;;
      --exz | --exclude-xz)
        exz=1
        shift
        ;;
      --etarzst | --exclude-tarzst)
        etarzst=1
        shift
        ;;
      --etzst | --exclude-tzst)
        etzst=1
        shift
        ;;
      --ezst | --exclude-zst)
        ezst=1
        shift
        ;;
      --)
        shift
        break
        ;;
      *)
        break
        ;;
    esac
  done
  [ "$#" -lt 2 ] && return 1
  (
    shopt -s globstar nullglob
    for f in "$1" "$1"/**/*; do
      [[ -f $f ]] || continue
      local file=${f##*/}
      local dir=${f%/*}
      [[ $dir == "$f" ]] && dir=.
      local un=''
      local -a cmd=()
      case $file in
        *.rar)
          [ "$erar" -eq 1 ] && continue
          un=${file%.rar}
          cmd=(unrar x)
          ;;
        *.zip)
          [ "$ezip" -eq 1 ] && continue
          un=${file%.zip}
          cmd=(unzip)
          ;;
        *.7z)
          [ "$e7z" -eq 1 ] && continue
          un=${file%.7z}
          cmd=(7z x)
          ;;
        *.tar.gz)
          [ "$etargz" -eq 1 ] && continue
          un=${file%.tar.gz}
          cmd=(tar -xzf)
          ;;
        *.tgz)
          [ "$etgz" -eq 1 ] && continue
          un=${file%.tgz}
          cmd=(tar -xzf)
          ;;
        *.gz)
          [ "$egz" -eq 1 ] && continue
          un=${file%.gz}
          cmd=(gzip -d)
          ;;
        *.tar.bz2)
          [ "$etarbz2" -eq 1 ] && continue
          un=${file%.tar.bz2}
          cmd=(tar -xjf)
          ;;
        *.tbz2)
          [ "$etbz2" -eq 1 ] && continue
          un=${file%.tbz2}
          cmd=(tar -xjf)
          ;;
        *.bz2)
          [ "$ebz2" -eq 1 ] && continue
          un=${file%.bz2}
          cmd=(bzip2 -d)
          ;;
        *.tar.xz)
          [ "$etarxz" -eq 1 ] && continue
          un=${file%.tar.xz}
          cmd=(tar -xJf)
          ;;
        *.txz)
          [ "$etxz" -eq 1 ] && continue
          un=${file%.txz}
          cmd=(tar -xJf)
          ;;
        *.xz)
          [ "$exz" -eq 1 ] && continue
          un=${file%.xz}
          cmd=(xz -d)
          ;;
        *.tar.zst)
          [ "$etarzst" -eq 1 ] && continue
          un=${file%.tar.zst}
          cmd=(tar -xf --zstd)
          ;;
        *.tzst)
          [ "$etzst" -eq 1 ] && continue
          un=${file%.tzst}
          cmd=(tar -xf --zstd)
          ;;
        *.zst)
          [ "$ezst" -eq 1 ] && continue
          un=${file%.zst}
          cmd=(zst -d)
          ;;
        *)
          continue
          ;;
      esac
      (
        cd "$dir" &&
          "${cmd[@]}" "$file" &&
          rm -- "$file" &&
          "${@:2}" "$un" &&
          rm -rf -- "$un"
      )
    done
  )
}

extract_all() {
  extract_all_and "$@" false
}

extract_all_and_bz2() {
  local -a args=()
  while [ "$#" -gt 0 ]; do
    case "$1" in
      -p | --pad)
        if [ "$#" -lt 2 ]; then
          return 1
        fi
        args+=("$1" "$2")
        shift 2
        ;;
      --)
        shift
        break
        ;;
      *)
        break
        ;;
    esac
  done
  extract_all_and "$@" bz2_single "${args[@]}"
}

extract_all_and_gz() {
  local -a args=()
  while [ "$#" -gt 0 ]; do
    case "$1" in
      -p | --pad)
        if [ "$#" -lt 2 ]; then
          return 1
        fi
        args+=("$1" "$2")
        shift 2
        ;;
      --)
        shift
        break
        ;;
      *)
        break
        ;;
    esac
  done
  extract_all_and "$@" gz_single "${args[@]}"
}

extract_all_and_xz() {
  local -a args=()
  while [ "$#" -gt 0 ]; do
    case "$1" in
      -p | --pad)
        if [ "$#" -lt 2 ]; then
          return 1
        fi
        args+=("$1" "$2")
        shift 2
        ;;
      --)
        shift
        break
        ;;
      *)
        break
        ;;
    esac
  done
  extract_all_and "$@" xz_single "${args[@]}"
}

extract_all_and_zst() {
  local -a args=()
  while [ "$#" -gt 0 ]; do
    case "$1" in
      -p | --pad)
        if [ "$#" -lt 2 ]; then
          return 1
        fi
        args+=("$1" "$2")
        shift 2
        ;;
      --)
        shift
        break
        ;;
      *)
        break
        ;;
    esac
  done
  extract_all_and "$@" zst_single "${args[@]}"
}

extract_all_and_tar() {
  local -a args=()
  while [ "$#" -gt 0 ]; do
    case "$1" in
      -p | --pad)
        if [ "$#" -lt 2 ]; then
          return 1
        fi
        args+=("$1" "$2")
        shift 2
        ;;
      --)
        shift
        break
        ;;
      *)
        break
        ;;
    esac
  done
  extract_all_and "$@" tar_single "${args[@]}"
}

extract_all_and_zip() {
  local -a args=()
  while [ "$#" -gt 0 ]; do
    case "$1" in
      -p | --pad)
        if [ "$#" -lt 2 ]; then
          return 1
        fi
        args+=("$1" "$2")
        shift 2
        ;;
      --)
        shift
        break
        ;;
      *)
        break
        ;;
    esac
  done
  extract_all_and "$@" zip_single "${args[@]}"
}

extract_all_and_7z() {
  local -a args=()
  while [ "$#" -gt 0 ]; do
    case "$1" in
      -p | --pad)
        if [ "$#" -lt 2 ]; then
          return 1
        fi
        args+=("$1" "$2")
        shift 2
        ;;
      --)
        shift
        break
        ;;
      *)
        break
        ;;
    esac
  done
  extract_all_and "$@" 7z_single "${args[@]}"
}

extract_all_and_7z_non_solid() {
  local -a args=()
  while [ "$#" -gt 0 ]; do
    case "$1" in
      -p | --pad)
        if [ "$#" -lt 2 ]; then
          return 1
        fi
        args+=("$1" "$2")
        shift 2
        ;;
      --)
        shift
        break
        ;;
      *)
        break
        ;;
    esac
  done
  extract_all_and "$@" 7z_non_solid_single "${args[@]}"
}

extract_all_and_bz2_split() {
  local -a args=()
  while [ "$#" -gt 0 ]; do
    case "$1" in
      -p | --pad)
        if [ "$#" -lt 2 ]; then
          return 1
        fi
        args+=("$1" "$2")
        shift 2
        ;;
      -b | --bytes)
        if [ "$#" -lt 2 ]; then
          return 1
        fi
        args+=("$1" "$2")
        shift 2
        ;;
      --)
        shift
        break
        ;;
      *)
        break
        ;;
    esac
  done
  extract_all_and "$@" bz2_split "${args[@]}"
}

extract_all_and_gz_split() {
  local -a args=()
  while [ "$#" -gt 0 ]; do
    case "$1" in
      -p | --pad)
        if [ "$#" -lt 2 ]; then
          return 1
        fi
        args+=("$1" "$2")
        shift 2
        ;;
      -b | --bytes)
        if [ "$#" -lt 2 ]; then
          return 1
        fi
        args+=("$1" "$2")
        shift 2
        ;;
      --)
        shift
        break
        ;;
      *)
        break
        ;;
    esac
  done
  extract_all_and "$@" gz_split "${args[@]}"
}

extract_all_and_xz_split() {
  local -a args=()
  while [ "$#" -gt 0 ]; do
    case "$1" in
      -p | --pad)
        if [ "$#" -lt 2 ]; then
          return 1
        fi
        args+=("$1" "$2")
        shift 2
        ;;
      -b | --bytes)
        if [ "$#" -lt 2 ]; then
          return 1
        fi
        args+=("$1" "$2")
        shift 2
        ;;
      --)
        shift
        break
        ;;
      *)
        break
        ;;
    esac
  done
  extract_all_and "$@" xz_split "${args[@]}"
}

extract_all_and_tar_split() {
  local -a args=()
  while [ "$#" -gt 0 ]; do
    case "$1" in
      -p | --pad)
        if [ "$#" -lt 2 ]; then
          return 1
        fi
        args+=("$1" "$2")
        shift 2
        ;;
      -b | --bytes)
        if [ "$#" -lt 2 ]; then
          return 1
        fi
        args+=("$1" "$2")
        shift 2
        ;;
      --)
        shift
        break
        ;;
      *)
        break
        ;;
    esac
  done
  extract_all_and "$@" tar_split "${args[@]}"
}

extract_all_and_zip_split() {
  local -a args=()
  while [ "$#" -gt 0 ]; do
    case "$1" in
      -p | --pad)
        if [ "$#" -lt 2 ]; then
          return 1
        fi
        args+=("$1" "$2")
        shift 2
        ;;
      -b | --bytes)
        if [ "$#" -lt 2 ]; then
          return 1
        fi
        args+=("$1" "$2")
        shift 2
        ;;
      --)
        shift
        break
        ;;
      *)
        break
        ;;
    esac
  done
  extract_all_and "$@" zip_split "${args[@]}"
}

extract_all_and_7z_split() {
  local -a args=()
  while [ "$#" -gt 0 ]; do
    case "$1" in
      -p | --pad)
        if [ "$#" -lt 2 ]; then
          return 1
        fi
        args+=("$1" "$2")
        shift 2
        ;;
      --)
        shift
        break
        ;;
      *)
        break
        ;;
    esac
  done
  extract_all_and "$@" 7z_split "${args[@]}"
}

extract_all_and_7z_non_solid_split() {
  local -a args=()
  while [ "$#" -gt 0 ]; do
    case "$1" in
      -p | --pad)
        if [ "$#" -lt 2 ]; then
          return 1
        fi
        args+=("$1" "$2")
        shift 2
        ;;
      --)
        shift
        break
        ;;
      *)
        break
        ;;
    esac
  done
  extract_all_and "$@" 7z_non_solid_split "${args[@]}"
}
View original on lemmy.world
2
callofdutymobile·Call of Duty MobilebyWillieShen

Login options of each Call of Duty Mobile Android app

Login options of each Call of Duty Mobile Android app as of 2026-09-01:

  • Call of Duty / Call of Duty®: Mobile by Activision Publishing, Inc. (com.activision.callofduty.shooter): Guest, Call of Duty, Facebook, LINE, Google
  • Call of Duty / Call of Duty®: Mobile - Garena by Garena Mobile Private (com.garena.game.codm): Guest, Garena, Facebook
  • 콜 오브 듀티: 모바일 / Call of Duty Mobile (KR) by Level Infinite (com.tencent.tmgp.kr.codm): Guest, Facebook, Google
  • Call of Duty / Call Of Duty: Mobile VN by VNG GROUP JSC (com.vng.codmvn): Facebook, Google
  • 使命召唤手游 by 深圳市腾讯计算机系统有限公司 (com.tencent.tmgp.cod): 微信 (WeChat and Weixin), QQ
View original on lemmy.world
2
callofdutymobile·Call of Duty MobilebyWillieShen
2
callofdutymobile·Call of Duty MobilebyWillieShen

Both Activision (global) and Garena Call of Duty Mobile Android apps are connecting to IP address directly, bypassing DNS

Both Activision (global) and Garena Call of Duty Mobile Android apps are connecting to IP address directly, bypassing DNS, and the former is connecting to tens of countries while the later is a bit less, as shown by the following screenshots of Rethink log on my phone with both installed.

View original on lemmy.world
5
shellscripting·Shell ScriptingbyWillieShen

My bash functions for compression, file name handling, delimiters matching, LaTeX, multimedia processing etc. in .bashrc

__pv() {
  if command -v pv >/dev/null 2>&1; then
    pv
  else
    cat
  fi
}

compress_single() {
  local msg='Usage: compress_single [-h|--help]
compress_single [-t|--tar] [-n|--no-tar] [-p|--pad PAD] COMMAND SOURCE [TARGET]
If TARGET is not provided and PAD is provided, SOURCE concatenating PAD is used.
No tar is used by default.'
  local tar=0
  local pad=''
  local target=''
  while [ "$#" -gt 0 ]; do
    case "$1" in
      -h | --help)
        echo "$msg"
        return 0
        ;;
      -t | --tar)
        tar=1
        shift
        ;;
      -n | --no-tar)
        tar=0
        shift
        ;;
      -p | --pad)
        if [ "$#" -lt 2 ]; then
          echo "$msg" >&2
          return 1
        fi
        pad="$2"
        shift 2
        ;;
      --)
        shift
        break
        ;;
      *)
        break
        ;;
    esac
  done
  if [ "$#" -eq 3 ]; then
    target="$3"
  elif [ "$#" -eq 2 ] && [ -n "$pad" ]; then
    target="${2}${pad}"
  else
    echo "$msg" >&2
    return 1
  fi
  if [ "$tar" -eq 1 ]; then
    (
      set -o pipefail
      tar -cf - "$2" | __pv | $1 | __pv >"$target"
    )
  else
    (
      set -o pipefail
      $1 "$2" | __pv >"$target"
    )
  fi
}

split_file() {
  local bytes
  if [ -n "${SPLIT_SIZE:-}" ]; then
    bytes="$SPLIT_SIZE"
  else
    bytes="4000M"
  fi
  split -b "$bytes" -d -a 3 "$1" "$1.part."
}

compress_split() {
  # shellcheck disable=2016
  local msg='Usage: compress_split [-h|--help]
compress_split [-t|--tar] [-n|--no-tar] [-p|--pad PAD] [-b BYTES|--bytes BYTES] COMMAND SOURCE [TARGET]
If TARGET is not provided and PAD is provided, SOURCE concatenating PAD is used.
No tar is used by default.
If BYTES is not provided, $SPLIT_SIZE is used if set and 4000M is used otherwise.'
  local bytes
  local pad=''
  local target=''
  if [ -n "${SPLIT_SIZE:-}" ]; then
    bytes="$SPLIT_SIZE"
  else
    bytes="4000M"
  fi
  local tar=0
  while [ "$#" -gt 0 ]; do
    case "$1" in
      -h | --help)
        echo "$msg"
        return 0
        ;;
      -t | --tar)
        tar=1
        shift
        ;;
      -n | --no-tar)
        tar=0
        shift
        ;;
      -p | --pad)
        if [ "$#" -lt 2 ]; then
          echo "$msg" >&2
          return 1
        fi
        pad="$2"
        shift 2
        ;;
      -b | --bytes)
        if [ "$#" -lt 2 ]; then
          echo "$msg" >&2
          return 1
        fi
        bytes="$2"
        shift 2
        ;;
      --)
        shift
        break
        ;;
      *)
        break
        ;;
    esac
  done
  if [ "$#" -eq 3 ]; then
    target="$3"
  elif [ "$#" -eq 2 ] && [ -n "$pad" ]; then
    target="${2}${pad}"
  else
    echo "$msg" >&2
    return 1
  fi
  if [ "$tar" -eq 1 ]; then
    (
      set -o pipefail
      tar -cf - "$2" | __pv | $1 | __pv | split -b "$bytes" -d -a 3 - "$target.part."
    )
  else
    (
      set -o pipefail
      $1 "$2" | __pv | split -b "$bytes" -d -a 3 - "$target.part."
    )
  fi
}

bz2_single() {
  compress_single --tar --pad '.tar.bz2' 'bzip2 -9' "$@"
}

gz_single() {
  compress_single --tar --pad '.tar.gz' 'gzip -9' "$@"
}

xz_single() {
  compress_single --tar --pad '.tar.xz' 'xz -9' "$@"
}

tar_single() {
  compress_single --no-tar --pad '.tar' 'tar -cf -' "$@"
}

zip_single() {
  compress_single --no-tar --pad '.zip' 'zip -r -9 -' "$@"
}

bz2_split() {
  compress_split --tar --pad '.tar.bz2' 'bzip2 -9' "$@"
}

gz_split() {
  compress_split --tar --pad '.tar.gz' 'gzip -9' "$@"
}

xz_split() {
  compress_split --tar --pad '.tar.xz' 'xz -9' "$@"
}

tar_split() {
  compress_split --no-tar --pad '.tar' 'tar -cf -' "$@"
}

zip_split() {
  compress_split --no-tar --pad '.zip' 'zip -r -9 -' "$@"
}

bz2_single_all() {
  (
    shopt -s nullglob
    for f in *; do
      compress_single --tar --pad '.tar.bz2' 'bzip2 -9' "$f" "$@" && rm -- "$f"
    done
  )
}

gz_single_all() {
  (
    shopt -s nullglob
    for f in *; do
      compress_single --tar --pad '.tar.gz' 'gzip -9' "$f" "$@" && rm -- "$f"
    done
  )
}

xz_single_all() {
  (
    shopt -s nullglob
    for f in *; do
      compress_single --tar --pad '.tar.xz' 'xz -9' "$f" "$@" && rm -- "$f"
    done
  )
}

tar_single_all() {
  (
    shopt -s nullglob
    for f in *; do
      compress_single --no-tar --pad '.tar' 'tar -cf -' "$f" "$@" && rm -- "$f"
    done
  )
}

zip_single_all() {
  (
    shopt -s nullglob
    for f in *; do
      compress_single --no-tar --pad '.zip' 'zip -r -9 -' "$f" "$@" && rm -- "$f"
    done
  )
}

bz2_split_all() {
  (
    shopt -s nullglob
    for f in *; do
      compress_split --tar --pad '.tar.bz2' 'bzip2 -9' "$f" "$@" && rm -- "$f"
    done
  )
}

gz_split_all() {
  (
    shopt -s nullglob
    for f in *; do
      compress_split --tar --pad '.tar.gz' 'gzip -9' "$f" "$@" && rm -- "$f"
    done
  )
}

xz_split_all() {
  (
    shopt -s nullglob
    for f in *; do
      compress_split --tar --pad '.tar.xz' 'xz -9' "$f" "$@" && rm -- "$f"
    done
  )
}

tar_split_all() {
  (
    shopt -s nullglob
    for f in *; do
      compress_split --no-tar --pad '.tar' 'tar -cf -' "$f" "$@" && rm -- "$f"
    done
  )
}

zip_split_all() {
  (
    shopt -s nullglob
    for f in *; do
      compress_split --no-tar --pad '.zip' 'zip -r -9 -' "$f" "$@" && rm -- "$f"
    done
  )
}

extract_all_and() {
  local erar=0
  local ezip=0
  local etargz=0
  local etgz=0
  local egz=0
  local etarbz2=0
  local etbz2=0
  local ebz2=0
  local etarxz=0
  local etxz=0
  local exz=0
  while [ "$#" -gt 0 ]; do
    case "$1" in
      --erar | --exclude-rar)
        erar=1
        shift
        ;;
      --ezip | --exclude-zip)
        ezip=1
        shift
        ;;
      --etargz | --exclude-targz)
        etargz=1
        shift
        ;;
      --etgz | --exclude-tgz)
        etgz=1
        shift
        ;;
      --egz | --exclude-gz)
        egz=1
        shift
        ;;
      --etarbz2 | --exclude-tarbz2)
        etarbz2=1
        shift
        ;;
      --etbz2 | --exclude-tbz2)
        etbz2=1
        shift
        ;;
      --ebz2 | --exclude-bz2)
        ebz2=1
        shift
        ;;
      --etarxz | --exclude-tarxz)
        etarxz=1
        shift
        ;;
      --etxz | --exclude-txz)
        etxz=1
        shift
        ;;
      --exz | --exclude-xz)
        exz=1
        shift
        ;;
      --)
        shift
        break
        ;;
      *)
        break
        ;;
    esac
  done
  [ "$#" -lt 2 ] && return 1
  (
    shopt -s globstar nullglob
    for f in "$1" "$1"/**/*; do
      [[ -f $f ]] || continue
      local file=${f##*/}
      local dir=${f%/*}
      [[ $dir == "$f" ]] && dir=.
      local un=''
      local -a cmd=()
      case $file in
        *.rar)
          [ "$erar" -eq 1 ] && continue
          un=${file%.rar}
          cmd=(unrar x)
          ;;
        *.zip)
          [ "$ezip" -eq 1 ] && continue
          un=${file%.zip}
          cmd=(unzip)
          ;;
        *.tar.gz)
          [ "$etargz" -eq 1 ] && continue
          un=${file%.tar.gz}
          cmd=(tar -xzf)
          ;;
        *.tgz)
          [ "$etgz" -eq 1 ] && continue
          un=${file%.tgz}
          cmd=(tar -xzf)
          ;;
        *.gz)
          [ "$egz" -eq 1 ] && continue
          un=${file%.gz}
          cmd=(gzip -d)
          ;;
        *.tar.bz2)
          [ "$etarbz2" -eq 1 ] && continue
          un=${file%.tar.bz2}
          cmd=(tar -xjf)
          ;;
        *.tbz2)
          [ "$etbz2" -eq 1 ] && continue
          un=${file%.tbz2}
          cmd=(tar -xjf)
          ;;
        *.bz2)
          [ "$ebz2" -eq 1 ] && continue
          un=${file%.bz2}
          cmd=(bzip2 -d)
          ;;
        *.tar.xz)
          [ "$etarxz" -eq 1 ] && continue
          un=${file%.tar.xz}
          cmd=(tar -xJf)
          ;;
        *.txz)
          [ "$etxz" -eq 1 ] && continue
          un=${file%.txz}
          cmd=(tar -xJf)
          ;;
        *.xz)
          [ "$exz" -eq 1 ] && continue
          un=${file%.xz}
          cmd=(xz -d)
          ;;
        *)
          continue
          ;;
      esac
      (
        cd "$dir" &&
          "${cmd[@]}" "$file" &&
          rm -- "$file" &&
          "${@:2}" "$un" &&
          rm -rf -- "$un"
      )
    done
  )
}

extract_all() {
  extract_all_and "$@" false
}

extract_all_and_bz2() {
  local -a args=()
  while [ "$#" -gt 0 ]; do
    case "$1" in
      -p | --pad)
        if [ "$#" -lt 2 ]; then
          return 1
        fi
        args+=("$1" "$2")
        shift 2
        ;;
      --)
        shift
        break
        ;;
      *)
        break
        ;;
    esac
  done
  extract_all_and "$@" bz2_single "${args[@]}"
}

extract_all_and_gz() {
  local -a args=()
  while [ "$#" -gt 0 ]; do
    case "$1" in
      -p | --pad)
        if [ "$#" -lt 2 ]; then
          return 1
        fi
        args+=("$1" "$2")
        shift 2
        ;;
      --)
        shift
        break
        ;;
      *)
        break
        ;;
    esac
  done
  extract_all_and "$@" gz_single "${args[@]}"
}

extract_all_and_xz() {
  local -a args=()
  while [ "$#" -gt 0 ]; do
    case "$1" in
      -p | --pad)
        if [ "$#" -lt 2 ]; then
          return 1
        fi
        args+=("$1" "$2")
        shift 2
        ;;
      --)
        shift
        break
        ;;
      *)
        break
        ;;
    esac
  done
  extract_all_and "$@" xz_single "${args[@]}"
}

extract_all_and_tar() {
  local -a args=()
  while [ "$#" -gt 0 ]; do
    case "$1" in
      -p | --pad)
        if [ "$#" -lt 2 ]; then
          return 1
        fi
        args+=("$1" "$2")
        shift 2
        ;;
      --)
        shift
        break
        ;;
      *)
        break
        ;;
    esac
  done
  extract_all_and "$@" tar_single "${args[@]}"
}

extract_all_and_zip() {
  local -a args=()
  while [ "$#" -gt 0 ]; do
    case "$1" in
      -p | --pad)
        if [ "$#" -lt 2 ]; then
          return 1
        fi
        args+=("$1" "$2")
        shift 2
        ;;
      --)
        shift
        break
        ;;
      *)
        break
        ;;
    esac
  done
  extract_all_and "$@" zip_single "${args[@]}"
}

extract_all_and_bz2_split() {
  local -a args=()
  while [ "$#" -gt 0 ]; do
    case "$1" in
      -p | --pad)
        if [ "$#" -lt 2 ]; then
          return 1
        fi
        args+=("$1" "$2")
        shift 2
        ;;
      -b | --bytes)
        if [ "$#" -lt 2 ]; then
          return 1
        fi
        args+=("$1" "$2")
        shift 2
        ;;
      --)
        shift
        break
        ;;
      *)
        break
        ;;
    esac
  done
  extract_all_and "$@" bz2_split "${args[@]}"
}

extract_all_and_gz_split() {
  local -a args=()
  while [ "$#" -gt 0 ]; do
    case "$1" in
      -p | --pad)
        if [ "$#" -lt 2 ]; then
          return 1
        fi
        args+=("$1" "$2")
        shift 2
        ;;
      -b | --bytes)
        if [ "$#" -lt 2 ]; then
          return 1
        fi
        args+=("$1" "$2")
        shift 2
        ;;
      --)
        shift
        break
        ;;
      *)
        break
        ;;
    esac
  done
  extract_all_and "$@" gz_split "${args[@]}"
}

extract_all_and_xz_split() {
  local -a args=()
  while [ "$#" -gt 0 ]; do
    case "$1" in
      -p | --pad)
        if [ "$#" -lt 2 ]; then
          return 1
        fi
        args+=("$1" "$2")
        shift 2
        ;;
      -b | --bytes)
        if [ "$#" -lt 2 ]; then
          return 1
        fi
        args+=("$1" "$2")
        shift 2
        ;;
      --)
        shift
        break
        ;;
      *)
        break
        ;;
    esac
  done
  extract_all_and "$@" xz_split "${args[@]}"
}

extract_all_and_tar_split() {
  local -a args=()
  while [ "$#" -gt 0 ]; do
    case "$1" in
      -p | --pad)
        if [ "$#" -lt 2 ]; then
          return 1
        fi
        args+=("$1" "$2")
        shift 2
        ;;
      -b | --bytes)
        if [ "$#" -lt 2 ]; then
          return 1
        fi
        args+=("$1" "$2")
        shift 2
        ;;
      --)
        shift
        break
        ;;
      *)
        break
        ;;
    esac
  done
  extract_all_and "$@" tar_split "${args[@]}"
}

extract_all_and_zip_split() {
  local -a args=()
  while [ "$#" -gt 0 ]; do
    case "$1" in
      -p | --pad)
        if [ "$#" -lt 2 ]; then
          return 1
        fi
        args+=("$1" "$2")
        shift 2
        ;;
      -b | --bytes)
        if [ "$#" -lt 2 ]; then
          return 1
        fi
        args+=("$1" "$2")
        shift 2
        ;;
      --)
        shift
        break
        ;;
      *)
        break
        ;;
    esac
  done
  extract_all_and "$@" zip_split "${args[@]}"
}

remove_extension() {
  sed -E 's/^(.+)\.[^.]+$/\1/'
}

get_extension() {
  sed -E '/^\.?[^.]+$/d; s/^.+\.([^.]*)$/\1/'
}

ls_extension() {
  find . -type f | sed -n 's/.*\(\.[^.\/]*\)$/\1/p' | sort -u
}

ffmpeg_av1_opus() {
  if [ "$#" -lt 4 ]; then
    return
  fi
  local new="${5:-"$(echo "$4" | remove_extension)_ffmpeg_av1_$1_$2_opus_$3.mkv"}"
  if ! ffmpeg -n -i "$4" -c:v libsvtav1 -preset "$1" -crf "$2" -c:a libopus -vbr:a 1 -b:a "$3" "$new"; then
    rm -f -- "$new"
    return 1
  fi
}

ffmpeg_av1_lossless_flac() {
  if [ "$#" -eq 0 ]; then
    return
  fi
  local new="${2:-"$(echo "$1" | remove_extension)_ffmpeg_av1_lossless_flac.mkv"}"
  if ! ffmpeg -n -i "$1" -c:v libsvtav1 -svtav1-params lossless=1 -preset -2 -c:a flac "$new"; then
    rm -f -- "$new"
    return 1
  fi
}

ffmpeg_opus() {
  if [ "$#" -lt 2 ]; then
    return
  fi
  local new="${3:-"$(echo "$2" | remove_extension)_ffmpeg_opus_$1.opus"}"
  if ! ffmpeg -n -i "$2" -c:a libopus -vbr:a 1 -b:a "$1" "$new"; then
    rm -f -- "$new"
    return 1
  fi
}

ffmpeg_flac() {
  if [ "$#" -eq 0 ]; then
    return
  fi
  local new="${2:-"$(echo "$1" | remove_extension)_ffmpeg_flac.flac"}"
  if ! ffmpeg -n -i "$1" -c:a flac "$new"; then
    rm -f -- "$new"
    return 1
  fi
}

ffmpeg_segment() {
  if [ "$#" -lt 2 ]; then
    return
  fi
  ffmpeg -n -i "$2" -c copy -map 0 -segment_time "$1" -f segment -reset_timestamps 1 "${3:-"$(echo "$2" | remove_extension)_ffmpeg_%04d.$(echo "$2" | get_extension)"}"
}

ffmpeg_concat_auto() {
  local -a files=()
  if [ "$#" -eq 0 ]; then
    for f in *; do
      test -f "$f" && files+=("$f")
    done
  else
    files=("$@")
  fi
  ffmpeg -n -f concat -safe 0 -i <(printf "file '$PWD/%s'\n" "${files[@]}") -c copy "$(echo "${files[0]}" | remove_extension | sed -E 's/_ffmpeg_[0-9]+$//').$(echo "${files[0]}" | get_extension)"
}

ffmpeg_concat() {
  if [ "$#" -lt 2 ]; then
    return
  fi
  ffmpeg -n -f concat -safe 0 -i <(printf "file '$PWD/%s'\n" "${@:2}") -c copy "$1"
}

echo_non_ffmpeg() {
  while IFS= read -r -d '' f; do
    case "$f" in
      *ffmpeg_*) ;;
      *)
        echo "$f"
        ;;
    esac
  done < <(find . -type f -print0)
}

remove_non_ffmpeg() {
  while IFS= read -r -d '' f; do
    case "$f" in
      *ffmpeg_*) ;;
      *)
        rm -f -- "$f"
        ;;
    esac
  done < <(find . -type f -print0)
}

echo_ffmpeg() {
  while IFS= read -r -d '' f; do
    case "$f" in
      *ffmpeg_*)
        echo "$f"
        ;;
      *) ;;
    esac
  done < <(find . -type f -print0)
}

remove_ffmpeg() {
  while IFS= read -r -d '' f; do
    case "$f" in
      *ffmpeg_*)
        rm -f -- "$f"
        ;;
      *) ;;
    esac
  done < <(find . -type f -print0)
}

jxl_lossy() {
  if [ "$#" -lt 2 ]; then
    return
  fi
  local new="${3:-"$(echo "$2" | remove_extension).jxl"}"
  if ! cjxl -j 0 -e 10 -d "$1" "$2" "$new"; then
    rm -f -- "$new"
    return 1
  fi
}

jxl_lossless() {
  if [ "$#" -eq 0 ]; then
    return
  fi
  local new="${2:-"$(echo "$1" | remove_extension).jxl"}"
  if ! cjxl -j 1 -e 10 -d 0 "$1" "$new"; then
    rm -f -- "$new"
    return 1
  fi
}

multimedia_convert() {
  (
    shopt -s globstar nullglob
    for f in **/*; do
      [[ -f $f ]] || continue
      local file=${f##*/}
      local dir=${f%/*}
      [[ $dir == "$f" ]] && dir=.
      case ${file,,} in
        *_ffmpeg_av1_*_*_opus_*.mkv | *_ffmpeg_av1_lossless_flac*.mkv)
          continue
          ;;
        *.ico | *.flac | *.gif | *.opus)
          local ext="${file##*.}"
          ext="${ext,,}"
          if [[ ${file##*.} != "$ext" ]]; then
            if [[ -e "${f%.*}.${ext}" ]]; then
              printf 'Skipping: output exists: %s\n' "$f" >&2
              continue
            fi
            mv -- "$f" "${f%.*}.${ext}"
          fi
          ;;
        *.jpg | *.jpeg | *.png)
          local jxl="${file%.*}.jxl"
          if [[ -e "$dir/$jxl" ]]; then
            printf 'Skipping: output exists: %s\n' "$f" >&2
            continue
          fi
          (
            cd "$dir" &&
              jxl_lossy 1 "./$file" "./$jxl" &&
              rm -- "$file"
          )
          ;;
        *.avif | *.bmp | *.heic | *.heif | *.jp2 | *.tif | *.webp)
          local png="${file%.*}.png"
          if [[ -e "$dir/$png" ]]; then
            printf 'Skipping: intermediate png exists: %s\n' "$f" >&2
            continue
          fi
          local jxl="${file%.*}.jxl"
          if [[ -e "$dir/$jxl" ]]; then
            printf 'Skipping: output exists: %s\n' "$f" >&2
            continue
          fi
          (
            if cd "$dir"; then
              magick "./$file" "./$png" &&
                jxl_lossy 1 "./$png" "./$jxl" &&
                rm -- "$file"
              rm -f -- "$png"
            fi
          )
          ;;
        *.3gp | *.mov | *.vob | *.wmv)
          (
            cd "$dir" &&
              ffmpeg_av1_opus 4 40 24k "./$file" &&
              rm -- "$file"
          )
          ;;
        *.avi | *.mkv | *.mp4 | *.mts | *.webm)
          (
            cd "$dir" &&
              ffmpeg_av1_opus 4 32 72k "./$file" &&
              rm -- "$file"
          )
          ;;
        *.aac | *.mp3 | *.m4a | *.ogg)
          (
            cd "$dir" &&
              ffmpeg_opus 96k "./$file" &&
              rm -- "$file"
          )
          ;;
        *.wav)
          (
            cd "$dir" &&
              ffmpeg_flac "./$file" &&
              rm -- "$file"
          )
          ;;
        *)
          continue
          ;;
      esac
    done
  )
}

clean_file() {
  if [ $# -ne 0 ]; then
    files=("$@")
  else
    files=(*)
  fi
  for f in "${files[@]}"; do
    test -f "$f" && perl -i -pe 's/\x{FEFF}//g; s/\x{200B}//g; s/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]//g' -- "$f"
  done
}

latexmkc() {
  if command -v latexmk >/dev/null 2>&1; then
    latexmk -c
  else
    rm -f -- *.acn *.acr *.alg *.aux *.bbl *.blg *.fdb_latexmk *.fls *.glg *.glo *.gls *.idx *.ilg *.ind *.ist *.lof *.log *.lot *.maf *.mp *.mtc *.mtc1 *.nav *.nlo *.out *.pdfsync *.snm *.tmp *.toc *.top *.tui *.vrb
  fi
}

latexmkC() {
  if command -v latexmk >/dev/null 2>&1; then
    latexmk -C
  else
    latexmkc
    rm -f -- *.dvi *.hnt *.pdf *.ps *.synctex *.synctex.gz
  fi
}

latexci() {
  # shellcheck disable=2016
  local msg='latexci [-h|--help] [-m|--latexmk] [-n|--no-latexmk] [-o|--auto-latexmk] [-r|--reproducible] [-s|--no-reproducible] [-t|--auto-reproducible] [-l|--log log_file] [-c|--clean] [-d|--no-clean] [-e|--engine-times engine-times] engine [files]
--latexmk (default): Use latexmk -"$engine".
--no-latexmk: Use "$engine".
--auto-latexmk: Prefer latexmk -"$engine" and fallback to "$engine".
--reproducible (default): Compile reproducibly.
--no-reproducible: Compile normally.
--auto-reproducible: Prefer to compile reproducibly and fallback to compile normally.
--clean: Clean auxiliary files of each file after successful compilation and remove latexci_${engine}_*_log.txt if the whole run succeeds.
engine-times (default: 2): times to run "$engine" when not using latexmk.
log_file (default: latexci_${engine}_$(date +%s)_log.txt): name of log file. It is only used when there are warnings or errors. If file of the same name has existed, it will be deleted.
files (default: all **/*.tex): LaTeX files to compile.'
  # mk (latexmk), rp (reproducible): 0 auto, 1 must, 2 no
  local mk=1
  local rp=1
  local times=2
  local clean=1
  local log=''
  local -a args=()
  local -a files=()
  while [ $# -gt 0 ]; do
    case "$1" in
      -h | --help)
        echo "$msg"
        return 0
        ;;
      -m | --latexmk)
        mk=1
        shift
        ;;
      -n | --no-latexmk)
        mk=2
        shift
        ;;
      -o | --auto-latexmk)
        mk=0
        shift
        ;;
      -r | --reproducible)
        rp=1
        shift
        ;;
      -s | --no-reproducible)
        rp=2
        shift
        ;;
      -t | --auto-reproducible)
        rp=0
        shift
        ;;
      -l | --log)
        log="$2"
        shift 2
        ;;
      -e | --engine-times)
        if [[ ! $2 =~ ^[0-9]+$ ]] || (($2 < 1)); then
          echo "latexci error: engine-times must be a positive integer." >&2
          return 1
        fi
        times="$2"
        shift 2
        ;;
      -c | --clean)
        clean=1
        shift
        ;;
      -d | --no-clean)
        clean=0
        shift
        ;;
      --)
        shift
        args+=("$@")
        break
        ;;
      *)
        args+=("$1")
        shift
        ;;
    esac
  done
  local engine
  if [ "${#args[@]}" -eq 0 ]; then
    echo 'latexci error: engine required.' >&2
    return 1
  else
    engine="${args[0]}"
  fi
  local cwd
  cwd="$(pwd)"
  if [ "${#args[@]}" -ne 1 ]; then
    files=("${args[@]:1}")
  else
    mapfile -d '' -t files < <(
      find "$cwd" -type f -name '*.tex' -print0
    )
  fi
  if [ "${#files[@]}" -eq 0 ]; then
    echo "latexci warning: no .tex file found." >&2
    return 0
  fi
  [ -z "$log" ] && log="latexci_${engine}_$(date +%s)_log.txt"
  rm -f -- "$log"
  for f in "${files[@]}"; do
    local dir
    dir="$(dirname "$f")"
    if ! cd "$dir"; then
      echo "$f: can't cd $dir" >>"$cwd/$log"
      continue
    fi
    local file
    file="$(basename "$f")"
    local -a env_args=()
    local epoch=''
    if [ "$rp" -eq 1 ]; then
      epoch=$(command -v git >/dev/null 2>&1 && git log -1 --format=%ct -- "$file" 2>/dev/null)
      if [ -n "$epoch" ]; then
        env_args=(SOURCE_DATE_EPOCH="$epoch")
      else
        echo "$f: git log failed for and reproducible required" >>"$cwd/$log"
      fi
    elif [ "$rp" -eq 0 ]; then
      epoch=$(command -v git >/dev/null 2>&1 && git log -1 --format=%ct -- "$file" 2>/dev/null)
      if [ -n "$epoch" ]; then
        env_args=(SOURCE_DATE_EPOCH="$epoch")
      fi
    fi
    if [ "$mk" -ne 2 ] && command -v latexmk >/dev/null 2>&1; then
      if env "${env_args[@]}" latexmk -"$engine" -latexoption='-interaction=nonstopmode -halt-on-error' "$file"; then
        [ "$clean" -eq 1 ] && latexmkc
      else
        echo "$f: latexmk $engine failed" >>"$cwd/$log"
      fi
    elif [ "$mk" -ne 1 ] && command -v "$engine" >/dev/null 2>&1; then
      local fail=0
      local et="$times"
      while ((et > 0)); do
        if ! env "${env_args[@]}" "$engine" -interaction=nonstopmode -halt-on-error "$file"; then
          echo "$f: $engine failed" >>"$cwd/$log"
          fail=1
          break
        fi
        ((et--))
      done
      if [ "$fail" -eq 0 ]; then
        [ "$clean" -eq 1 ] && latexmkc
      fi
    else
      echo "$f: all allowed methods not executable" >>"$cwd/$log"
    fi
  done
  if [ "$mk" -eq 0 ] && ! command -v latexmk >/dev/null 2>&1; then
    echo "latexci warning: latexmk not executable, $engine used" >&2
  fi
  if [ -f "$cwd/$log" ]; then
    {
      echo "latexci log"
      echo "$cwd"
      date -uIs
    } >>"$cwd/$log"
    cat "$cwd/$log" >&2
    echo "latexci warning: failures logged to $cwd/${log}." >&2
    # shellcheck disable=2164
    cd "$cwd"
    return 1
  else
    [ "$clean" -eq 1 ] && rm -f -- "$cwd/latexci_${engine}"_*_log.txt
    # shellcheck disable=2164
    cd "$cwd"
  fi
}

xelatexci() {
  latexci xelatex "$@"
}

lualatexci() {
  latexci lualatex "$@"
}

match_round() {
  awk '{ n = gsub(/\(/, "("); m = gsub(/\)/, ")"); balance += n - m; printf "%2d %5d %s\n", balance, NR, $0
}' "$1"
}

match_square() {
  awk '{ n = gsub(/\[/, "["); m = gsub(/\]/, "]"); balance += n - m; printf "%2d %5d %s\n", balance, NR, $0
}' "$1"
}

match_curly() {
  awk '{ n = gsub(/\{/, "{"); m = gsub(/\}/, "}"); balance += n - m; printf "%2d %5d %s\n", balance, NR, $0
}' "$1"
}
View original on lemmy.world
6
callofdutymobile·Call of Duty MobilebyWillieShen

My updated loadout collection

Multiplayer

  • .50 GS-1A2A7A8A9A
  • 3-Line Rifle-1D2E4B5A8A
  • AGR 556-1C2B4A6C8C
  • AK117-1C2A4A8B9A
  • AK47-1C2C4A8A9A
  • AS VAL-2C4B6C8A9A automatic
  • AS VAL-2B3A4B8C9A semi automatic
  • ASM10-1C2D4A8A9A
  • Arctic.50-2A4B5A8C9C
  • BAL-27-1C2C4A6F8A
  • BK57-1C2C3A4B9C
  • BP50-1D2C4B8B9H no laser
  • BP50-1D2C4B6C8B laser
  • Bruen MK9-2B3A4A5E8B
  • CBR4-1A2B4A5E9A
  • Chopper-1E2C5A7G8A
  • DL Q33-1B2A4A5A8A
  • DR-H-1C2B4A8C9A
  • EM2-1B2C4A8B9C
  • FSS Hurricane-1D2B4C5B7K
  • HS0405-1F4A5E6B9A
  • HVK-30-1C2A3A8C9A red dot
  • HVK-30-1C2A4C8C9A no optics
  • JAK-12-1C2A5A6B + dragon breath
  • KN-44-1C2B4A5A8B
  • KRM-262-1C2A4A5E6A
  • L-CAR 9-2C4A7A8C9C + gung ho
  • LAG 53-1C3A5A8A9B
  • LC10-2F4E7B8F9F
  • LW3-Tundra-1A2B5A8A9E
  • Lachmann-556-1C2A4C6C8C
  • Locus-2A4B5A8C9C
  • M13-1C2B3A4A8D
  • M16-1C2B3A7C9B
  • M21 EBR-1D2C4D7D8B
  • M4LMG-1C3A4D5A6C low mobility, suppressed
  • M4LMG-3A4A5A6C9A high mobility, not suppressed
  • MAC-10-1B2A6B7B8B hipfire
  • MAC-10-1B2E4B7B8B ads
  • MG42-1E2A4B5A8D not suppressed
  • MG42-1F2C3T4D8D 4.4x scope, suppressed
  • MG42-1F2D5A8D9A no optics, suppressed
  • MW11-1E2A5F6A7A + gung ho + underkill
  • Maddox-2A3A4D8A9B
  • Man-O-War-1B2A3A5B8C
  • NA-45-1C4C5A7D8C
  • Oden-1D2A4A5A9A high mobility
  • Oden-1D2C4A5A9A high range
  • Oden-1D4A5A6C7D subsonic ammo, FMJ
  • Oden-1D4A6C7C9A subsonic ammo, no FMJ
  • PKM-1C2B3A5A8B red dot
  • PKM-1C2B4A5A8B no optics
  • PP19 Bizon-1A2B4C8B9A
  • PPSh-41-1E2B5F6A7B hipfire
  • Pharo-1C2B6A7G8C
  • QQ9-1C2C4A6C8C
  • QXR-1C2C4A5I8A ads
  • QXR-1C2C5I6A8A hipfire
  • R9-0-1G2B6C8A9A
  • RAAL MG-1C3A4B5A8A
  • RAM-7-1A2B4B5A8A no optics
  • RAM-7-2B3A4B5A8A red dot
  • Razorback-1C2A3A5I9A
  • Rytec AMR-1B2C4C5A9A
  • SKS-1B4C5A8A9A
  • SO-14-1C3E4A5A9B
  • Sten-1E2E4E6F7C
  • Striker-1F2B5E6A8B
  • Striker-1F2C6C8B9A ads
  • Switchblade X9-1C2C4A8A9A
  • Swordfish-1A3P4A5A8C
  • TEC-9-1G2F6B7B8F
  • Type 19-1D2A4A8B9C
  • Type 25-1C2C3A4A9E
  • Type 63-2A4F5A8B9C
  • USS 9-1C2D4A8C9A
  • VMP-2D4C5H8A9B ads
  • VMP-2D4C5H8A9C hipfire
  • XM4-1A2G3A8F9E
  • XPR-50-1A2C4B5A8C no optics
  • XPR-50-2B3F4B5A8C optics

Battle Royale

  • AK117-1C2C4D6C8B
  • DL Q33-1C2A4C6A8C
  • Hades-2B6C7A8A9C
  • HDR-1B2A4A5B6A
  • MG42-1E2C4D8C9A
  • PKM-2B4B6C8A9A
  • RAAL MG-1C2B3A5E8A
  • RPD-2D5E6C7A9C
  • Rytec AMR-1D2C4C5E8B
  • SVD-1D2B4C5E8B
View original on lemmy.world
1
callofdutymobile·Call of Duty MobilebyWillieShen

My current CODM loadouts collection

Multiplayer

  • .50 GS-1A2A7A8A9A
  • 3-Line Rifle-1D2E4B5A8A
  • AGR 556-1C2B4A6C8C
  • AK117-1C2A4A8B9A
  • AK47-1C2C4A8A9A
  • AS VAL-2C4B6C8A9A
  • ASM10-1C2D4A8A9A
  • Arctic.50-2A4B5A8C9C
  • BAL-27-1C2C4A6F8A
  • BK57-1C2C3A4B9C
  • Bruen MK9-2B3A4A5E8B
  • CBR4-1A2B4A5E9A
  • Chopper-1E2C5A7G8A
  • DL Q33-1B2A4A5A8A
  • DR-H-1C2B4A8C9A
  • EM2-1B2C4A8B9C
  • HS0405-1F4A5E6B9A
  • HVK-30-1C2A3A8C9A red dot
  • HVK-30-1C2A4C8C9A no optics
  • JAK-12-1C2A5A6B + dragon breath
  • KN-44-1C2B4A5A8B
  • KRM-262-1C2A4A5E6A
  • L-CAR 9-2C4A7A8C9C + gung ho
  • LAG 53-1C3A5A8A9B
  • LC10-2F4E7B8F9F
  • Locus-2A4B5A8C9C
  • LW3-Tundra-1A2B5A8A9E
  • Lachmann-556-1C2A4C6C8C
  • M13-1C2B3A4A8D
  • M16-1C2B3A7C9B
  • M21 EBR-1D2C4D7D8B
  • M4LMG-1C3A4D5A6C low mobility, suppressed
  • M4LMG-3A4A5A6C9A high mobility, not suppressed
  • MAC-10-1B2A6B7B8B hipfire
  • MAC-10-1B2E4B7B8B ads
  • MG42-1E2A4B5A8D not suppressed
  • MG42-1F2C3T4D8D 4.4x scope, suppressed
  • MG42-1F2D5A8D9A no optics, suppressed
  • MW11-1E2A5F6A7A + gung ho + underkill
  • Maddox-2A3A4D8A9B
  • Man-O-War-1B2A3A5B8C
  • NA-45-1C4C5A7D8C
  • Oden-1D2C4A5A9A high range
  • Oden-1D2A4A5A9A high mobility
  • Oden-1D4A5A6C7D subsonic ammo, FMJ
  • Oden-1D4A6C7C9A subsonic ammo, no FMJ
  • PKM-1C2B3A5A8B red dot
  • PKM-1C2B4A5A8B no optics
  • PP19 Bizon-1A2B4C8B9A
  • PPSh-41-1E2B5F6A7B hipfire
  • Pharo-1C2B6A7G8C
  • QQ9-1C2C4A6C8C
  • QXR-1C2C4A5I8A ads
  • QXR-1C2C5I6A8A hipfire
  • RAAL MG-1C3A4B5A8A
  • RAM-7-1A2B4B5A8A no optics
  • RAM-7-2B3A4B5A8A red dot
  • Razorback-1C2A3A5I9A
  • Rytec AMR-1B2C4C5A9A
  • R9-0-1G2B6C8A9A
  • SKS-1B4C5A8A9A
  • SO-14-1C3E4A5A9B
  • Sten-1E2E4E6F7C
  • Striker-1F2B5E6A8B
  • Striker-1F2C6C8B9A ads
  • Switchblade X9-1C2C4A8A9A
  • Swordfish-1A3P4A5A8C
  • TEC-9-1G2F6B7B8F
  • Type 19-1D2A4A8B9C
  • Type 25-1C2C3A4A9E
  • Type 63-2A4F5A8B9C
  • USS 9-1C2D4A8C9A
  • VMP-2D4C5H8A9B ads
  • VMP-2D4C5H8A9C hipfire
  • XM4-1A2G3A8F9E
  • XPR-50-2B3F4B5A8C optics
  • XPR-50-1A2C4B5A8C no optics

Battle Royale

  • AK117-1C2C4D6C8B
  • DL Q33-1C2A4C6A8C
  • Hades-2B6C7A8A9C
  • HDR-1B2A4A5B6A
  • MG42-1E2C4D8C9A
  • PKM-2B4B6C8A9A
  • RAAL MG-1C2B3A5E8A
  • RPD-2D5E6C7A9C
  • Rytec AMR-1D2C4C5E8B
  • SVD-1D2B4C5E8B
View original on lemmy.world
2

You reached the end