So I realized pretty quickly that manually updating a snarf site is quite annoying. I suppose it isn’t so bad if you’re Mr. Peck, but I just wrote a short little PHP script to go and update it for me.
They are as follows:
snarf.php Downloads a snarf XML file from a server, opens it, and downloads all of the projects listed inside of it. It then creates its own snarf.xml. Variables are on the top of the code, to download, right-click and save as…
create_snarf.php Goes through a non-recursive filename search through a directory, then creates a snarf.xml for it. It’s pretty easy to improve this one, but I never got around to it. Things for the future:
- Add recursion for folders
- Add folder-based categories
transfer.php This is the one that is both the simplest and the most time consuming. It reads a given snarf file, and downloads the projects. What took a really long time on this one was the “downloading” bit… It appears that PHP doesn’t have a built-in downloader that accepts inputs from my string… I just used wget in the end. Note: This will not maintain category structure while downloading, it all goes in ‘./’.
Currently, since Mr. Peck’s snarf isn’t back up yet, they are all coded to point at www.aeturnalus.com/snarf/snarf.xml. When the district’s server port gets opened up, I’ll point it at http://205.173.41.8/staff/peck_george/notemplate/apcssnarf/snarf.xml to mirror the snarf with one click.
Comments?
