Bubblision – Sprint 20 start

Sprint stories

My priorities for this sprint are:-

  1. Write some more tests

Other things:-

  1. Company bank account – this has become pretty critical now. I’m really unimpressed that it’s taken almost a month since I applied for a business bank account and I still haven’t got one. As a result I can’t sign up for ad networks etc so this is now a priority for me
  2. Register as a developer on the Play store
  3. Sign up for an ad network (company bank account permitting)

Expected duration

Two weeks (ending 13/07/2014)

How to: Create a static copy of a Gallery 2 site

For many years I maintained an instance of Gallery 2 (http://galleryproject.org/) to share some of our photos with family and friends. However, life and technology moves on and I simply don’t have time to maintain the installation of the Gallery software* and couldn’t justify the time to upgrade it to version 3. Similarly, we don’t tend to use it for our photos any more and instead share things via Flickr, Facebook or just plain email.

That said, I didn’t want to remove the site entirely… just “make it safe” and make it trivial to host/maintain. To that end, and because I had no requirement to keep on updating the site, I looked around for solutions on how to make a static copy of the site (i.e. one that could just be served as static files without needing PHP or a MySQL database etc). The first version of Gallery had a static mode that you could put the site into and then crawl to create a static copy. Version 2 doesn’t have that functionality.

In the end I settled on crawling the site with ‘wget’ and then using a series of Perl one liners to tidy up the resulting HTML. This results in a reasonable copy of the site in static form. The only downside is that the image sizes are lost so the pages just show the images at the default size – no great loss though as we have the originals anyway.

In case anyone is faced with a similar task, here are the commands and the bash script used to clean up the pages.

wget -m -R "*g2_v*,*g2_h*,*g2_c*,*g2_i*" http://photos.example.com/

-m = mirror the site
-R “reject,list” = list of file patterns to reject

The above command can take many hours to run, on my site the spidering took seven hours: Downloaded: 30453 files, 526M in 27m 7s (331 KB/s)

Once the spidering is done you have copies of the pages and the images etc but the pages still have references to PHP files and so on… so you need to do a bit of cleaning up.

To do this I created a shell script which I have included below.

Edit 13/02/2020 – the original shell script was created and run on Ubuntu Linux back in 2014. It uses “rename” but Daniel M. Drucker kindly got in contact with me to point out that the behaviour of this command is different on different Linux distros and macOS and may not work. I’ve left the original command in the script below but if it doesn’t work then you may be able to replace that line (4) with this one. However, I no longer have a gallery2 site to test this on so use at your own risk:

find . -name '*g2_*' | while read file; do newfile=`echo $file | awk -F [=.] '{print "." $2 "_page_" $4 ".html" }'`; mv $file $newfile; done;

Original shell script:

# Tidy up offline gallery

# Rename files
find . -name '*g2_*' -exec rename s'/index\.html\?g2_page=(\d+)/index_page_$1.html/' {} \;

# Fix links to the renamed files above
perl -0777 -spi -e 's!\?g2_page=(\d+)!index_page_$1.html!gs' `find . -name \*.html`

# Remove various links to scripts and functionality we don't have now
perl -0777 -spi -e 's!<script.*?</script>!!gs' `find . -name \*.html`
perl -0777 -spi -e 's!<a href=\"/main\.php.*?</a>!!s' `find . -name \*.html`
perl -0777 -spi -e 's!<form\s+id=\"search_SearchBlock\".*?</form>!!gs' `find .  -name \*.html`
perl -0777 -spi -e 's!<div id=\"gsFooter\">!<div id=\"gsFooter\">Was once powered by:<br />!gs' `find . -name \*.html`
perl -0777 -spi -e 's!<div class=\"block-core-PhotoSizes.*?</div>!!s' `find .  -name \*.html`

# Fix first breadcrumb link
# CHANGEME = Update to the name of your site
perl -0777 -spi -e 's!<a href=\"/main\.php.*? class=\"BreadCrumb-1\".*?</a>!<a href="/" class="BreadCrumb-1">Someone'\''s photos</a>!gs' `find . -name \*.html`

# Fix image links
perl -0777 -spi -e 's!<a href=\".*?g2_imageViewsIndex=[\d+]\">[\s*]<img(.*?)/>[\s*]</a>!<img$1/>!g' `find . -name \*.html`

# Remove any remaining links to main.php
perl -0777 -spi -e 's!<a href="\&quot;/main\.php.*?</a" data-mce-href="\&quot;/main\.php.*?</a">!!gs' `find . -name \*.html`</a>

Use the above at your own risk… 😉

* It turns out that the core Gallery team are also taking a break from the software too and it’s “in hibernation”

SunUp #14-25

Some of the things I did this week:

  • Finally created some integration tests for Bubblision. I’ve only done two so far but it’s a start.
  • Went along to the monthly Unity meet-up – a talk on editor extensions. Great talk and an excellent night.
  • Did a test upgrade of the Glossary to CakePHP 2.5.2 (from 2.5.1)
  • Prepared test fixtures for the Identifier tool prior to attempting to upgrade it from the CakePHP 1.3.x branch to 2.5.2 – once that’s done I can begin development again
  • A week after returning my forms to the bank they finally got in touch (by phone). They still haven’t set up the account and asked me a lot of odd questions (such as what software I’m using?! – I still don’t know why that might affect my application for an account). As I’m not already a games developer, this being a start-up for me afterall, I’m not convinced they’re going to give me an account because of my lack of experience. Anyway, my application has been sent to another department who would “take another week” before getting in touch. It’s now almost a month since I first applied and, let’s be honest, they’ve been really slow and I still haven’t got an account…. hardly encouraging for someone starting a business.
  • Read more of Electronic Brains

SunUp #14-23

Some of the things I did this week:

  • Finally got the forms for the business bank account from NatWest. Having done the initial sign-up online it’s pretty frustrating to wait two working days for a phone call then three more working days for them to email you forms to print out, complete and post back to them. It’s also the first form I think I’ve ever had to complete that switches back and forth between two different date formats from page to page (DDMMYYY and DDMMMYYYY)… it’s perhaps also the only form I’ve had to complete where it requires dates in DDMMMYYYY format for that matter.
  • Deployed the new Reality F1 code so it now supports the Ergast API again
  • Did a test upgrade of CakePHP 2.4 to 2.5 for the Glossary
  • I’ve also been reading Electronic Brains
  • Also started reading Unity 2D Game Development

Bubblision – Sprint 17 complete & SunUp #14-22

Some tasks completed during this sprint:

  • Adjusted NPC bubble speed depending on the number of bubbles remaining
  • Redesigned the end game screen
  • Tried redesigned the playing area (still don’t like it)
  • Updated NGUI to 3.6.1

A few other things I did:

  • Went to a UKIE session on tax relief for games development
  • Went to the Bristol Games Hub monthly social – excellent talk on sound and music in games
  • Tried to set up business bank account… had a preliminary phone call and they’re meant to be sending the next steps by email.. nothing as yet, sigh.