GSOC Day 8 – Media and panelPicture
Today was a busy day for me, but it ended well; I finally made some real progress in adding media support to panelPicture.py.
Llnz had finished putting in the media parameters for minisec, so I was able to test. I found that the URLs did not, as I first expected, have file extensions on them. For instance, the URL might be: common-2d/star-small/yellow. I then would have to figure out what file extensions were available for that image, which was not a small task.
I looked into the problem, and I realized that panelPicture used callback functions to get the information about available files from the MediaThread. This wouldn’t work for me, since I would need to get the available file list immediately and without using a whole class. At first, I just tried making a pass-through function to the internal media object in the MediaThread, but that violated thread safety.
So I had to add a function to the MediaThread to get the list of files for a given prefix. This also meant that the MediaThread would have to store a list of all available files, rather than just passing it on as part of a callback. Not such a big deal, though.
This eventually worked, and I was able to get the available files – and display them!
I realized, however, that there were some media URLs referenced by objects that didn’t seem to exist in the repository. This, I realized, could be due to the fact that the MediaThread always went to the same repository, hard-coded, rather than using the one that is now specified by each Game object. I had to dig around to find where that information was stored, and then I realized that the only place it seems to be is in a list – potentially of multiple games – on the server you’re connecting to. I’m not sure how to figure out which game you’re actually connected to, if there are more than one, to get the media URL for just that game. So for now, until I can figure it out, I’m going to just go through the list and use the last URL. I’ll talk to Mithro tomorrow about this.
Oddly enough, in the end, this still didn’t solve the problem of the missing URLs. Some objects still specify URLs that don’t appear to exist in the repository specified for their game. I’ll also have to look into this more tomrrow – it might be a server-side problem.
Overall, however, I definitely feel like I made some good progress on media support today, and I have a much better understanding of how it works.
Here’s a screenshot of one of the new media displays: