Advertisement
udance4ever

script to link existing Batocera assets in EmulatorJS

Apr 26th, 2024
769
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.78 KB | Gaming | 0 0
  1. #!/bin/bash
  2.  
  3. # April 25, 2024
  4.  
  5. # EmulatorJS (in CasaoS)
  6.  
  7. # original snippets
  8. #  for x in *-video.mp4; do  ln -s "$x" "$(basename "$x" -video.mp4).mp4"; done
  9. #  for x in *-marquee.png; do  ln -s "$x" "$(basename "$x" -marquee.png).png"; done
  10.  
  11. dirname=$(dirname $0)
  12.  
  13. # $$$ list needs to be an absolute path (for now)
  14. list="$dirname/system.emuJS.list"
  15. # https://stackoverflow.com/a/3063887/9983389
  16. if [ ! -z "$1" ]; then
  17.         list=$1
  18. fi
  19.  
  20. # $$$ assumptions
  21. config=/userdata/system/casaos/DATA/AppData/emulatorjs
  22. roms=/userdata/roms
  23.  
  24. #pushd "$config/data"
  25. pushd $roms
  26.  
  27. # https://stackoverflow.com/a/1689063/9983389
  28. while read system; do
  29.         if ([[ $system == \#* ]] || ([[ "x$system" == "x" ]])); then continue; fi
  30.  
  31.         echo "--------------------------------"
  32.         echo "processing $system..."
  33.         echo "--------------------------------"
  34.         pushd $system
  35.  
  36.         echo -n "processing videos..."
  37.         cd videos
  38.  
  39.         for video in *-video.mp4; do
  40.                 emuJSfile="$(basename "$video" -video.mp4).mp4"
  41.  
  42.                 if [[ -e $emuJSfile ]]; then
  43. #                       echo "$emuJSfile exists"
  44.                         echo -n "."
  45.                 else
  46.                         ln -s "$video" "$emuJSfile"
  47.                 fi
  48.         done
  49.  
  50.  
  51.         echo -n "processing images (logos)..."
  52.         cd ../images
  53.  
  54.         for logo in *-marquee.png; do
  55.                 emuJSfile="$(basename "$logo" -marquee.png).png"
  56.  
  57.                 if [[ -e $emuJSfile ]]; then
  58. #                       echo "$emuJSfile exists"
  59.                         echo -n "."
  60.                 else
  61.                         ln -s "$logo" "$emuJSfile"
  62.                 fi
  63.         done
  64.  
  65.         popd
  66. done <$list
  67.  
  68. popd
  69.  
  70. echo
  71. echo "DONE! Ready to retro! 🕹️"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement