The Artima Developer Community
Sponsored Link

Web Buzz Forum
Publishing a folder with Ubuntu One

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Stuart Langridge

Posts: 2006
Nickname: aquarius
Registered: Sep, 2003

Stuart Langridge is a web, JavaScript, and Python hacker, and sometimes all three at once.
Publishing a folder with Ubuntu One Posted: Apr 19, 2012 12:38 AM
Reply to this message Reply

This post originated from an RSS feed registered with Web Buzz by Stuart Langridge.
Original Post: Publishing a folder with Ubuntu One
Feed Title: as days pass by
Feed URL: http://feeds.feedburner.com/kryogenix
Feed Description: scratched tallies on the prison wall
Latest Web Buzz Posts
Latest Web Buzz Posts by Stuart Langridge
Latest Posts From as days pass by

Advertisement

Ubuntu One has the concept of publishing a file — that is, giving a file in your personal cloud a URL so that anyone can download it, if you tell them the URL — but you can't currently do that with a whole folder of files. Since that'd be quite a useful thing to be able to do, and it's not yet supported by U1 itself, I wrote a little script to do it, u1-publish-folder (the script needs you to be on Ubuntu 12.04, which is released next week). Simply do u1-publish-folder /path/to/synced/folder and it'll give you a URL for the index for that folder; a handy way to get a bunch of files to someone without a U1 account* where they can pick and choose the ones they want (rather than sending them a zip file, or sharing a folder with them).

The way it actually works is to publish all the files in the folder, then create an HTML index file linking to all those published files, then sync and publish the index. So you get a directory listing, like Apache gives you when you browse a folder: List of files in testpublishfolder.

The thing I found nicest about this is working with SyncDaemonTool, the Python U1 controller. Combined with Twisted's defer.inlineCallbacks stuff, it makes dealing with U1 really easy:

@defer.inlineCallbacks
def dosomething():
    sd = SyncDaemonTool()
    metadata = yield sd.get_metadata("/home/aquarius/Documents/somefile")
    print metadata

Normally, dealing with async stuff is hard, but it's just dead easy this way; simply throw in a yield and you can write code as if it's normally synchronous but it's actually async, so your program doesn't block while it's working and you don't need to invent a zillion "callback" functions (whether they're anonymous functions or not). I like this.

Read: Publishing a folder with Ubuntu One

Topic: Publishing a folder with Ubuntu One Previous Topic   Next Topic Topic: Skeuomorphs and Web Design

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use