August 07, 2013

Netflix on SUSE Linux Enterprise Desktop

Netflix provide a means for you to watch stuff on your 'smart' TV, your iThing, your Androids and your computer, unless it runs Linux. To watch in a web browser on a computer you need Silverlight and of course there is no Silverlight for Linux. Apparently Netflix are ditching Silverlight, but right now you still need it. Inevitably lots of people using Linux want to watch Netflix on their computer and have been hacking together ways to achieve it. Here is my take on it, which works on SUSE Linux Enterprise Desktop 11 SP3 64bit. It's put together from various sources with some adaptations.

One additional package is needed which isn't included in a default SLED 11 SP3 64bit install and that's alsa-plugins-pulse-32bit. Without that you won't get any sound. Apart from installing that package it's all done as a regular non-root user and everything is kept nice and neat in one single directory.

$ cd 
$ mkdir netflix

Go to http://www.compholio.com/wine-compholio/#download get the x86-64 wine-compholio alien-ized RPM and save it to the netflix directory you just created. Wine Compholio Edition is a build of Wine with special patches which amongst other things, make Netflix work. Hurray for that guy.


Go to ftp://ftp.mozilla.org/pub/firefox/releases/ and get the 32bit Windows version of Firefox. Apparently it doesn't matter what version you get. I used what is at time of writing the latest 17ESR release, 17.0.8. Save the installer to the to the netflix directory

$ cd netflix
$ mkdir wine
$ cd wine
$ rpm2cpio ../wine-compholio-1.5.30.x86_64.rpm | cpio -idmv
$ cd ..
$ export PATH=${PATH}:${PWD}/wine/opt/wine-compholio/bin/
$ export WINEARCH=win32
$ export WINEPREFIX=${PWD}/winerootdir
$ wine Firefox\ Setup\ 17.0.8esr.exe

If asked about a Gecko-Wine installation, say yes. I said yes when I was asked. I ran through this process from scratch multiple times and wasn't always asked though. Couldn't work out why. Anyway, say yes if asked. Select Custom install and untick the option to put an icon on the Desktop to avoid ending up with a weird and unhelpful Firefox icon on your Desktop which launches the Windows version of Firefox. Untick the 'Launch Firefox' option at the end of the install.

Get and install Silverlight 4. I tried Silverlight 5 and Firefox locked up when I tried to watch anything on Netflix. I was able to watch Silverlight video on another website I tried though, which is curious, but so it goes with this sort of thing.

$ wget http://silverlight.dlservice.microsoft.com/download/6/A/1/6A13C54D-3F35-4082-977A-27F30ECE0F34/10329.00/runtime/Silverlight.exe
$ wine Silverlight.exe /q

Get Winetricks and use it to install the Microsoft Core Fonts for the Web. If you don't have these the Netflix player chucks an error and won't play anything.

$ wget http://winetricks.org/winetricks
$ chmod u+x winetricks
$ ./winetricks corefonts

Now make a script to set all the required environment variables and launch Firefox.

$ touch netflix
$ chmod u+x netflix

Open the netflix file with your text editor of choice and paste in

#!/bin/bash
scriptdir="$(cd "$( dirname "$0" )" && pwd )";
PATH="${PATH}:${scriptdir}/wine/opt/wine-compholio/bin/" WINEARCH=win32 WINEPREFIX="${scriptdir}/winerootdir" wine "C:\\Program Files\\Mozilla Firefox\\firefox.exe" http://netflix.com/

Whenever you want to run it

$ ~/netflix/netflix

Watch and enjoy. The first time you watch anything you'll get a Silverlight dialogue prompting you to 'Enable playback of protected content'. Do so if you want to be able to watch anything.

I've found that the video is watchable, but not as smooth as it could be even on a machine with an i7 processor. It seems smoother on that other site I mentioned earlier which again, curious but so it goes. I've found audio to be fine.

If like me you're one of the many people who don't live in the United States of America but occasionally wants to watch something that's available on US Netflix but not your regional Netflix, install the Hula Firefox extension and enable it when you want to access US Netflix.


May 06, 2013

Controlling LED on front of Pogoplug V2

I've recently been looking for some sort of network storage solution. My requirements were that it should be very flexible, both in terms of what it can be made to do and storage expandability, be easy to backup to something I can take off site, low power usage, low set up cost. I ended up buying a couple of Western Digital 2TB USB drives and attaching them to Pogoplug V2 that I found for sale on Amazon from a third party which I then made run Arch Linux ARM The V2 is a bit old now, the Pogoplug devices are currently on the fourth generation, but everything I read (e.g. http://fortysomethinggeek.blogspot.co.uk/2013/03/pogoplug-series-4-archlinux-review.html) indicated that the V2 is actually better for my purposes. The V4 has USB 3 ports compare to the USB 2 ports on the V2, but it negates the advantage by having a weaker CPU and fewer ports.

Anyway, the Pogoplug V2 (mine is actually black) has an LED illuminated logo on the front and it's possible to control that from within the Arch install. So I wrote I couple of scripts to do that.

One of them can be used to set or save the current colour and restore a saved colour.

#!/bin/bash

# /usr/local/bin/ledcolour

# n.b. blue is actually orange
trigger_green=/sys/class/leds/status\:green\:health/trigger
trigger_orange=/sys/class/leds/status\:blue\:health/trigger

save_green="/tmp/$(basename $0)_save_green"
save_orange="/tmp/$(basename $0)_save_orange"

if [ ! -w "${trigger_green}" ];then
echo "trigger files are not writable or do not exist. try as root"
exit 1
fi

if [ -z "${1}" ];then
echo "Usage: $(basename $0) colour|save|restore"
echo "Examples:"
echo "$(basename $0) green"
echo "$(basename $0) yellow"
echo "$(basename $0) orange"
echo "$(basename $0) off"
echo
echo "Save current led state with"
echo "$(basename $0) save"
echo "and restore it later with"
echo "$(basename $0) restore"
exit 1;
fi

case $1 in
"green" )
echo default-on > "${trigger_green}";
echo none > "${trigger_orange}";
;;
"orange" )
echo none > "${trigger_green}";
echo default-on > "${trigger_orange}";
;;
"yellow" )
echo default-on > "${trigger_green}";
echo default-on > "${trigger_orange}";
;;
"off" )
echo none > "${trigger_green}";
echo none > "${trigger_orange}";
;;
"save" )
grep -o '\[.*\]' "${trigger_orange}" | sed 's/\[//;s/\]//' > "${save_orange}";
grep -o '\[.*\]' "${trigger_green}" | sed 's/\[//;s/\]//' > "${save_green}";
;;
"restore" )
cat "${save_green}" > "${trigger_green}";
cat "${save_orange}" > "${trigger_orange}";
;;
esac


The other can be used to flash between off and a specified colour or cycle through a sequence of colours. It allows specifying the duration for each colour and the number of iterations.

#!/bin/bash

# /usr/local/bin/ledflash

# save current led state
ledcolour save

# restore that state on script exit
trap "ledcolour restore" EXIT

if [ -z "${1}" ];then
echo "Usage: $(basename $0) colour[,colour[,colour]] [interval] [iterations]"
echo "Examples:"
echo "Flash green for ever with default interval:"
echo "$(basename $0) green"
echo "Flash green for ever with interval of 0.5 seconds:"
echo "$(basename $0) green 0.5"
echo "Flash green and yellow for ever with interval of 0.5 seconds:"
echo "$(basename $0) green,yellow 0.5"
echo "Flash green yellow orange five times with interval of 5 seconds:"
echo "$(basename $0) green,yellow,orange 5 5"
exit 1;
fi

p=1;
test -n "${2}" && p=$2

iterations=0
test -n "${3}" && iterations=$3

OIFS=$IFS
IFS=,
colourarray=($1)
IFS=$OIFS

if [ ${#colourarray[@]} = 1 ];then
colourarray[${#colourarray[*]}]='off';
fi

flipon=${#colourarray[@]}
flipcount=0;

loopcount=0;
while true;do
ledcolour ${colourarray[flipcount]};
sleep $p;
((flipcount++))
if [ $flipcount -eq $flipon ];then
flipcount=0
((loopcount++))
test $loopcount -eq $iterations && exit;
fi
done

Edit: forgot to say, there is a file called brightness in the directory along with the trigger file and a max_brightness file that suggests the brightness file takes a value up to 255. Sadly no matter what value I put in the brightness file, the brightness of the LED(s) did not change. I couldn't find any information about controlling the brightness. Which is a shame. I was hoping to write a script to mimic the pulsing power LED of a sleeping Mac.


April 23, 2013

Sticks will still not detect bombs

Follow-up to A stick will not detect a bomb. from Mike's blag

James McCormick guilty of selling fake bomb detectors:

http://www.bbc.co.uk/news/uk-22266051


March 09, 2013

Webcam timelapse – January 2013 and February 2013

Follow-up to Webcam timelapse – Monday 10th December 2012 – Sunday 16th December 2012 from Mike's blag

This time, entire months. As before, images grabbed from webcam once per minute. Videos are made at 48 images per second.


January 2013. If you want to see snow skip to 6:00. There's several instances of snow. You can also see the snow hangs around for ages on the roof on the far right.



February 2013.



February 14, 2013

B–em

Follow-up to BBC Computer 32K, Acorn DFS, BASIC from Mike's blag

So I found a better BBC Emulator than BeebEm. It's called B-em. Why is it better?

  • It was last updated about a year ago rather than about 5 years ago. Newer is better, right? Sure it is.
  • It allows easy modification of the keyboard layout, including a menu option to remap A/S to Caps Lock/Ctrl which makes playing Arcadians practical. This is nicer than mucking around with setting an environment variable for SDL to make Caps Lock work like a regular key and using xmodmap to remap keys, which is how I made Arcadians playable with BeebEM.
  • It makes disk-drive like noises when you run disks.
  • Probably other... things... maybe...

I run it on SLED 11 SP2. If you want to do likewise, here's how.

If you don't already have it, get the SLE-SDK from http://download.novell.com/Download?buildid=NgW3ToaagDQ~ and use YaST to add it as an Add on Product.

Install the following packages: cmake zlib-devel libpng-devel libjpeg-devel xorg-x11-libX11-devel libogg-devel freetype2-devel libpulse-devel alsa-devel flac-devel libvorbis-devel alsa-oss automake gcc make gcc-c++

Then, as a regular user, run these commands:

$ cd
$ mkdir b-em
$ cd b-em
$ export PKG_CONFIG_PATH=${PWD}/lib/pkgconfig/
$ export PATH=$PATH:${PWD}/bin
$ export LD_LIBRARY_PATH=${PWD}/lib
$ export LIBS="-L${PWD}/lib"
$ export CPPFLAGS="-I${PWD}/include"
$ curl -L http://sourceforge.net/projects/alleg/files/allegro/4.4.2/allegro-4.4.2.tar.gz/download | tar zxvf -
$ cd allegro-4.4.2/
$ mkdir build
$ cd build
$ cmake -DWANT_LINUX_CONSOLE=on -DCMAKE_INSTALL_PREFIX:PATH=$(dirname $(dirname $PWD)) ..
$ make install
$ cd ../..
$ curl http://kcat.strangesoft.net/openal-releases/openal-soft-1.15.1.tar.bz2 | tar jxvf -
$ cd openal-soft-1.15.1/build
$ cmake -DCMAKE_INSTALL_PREFIX:PATH=$(dirname $(dirname $PWD)) ..
$ make install
$ cd ../..
$ curl http://connect.creativelabs.com/openal/Downloads/ALUT/freealut-1.1.0.tar.gz | tar xzvf -
$ cd freealut-1.1.0/
$ ./configure --prefix=$(dirname "${PWD}") && make && make install
$ cd ..
$ curl -L http://b-em.bbcmicro.com/B-emv2.2Linux.tar.gz | tar xvfz -
$ for i in INSTALL depcomp COPYING compile;do unlink $i; ln -s /usr/share/automake-1.10/$i;done
$ ./configure --prefix=${PWD} && make
$ mv b-em b-em.real
$ cat > b-em << EOF
#!/bin/bash
dir="$( cd "$( dirname "$0" )" && pwd )";
export LD_LIBRARY_PATH="${dir}/lib";
cd "${dir}"
./b-em.real
EOF
$ chmod u+x b-em


Grab the images for your favourite games from somewhere such as Stairway to Hell and run the b-em executable

$ ~/b-em/b-em

F11 shows/hides the menu. Once you've loaded a disk you need to hide the menu again and press Shift-F12 to run it.

Obligatory screenshot:

Arcadians running on B-em

The trick to maximum points in Arcadians is to only shoot the aliens whilst they're swooping down. You get double the points for picking them off whilst they're in motion.


January 28, 2013

(=75D96–O9&4`

M8V]N9W)A='5L871I;VYS+"!Y;W4@87)E(&]L9"!E;F]U9V@@=&\@<F5M96UB
M97(@=VAE;B!U=65N8V]D:6YG(&%N9"!U=61E8V]D:6YG(&9I;&5S('=A<R!A
2('1H:6YG('!E;W!L92!D:60*
`


January 24, 2013

Intriguing square pattern in snow

This is what the snow on the paving slabs in my garden looked like yesterday morning (click to embiggen):

Snow squares on paving slabs.

I figure it's caused either by aliens or physics. Are you an alien? Are you a physicist or other type of scientist? Can you explain why how this pattern comes about?


January 13, 2013

Useless visualisation of data – logins.

Sometimes I like to see if I turn a bunch of data in to some sort of image. Not an image that's in any way useful for comprehending the data though. Just because.

Each square is one of 100000 instances of someone logging in to a computer (click to embiggen):

100000 logins

The position on the x axis represents the hour and minute at which the login occurred. Position on y axis is the seconds. The colour of each square is a function of the date, month and the IP address of the computer.

Each square is added to the image individually, placed over the top of whatever is already there. The opacity of each square is 50% and the blending method is Imagemagick's ModulusAdd. (The very first run I used 'Plus' and was briefly puzzled by the result being all white :) )


January 03, 2013

Handbrake on SLED 11 SP2 revisited

Follow-up to Handbrake on SLED 11 SP2 from Mike's blag

I decided to figure out what needed to be done to build the currently current version of Handbrake, 0.9.8, on SLED 11 SP2.

If you don't already have it, get the SLE-SDK from http://download.novell.com/Download?buildid=NgW3ToaagDQ~ and use YaST to add it as an Add on Product.

Install these packages: doxygen yasm patch autoconf automake libbz2-devel libwebkit-devel libnotify-devel libgudev-1_0-devel gstreamer-0_10-plugins-base-devel dbus-1-glib-devel libtool gcc gcc-c++ intltool gtk2-devel glib2-devel zlib-devel libogg-devel

Then run the following commands. hbinstdir is where Handbrake gets installed to, change the value if you want. You can omit the lines relating to libdvdcss if you already have that installed somewhere Handbrake will find it, or if you don't want to be able to rip any DVDs that use CSS.

$ hbinstdir=/local/myapps/handbrake/
$ mkdir handbrakebuild
$ cd handbrakebuild
$ curl http://ftp.gnu.org/gnu/automake/automake-1.12.tar.gz | tar xvfz -
$ cd automake-1.12/
$ ./configure --prefix="${hbinstdir}" && make && make install
$ cd "${hbinstdir}"share/aclocal
$ for i in /usr/share/aclocal/*;do ln -s $i;done
$ cd -
$ cd ..
$ curl http://fribidi.org/download/fribidi-0.19.5.tar.bz2 | tar xvfj -
$ cd fribidi-0.19.5/
$ ./configure --prefix="${hbinstdir}" && make && make install
$ cd ..
$ curl http://download.videolan.org/pub/libdvdcss/1.2.12/libdvdcss-1.2.12.tar.bz2 | tar xvfj -
$ cd libdvdcss-1.2.12/
$ ./configure --prefix="${hbinstdir}" && make && make install
$ cd ..
$ export PATH="${hbinstdir}bin:${PATH}"
$ export FRIBIDI_LIBS="-L${hbinstdir}lib/ -lfribidi"
$ export FRIBIDI_CFLAGS="-I${hbinstdir}include/"
$ export LDFLAGS="-L${hbinstdir}lib/ -lfribidi"
$ curl -L "http://downloads.sourceforge.net/project/handbrake/0.9.8/HandBrake-0.9.8.tar.bz2?r=http%3A%2F%2Fhandbrake.fr%2Fdownloads.php&ts=1356991772&use_mirror=garr" | tar xvfj -
$ cd HandBrake-0.9.8
$ sed -i 's/autoreconf -I m4 -fiv/sh autogen.sh/' contrib/libvorbis/module.defs
$ ./configure --prefix="${hbinstdir}" --launch --launch-jobs=0 --verbose

Assuming the build process finishes without errors then install

$ cd build && make install

The binaries have been compiled against fribidi-0.19.5 but they're dynamically linked. So if you have the version of fribidi that's included with SLED installed the binaries will find and use that by default. If you don't have fribidi installed, they'll be looking for something that doesn't exist. So to make the binaries look at the right version of fribidi they need to be run in a wrapper

$ cd "${hbinstdir}/bin"
$ mv ghb ghb.real
$ mv HandBrakeCLI HandBrakeCLI.real
$ cat > ghb << EOF
#!/bin/bash
dir="\$(dirname "\$( cd "\$( dirname "\$0" )" && pwd )")"
PATH="\${dir}/bin:\${PATH}"
LD_LIBRARY_PATH="\${dir}/lib"
ghb.real
EOF
$ chmod u+x ghb
$ cat > HandBrakeCLI << EOF
#!/bin/bash
dir="\$(dirname "\$( cd "\$( dirname "\$0" )" && pwd )")"
PATH="\${dir}/bin:\${PATH}"
LD_LIBRARY_PATH="\${dir}/lib"
HandBrakeCLI.real
EOF
$ chmod u+x HandBrakeCLI

Run Handbrake with

$ /replace_with_whatever_you_set_hbinstdir_to/bin/ghb

The tweak to libvorbis/module.defs comes from http://benjisimon.blogspot.co.uk/2012/04/gotcha-of-day-building-handbrake-on.html

Initially I used LIBRARY_PATH=${hbinstdir}lib/ instead of LDFLAGS but system locations are searched before anything specified in LIBRARY_PATH and if you have fribidi-devel installed that's found first and the Handbrake build fails.

I also initially used export PKG_CONFIG_PATH="${hbinstdir}/lib/pkgconfig/" instead of FRIBIDI_CFLAGS and FRIBIDI_LIBS but the Handbrake build process was still finding the system version. I eventually realised the Handbrake build process sets it's own value for PKG_CONFIG_PATH which overwrites anything you've set.



December 31, 2012

Converting FLAC to AAC/M4A

I found myself wanting to convert some audio files that were encoded with FLAC to AAC/M4A that iTunes can understand. Conversion using ffmpeg is easy enough but I couldn't find a way to make ffmpeg copy the artwork that's embedded in the FLAC files. So I ended up using atomicparsley as well.

$ for i in *flac;do of="${i/.flac/.m4a}";af=foo.jpg;ffmpeg -i "${i}" -y "${af}"; ffmpeg -i "${i}" -vn -acodec libfaac -aq 320k -f mp4 -y "${of}";atomicparsley "${of}" --artwork "${af}" --overWrite;rm -f "${af}";done

I had to tell ffmpeg to force the mp4 container otherwise atomicparsley wouldn't process the resulting file.


Search this blog

Tags

RSS2.0 Atom
Not signed in
Sign in

Powered by BlogBuilder
© MMXXIV