Gargaj / wuhu

Lightweight Party Management System
http://wuhu.function.hu/
Other
41 stars 26 forks source link

✨ Add functions to export an M3U playlist for SceneSat #77

Closed Bombe closed 10 months ago

Bombe commented 10 months ago

This pull requests add a download function for a playlist in a format that SceneSat’s admin backend can use, relieving the user from having to either copy & paste all entries to SceneSat’s backend, or typing it all manually. We have computers for this kind of thing, don’t we? Yes.

This feels like an abuse of the index_template_elements hook. I could have put in a way more elaborate scheme to allow non-admin user access to a file in the www_admin directory but I’m not familiar enough with the philosophy behind Wuhu’s code, so I didn’t.

Anyway, this is straight-forward: behind every compo header I add a link to the same URL with another parameter (“compoid”). The existence of this parameter will stop the newly added index_template_elements hook in compodump_export_compo_playlist from returning early. It will then output headers to force the browser to download a file, and generate the file from the entries of the compo in question, in the weird M3U format that SceneSat’s admin backend will happily swallow.

Oh, and it will add a “SceneSat” menu item so the poor SceneSat people at a party don’t have to remember the page name “Compodump” anymore. 😄