Showing posts with label media players. Show all posts
Showing posts with label media players. Show all posts

Saturday, 2 November 2013

Setting up a Raspberry Pi as a home server

A lot of people have spoken about the potential uses for a Raspberry Pi, however a lot of these are often very specific to be of use to anybody other than the project creator (using it as part of a home made weather balloon system for example).  When I purchased my Raspberry Pi it was for a specific purpose; the old PC that I used as a home server had given up the ghost and I needed a replacement.  The Raspberry Pi seemed like the ideal answer as it was small and used a lot less electricity (a big plus for a piece of equipment that is going to be on 24/7).

Before we start there are a few things you will need:

  • A Raspberry Pi
  • A computer with internet access 
  • Raspian linux distro
  • An SD Card (4GB minimum)
  • An SD Card reader/slot on your computer
  • External USB hard drive (this will need to be large if you plan to have video and music files on it, I recommend about 2TB minimum)
  • Micro USB charger (my old one from a previous Android phone did the job)
  • A wired USB keyboard
  • An ethernet cable
  • An HDMI cable
  • A monitor/TV with an HDMI connection

1. Firstly we are going to need to install Raspian onto the SD card, for full instructions on how to do this I recommend reading this how to guide. However I kept it simple and used the command line on my Linux system.

Firstly we need to extract the file out of the Zip archive.  Navigate to the place where the downloaded file is and enter the command:
unzip {thefilename}

As these change every time a new version is released the command will alter depending on the image that has been downloaded.

2. Now to get the image onto the SD card.  I needed to use the bs=1M option in the command as the install failed twice with bs=4M, it stated that it would take 'considerably' longer, but the whole process was still fairly quick:
dd bs=1M if={location of raspian.img file} of={location of SD card}

If your not sure what the location of the SD card is then make sure it is removed from the computer and in the command line type:
df -h

Then insert (and mount) the SD card and retype the command:
df -h

There will be an additional item on the list:

In the example above the location of the card is /dev/sdc, we ignore the number as this refers to the partition.

3. Once the process has been complete, unmount the SD card and insert it into the Raspberry Pi.  Connect your keyboard and external hard drive via the USB ports and then connect the Pi to your router and TV before finally giving it power.

4. When you first power up the Raspberry Pi you are asked for some initial settings:


Firstly we'll want to expand_rootfs, this means that we'll be able to use the entire SD card if we ever need to.

We need to know the password, so the next thing we'll do is change the password, to do this simply select change_pass and enter in your new password.

configure_keyboard, change_local and change_timezone allow the user to set the keyboard layout, the location and the local time zone (these are all UK by default).

As this is a server we won't have it connected to a monitor for the majority of
it's life so make sure that we do not start the graphical desktop on boot, boot_behaviour changes this setting.   Although this may look nicer, the Raspberry Pi has limited power and we want this to focus on sharing our files over a server, not looking pretty.

5. To allow us to share our files over a network we will install Samba:  
sudo apt-get install samba

6. To find UUID and the file system of the drive, enter:
sudo blkid

This will give an output similar to the one below:


We can ignore the line that has the TYPE="fat32" as this is the SD Card, take a note of the other line, you need the UUID and the Type, the labels aren't important at this point (depending on the formatting some drives may not have a label)

7.  We need to mount this drive automatically whenever the Raspberry Pi is switched on. Firstly, we'll need to create a location to mount the external hard drive, we can do this by using the command:
sudo mkdir /media/external

Now we need to edit the fstab to tell the Raspberry Pi to automount the external drive every time it is switched on
sudo nano /etc/fstab

Insert the following line at the bottom of the page:
UUID="{the UUID you noted down in step 6}"     /media/external    
{type noted in step 6}     auto,user,rw      0     0

The above should all be on one line, pressing the key to create a gap between each piece of information.

8. Now we need to set up which folders are going to be shared.  I'll assume that we are going to make the whole of the external drive available over the network
nano /etc/samba/smb.conf

at the bottom of the page add the following, note that you can call this anything you wish, just exchange the word external but you must include []
[external]
path = /media/external
available= yes
browsable = yes
public = yes
writable = yes

It's worth noting before we continue that I've set the option writable - yes, this means that you can add to or remove the contents of the external drive over the network.  If you are not comfortable having this option then simply change it to writable = no. Now save and exit (ctrl + X), make sure that you answer 'yes' to save your changes. 

9. We will now set the Raspberry Pi to log in automatically on startup, if the user Pi isn't logged in then all of things we've just set up will not work. Type:
sudo nano /etc/inittab

navigate down to the line:
1:2345:respawn:/sbin/getty --noclear 38400 tty1 

and add --autologin pi after getty to make the line:
1:2345:respawn:/sbin/getty --autologin pi --noclear 38400 tty1

save and exit (ctrl + X) make sure that you answer 'yes' to save it.

10. We're going to need one more piece of information before we finish.  I've had trouble in the past browsing Samba share folders using assigned names rather than IP addresses.  So to find the IP address of the Raspberry Pi type
ifconfig eth0

You'll be given a an output similar to what is shown below:

The part that is circled in orange (inet addr) in the above image is what you need to note down.  We'll need this to test the share drive later on.

11. We can try it out our system and auto-login by using the command
sudo reboot

Assuming that everything goes well, your system should be up and running.

Lets try this out on a different computer or device.

Load up your chosen file manager, most have location bar at the top (similar to the address bar on a browser).  Enter the following in the location bar: smb://{your Raspberry Pi's IP address from step 10}

You should now be able to access the files on the external hard drive connected to your Raspberry Pi.

Congratulations you've now set up your home server.

Friday, 13 May 2011

Pogo music player



Having recently volunteered to do a bit of graphics work for a project called Pogo, I thought I should investigate this application a bit more and even give it a trial run. I have to confess, at the time the email came in requesting help with a logo I accepted the challenge without even knowing what the application did.

After briefly reading through the email and several brief conversations between the creator Jendrik Seipp and myself, I took a look at the website, which to my disappointment was simply a launchpad page. So the first thing that struck my mind was that this was, primarily, an Ubuntu project. The choices for download are a *.deb file or the source data in a *.tar.gz file. As I have Crunchbang installed on my system anyway I opted for the deb file simply to make life easier.


The install went smoothly and very quickly I had the Pogo music player (0.4 at the time of writing this) up and running:


The user interface is very simple; a window split into two screens. The left screen is a tree view of your files, this can be navigated quite easily for any music that is in your home folder. However for files that are on a separate partition, you will need to go all the way back to / and manually find the mount point of the drive (usually /mnt or /media depending on your distro). The partition must be mounted already as there is no way to mount it from Pogo.

The right screen is your playlist, to add a music file you can either double click on it in the left screen or drag it into the right screen using the mouse and holding the left button. The responsiveness of Pogo is very good indeed, it is lightning fast and the files play without any delay. Whilst playing, a progress bar appears at the top, which can be dragged to get the position in the file you want, handy for longer podcasts. Also the cover of the album appears in the bottom right of the window.

True to Ubuntu style, whenever a new track starts a notification pops up in the top right of your desktop just under the system tray (again this is depending on your desktop environment, but this is the case in XFCE). These, thankfully, can be turned off with a single click in preferences.


A search function is also included to allow you to look out your favourite bands or songs quickly, however all it kept giving me was a "no tracks found" message. Take a look at the screenshot below, look at the search, now compare the result with the tracks that are currently playing:


There are a few major omissions that I simply couldn't live without with regards to my media player:
  1. The lack of a shuffle option (this apparently is set to be included in the next release)
  2. The ability to add all the files from a folder, instead of selecting the files and moving them over to the playlist screen.
  3. The ability to stream from the internet
This isn't aiming to be VLC. It is a fast and simple music player and, if I'm being honest, it plays files and uses up hardly any resources in the process. The notifications that can't be interacted with are very much in line with the current Ubuntu trend. I feel that this project is best suited to low spec machines and (very early stage) newbie users, those like your older relations who only want to play a few files. Pogo adopts a 'keep it simple' philosophy, the lack of options and buttons make it incredibly easy to use. I'll keep an eye on this project, but I won't be uninstalling VLC quite yet. A bit too basic for my needs at the present time.

Monday, 9 May 2011

Saving BBC iplayer programmes



The BBC iplayer offers viewers a chance to catch up on programmes that have recently been shown on the channels. However this is for a strictly limited period and many of the programmes shown will not be released on DVD. A lot of us still don't have DVD recorders, most of us have disconnected the video recorders, although Sky+ does allow us to store programmes, they can only be stored to the local box and not to portable devices or even other TVs in the house.

However there is an easy way to download the programmes, we only need two applications installed on our home PC:
  1. get_iplayer
  2. flvstreamer
Both of these are available in the Debian/Ubuntu repositories, you can get these by opening up the terminal and entering the command:
sudo apt-get install get-iplayer flvstreamer
Users of Fedora or other distros based on Red Hat will need to make sure that the rpm fusion repository is enabled. Once this has been done then it is simply a matter of opening the terminal and entering:
sudo yum install get_iplayer
The application is now installed on your machine however it is a command line tool and therefore will not show up on your applications menu.

Using get_iplayer

1. To use it go to the BBC iplayer website and select the programme of your choice:


2. Copy the web address of the programme from the address bar.


3. Open up a terminal

4. type: get_iplayer --pid={the web address of your chosen programme} if you want the video in HD then add the command --vmode=flashhigh after the web address


get_iplayer will start to convert the film and it will be saved as an MP4 file.


The file is now saved on your computer, the best part is that it is now DRM free, you can watch it on your media player, phone (you may need to perform a bit of converting/editing) or any other PC in the house. If you want to watch it on your home TV through your DVD player then that is also possible (I personally recommend DeVeDe for that task). Enjoy your videos.


Friday, 21 May 2010

Switch to Ogg Vorbis

Everybody with a PC on the planet has heard of MP3. Some may know a little about wav and wmv but very few people have heard of the Ogg Vorbis file format (commonly refered to as Oggs).

You may ask why should I care? I have used MP3s for ages and I'm happy with them. Well you have the right to ask that and if anybody is going to convert from any form of media or software that works for them, then they will need a bit of convincing. People are not going to simply stop using one form of music file and switch to another over night.

The main selling point of Oggs is their free and openness. Should you choose to purchase a song from itunes, Napster or any other online music store then it may come with something called DRM (Digital Rights Management) this stops you from playing the file on another PC, MP3 player and can also stop the file being burnt onto CD; a bit unfair for something you purchased, right? Ogg files are DRM free due to their open nature; when you download an Ogg file you can burn it to CD, play it on as many PCs and media players as you wish.

OK then you may respond "I don't buy MP3s so this does not affect me." Well the other main point without getting too technical is that Oggs are smaller file sizes than their MP3 equivalents. Which means that you can get more music files onto your media player. Of course not all media players play Ogg Vorbis yet, a list of players that play Ogg natively can be found here.

CDs can be ripped directly to Ogg using a variety of software. If you run a Linux distro then the standard CD ripping software should convert your CDs to Ogg files by default. For a Windows platform then there a variety of packages that can do this, the Free Software Foundation recommend CDex. Music Man can be used to rip Ogg using a Mac platform.

One piece of advice I would give any users changing from MP3 to Ogg is not to convert the software; rip from a CD when possible. Why? Well both MP3 and Ogg are known as 'lossy' which means that every time you convert a file to them you lose a bit of quality. There are plenty of MP3 to Ogg converters available, but I would only recommend this as a last resort, for best results rip from a CD.

Most media players will play Ogg files with a bit of tweaking, but I would personally recommend VLC player. This is cross platform and plays Oggs 'out of the box'.

I personally use my GP2X Wiz and my Android phone, both of which play Ogg without any modifications. I've also been recommended Sansa Clip by gadgetwisdom on identi.ca, but I have no personal experience with this player.

The link earlier in the post gave a list of media players that currently play Ogg. I am aware that the Ipod is probably the biggest selling MP3 player and it's not on the list. This is not a problem, I have an Ipod Classic and it runs Ogg fine with a wee bit of fine tuning, watch the video below for more information:



Check out the Rockbox site if your MP3 player is not listed as compatible, it may be able to allow your MP3 player to run Ogg Vorbis.

Now that you know what it is spread the word: the Free Software Foundation have a pre-written email available for copying here.

PlayOgg