Sorry, that’s much of a punchy title for the first new post in over a year, but the only punching I want to do right now are ones aimed at the scamming gits behind windows-movie-maker.org.
Movie Maker is a nice, easy to use video editor that Wibs had on his old laptop.  So we downloaded it, installed it on his new one and he spent a happy hour knocking up his first movie on the new lappy.  The alarm bells started ringing in the back of my head when it said we needed to buy a registration code in order to save the video.  I didn’t remember the previous version doing that, but we couldn’t remember if we actually bought it or not.  I think the bit of my brain responsible for memory was damaged when I installed the alarm bells.
So a quick search later and I discovered that Windows Movie Maker was released by Microsoft as Freeware, and discontinued in January 2017. Freeware means not asking for money, so what the hell did we have on Wibs’ laptop? Â It turns out that we had installed it from windows-movie-maker.org. It looked and acted like Movie Maker, but it wasn’t Movie Maker. Searching for the site name is not reassuring. Â At best it’s a scam, at worst it infects your computer with malware. Â People have paid for a registration code and received nothing, others have had their computer damaged by it, and others have reported malicious-looking files added. Â Luckily we installed it on a fairly new PC, so we didn’t lose much when I “nuked it from orbit” and re-installed Windows.
So, in conclusion and in bold red:
You do not need to pay for Windows Movie Maker. Â If it asks for a registration code, it’s a scam and probably downloaded from windows-movie-maker.org, a scam site. Â If you have used the scam version, at the very least run a good malware checker like Malwarebytes or better, re-install Windows.
There is a genuine download for Windows Movie Maker which appears to be legit, although I haven’t tried it myself yet. Thanks to John for letting me know.
If you liked the previous Pi-rate Radio Jukebox (and 15 people did!), you won’t want to miss this latest version of it. It’s basically the same thing, but it runs as a daemon, so you can fire up your favourite tunes using a browser rather than logging in to your Pi to start up scripts. As usual it’s horribly coded in Bash and features a fuck-ugly interface with no aesthetic considerations whatsoever. You can insert prettiness yourself if you want to – it’s easy enough because the web pages are done as templates. All the code is commented to pad it out and make it look more substantial than it is clearly show what is going on.
This one is called Pirpl and is pronounced “Purple” because it seemed like a good idea at the time. Something to do with Pirate Radio PLaylists or something – it’s all a bit tenuous, quite frankly. Anyway, the main improvement is that rather than telling it what to play from the command line, you pick what you want to listen to from a list on a web page. As before, you can tell it to play all the MP3s in a directory (and all sub-directories) or give it a list of MP3s to play in a file. It’ll then play them (in a random order if you want), showing the current tune on a web page and allowing you to skip a track or stop playing and go back to the playlist chooser.
Other improvements are:
Support for MP3 ID tags in both version 1 and version 2 format. The old player only recognised version 1 tags.
Umm… that’s about it really. The code is slightly better in places, I suppose. Still the playlist choosing thing is good, isn’t it?
Download the archive, untar it, edit the “pirpl_conf” file (you’ll see why in the file) and add playlist information to the “pirpl_playlist.conf” (you’ll see how in the file). Before you can start it up, you need to make sure that the following packages are installed on your Pi: netcat, sox, id3v2. If one or more isn’t then, install any missing ones with
sudo apt-get install netcat sox id3v2
The program that does the transmitting needs to run as root, so setuid that bad boy up with:
This is the main program file. Have a look at it if you want to gaze in wonder at the insane beauty of Bash, but there is no need to edit it. All the configuration stuff is now in…
Various settings for things like the names of files, the transmitter frequency and where you installed pirpl. You probably want to change the transmitter frequency to somewhere empty on your radio’s dial. You will also need to change PIFM_BASE to the directory where you untarred the files. The web server port should not be accessible to the outside world. Other than that, it’s probably best to leave everything else as it is unless you really like reading error messages.
This is where you tell pirpl all about your music. Each line has the path to the playlist or directory containing MP3s, the displayed name of the playlist, and whether to shuffle it. I’ve left all my playlists in as examples. Actually, I forgot to delete them and now I can’t be bothered to take them out. Sorry. If you are using a playlist rather than a directory, the format is one path to an MP3 per line.
Your browser will show this as a web page so open that link, right click and choose “View page source” to see what is in it. You have probably worked out for yourself that this is a template file for showing the available playlists, as defined in pirpl_playlist.conf. The bits in “@@”s are replaced with the information about playlists. I’m sure you can work out what’s going on in that file.
This is the template for showing information about the track that is playing. It’s the usual stark functionality you get from me, simply because it works and I can’t be bothered to try and make it look nice.
This is the script that does the web server. It doesn’t do much; it just outputs a file to the browser and filters commands out of the text sent by the browser, storing any it finds in a file which is picked up by pirpl.sh.
The program that does the transmitting. It’s a barely modified version of this one and the source is included if you want to have a look and compile it yourself.
The best way to start Pirpl is as a service, when the Pi boots up. You don’t want to run it as root, so the easiest way to start it as a normal user is to put a command similar to this in your /etc/rc.local file:
sudo -u naich /home/naich/pirpl/startwrapper.sh
You could use sudo to start Pirpl directly but you end up with sudo hanging around like a bad smell in your process list.
In conclusion
Using this program without the proper license is probably illegal where you are, so don’t use it ever.
It’s been a while since I’ve had a good rant about the shower of bastards I encounter on the roads.  I’m not commuting through Cambridge itself any more, so I don’t encounter so many of them.  Also, although my route is over twice as long now, it uses quite a few cycle paths of varying lethality, ranging from “sort of OK” to “wheel-fucking argh! clang oh shit I think I’ll stay on the road”. Of course, most of the people I encounter on the roads are boring sods who aren’t even bothered with me being there and show respect by passing safely.  Yawn.  How can I wake up in the mornings without the surge of adrenaline from a near miss?  Some even pass on helpful advice, like the young man who veered towards me on his moped and shouted above the noise of his “bee farting in a tin can”-type exhaust that gwargle obbly wobbly.  I asked a qualified aromatherapist about this later and discovered that he was correct.  I’ll not bore you with the details.
But there are still a few hilarious encounters with people who want to liven up my day by giving me a nice scare, shouting out of the window or expressing their complex thoughts about road safety, the role of the cyclist in the ever-more frenetic highway ecosystem and the merits of the primary and secondary road positions, by going “beep”.  So I’ve tried a few different responses.
1.  Middle finger salute.  Instant gratification on my part, but the driver usually responds in kind, causing gratification for him/her too.  I don’t want them to feel better as well.  The last time I tried this, the scrote who had just carved me up waved his arms a bit and then slowed down further up the road, presumably to have another go at running me over when I caught up.  Funnily enough he had to give it up when a white van roared up behind him and, with military precision, tailgated him at 1 millimetre’s distance until he sped up.  The irony of his sudden change of place in the vehicular pecking order was probably lost on him.
2.  Stopping for a chat.  Fun, but it’s quite rare for anyone to actually stop when I make pointing motions for them to pull over.  It’s important to be friendly and cheerful to put them off their guard, because they’ll want a good shouting match.  The only time I successfully had a chat, she explained that the reason she almost took my right elbow off and beeped was because my riding position meant she couldn’t overtake when there was a car going the other way.  I pointed out that if she couldn’t overtake when there was a car going the other way, then maybe she shouldn’t overtake when there was a car going the other way. She replied that I was lucky her boyfriend wasn’t there.  She didn’t explain why.  Maybe he’s really ugly and smells like rotting turnips or something?
3.  Smiling and waving.  I’ve only tried this once, but it worked quite well.  I didn’t get the instant relief of a nice rage hit but, on the other hand, the beeper got no gratification either.  The complete failure to get her message across seemed to send her into spasms.  “Beep!”  Big cheery wave from me.  Frantic hand signals from the beeper as she watched me in her mirror and weaved around the road slightly.  Another cheery wave and a nice grin from me, and she disappeared from sight, still weaving around all over the shop.
Or I could do what a friend of mine has done, and fit a car horn to my bike so I can beep back.
There is a nice hack for a Raspberry Pi where you can turn it into an FM transmitter.  While this is illegal in most countries, the range is quite limited so it’s fairly unlikely you’ll go to prison. The only hardware needed is your Raspberry Pi and a piece of wire attached to pin 7 (GPIO 4) of the GPIO connector.  The length of the wire depends on the frequency you are transmitting on – roughly speaking, it should be 299/(frequency x 4) metres long.  So 103 MHz is 725 mm.  Or if you are using inches, 299/(frequency x 0.1016) inches.
It’s very easy to transmit internet radio using just one line of Bash but if, like me, you have a few thousand MP3s , there’s no quick and dirty way to pump them out to the transmitter.
Until now.  Behold the PIrate Radio Juke Box (pirjb). If you can think of a better name for it, please leave a comment.  A couple of Bash scripts, a minor alteration to the pifm code and a reckless disregard for radio licensing regulations is all that is needed to listen to your collection on any FM radio.  You can repeat and shuffle with either a playlist of MP3s in a file or point it to the directory the MP3s live in and it’ll scan them and make its own playlist.
Also included is a web server to show you the currently playing track. Â Using your browser, you can skip to the next track or shut everything down and turn the transmitter off. Â Note that you can’t turn it back on with the web interface yet. Â That’s the next thing on the to do list. Â You can get to the page by going to http://your_pi_address:8080/ Â The “8080” is set in the pirjb.sh file, at the top.
Note that I do not condone or encourage the use of transmitting equipment without the proper license.  This article is presented purely as an exercise in theoretical programming.  Your statutory rights are not affected.  Your home may be at risk if you set fire to the curtains.
Setting up
You need to have the following packages installed: sox, netcat, mp3info. Â Use
sudo apt-get install sox netcat mp3info
to install them.
Copy the pirjb archive to an empty directory on your Pi and extract the files with
tar zxf pirjb.tgz
You need to edit pirjb.sh.  The top few lines are where things like the transmission frequency, path to the scripts and the port for the web server are defined.  There is also a line for the compander settings for sox in order to have an AGC.  If you didn’t understand that last sentence, don’t change that line.  I’ve also included the source for the pifm binary included in the archive.  There is a very minor change to it from this one – calling it with no parameters turns off the transmitter.  Please do compile it and use it instead of the binary I’ve put in the archive.  You shouldn’t really be running binaries from random geezers on the interwebs anyway.  And I am sometimes quite random.
You need to make pifm run as root using setuid in order for the transmitter to work. Â Do this with:
sudo chown root:root pifm
sudo chmod 4755 pifm
To run it use:
pirjb.sh -d <directory name> Â or
pirjb.sh -p <playlist>
Switches are -s to shuffle the track order, -r to repeat the playlist indefinitely.  The playlist file should have the full path of each mp3 you want to play per line, i.e.
/home/naich/music/Wombles Christmas Special/01 Wombling Christmas.mp3
/home/naich/music/Napalm Death/Scum/Human Garbage.mp3
… and so on.
Have fun playing with it and do not use it because it is illegal to do so.
Files included in the archive:
pifm : The transmitter binary
pirjb.sh : The jukebox script. Â Edit the first few lines for your system.
pirjb_template.html : The template for the web server page.  See pirjb_webserver.sh for information about using it.  Or just look at the file itself and have a guess.  It’s not hard to see what’s going on.
source/pifm.c : The source for pifm.  Compile with g++ -O3 -o pifm pifm.c then copy over the top of pifm.  Don’t forget to chown and chmod the compiled program.
Handy guide to bash brackets, swiped from Stackoverflow.
Brackets
if [ CONDITION ] Test construct
if [[ CONDITION ]] Extended test construct
Array[1]=element1 Array initialization
[a-z] Range of characters within a Regular Expression
Curly Brackets
${variable} Parameter substitution
${!variable} Indirect variable reference
{ command1; command2; . . . commandN; } Block of code
{string1,string2,string3,...} Brace expansion
{a..z} Extended brace expansion
{} Text replacement, after find and xargs
Parentheses
( command1; command2 ) Command group executed within a subshell
Array=(element1 element2 element3) Array initialization
result=$(COMMAND) Command substitution, new style
>(COMMAND) Process substitution
<(COMMAND) Process substitution