Tuesday, January 4, 2011

Ushare made easier!

For those who don't know, USHARE is a free UPnP A/V & DLNA Media Server for Linux. If that didn't clarify much, it means it can convert your Linux PC into a streaming media center compatible with both Playstation 3 and Xbox 360, among other devices.

Ushare configuration is not necessarily complicated, but it does require some CLI skills and is not that flexible. There are two main ways in which Ushare can be configured:

  1. AD-HOC: Opening a terminal window and running ushare with the correct parameters. For example:

    ushare --name=Ushare -D --dlna --interface=wlan0 --content=/shares2

    The line above creates a streaming session named "Ushare" as a daemon, using interface wlan0 and the PS3 streaming protocol, as well as sharing contents from the folder "/shares2".

  2. FIXED: Ushare uses a default configuration file, /etc/ushare.conf, which allows users to configure all parameters so they remain static and Ushare always streams the same media through the same protocol.

I personally find both methods flawed, either cumbersome or not flexible enough. I own both a PS3 and an Xbox 360, so I want the flexibility to easily select the streaming protocol on the fly. More over, it isn't necessarily the smartest thing to share a big folder full of media files, for it may complicate things and make indexing slower.

As a result, I thought it would be better if there was a GUI interface that simplified the creation of a Ushare streaming session on the fly and in a matter of seconds, allowing users to easily share the specific media they are interested on. Such interface would not only help unexperienced users that do not feel comfortable using the CLI, but it would also save time for more experienced users.

INTRODUCING UCT

To cope with the requirements above, I created UCT (Ushare Configuration Tool), a script that brings Ushare closer to the GUI and makes its configuration just a few clicks worth. An image is worth a thousand words, but in this case I recorded a video of UCT in action:



NOTE: I recommend watching this video fullscreen and in 720p resolution.

To further explain what is going on in this video, here's a step by step run through:

I first ran UCT from a desktop launcher. When the script starts up, it checked that Ushare was installed and that there were no previous active sessions running. It then proceeded to gather information about a few parameters so it can start a new streaming session, namely:

  • Network Interface: Defaults to wlan0, but a number of options are offered. If none of the options available fits the user setup, UCT cannot automate the creation of a session, so it quits. MANDATORY.
  • Session Name: Defaults to "Ushare", so the field can be left blank or skip this step entirely.
  • Device: Defaults to Playstation 3. MANDATORY.
  • Share: Select a folder to be shared. Note that subfolders inside the selected folder will be streamed as well. MANDATORY.

With all the necessary information, UCT started a streaming session. I opened a terminal so I could display the active daemon process running. After that, I ran UCT again, which in turn detected that a previous instance of Ushare was already active. As a result, it offered the user an option to shut it down, but because killing processes requires admin privileges, credentials must be entered.

INSTALL UCT

I hope you agree UCT simplifies using Ushare on a day to day basis, saving configuration time and adding flexibility. I am using it often and I am more comfortable streaming now than I ever have been. In the past there was always uncertainty about whether I typed the command correctly, but now it's just a few clicks and it's done.

Installing UCT is pretty simple, just follow these few steps:

  1. Download UCT.sh from HERE
  2. Store UCT.sh locally and grant it execute rights from the GUI. To do it from the CLI:

    chmod +x UCT.sh

  3. Create a launcher so that UCT can be started with a couple clicks from the GUI (optional).

That's all there is to it, really... other than having Ushare installed, of course! ;-)

A FEW THINGS TO KEEP IN MIND:

- UCT does not provide an interface to modify the port Ushare uses for streaming, so it will need some manual tweaking if the default port used by the application is no good.

- It should be noted that firewalls can get in the way and prevent Ushare from streaming correctly, so the necessary exceptions will need to be managed by the user.

- I have tested UCT extensively and am confident it works solidly. Having said so, that applies to my hardware running Ubuntu 10.10, so (although unlikely) you may experience a different behavior under different hardware/distro combinations.


TRY, TEST, ENJOY... IMPROVE!

I created UCT for my own use, but of course I would be glad if it would help others as well. Therefore, I encourage everybody to give it a go and let me know their experience. Please report unexpected behavior or bugs... and if you enjoy using it, of course!

If you would like to improve UCT, I am perfectly fine with that, I would only ask you keep my name in the script credits.

Thanks for reading!

9 comments:

  1. looks like a fine idea, will download it and try it. thanks. is it a bash script to edit?

    ReplyDelete
  2. Great bit of script... very handy, works well.

    ReplyDelete
  3. You sir, are my messiah. Thanks! :)

    ReplyDelete
  4. Hi.. UCT does not show my DLNA certified Mobile Phone! Any help?

    ReplyDelete
  5. Hi

    Akkash, UCT should not show anything, it simply starts sharing content over a specific protocol. If you want to do so over DLNA, select the PS3 option, then it´s up to your mobile phone to detect the stream and allow you to work with it.

    In any case, my aim with this script was to make it work for Xbox360/PS3. I don´t have a smart phone to test with, so they are officially out of scope.

    ReplyDelete
  6. Hi,

    Just wondering if I could get some help..This was exactly what I was after! and great work...I did the above and it worked no problems straight away - streamed music. I have two laptops and 2 xbox's in the house, and after that first time I can no longer get it work with either laptop or xbox. I got through and select the wlan, xbox 360, folders etc - ushare shows up on the xbox but it fails to load any of the folder contents.. this is on both laptops and both xbox's. Any ideas would be much appreciated!

    ReplyDelete
  7. @Clinton: Hmmm... that's strange indeed. Ushare is not rock solid by any means and I have had my share of glitches while using it, but I certainly was able to use it more than once.

    Finding what is failing should not be rocket science, though. There are only a few parameters involved, so I guess you need to investigate them one by one.

    First off, can you make sure your wireless interface hasn't changed? Run ifconfig -a (as root) and make sure wireless is still sitting on wlan0.

    If there are no changes there, next stop is your firewall, should you be using one. If so, I would recommend stopping it temporarily and testing whether UCT works after that. If it does, you will need to define exceptions in your firewall to allow Ushare traffic through.

    If none of that helps, I would try to run Ushare straight from the command line to see what it does and if it throws any errors at you. In your case, it should go along the lines of:

    ushare -D --xbox --name "NameOfYourChoice" --interface wlan0 --content="PathOfYourChoice"

    Hope that helps. It's always very difficult to try to help without seeing the problem, but if I had to bet, I'd go with the firewall thingy.

    Good luck!

    ReplyDelete
  8. I realize this post is pretty old, but I'm having a slight problem with ushare and was wondering if I could get some help. I've run sudo dpkg-reconfigure ushare and it walked me through the setup, but when it came to the part where you select the network interface, wlan0 was not an option. I added it in /etc/ushare.conf and selected it, but now when I start ushare it gives me the error "can't find interface wlan0." How can I configure ushare to use wlan0 as the network interface?

    ReplyDelete
  9. Hey Max,

    Maybe a stupid question, but are you sure wlan0 is among the available interfaces? Have you run ifconfig -a? Is wlan0 in there?

    ReplyDelete