HTML page to send a...
 
Notifications
Clear all

HTML page to send api request to pixelcade

2 Posts
2 Users
0 Reactions
328 Views
Al Linke
(@alinke)
Estimable Member
Joined: 5 years ago
Posts: 140
Topic starter  

So I use my pixelcade without a frontend because my arcade machine is a pandora box dx with a jamma connector and I am using a raspberry pi to connect to the pixelcade. I couldn't successfully create a shell file to run on startup of the pi and pixelcade to send api request to create a slideshow of specific marquee's I want it to cycle through. Granted I am not very fluent on shell files so I tried to do the same request with an html page and came across this code I found using an iframe to stay on the same page but load multiple sites on a timer in turn which send api request to pixelcade to show a slideshow of my specific marquee's. I have done this with the windows frontend but I rather run this on a pi as it is a lighter and simpler computer then a full blown pc for just the pixelcade. Below is the code I used and just replaced the sites with the api url for the marquee's I wanted....

<!doctype html>
<html>
<style>
html,body,iframe{height:100%;width:100%;border:0;padding:0;margin:0;}
html,body{overflow:hidden;}
</style>
<iframe></iframe>
<script>
var timer = 5;
var sites = [
    'http://pixelcade.local:8080/arcade/stream/mame/centiped',
    'http://pixelcade.local:8080/arcade/stream/mame/milliped',
    'http://pixelcade.local:8080/arcade/stream/mame/tetris',
    'http://pixelcade.local:8080/arcade/stream/mame/frogger',
    'http://pixelcade.local:8080/arcade/stream/images/suprmrio',
    'http://pixelcade.local:8080/arcade/stream/images/dkngjnrj',
    'http://pixelcade.local:8080/arcade/stream/mame/galaga',
    'http://pixelcade.local:8080/arcade/stream/mame/1941',
    'http://pixelcade.local:8080/arcade/stream/mame/pixelcade',
];
var frame = document.getElementsByTagName("IFRAME")[0];
var index = 0;
var cycle = function() {
    frame.src = sites[index];
    if(++index>=sites.length) {
        index = 0;
    }
    setTimeout(cycle,timer*1000);
}
cycle();
</script>
</html>

I am sure there is a way to create a shell file to run on the pi but everything I have tried would not run on the pi itself but would work when ssh'ing to the pi and sending the api request. If anyone has tried this I would appreciate the help. 

Adding to the html page I am hopping to see this added to the pixelcade index.html with maybe a way to edit the url's and delay timer between each marquee that is more user friendly. Currently, you have to edit the url's within the page and save it. 

My final test is to run the pi in desktop mode with chrome kiosk mode and it only on the slideshow html page so that it constantly sends request to the pixelcade's api and not need another computer to send the request.

Let me know your guy's thoughts... sorry for the long read 😀

 


   
Quote
Pixelcade Admin
(@pixelcade-admin)
Reputable Member Admin
Joined: 6 years ago
Posts: 330
 

have not tried your method so can't advise there, personally bash shell script is what I would recommend. The installer should be adding pixelcade to your startup but if not, have a look at the installer script here and perhaps you can set that up manually https://github.com/alinke/pixelcade-linux/blob/main/installer-scripts/setup-retropie.sh


   
ReplyQuote
Proudly powered by Wpopal.com