My original iPad finally bit the dust in August, just before I could get a final good backup of it. Most of the stuff on it was already backed up elsewhere (GMail, Dropbox, iCloud), but Scape was the exception.
Scape is (at least not yet) able to back up its files to the cloud, so there wasn’t anyplace else to restore from — except I had take advantage of the fact that under iOS5, the files in the app were still directly readable using Macroplant’s iExplorer, so I had actually grabbed all the raw Scape files and even the Scape internal resources. Sometime I’ll write up what I’ve figured out about Scape from those files…
The Scape files themselves are just text files that tell Scape what to put on the screen and play, so the files themselves were no problem; they don’t include checksums or anything that would make them hard to work with.
Version:0.20
Mood:7
Date:20121113025954
Separation:0.50
HarmonicComplexity:0.50
Mystery:0.50
Title:Scape 117
Steam Factory,0.50,0.50,1.0000
Spirit Sine Dry,0.23,0.31,3.1529
Spirit Sine Dry,0.40,0.36,3.4062
Spirit Sine Dry,0.64,0.19,3.9375
Spirit Sine Dry,0.55,0.49,1.0065
Spirit Sine Dry,0.26,0.67,3.5039
Spirit Sine Dry,0.76,0.54,3.1211
Spirit Sine Dry,0.49,0.79,3.8789
Spirit Sine Dry,0.46,0.17,3.9766
Spirit Sine Dry,0.85,0.27,2.0732
Spirit Sine Dry,0.90,0.53,1.5154
Spirit Sine Dry,0.66,0.72,3.6680
Spirit Sine Dry,0.15,0.55,2.2527
Spirit Sine Dry,0.11,0.80,1.9320
Spirit Sine Dry,0.32,0.88,4.1289
Spirit Sine Dry,0.18,0.14,3.2779
Spirit Sine Dry,0.81,0.11,3.0752
Spirit Sine Dry,0.49,0.56,1.7528
Spirit Sine Dry,0.82,0.80,3.3783
Bass Pum,0.53,0.46,1.8761
Thirds Organ Pulsar Rhythm,0.50,0.50,1.0000
End
I wrote to Peter Chilvers, who is a mensch, and asked if there was any way to just import these text files. He replied that there unfortunately wasn’t, but suggested that if I still had access to a device that had the scapes on it, I could use the share feature and mail them one by one to my new iPad, where I could tap them in Mail to open them in Scape and then save them.
At first I thought I was seriously out of luck, but then I figured, why not share one from the new iPad and see what was in the mail? I did, and found it was just an attachment of the text file, with a few hints to iOS as to what app wanted to consume them:
Content-Type: application/scape; name="Scape 10";x-apple-part-url=Scape 10ar; name="Scape 10ar.scape"
Content-Disposition: inline; filename="Scape 10ar.scape"
Content-Transfer-Encoding: base64
Fab, so all I have to do is look through five or six folder containing bunches of scape files that may or may not be duplicates, build emails, and…this sounds like work. Time to write some scripts. First, I used this script to ferret through the directories, find the scapes, and bring them together.
use strict;
use warnings;
use File::Find::Rule;
my $finder = File::Find::Rule->new;
my $scapes = $finder->or(
$finder->new
->directory
->name(‘Scape.app’)
->prune
->discard,
$finder->new
->name(‘*_scape.txt’)
);
my $seq=”a”;
for my $scape ($scapes->in(‘.’)) {
(my $base = $scape) =~ s/_scape.txt//;
my $title;
open my $fh, “<“, $scape or die “can’t open $scape: $!”;
while(<$fh>){
chomp;
next unless /Title:(.*)$/;
$title = $1;
last;
}
$title =~ s[/][\\/]g;
if (-e “$title.scape”) {
$title = “$title$seq”;
$seq++;
die if $seq gt “z”;
}
system qq(mv “$scape” “$title.scape”);
system qq(mv “$base.jpg” “$title.jpg”)
}
I decided it was easier to do a visual sort using the .jpg thumbnails to spot the duplicates and filter them out; I probably could have more easily done it by checksumming the files and eliminating all the duplicates, but I wanted to cull a bit as well.
So now I’ve got these, and I need to get them to my iPad. Time for another script to build me the mail I need:
#!/usr/bin/env perl
=head1 NAME
bulk_scapes.pl – recover scape files in bulk
=head1 SYNOPSIS
MAIL_USER=gmail.sendername@gmail.com \
MAIL_PASSWORD=’seekrit’ \
RECIPENT=’icloud_user@me.com’ \
bulk_scapes
=head1 DESCRIPTION
C will collect up all the C<.scape> files in a directory
and mail them to an iCloud user. That user can then open the mail on their
iPad and tap the attachments to restore them to Scape.
This script assumes you’ll be using GMail to send the files; create an app
password in your Google account to use this script to send the mail.
=cut
use strict;
use warnings;
use Email::Sender::Simple qw(sendmail);
use Email::Sender::Transport::SMTP;
use MIME::Entity;
my $top = MIME::Entity->build(Type => “multipart/mixed”,
From => $ENV{MAIL_USER},
To => $ENV{RECIPIENT},
Subject => “recovered scapes”);
# Loop over files and attach. MIME type is ‘application/scape’.
my $n = 1;
for my $file (`ls -1 *.{scape,playlist}`) {
chomp $file;
my($part, undef) = split /\./, $file;
open my $fh, “<“, $file or die “Can’t open $file: $!\n”;
my $name;
while(<$fh>){
next unless /Title/;
(undef, $name) = split /:/;
last;
}
unless ($name) {
$name = “Untitled $n”;
$n++;
}
close $fh;
$top->attach(Path => $file,
Type => “application/scape; name=\”$name\”;x-apple-part-url=$part”,
);
}
my $transport = Email::Sender::Transport::SMTP->new(
host => ‘smtp.gmail.com’,
port => 587,
ssl => ‘starttls’,
sasl_username => $ENV{MAIL_USER},
sasl_password => $ENV{MAIL_PASSWORD},
);
sendmail($top, { transport => $transport });
I was able to receive this on my iPad, tap on the attachments, and have them open in Scape. Since there were a lot of these, it took several sessions over a week to get them all loaded, listened to, saved, and renamed using Scape’s edit function (the titles did not transfer, unfortunately).
So now I have all my Scapes back, and I’m working through the program, trying to get to the point where I have all the objects enabled again. I haven’t played with it in a while, and I’m glad to be rediscovering what a gem this app is.