Please do not post a support request without first reading and following the advice in https://retropie.org.uk/forum/topic/3/read-this-first

Here: Short shell-script to check Custom-Collections. Mabye it's usefull ...



  • Hi,
    Happy new year!

    Yesterday I wrote a short script for me to check my Custom-Collections I have created.
    Simply copy (ftp, winscp, ...) the script to your /home/pi -folder, chmod 755 and execute it ...

    I get a lot of help and ideas from this forum, so this is what I can give back actual. Thanks to you!!

    Maybe there are already tools with same function, maybe it's usefull for some ...

    The script will help you to find out, what game is in which collection.
    And to find out the games which are missing in any Custom collections. This is usefull when added (copied) new games to the Emulators ...

    First it will give a short overview about the existing "Custom-Collections" and existing games in the system:

    OVERVIEW existing Custom-Collections:
    
    Drive + Race: 17
    Fight + War: 16
    Platform - Games: 27
    Space - Games: 20
    Sport + Co: 19
    Think + Logic: 4
    ======================================
    
    EXISTING ROMS in the Arcade-Folders:
    
    mame-libretro: 105
    zxspectrum: 31
    
    

    Than it will show for every Game the associated Custom-Collection(s) (if exists):

    1942 (File: 1942.zip; mame-libretro) was founded in  1:
    Platform - Games
    --------------------------------------------------------------------
    1943 Kai: Midway Kaisen (File: 1943kai.zip; mame-libretro) was founded in  2:
    Fight + War
    Platform - Games
    --------------------------------------------------------------------
    Three Wonders (File: 3wonders.zip; mame-libretro) was founded in  1:
    Platform - Games
    --------------------------------------------------------------------
    Airwolf (File: airwolf.zip; mame-libretro) was founded in  1:
    Fight + War
    --------------------------------------------------------------------
    Alpha Mission II (File: alpham2.zip; mame-libretro) was founded in  0:
    -  (not found in any Custom-Collection)
    --------------------------------------------------------------------
    Alpine Ski (File: alpine.zip; mame-libretro) was founded in  1:
    Sport + Co
    .....
    ...
    

    At the end also a summary about the games which are not in any Custom-Collection:

    THESE 6 games from mame-libretro are not found in any Custom Collection:
     Alpha Mission II, Asterix, Bagman, Ghouls'n Ghosts, , Super Bagman,
    
    

    In line 20 you have to enter your game-folders (emulators) to check (in my example there is: mame-libretro and zxspectrum; seperated by spaces):

    RomFolders="mame-libretro zxspectrum"
    

    To see detailed output (for every game/ROM) use parameter "-v":

    /home/pi/check-custcoll.sh -v
    

    Thats all ;-)
    Maybe it's usefull, for me it is ;-)

    Bugs, hints and ideas can reported to me.
    (and yes, the script is NOT optimized, it's realy "quick & dirty", but working and easy to understand)


    ######################################################################
    # Short Shell-Script (yes, quick and dirty) to check own Custom Collections
    # Should/can be placed and started in /home/pi
    #
    # Use parameter "-v" to get detailed output for every ROM/Game ....
    #
    # Output goes to standard-out (can be redirected to a text file
    #        (i.e.: /homePi/check-cust-coll.sh -v >/tmp/cust-coll-output.txt)
    #
    # mmades, 01.01.2020
    #
    ######################################################################
    
    CustCollPath=/opt/retropie/configs/all/emulationstation/collections
    RomPath=/home/pi/RetroPie/roms
    GameListPath=/opt/retropie/configs/all/emulationstation/gamelists
    
    
    ### These two lines can/must be modfified:
    RomFolders="mame-libretro zxspectrum"
    Ext="zip|tap|tzx|szx|z80"   # All file extentions from Roms / games that should be checked
    ##########################################################################################
    
    [ "$1" = "-v" ] && V=1 || V=0
    
    echo "OVERVIEW existing Custom-Collections:"; echo
    
    for i in $CustCollPath/*.cfg
    do
       C=`cat "$i" | wc -l`
       BaseFileName=`echo $i | cut -d/ -f8- | cut -c8- | sed 's/.cfg//g' `
       echo "$BaseFileName: $C"
    done
    
    echo -e "======================================"
    sleep 1
    
    echo -e "\nEXISTING ROMS in the Arcade-Folders:"
    echo
    for i in $RomFolders
    do
       C=`ls -l $RomPath/$i | egrep ".$Ext" | wc -l`
       echo $i: $C
    done
    
    echo -e "======================================"
    sleep 2
    
    for i in $RomFolders
    do
       echo -e "\nSTARTING Custom Collection Check for: $i -------------------"
       [ $V -eq 0 ] && echo "running ..."
       NotInCustColl=""
       C=0
       for File in $RomPath/$i/*
       do
          ExtCheck=`echo $File | egrep ".$Ext"`
          if [ "$ExtCheck" != "" ]
          then
             [ $V -eq 1 ] && echo "--------------------------------------------------------------------"
             Founds=`grep -l "$File" $CustCollPath/custom*.cfg | cut -d/ -f8 | cut -c8- | sed 's/.cfg//g' `
             BaseFileName=`echo $File | cut -d/ -f7-`
             ClearName=`grep -A4 "<path>./$BaseFileName" $GameListPath/$i/gamelist.xml | grep "<name>" | cut -d">" -f2 | cut -d"<" -f1`
             if [ "$Founds" = "" ]
             then
                FoundCount=0
                Founds="-  (not found in any Custom-Collection)"
                NotInCustColl="$NotInCustColl $ClearName,"
                ((C+=1))
             else
                FoundCount=`echo "$Founds" | wc -l`
             fi
             [ $V -eq 1 ] && echo -e "$ClearName (File: $BaseFileName; $i) was founded in  $FoundCount: \n$Founds"
          fi
       done
    
       [ $V -eq 1 ] && echo -e "\n- - - - - - - - - - - - - - - - - - - - - - - - - - - -"
       echo -e "\nTHESE $C games from $i are not found in any Custom Collection: \n$NotInCustColl \n"
       echo "- - - - - - - - - - - - - - - - - - - - - - - - - - - -"
       sleep 1
    done
    


Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.

Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.