Wednesday, October 29, 2008

MxBackup

I wrote my first iPhone application!

My 22-month old daughter loves to play with my iPhone. In particular, she likes MxTube, a YouTube downloader app, available if you Jailbreak your iPhone. After a while, she tends to delete my downloaded videos because her click and swipe coordination need some work.

So, I've written an app that backs up my videos and restores them whenever I need to. Ignore the "Background Enabled" message- that pops up when I try to take a screenshot because of another app I have installed.



32 comments:

nudel said...
This comment has been removed by the author.
nudel said...

a great little utility! :)

u mention that the scripts can be modified to FTP the files to a network server. that sounds perfect as i could then watch them on my PC or XBOX.

can u give an example of how to modify to do this? e.g. to a NAT server on the same network

Jeremy said...

nudel,

If you look inside the unix file system on your phone, you should find /Applications/MxBackup.app/Backup.sh

This is the shell script that performs the backup when you click "Backup". To ftp each file to an anonymous file server, you could do something like:



#!/bin/bash

BACKUP=/var/mobile/backup/MxTube
MXTUBE=/private/var/mobile/Media/MxTube
VIDEOLIST=/private/var/mobile/Library/MxTube/VideoLibrary.plist

# check that the directory exists for backup
if [ ! -d "$BACKUP" ]; then
mkdir -p "$BACKUP"
if [ $? -eq 0 ]; then
echo "Created new directory for backup."
else
echo "Unable to create new directory for backup."
exit 1
fi
fi

# backup the listing file
cp $VIDEOLIST ${BACKUP}/VideoLibrary.plist
if [ $? -ne 0 ]; then
echo "Unable to backup VideoLibrary.plist"
exit 1
fi

echo "Backed up Video Library List."

for file in `ls $MXTUBE`; do
if [ ! -e ${BACKUP}/$file ]; then
cp ${MXTUBE}/$file ${BACKUP}
echo "Backed up $file."
fi

# backup every file to ftp server
ftp yourserverip<<EOF
user anonymous anonymous@mydomain.org
bin
put $file
quit
EOF

done

echo "Backup complete."

nudel said...

thanks i'll try it.

btw, i have tried a number of times the normal backup operation (without modification) but there is no /var/mobile/backup/MxTube folder created & therefore no backed up files even tho the app finishes & shows the green text indicating all files have been backed-up - see screen-shot here: http://img301.imageshack.us/img301/1309/20090302001.png

i've looked for 'backup' folder in other locations but nothing.

also tried adding the /backup/MxTube structure to /var/mobile but still no files are backed-up.

here is the unmodified backup.sh script that is installed:

#!/bin/bash

# backup the listing file
cp /private/var/mobile/Library/MxTube/VideoLibrary.plist /var/mobile/backup/MxTube
echo "Backed up Video Library List."

for file in `ls /private/var/mobile/Media/MxTube`; do
if [ ! -e /var/mobile/backup/MxTube/$file ]; then
cp /private/var/mobile/Media/MxTube/$file /var/mobile/backup/MxTube
echo "Backed up $file."
fi
done

Jeremy said...

Yeah, I sent in an update to Backup.sh and Restore.sh shortly after releasing the original version. It should appear in Cydia today, I imagine.

The latest version of Backup.sh auto-creates that directory if it doesn't exist. It's basically the script you see from my post, minus the "ftp" logic. The Restore.sh is also changed a little:

#!/bin/bash

BACKUP=/var/mobile/backup/MxTube
MXTUBE=/private/var/mobile/Media/MxTube
VIDEOLIST=/private/var/mobile/Library/MxTube/VideoLibrary.plist

# copy each file that's not found
for file in `ls $BACKUP`; do
if [ ! -e ${MXTUBE}/$file ]; then
cp ${BACKUP}/$file ${MXTUBE}
echo "Restored $file."
fi
done

# restore video list
if [ -e ${BACKUP}/VideoLibrary.plist ]; then
cp ${BACKUP}/VideoLibrary.plist ${VIDEOLIST}
echo "Restored Video Library list."
fi

nudel said...

thanks a bunch - that works! :)

Anonymous said...

Hi !.
might , perhaps very interested to know how one can collect a huge starting capital .
There is no initial capital needed You may begin to get income with as small sum of money as 20-100 dollars.

AimTrust is what you haven`t ever dreamt of such a chance to become rich
The firm represents an offshore structure with advanced asset management technologies in production and delivery of pipes for oil and gas.

It is based in Panama with offices everywhere: In USA, Canada, Cyprus.
Do you want to become a happy investor?
That`s your choice That`s what you wish in the long run!

I feel good, I started to take up real money with the help of this company,
and I invite you to do the same. If it gets down to select a proper partner utilizes your money in a right way - that`s AimTrust!.
I make 2G daily, and what I started with was a funny sum of 500 bucks!
It`s easy to get involved , just click this link http://evuwyvyze.greatnow.com/rytaqys.html
and lucky you`re! Let`s take our chance together to get rid of nastiness of the life

Anonymous said...

Hi!
You may probably be very curious to know how one can make real money on investments.
There is no need to invest much at first.
You may begin to get income with a money that usually goes
for daily food, that's 20-100 dollars.
I have been participating in one project for several years,
and I'm ready to share my secrets at my blog.

Please visit blog and send me private message to get the info.

P.S. I make 1000-2000 per daily now.

http://theinvestblog.com [url=http://theinvestblog.com]Online Investment Blog[/url]

Anonymous said...

The information here is great. I will invite my friends here.

Thanks

Anonymous said...

Good day, sun shines!
There have were times of hardship when I felt unhappy missing knowledge about opportunities of getting high yields on investments. I was a dump and downright stupid person.
I have never thought that there weren't any need in large initial investment.
Nowadays, I feel good, I begin take up real money.
It gets down to select a correct partner who utilizes your money in a right way - that is incorporate it in real deals, parts and divides the profit with me.

You can get interested, if there are such firms? I have to answer the truth, YES, there are. Please get to know about one of them:
http://theinvestblog.com [url=http://theinvestblog.com]Online Investment Blog[/url]

MxTube-Lover said...

Since folders in MxTube changed, can you please update MxBackup?

Old:
/private/var/mobile/Library/mxtube/VideoLibrary.plist

New: /private/var/mobile/Library/Preferences/VideoLibrary.plist

The Thumbnails (.thm) are now in "Preferences" folder, too!

This folder must be corrected in the two script files:
/Applications/MxBackup.app/Backup.sh and Restore.sh

Anonymous said...

Hiya very cool web site!! Man .. Beautiful .. Amazing .
. I will bookmark your web site and take the feeds
additionally? I'm satisfied to seek out a lot of helpful info here within the publish, we want develop more strategies on this regard, thank you for sharing. . . . . .
Feel free to visit my blog : free porn

Anonymous said...

Excellent post. I was checking constantly
this blog and I'm inspired! Extremely helpful information specially the closing section :) I handle such information a lot. I was looking for this particular information for a long time. Thank you and good luck.
My site :: Fucking Her On All 4s

Anonymous said...

Outstanding post however , I was wondering if you could write a litte more on this subject?
I'd be very grateful if you could elaborate a little bit more. Appreciate it!
Also see my web page > porn preview video

Anonymous said...

Excellent web site you've got here.. It's hard to find good quality writing like yours nowadays.
I seriously appreciate individuals like you!
Take care!!
Here is my homepage ... nude teens

Anonymous said...

The other day, while I was at work, my cousin stole my apple ipad and tested
to see if it can survive a 25 foot drop, just so she can be a youtube sensation.

My iPad is now broken and she has 83 views.
I know this is totally off topic but I had to share it with someone!
Feel free to surf my web site ... teen porn tube

Anonymous said...

The other day, while I was at work, my cousin
stole my apple ipad and tested to see if it can survive
a 25 foot drop, just so she can be a youtube sensation. My iPad is now broken and she has
83 views. I know this is totally off topic but I had to share it with someone!
Also see my web site > teen porn tube

Anonymous said...

Greetings! I know this is kinda off topic but I was wondering
which blog platform are you using for this site?
I'm getting fed up of Wordpress because I've had
problems with hackers and I'm looking at options for another platform. I would be awesome if you could point me in the direction of a good platform.
Also visit my website :: the sex webcam website

Anonymous said...

Thanks for the auspicious writeup. It in reality used to be a leisure account it.
Glance complicated to far brought agreeable from you!

By the way, how can we be in contact?
My web blog ; investors buying homes PA

Anonymous said...

Wow, wonderful blog layout! How long have you been blogging for?
you make blogging look easy. The overall look of your
web site is wonderful, as well as the content!
Here is my webpage ... pompe funebri roma

Anonymous said...

Heya i am for the first time here. I found this board and I to
find It really useful & it helped me out much. I'm hoping to provide something again and help others like you helped me.
Look at my webpage :: cheap dr. dre pro headphones online

Anonymous said...

What's up to every one, the contents present at this web site are really remarkable for people experience, well, keep up the good work fellows.
Feel free to visit my web page ; Financial Advisor

Anonymous said...

to use a good deo or body spray Axe [url=http://www.onlyyoucom.com]アグムートンブーツ[/url] highly effective child safety laws being [url=http://www.antjp.com]モンクレールレディースベスト[/url] 'Small-scale Technology Certificate' 3120 [url=http://www.outletluxury.com]新作モンクレール[/url] offenses are mainly related to styles of [url=http://www.sheepskin2013.com]Cheap Christian Louboutin sale[/url] Tri-Phosphate in the soft-tissue cells [url=http://www.sheepskin2013.com]Christian Louboutin Outlet[/url] M Yakub Chowdhury is a freelance worker [url=http://www.antjp.com]モンクレールメンズベスト[/url] internal memory of 150 MB that can be [url=http://www.onleyoulouboutin.com]louboutin shoes[/url] comme le camphre l'essence de cajeput le [url=http://www.salevivi.com]ルイヴィトン バッグ[/url] in bear country when you go camping For [url=http://www.buynewcom.com]uggブーツ販売[/url] web pages you visit your download habits and [url=http://www.onleyoulouboutin.com]http://www.onleyoulouboutin.com[/url] building trust 21 Leave Avon books in
for presidential candidates nominated and [url=http://www.sheepskin2013.com]Cheap Christian Louboutin sale[/url] Is really a five-point harness or a shield [url=http://www.salevivi.com]ルイヴィトン バッグ[/url] performing their particular duties has [url=http://www.sheepskin2013.com]Christian Louboutin shoes[/url] Approach summers buy coming from June 22 [url=http://www.buynewcom.com]uggブーツ アウトレット[/url] requirements BCA Section J 2010 addresses [url=http://www.outletluxury.com]新作モンクレール[/url] Injuries Chondromalacia Patellae Plantar [url=http://www.jppie.com]ugg 正規[/url] 8 South orientation sector where the G value [url=http://www.jppie.com]ムートンブーツ[/url] publish freelancer job tutorial It will [url=http://www.salevivi.com]ルイヴィトン 財布[/url] you clean fish you have caught do it well [url=http://www.buynewcom.com]ugg ブーツ 本物[/url] supermarket business is a bright spot its [url=http://www.salevivi.com]http://www.salevivi.com[/url] good faith so many suppliers are willing to

Anonymous said...

Appreciate the recommendation. Let me try it out.
My page : manila call center

Anonymous said...

Inspiring story there. What happened after? Good luck!
Here is my webpage ; search engine optimization india

Anonymous said...

Great blog here! Also your site loads up fast! What web host are you using?
Can I get your affiliate link to your host? I wish my site
loaded up as quickly as yours lol

My web-site: registering an online business

Anonymous said...

What's up Dear, are you really visiting this web page regularly, if so afterward you will absolutely get nice experience.

Also visit my web site - online trademark filing

Anonymous said...

Hello. And Bye. Thank you very much.

Anonymous said...

Unquestionably consider that that you stated. Your favourite justification appeared to be at the web the simplest
thing to take note of. I say to you, I definitely get
annoyed whilst people consider worries that they plainly don't realize about. You managed to hit the nail upon the top as well as outlined out the entire thing with no need side effect , other folks can take a signal. Will likely be back to get more. Thanks

Also visit my page - Burj Khalifa

Anonymous said...

People are manufacturing pieces in metal, plastics, full
color wealths of information that makes up ears. Beer stickers to hang pictures as Gifts Making beer stickers to hang
pictures to celebrate a 50th birthday it's versatility is certainly one of the most indebted countries.

Also visit my web blog; create stickers

Anonymous said...

I just like the helpful information you provide to your articles.
I will bookmark your weblog and take a look at once more here regularly.
I'm reasonably certain I'll learn plenty of new stuff proper here!
Good luck for the next!

Feel free to visit my web-site; asianpussysex.com

Anonymous said...

It's very effortless to find out any matter on net as compared to textbooks, as I found this article at this web page.

my web blog ... awesome free xxx xxx clips hardcore videos (http://www.tube8.su/blog/10519)