Grab BBC News Videos with a Bash Script

A colleague asked me the other day if I could download a video clip from the BBC News website so that she could use it in her training course (to save having to load up the website and play it “live” from there!)

I said anything is possible 😉  Took me on a little journey but finally found a way without having to resort to any browser plugins or switching to Windows to download a video grabber program. Decided to write a bash script to pull all the elements together too :) Continue reading

Automate Printing of Completed Google Form

I need to write this up before I forget what I did!

This is quite complex and draws on several resources. Why do this? Because in my organisation many have not/cannot move to online systems, we do not have the resources (e.g. tablets/laptops), or what we need is not yet written/ready, so whilst we can easily input data with google forms, we still need a paper copy in order to act on the contents and record actions. In addition this gets the data into a digital format we can work with (on the google sheet), making it easier to work with and interrogate later, without having to input it from the paper form. Continue reading

Digital Signage with Google Slides and Chromium in Kiosk Mode

Another solution to digital signage, this time using Google Slides and Chromium (or Chrome) in Kiosk mode.

I am using the base of a linux install (Crunchbang) and Chromium, but the basics transfer across to Chrome and other OS platforms with some tweaking.

Issues:

  • Kiosk Syntax
  • Fullscreen
  • The Google Slides Toolbar or Transport
  • Web Page Presentation
  • Updating the Slides
  • Sharing the Slides
  • Locking Down if keyboard/touchscreen in use

Am grateful for the work done by Mark Pajak at Bristol Museums on setting up Chrome/Chromium in kiosk mode, and to Google Slides users on the google groups forums and good old StackOverflow for other snippets.

As an overview, one needs to publish the google slides presentation, then pull this into an iframe on a web page. Then call chromium in kiosk mode to load that web page. Once the slides are loaded they will not update with new content unless the call to the slides is reset (page reload) so some html/javascript is required to refresh things. This all may seem a little disjointed at first but be patient, i will put it all together at the end with a workflow and example 😉 Continue reading

Automating Framebuffer Digital Photo Frame

dpf6We have seen in my previous post how I setup the DPF to work against the framebuffer. Now it was time to automate things a bit.

Task List:

  • Autologin on Startup
  • Start gnu screen on Boot
  • Uploading New Images
  • Screen On/Off Timer
  • Reboot Timer
  • Shutdown Timer
  • Unique names/shuffle for file list
  • Cycle Colour Change for Clock ?

Continue reading

Digital Picture Frame & Clock on the Framebuffer!

dpfBeen wanting to have a go at this for a long time, and finally found some time to sit down and hack my way through it. Everyone else on the web seems to have used X to do this, but encouraged by all the work done on the cli and framebuffer by KMandla I felt this could be done. Now I’ve done all the hard work, I am happy to share it with you!

Continue reading

Rough Guide to Bitrate Calulations for Video Encoding

Want a video to be a particular size?

((Size (mb) x 8192) / length of video (secs)) – audio bitrate (k) = video bitrate required

Example in bash with file size of 13.79mb, audio bitrate of 128k and length of 180 seconds:

What to know the size of a video when using a particular bitrate?

((Video bitrate (k) + Audio bitrate (k))  x length (secs)) / 8192 = Size (mb)

Example in bash, with video bitrate of 500, Audio bitrate of 128, length of video 180 seconds:

You can put these into a variable:

Bash – Sort Files in All Sub-Directories by Extension

I try to be organised, and put everything in folders where they belong, but, especially at work, this all stops being important after a couple of years, and becomes more difficult to find things especially when backed up. This one liner can resolve all of that by moving each file type to a directory of its own, retaining any duplicate files for further inspection. It may be best to keep a backup of all the original file locations where files of many types come together to make a whole.

Here is my one liner, which needs to be placed in the top directory. One can add as many different file extensions as needed into the variable array EXTS. I have used txt and jpg as example extensions.

Continue reading

Rolling Video Player

Here is a nice little bash script that will keep repeating the same video over and over. I guess with a bit more work you could have more than one. In this case I used test.mp4 as the video, and as it was only 2 minutes long set a sleep time of 90 seconds. Amend these two parameters to suit

Run Once Only Bash Scripts

I am constantly amazed by what can be achieved with a simple bash script or two. I had a situation where I needed a script to run only once, and to not get any errors spat out at me from the cli. I needed a second script to call the run once script to go into rc.local, a file I didn’t want to mess with, so the call in rc.local would just be a quick file check after the first run. for me, the clever bit is that the scriptI have to do the work can “move” (rename) itself once it has done its business, thereby ensuring it is not called upon again, but is still there if needed.

Continue reading

Play your entire music collection – Mplayer One Liner

Sometimes just plain lazy, and want just to play music. Run this command in the background (ALT+F2) or in a terminal for playback of all your mp3/ogg/m4a/wma, shuffled, looped, normalised. What’s nice about this is that the shuffle algorithym does a good job and with a large collection of music you don’t get repeats. I found that trying the same thing with vlc meant the shuffle was  always the same, and so you always started with the same music. :( Anyway the one-liner:

find ~/Music ( -iname “*.mp3” -o -iname “*.m4a” -o -iname “*.ogg” -o -iname “*.wma” ) -exec mplayer -nocache -af volnorm -shuffle -loop 0 ‘{}’ + &

Change “~/Music” to suit.

Even better put this in a script, and link to a keyboard shortcut, or add to your startup?

Now running the one liner from a terminal takes a bit of stopping, you’ll need to CTRL+C a couple of times in quick succession to close find then mplayer. Or you can run another one-liner:

killall -15 find mplayer

If you run the command from a script, you’ll have to shut down the script first, and then kill off the running instances of find and mplayer. Best to also do this from a script as well. Say the script you use to run is called singles.sh, let’s create another called endsingles.sh which contains:

#!/bin/bash

killall -15 singles.sh
killall -15 find
killall -15 mplayer

I am sure someone clever could bind this all together in one script, based upon a keyboard shortcut toggle or something…