Author Topic: What are the triggers for plugins?  (Read 2250 times)

rwebb616

  • Jr. Member
  • **
  • Posts: 24
    • View Profile
What are the triggers for plugins?
« on: January 22, 2019, 02:18:22 PM »
I know you can have them activate based on a keypress through the controls custom1,2,3 etc but are there other ways to have them trigger? 

I'm thinking about writing a favorites plugin that does favorites a different way from how the base install does it.  Basically it would read the line from the romlist for the currently selected game and place it in a favorites romlist if it's being flagged as a favorite.  If it's being unflagged it would remove it from the favorites romlist.  Seems that would be a pretty simple plugin.

Thanks,
Rich

progets

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1271
    • View Profile
Re: What are the triggers for plugins?
« Reply #1 on: January 22, 2019, 07:07:36 PM »
It's not a plugin but scripts exist for what you want to do. People usually just create a "Setup" or "Maintenance" display in AM and run things like this from there.

Here's an example
Code: [Select]
cd /home/pi/.attract/romlists
rm Favorites.tag

clear
echo
echo "This script will generate a new romlist called Favorites.txt."
echo
echo "The new romlist will contain all of your current tagged favorites from all different romlists."
echo
sleep 5

echo
echo "Renaming old Favorites.txt file ....."
sleep 5
mv Favorites.txt Favorites.txt.backup

echo
echo "Gathering file listing of tagged favorites ....."
sleep 5

echo
echo "Generating new Favorites.txt file ....."
sleep 5
echo

ls *.tag > tagfiles

while read filename
do
echo "Using ${filename} ....."
echo

  while read gamename
  do
    romlist=`echo ${filename} |cut -f1 -d '.'`
    echo "     Searching ${romlist}.txt for ${gamename} ....."
    cat "${romlist}.txt"|grep "^${gamename};" >> Favorites.txt
#    cat "${romlist}.txt"|egrep "^${gamename};" >> Favorites.txt
#    cat "${romlist}.txt"|grep "[;]${gamename}[;]" >> Favorites.txt
  done < "${filename}"

sleep 5
echo
done < tagfiles

rm tagfiles

cat Favorites.txt |sort -u > tmp_favorites.txt
mv tmp_favorites.txt Favorites.txt

echo "Finished creating new Favorites.txt ....."
echo
echo

echo "Using this new romlist, create a new Display and choose Favorites as the romlist for it."
echo   
echo "You may need to periodically update the Favorites romlist as you add new favorites."
echo
echo
sleep 10
echo

You can find this script as well as a favorites cleanup script and some others here https://github.com/hyperpie/AM_Config_Display/tree/master/attract/Attract%20Mode%20Setup