While I was streaming on twitch.tv/atommouse, I kept finding myself updating the chat with the print progress. I thought there could be a better way, so I did some research and found there is an Octoprint API that allows you to query information such as File Name and Print Percentage.
You can copy it from my github at https://github.com/adamrouse/Octoprint-Percent-Complete
Just Replace [PiIPAddress] with your Pi’s IP address and [APIKEY] with the OctoPrint API key accessed from the Settings > Features > API page.
Custom CSS Code needed for display in OBS:
#percentinfo {
font-family: “Trebuchet MS”, Arial, Helvetica, sans-serif;
border-collapse: collapse;
width: 100%;
}
#percentinfo td, #percentinfo th {
border: 1px solid #ddd;
padding: 2px;
}
#percentinfo tr:nth-child(even){background-color: #f2f2f2;}
#percentinfo th {
padding-top: 10px;
padding-bottom: 10px;
text-align: center;
background-color: #4CAF50;
color: white;
}