Translate

Thursday, June 21, 2012

The Logitech saga ...

OK. Let me state as first thing, that Logitech is NOT paying me for this   :)
I love this company ! So far everything I have from Logitech is working flawlessly, from my keyboard, mouse, TV universal remote (series Harmony ... REALLY Neat !) and of course my SqueezeBox.
(well .. Mr. Logitech ... I would not be offended if you want to contribute somehow :) )

Time ago I posted some information about the SqueezeBox internet radio and it's Logitech Media Server code.
Just remember that I don't use Windows, so everything in these articles assumes we are talking about Linux. Specifically the Logitech Media Server was installed previously over an Ubuntu 10.04 distro, now is running over a CentOS 5.x one.

This time I want to discuss a little bit more about the server and other projects around it.
First of all, the SqueezeBox is still working quite great !
I updated the server and the firmware a couple of time and few days ago I decided to move the server on another machine.
Why ?  well, just to optimize the resources and free up a little bit the machine previously hosting the server.

Logitech Media Server


So I downloaded the latest version of the code and installed it from the scratch on a different machine (always on my network).
Initially it was not recognized by the SqueezeBox so I checked some things.
Here some hints and things to check :

  • Be sure that the linux machine where the Logitech Media Server  is installed has the port 9000 and 3843 open
  • Be sure that the directory where the music is stored, has the right permissions.
    The permission should be assigned to the user squeezeboxserver (created automatically during the server installation)
  • Check that the server is actually running
    I had some permission set wrong so the server crashed because it could not access the music folder for the scan
  • Give some time !!  There are some timeout involved in the system, so there is some time (15 minutes or more) before the SqueezeBox sees the server
Also remember that any time you change the Logitech Media Server code, a new firmware is loaded in the SqueezeBox !
My current version of the Logitech Media Server is the 7.7.2



SoftSqueeze

While waiting for the SqueezeBox to see the server, I found another very interesting project : SoftSqueeze.
SoftSqueeze is an open source project aimed to reproduce a SqueezeBox on a PC.
Very neat !
It requires to have Java installed.

Use on Ubuntu 10.04

I installed it very simply downloading the RPM from the website and converted it (with alien) in DEB.
Then simply I installed it.
On my machine (Ubuntu 10.04) the DEB installed the main access to the program it in the /opt/softsqueeze directory.
So in order to run it, is possible to open a terminal and then digit : /opt/softsqueeze/softsqueeze

If is working, it's easy to add an icon in a panel. In this case pointing in the /opt/softsqueeze/softsqueeze/lib is possible to find some icons.


After the installation SoftSqueeze recognized the server using the server name I assigned it.
However it was not working.

In order to have it working I had to force the IP address of the server, instead the name of the server found automatically. It is possible that is due to the fact the version of the player (SoftSqueeze) installed is optimized for the server version 7.5.x and I installed the latest one, 7.7.x.


Anyway after forcing the local IP of the server, the player started to work immediately.
So now the new server recognize the SqueezeBox and SoftSqueeze without problems.

Use on Kubuntu 12.04


I have a laptop with installed Kubuntu 12.04 (it uses KDE).
I just copied the DEB package created with alien and installed via the standard package installer.
Same identical procedure and problems find on Ubuntu.
After forcing the IP address of the server instead the found name, started to work perfectly !
Very very neat !

Like the Ubuntu 10.04, I created a link to the application and is working without problems.
So a new way to hear my collection in streaming !

Hope this can help somebody :)

Tuesday, June 5, 2012

Messages between computers (Linux)

In the era of internet, sometime small needs are solved using complicate applications, when "old" but more functional solutions are available.
If, like me, somebody has the need to exchange quick messages between users inside a LAN, here an easy and functional solution.

Problem

To better define the problem, the need is to be able to send to a user on a computer in the LAN, a brief message.
It is assumed the computer running Linux (Ubuntu).
The user doesn't have to start any application nor do something.
Ideally a "popup" window with the message appears on the screen.

Solution

Two programs are needed and "usually" they are installed by default in a standard Ubuntu and Kubuntu distribution.
It is possible to use other programs, but these two are quite easy to use and the "popup" effect is nice.
In order to receive messages, EACH computer we want be able to do so, need to have a "daemon" running.

Here some pro and cons

Pro

  • easy to implement
  • no special programs to install
  • transparent to the user
Cons
  • it is necessary to know the IP address of the computer where to send the message
    If the computer has a fixed IP is not a big deal. In a DHCP environment it could be a problem
  • it address the machine, not the user so it is implicit only ONE user is using the machine
  • ending the process that sends messages, ends also the receiver
  • in order to send more than one message, the receiver needs to acknowledge the messages hitting OK

Prerequisites

I'm assuming :
  • you are capable to open a terminal
  • you are capable to open an editor 
  • you are capable to change file properties
  • you are capable to install programs
  • you don't run in the church if you hear the word "daemon"
  • you have admin permission
If you don't understand one of more of the above prerequisites, then better to ask somebody that understand that to set up the system.

Creating the daemon


The daemon is a program that is running in background. In this case the daemon is a bash script.
Here a step by step guide to create the daemon. Remember, this must be done on each computer we want to be able to receive messages.
Of course is possible to prepare the script somewhere else and copy it on the computer.
Again, it is assumed we are using Ubuntu or Kubuntu with zenity and netcat installed.
  1. open a terminal
    You should end up in your  default home directory
  2. open an editor, for example
    $ vim bkmsg.sh
  3. insert in the file these lines :
    #!/bin/bash
    msgport=3564
    nc -l $msgport | while read message; do zenity --info --text "$message"; done
  4. save the file
  5. make the file executable
    $ chmod +x bkmsg.sh
At this point we have the daemon script ready.
To test it, simply run it in background from the terminal : $ ./bkmsg.sh &
Then open another terminal and digit : nc localhost 3564
When you hit Enter, everything you type until the next Enter, will be sent as message and a popup window will appear.
To stop to send messages, simply hit Ctrl-C.

It is important to understand that even if the script is running in background, closing the terminal where the daemon was started, will end the daemon.

Installing the daemon


We need to have the daemon installed and run automatically.
To do so, we need to put our script in the startup list of application.
Be aware that ending the process that sends messages, ends also the daemon !

Sending messages


In order to send a message to the machine, it is necessary to know :

  1. the IP address of the machine where to send the message
  2. the port used to send message (the one in the script, in the example above it would be 3564
The is enough to open a terminal and digit :

$ nc ip_address_where_to_send_the_msg port

For example if the machine has the IP address 192.168.1.134 and the port the one of the example :

$ nc 192.168.1.134 3564

After that every thing written will be sent to the remote machine after hitting the key Enter.
To close the process, hit Ctrl-D or Ctrl-C.
Be careful that doing so, will close also the daemon on the remote machine !