Saving a folder into Ubuntu One

I listen to a lot of audiobooks. They’re a great thing when you’re walking, or sitting on a train, or falling asleep at night.Librivox are good for this; they’re something like the Project Gutenberg of audiobooks, and they have things like Sherlock Holmes and H. P. Lovecraft and so on. I use MortPlayer Audio Books to listen to them: it’s a pretty complicated looking app, and something with a simpler UI would be nice, but it does everything I want (including having a sleep timer).

However, the flaw with audiobooks is that they take up quite a bit of disc space. I store all my audiobooks in Ubuntu One, so that to put a new book on the phone I just browse to it in the Ubuntu One Android files app and tell it to download. I created a specific cloud folder just for audiobooks (at Music/Audiobooks in my home folder) so they’re nicely partitioned away from the rest of my stuff. But, again, the flaw is disc space. I’ve now got about 10GB of audiobooks in total, and because they’re stored in Ubuntu One, that 10GB is synced with to my laptop. I’ve got an SSD in my laptop; it’s great for fast access of all my files, but it’s only 128GB in size. 10GB is a pretty big chunk of that.

Now, it occurred to me that I never actually listen to audiobooks on my laptop. So I don’t actually need those files there. If I just stored them in Ubuntu One, I’d get 10GB back, which seems like a good idea.

Now, you can do that fine; you select on a machine which cloud folders you want synced to that machine. So I can just stick those audiobooks in a cloud folder and then not sync it to this machine, and they’ll be stored only in Ubuntu One, ready to be downloaded to my phone as and when I want them. Perfect.

And indeed that’s what I did; since I already had that folder synced with my machine, I just unsynced it (open the Ubuntu One control panel, look in Cloud Folders, find Music/Audiobooks under My folders, untick it, done), and then deleted all the audiobooks from my laptop. Now they’re safe in U1 (because I unsynced that cloud folder first, remember; if I’d just deleted them from my machine, they’d have been deleted from Ubuntu One as well), and I’ve got 10GB of space back.

Then I downloaded a new audiobook (Frankenstein, as it happens), and I thought: hm, how do I get this new book into U1? I don’t want to mark the cloud folder as synced again; that’ll download all the other books. You can’t sync only part of a cloud folder. I could upload the files via the U1 website, but there are 24 files in this audiobook, one per chapter, and U1 doesn’t allow you to upload more than one file at once. (This is bug 375454.)

However, there is an API to work directly with files stored in Ubuntu One, and there’s a Python wrapper library for it (written by John O’Brien, who’s also been writing a blog about using the wrapper library.) So, I figured, what I want is a simple little executable that I drop into a particular folder on my laptop, called “Save into Ubuntu One”. When I click that file, it looks for other files in the same folder as it, and then if it finds any, checks whether they’re in Ubuntu One; if they’re not, it uploads those files. So I can drop that executable into my Music/Audiobooks folder, and then when I grab a new audiobook from Librivox, I just save it into the Audiobooks folder and then click “Save into Ubuntu One” to upload it to U1. I can then delete the book from my laptop at my leisure.

So, building that wasn’t too difficult. Drag the link into a folder that you want to do “poor man’s sync” on, as above.

Save into Ubuntu One

Then mark the new “Save into Ubuntu One” in your folder as executable, and then when you want to upload the files from there into Ubuntu One, click it and say “Run in terminal” (so you can see what it’s doing).*

I'm currently available for hire, to help you plan, architect, and build new systems, and for technical writing and articles. You can take a look at some projects I've worked on and some of my writing. If you'd like to talk about your upcoming project, do get in touch.

More in the discussion (powered by webmentions)

  • (no mentions, yet.)