How can I get the UbuntuOne URL from a file in a bash script?

Here's what my script does so far: I run the script via Nautilus Actions, and it requires one parameter and an URL in the clipboard. The parameter must be a FLAC file name. The script checks that the URL in the clipboard is valid and also if the FLAC file is a valid FLAC file. It then extracts some of the tags and produce two HTML files. One containing information about the song, the other one adding a line in an ”index file” – a file with one line per song with links to the different HTML files and so on…

Anyway, to run the script properly right now I need to do the following:
1. In Nautilus, right click the file, then Ubuntu One → Publish
2. Right click the file again, then Ubuntu One → Copy URL (sometimes I need to press F5 first for this to work properly)
3. Right click the file again, then Nautilus Actions → FLAC tags to HTML
4. The script then asks for a comment via Yad (”Yet Another Dialog” – a fork of Zenity)

So, all I want to do at the moment, is to eliminate step 1 and 2. It would be nice if the script could do that for me. The file name and path should be enough information for the script, I think.

1 Answer 1


You can use the u1sdtool command line tool to interact with ubuntuone-syncdaemon from a script. The --publish-file and --info options should let you do what you need to do. You'll have to wait until the file is actually "published" before --info will include the URL to the public file, though.

  • $ u1sdtool --publish-file "04. Mr. Moto.flac" /usr/lib/python2.7/dist-packages/ubuntuone-client/ubuntuone/platform/tools/__init__.py:484: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal success_filter=lambda info: info['path'] == path, Then nothing more happens and I need to stop it with Ctrl+c…
    – user8179
    Commented Mar 4, 2014 at 21:20
  • Sorry for ugly comment. Couldn't make new lines as I could to the original post.
    – user8179
    Commented Mar 4, 2014 at 21:21
  • I think you need to pass the full path to the file.
    – dobey
    Commented Mar 4, 2014 at 21:26
  • Tried that too with the same result. Both ”/home/…/…/filename.flac” and ”./filename.flac”. It seemed to work somehow anyway; in Nautilus the file was actually published and I could click the Copy URL right click menu option.
    – user8179
    Commented Mar 4, 2014 at 22:00
  • Also, --publish-file is not mentioned in the man page…
    – user8179
    Commented Mar 4, 2014 at 23:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .