Created
February 27, 2022 06:30
-
-
Save CanadianJeff/5e0502950e52d7730201a16fe1b0fe35 to your computer and use it in GitHub Desktop.
Lakka TV Playlist Scanner /storage/playlists
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Libretro playlist builder | |
# | |
# Usage: | |
# scan.sh "Files path" "Core" "Core name" "Playlist filename" ["Playlists path"] | |
# | |
# Example: | |
#./scan.sh "/storage/roms/arcade/*.zip" "/tmp/cores/fba_libretro.so" "Arcade (FB Alpha - SVN)" "FB Alpha - Arcade Games.lpl" "/storage/playlists/" | |
# | |
SAVEIFS=$IFS | |
IFS=$(echo -en "\n\b") | |
CA=0 | |
CS=0 | |
echo " Scaning \"$1\" for \"$3\" ROMs and adding to \"$5$4\"... " | |
for fullpath in $1; do | |
touch "$4" | |
filename=$(basename "$fullpath") | |
if [ `grep -c "$fullpath" "$4"` -lt 1 ]; then | |
CA=$(($CA+1)) | |
echo "$CA - Adding $filename" | |
echo $fullpath >> "$5$4" | |
echo "${filename%.*}" >> "$5$4" | |
echo $2 >> "$5$4" | |
echo $3 >> "$5$4" | |
echo "DETECT" >> "$5$4" | |
echo $4 >> "$5$4" | |
else | |
CS=$(($CS+1)) | |
echo "$CS - Skipping $filename" | |
fi | |
done | |
echo " Added $CA and skipped $CS \"$3\" ROMs out of $(($CA+$CS)) scanned files to \"$4\" " | |
IFS=$SAVEIFS |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment