• Assuming you want the fancy splash screen (ie you want to hide the ugly boot messages), add “quiet splash logo.nologo plymouth.ignore-serial-consoles” to the end of the single line in /boot/cmdline.txt file. This enables the splash screen. Now you need to choose one (I like spinfinity), so issue the following command to switch from default (bland grey screen):
    sudo plymouth-set-default-theme spinfinity
  • There are other themes as well (some don’t seem to work properly for me. To find out what’s installed and use it in the above command issue:
    sudo plymouth-set-default-theme -l
  • You might notice that there is a black border on your splash screen. Overscan problem, so disable it by adding (uncommenting) this line to /boot/cmdline.txt
    disable_overscan=1
  • To disable console from blanking out add “consoleblank=0” to the end of the single line in /boot/cmdline.txt file.
  • Might want to get rid of the Linux login prompt on the console (tty1) altogether. Do this only if you’ve got a auto starting script or CLI autologin enabled. The login prompt WILL be disabled.
    sudo systemctl disable getty@tty1.service

So here are the design goals:

  • Provide atleast 6 channels of streaming video.
  • Allow “hot” switching between streams using a remote control.
  • Allow network to fail and be able to have the stream automatically recover.
  • Allow the Pi to autostart on a particular stream when powered.
  • Be flexible enough to potentially provide more than 6 channels of streaming video.
  • System will be hosted on a read-only Micro-SD card to lessen the chance of long term SD corruption.

Here are the assumptions:

  • System is based on Raspberry Pi 2 B+ as a minimum (old Pi 1 and Pi zero have not been tested, but should work).
  • System uses HDMI audio and or analogue audio out from Pi’s 3.5mm jack.
  • System is limited to 720p and 1080p output.
  • System has been tested with video streams up to 6Mb/s.
  • System works with rtmp streaming protocol. Tested with Wowza Streaming server providing 6 streams.

Requirements:

  • Pi 2 B+ or better.
  • Latest raspbian jessie or better.
  • HDMI monitor and cable for testing.
  • Good Pi power supply 5V@2A.
  • speaker or headphone for monitoring during testing phase.
  • 8 GB Micro-SD card.
  • USB keyboard and Mouse (for the building phase only).
  • Ethernet cable.
  • A simple remote control with number pad.
  • A Flirc IR receiver. There are other ways of getting IR into Pi, but this is by far the easiest.

Here we go……

  • So write the raspbian image file to sd.
  • Hook up everything and do your first boot.
  • Pi will boot up and resize the filesystem automatically and reboot. Then you’ll end up in X-windows.
  • Open up terminal and run “sudo raspi-config” command.
  • Change the hostname to something. I chose “signage” for mine.
  • Enable SSH (option 5/P2), enable CLI boot (option 3/B1/B1), change memory split to 128Mb (option 7/A3), change password (option 1) and anything you need under localization options.

Take the reboot at the end of this process. Once back you should have the signage login screen with “Welcome to PIXEL” graphic on the screen. Lets continue……

  • Since my workstation is on the same network as the Pi I can do the following, if you’re not, you can always login (remember the password) using keyboard and issue the command “sudo ifconfig” to find the IP address of your Pi.
  • Use “ssh pi@signage.local” to login to the Pi from your workstation (on windows you need a program like putty to facilitate ssh connections).
  • sudo to root and follow along
  • Update and upgrade to latest greatest
    pi@signage:~ $ sudo -i
    root@signage:~# apt-get update ; apt-get dist-upgrade 
    Get:1 http://mirrordirector.raspbian.org jessie InRelease [14.9 kB]
    Get:2 http://mirrordirector.raspbian.org jessie/main armhf Packages [8,981 kB]
    Get:3 http://archive.raspberrypi.org jessie InRelease [22.9 kB]            
    Get:4 http://archive.raspberrypi.org jessie/main armhf Packages [145 kB]   
    Get:5 http://archive.raspberrypi.org jessie/ui armhf Packages [57.9 kB]                                           
    Ign http://archive.raspberrypi.org jessie/main Translation-en_US                                                                                     
    Ign http://archive.raspberrypi.org jessie/main Translation-en                                                                                        
    Ign http://archive.raspberrypi.org jessie/ui Translation-en_US                                                                                       
    Ign http://archive.raspberrypi.org jessie/ui Translation-en                                                                                          
    Get:6 http://mirrordirector.raspbian.org jessie/contrib armhf Packages [37.5 kB]                                                                     
    Get:7 http://mirrordirector.raspbian.org jessie/non-free armhf Packages [70.3 kB]                                                                    
    Get:8 http://mirrordirector.raspbian.org jessie/rpi armhf Packages [1,356 B]                                                                         
    Ign http://mirrordirector.raspbian.org jessie/contrib Translation-en_US                                                                              
    Ign http://mirrordirector.raspbian.org jessie/contrib Translation-en                                                                                 
    Ign http://mirrordirector.raspbian.org jessie/main Translation-en_US                                                                                 
    Ign http://mirrordirector.raspbian.org jessie/main Translation-en                                                                                    
    Ign http://mirrordirector.raspbian.org jessie/non-free Translation-en_US                                                                             
    Ign http://mirrordirector.raspbian.org jessie/non-free Translation-en                                                                                
    Ign http://mirrordirector.raspbian.org jessie/rpi Translation-en_US                                                                                  
    Ign http://mirrordirector.raspbian.org jessie/rpi Translation-en                                                                                     
    Fetched 9,330 kB in 50s (185 kB/s)                                                                                                                   
    Reading package lists... Done
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    Calculating upgrade... Done
    The following packages will be upgraded:
      alacarte gstreamer1.0-alsa gstreamer1.0-plugins-bad gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-x libaudiofile1
      libgstreamer-plugins-bad1.0-0 libgstreamer-plugins-base1.0-0 libgstreamer1.0-0 libopenblas-base libpam-chksshpwd libpam-modules libpam-modules-bin
      libpam-runtime libpam0g libsmbclient libwbclient0 pi-greeter piclone pix-plym-splash raspberrypi-sys-mods raspberrypi-ui-mods raspi-config
      realvnc-vnc-server rpi-chromium-mods samba-common samba-libs wiringpi wolfram-engine
    30 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
    Need to get 274 MB of archives.
    After this operation, 1,623 kB disk space will be freed.
    Do you want to continue? [Y/n] y
    Get:1 http://archive.raspberrypi.org/debian/ jessie/main libpam0g armhf 1.1.8-3.1+deb8u2+rpi3 [121 kB]
    Get:2 http://mirrordirector.raspbian.org/raspbian/ jessie/main libgstreamer1.0-0 armhf 1.4.4-2+deb8u1 [1,593 kB]
    Get:3 http://mirrordirector.raspbian.org/raspbian/ jessie/main libaudiofile1 armhf 0.3.6-2+deb8u2 [97.1 kB]
    Get:4 http://archive.raspberrypi.org/debian/ jessie/main libpam-modules-bin armhf 1.1.8-3.1+deb8u2+rpi3 [101 kB] 
    Get:5 http://archive.raspberrypi.org/debian/ jessie/main libpam-modules armhf 1.1.8-3.1+deb8u2+rpi3 [288 kB]
    Get:6 http://mirrordirector.raspbian.org/raspbian/ jessie/main libgstreamer-plugins-base1.0-0 armhf 1.4.4-2+deb8u1 [1,248 kB]
    Get:7 http://mirrordirector.raspbian.org/raspbian/ jessie/main libwbclient0 armhf 2:4.2.14+dfsg-0+deb8u4 [118 kB]
    Get:8 http://archive.raspberrypi.org/debian/ jessie/main wolfram-engine armhf 11.0.1+2017031701 [240 MB]           
    Get:9 http://mirrordirector.raspbian.org/raspbian/ jessie/main libsmbclient armhf 2:4.2.14+dfsg-0+deb8u4 [139 kB]
    Get:10 http://mirrordirector.raspbian.org/raspbian/ jessie/main samba-libs armhf 2:4.2.14+dfsg-0+deb8u4 [4,246 kB]
    Get:11 http://mirrordirector.raspbian.org/raspbian/ jessie/main gstreamer1.0-plugins-good armhf 1.4.4-2+deb8u3 [2,218 kB]
    Get:12 http://mirrordirector.raspbian.org/raspbian/ jessie/main gstreamer1.0-plugins-bad armhf 1.4.4-2.1+deb8u2 [2,231 kB]     
    Get:13 http://mirrordirector.raspbian.org/raspbian/ jessie/main gstreamer1.0-plugins-base armhf 1.4.4-2+deb8u1 [1,236 kB]                            
    Get:14 http://mirrordirector.raspbian.org/raspbian/ jessie/main samba-common all 2:4.2.14+dfsg-0+deb8u4 [243 kB]                                     
    Get:15 http://mirrordirector.raspbian.org/raspbian/ jessie/main libgstreamer-plugins-bad1.0-0 armhf 1.4.4-2.1+deb8u2 [1,299 kB]                      
    Get:16 http://mirrordirector.raspbian.org/raspbian/ jessie/main gstreamer1.0-alsa armhf 1.4.4-2+deb8u1 [790 kB]                                      
    Get:17 http://mirrordirector.raspbian.org/raspbian/ jessie/main gstreamer1.0-x armhf 1.4.4-2+deb8u1 [823 kB]                                         
    Get:18 http://archive.raspberrypi.org/debian/ jessie/main libpam-runtime all 1.1.8-3.1+deb8u2+rpi3 [213 kB]                                          
    Get:19 http://archive.raspberrypi.org/debian/ jessie/ui alacarte all 3.11.91-2+rpi4 [111 kB]                                                         
    Get:20 http://archive.raspberrypi.org/debian/ jessie/main libopenblas-base armhf 0.2.12-1+rpi1 [1,688 kB]                                            
    Get:21 http://archive.raspberrypi.org/debian/ jessie/main libpam-chksshpwd armhf 1.1.8-3.1+deb8u2+rpi3 [79.3 kB]                                     
    Get:22 http://archive.raspberrypi.org/debian/ jessie/ui pi-greeter armhf 0.4 [41.3 kB]                                                               
    Get:23 http://archive.raspberrypi.org/debian/ jessie/ui piclone armhf 0.4 [13.2 kB]                                                                  
    Get:24 http://archive.raspberrypi.org/debian/ jessie/ui pix-plym-splash armhf 0.9 [25.4 kB]                                                          
    Get:25 http://archive.raspberrypi.org/debian/ jessie/main raspberrypi-sys-mods all 20170313 [8,596 B]                                                
    Get:26 http://archive.raspberrypi.org/debian/ jessie/main realvnc-vnc-server armhf 6.0.2.26558 [5,305 kB]                                            
    Get:27 http://archive.raspberrypi.org/debian/ jessie/ui rpi-chromium-mods armhf 20170317 [9,185 kB]                                                  
    Get:28 http://archive.raspberrypi.org/debian/ jessie/main wiringpi armhf 2.44 [52.7 kB]                                                              
    Get:29 http://archive.raspberrypi.org/debian/ jessie/ui raspberrypi-ui-mods all 1.20170315 [426 kB]                                                  
    Get:30 http://archive.raspberrypi.org/debian/ jessie/main raspi-config all 20170307 [18.7 kB]                                                        
    Fetched 274 MB in 22min 41s (201 kB/s)                                                                                                               
    Reading changelogs... Done
    Preconfiguring packages ...
    (Reading database ... 112361 files and directories currently installed.)
    Preparing to unpack .../libpam0g_1.1.8-3.1+deb8u2+rpi3_armhf.deb ...
    Unpacking libpam0g:armhf (1.1.8-3.1+deb8u2+rpi3) over (1.1.8-3.1+deb8u2+rpi1) ...
    Processing triggers for libc-bin (2.19-18+deb8u7) ...
    Setting up libpam0g:armhf (1.1.8-3.1+deb8u2+rpi3) ...
    Processing triggers for libc-bin (2.19-18+deb8u7) ...
    (Reading database ... 112361 files and directories currently installed.)
    Preparing to unpack .../libpam-modules-bin_1.1.8-3.1+deb8u2+rpi3_armhf.deb ...
    Unpacking libpam-modules-bin (1.1.8-3.1+deb8u2+rpi3) over (1.1.8-3.1+deb8u2+rpi1) ...
    Processing triggers for man-db (2.7.0.2-5) ...
    Setting up libpam-modules-bin (1.1.8-3.1+deb8u2+rpi3) ...
    (Reading database ... 112361 files and directories currently installed.)
    Preparing to unpack .../libpam-modules_1.1.8-3.1+deb8u2+rpi3_armhf.deb ...
    Unpacking libpam-modules:armhf (1.1.8-3.1+deb8u2+rpi3) over (1.1.8-3.1+deb8u2+rpi1) ...
    Processing triggers for man-db (2.7.0.2-5) ...
    Setting up libpam-modules:armhf (1.1.8-3.1+deb8u2+rpi3) ...
    (Reading database ... 112361 files and directories currently installed.)
    Preparing to unpack .../libaudiofile1_0.3.6-2+deb8u2_armhf.deb ...
    Unpacking libaudiofile1:armhf (0.3.6-2+deb8u2) over (0.3.6-2+deb8u1) ...
    Preparing to unpack .../libgstreamer1.0-0_1.4.4-2+deb8u1_armhf.deb ...
    Unpacking libgstreamer1.0-0:armhf (1.4.4-2+deb8u1) over (1.4.4-2) ...
    Preparing to unpack .../libgstreamer-plugins-base1.0-0_1.4.4-2+deb8u1_armhf.deb ...
    Unpacking libgstreamer-plugins-base1.0-0:armhf (1.4.4-2+deb8u1) over (1.4.4-2) ...
    Preparing to unpack .../libwbclient0_2%3a4.2.14+dfsg-0+deb8u4_armhf.deb ...
    Unpacking libwbclient0:armhf (2:4.2.14+dfsg-0+deb8u4) over (2:4.2.14+dfsg-0+deb8u2) ...
    Preparing to unpack .../libsmbclient_2%3a4.2.14+dfsg-0+deb8u4_armhf.deb ...
    Unpacking libsmbclient:armhf (2:4.2.14+dfsg-0+deb8u4) over (2:4.2.14+dfsg-0+deb8u2) ...
    Preparing to unpack .../samba-libs_2%3a4.2.14+dfsg-0+deb8u4_armhf.deb ...
    Unpacking samba-libs:armhf (2:4.2.14+dfsg-0+deb8u4) over (2:4.2.14+dfsg-0+deb8u2) ...
    Preparing to unpack .../samba-common_2%3a4.2.14+dfsg-0+deb8u4_all.deb ...
    Unpacking samba-common (2:4.2.14+dfsg-0+deb8u4) over (2:4.2.14+dfsg-0+deb8u2) ...
    Preparing to unpack .../wolfram-engine_11.0.1+2017031701_armhf.deb ...
    wolfram-eula license has already been accepted
    Unpacking wolfram-engine (11.0.1+2017031701) over (11.0.1+2017022002) ...
    Preparing to unpack .../gstreamer1.0-plugins-good_1.4.4-2+deb8u3_armhf.deb ...
    Unpacking gstreamer1.0-plugins-good:armhf (1.4.4-2+deb8u3) over (1.4.4-2+deb8u2) ...
    Preparing to unpack .../gstreamer1.0-plugins-bad_1.4.4-2.1+deb8u2_armhf.deb ...
    Unpacking gstreamer1.0-plugins-bad:armhf (1.4.4-2.1+deb8u2) over (1.4.4-2.1+deb8u1) ...
    Preparing to unpack .../gstreamer1.0-plugins-base_1.4.4-2+deb8u1_armhf.deb ...
    Unpacking gstreamer1.0-plugins-base:armhf (1.4.4-2+deb8u1) over (1.4.4-2) ...
    Preparing to unpack .../libgstreamer-plugins-bad1.0-0_1.4.4-2.1+deb8u2_armhf.deb ...
    Unpacking libgstreamer-plugins-bad1.0-0:armhf (1.4.4-2.1+deb8u2) over (1.4.4-2.1+deb8u1) ...
    Preparing to unpack .../libpam-runtime_1.1.8-3.1+deb8u2+rpi3_all.deb ...
    Unpacking libpam-runtime (1.1.8-3.1+deb8u2+rpi3) over (1.1.8-3.1+deb8u2+rpi1) ...
    Processing triggers for man-db (2.7.0.2-5) ...
    Processing triggers for hicolor-icon-theme (0.13-1) ...
    Processing triggers for shared-mime-info (1.3-1) ...
    Processing triggers for gnome-menus (3.13.3-6) ...
    Processing triggers for desktop-file-utils (0.22-1) ...
    Processing triggers for mime-support (3.58) ...
    Setting up libpam-runtime (1.1.8-3.1+deb8u2+rpi3) ...
    (Reading database ... 112361 files and directories currently installed.)
    Preparing to unpack .../alacarte_3.11.91-2+rpi4_all.deb ...
    Unpacking alacarte (3.11.91-2+rpi4) over (3.11.91-2+rpi2) ...
    Preparing to unpack .../gstreamer1.0-alsa_1.4.4-2+deb8u1_armhf.deb ...
    Unpacking gstreamer1.0-alsa:armhf (1.4.4-2+deb8u1) over (1.4.4-2) ...
    Preparing to unpack .../gstreamer1.0-x_1.4.4-2+deb8u1_armhf.deb ...
    Unpacking gstreamer1.0-x:armhf (1.4.4-2+deb8u1) over (1.4.4-2) ...
    Preparing to unpack .../libopenblas-base_0.2.12-1+rpi1_armhf.deb ...
    Unpacking libopenblas-base (0.2.12-1+rpi1) over (0.2.12-1) ...
    Preparing to unpack .../libpam-chksshpwd_1.1.8-3.1+deb8u2+rpi3_armhf.deb ...
    Unpacking libpam-chksshpwd:armhf (1.1.8-3.1+deb8u2+rpi3) over (1.1.8-3.1+deb8u2+rpi1) ...
    Preparing to unpack .../pi-greeter_0.4_armhf.deb ...
    Unpacking pi-greeter (0.4) over (0.3) ...
    Preparing to unpack .../archives/piclone_0.4_armhf.deb ...
    Unpacking piclone (0.4) over (0.3) ...
    Preparing to unpack .../pix-plym-splash_0.9_armhf.deb ...
    Unpacking pix-plym-splash (0.9) over (0.8) ...
    Preparing to unpack .../raspberrypi-sys-mods_20170313_all.deb ...
    Unpacking raspberrypi-sys-mods (20170313) over (20170302) ...
    Preparing to unpack .../realvnc-vnc-server_6.0.2.26558_armhf.deb ...
    
    (gconftool-2:18645): GConf-WARNING **: Client failed to connect to the D-BUS daemon:
    Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
    Unpacking realvnc-vnc-server (6.0.2.26558) over (6.0.2.25562) ...
    Preparing to unpack .../rpi-chromium-mods_20170317_armhf.deb ...
    Unpacking rpi-chromium-mods (20170317) over (20170213) ...
    Preparing to unpack .../wiringpi_2.44_armhf.deb ...
    Unpacking wiringpi (2.44) over (2.42) ...
    Preparing to unpack .../raspberrypi-ui-mods_1.20170315_all.deb ...
    Unpacking raspberrypi-ui-mods (1.20170315) over (1.20170301) ...
    Preparing to unpack .../raspi-config_20170307_all.deb ...
    Unpacking raspi-config (20170307) over (20170228) ...
    Processing triggers for gnome-menus (3.13.3-6) ...
    Processing triggers for desktop-file-utils (0.22-1) ...
    Processing triggers for mime-support (3.58) ...
    Processing triggers for hicolor-icon-theme (0.13-1) ...
    Processing triggers for man-db (2.7.0.2-5) ...
    Processing triggers for libc-bin (2.19-18+deb8u7) ...
    Processing triggers for gconf2 (3.2.6-3) ...
    Processing triggers for shared-mime-info (1.3-1) ...
    Processing triggers for systemd (215-17+deb8u6) ...
    Setting up libaudiofile1:armhf (0.3.6-2+deb8u2) ...
    Setting up libgstreamer1.0-0:armhf (1.4.4-2+deb8u1) ...
    Setting up libgstreamer-plugins-base1.0-0:armhf (1.4.4-2+deb8u1) ...
    Setting up libwbclient0:armhf (2:4.2.14+dfsg-0+deb8u4) ...
    Setting up samba-libs:armhf (2:4.2.14+dfsg-0+deb8u4) ...
    Setting up libsmbclient:armhf (2:4.2.14+dfsg-0+deb8u4) ...
    Setting up samba-common (2:4.2.14+dfsg-0+deb8u4) ...
    Setting up wolfram-engine (11.0.1+2017031701) ...
    Setting up gstreamer1.0-plugins-base:armhf (1.4.4-2+deb8u1) ...
    Setting up gstreamer1.0-plugins-good:armhf (1.4.4-2+deb8u3) ...
    Setting up libgstreamer-plugins-bad1.0-0:armhf (1.4.4-2.1+deb8u2) ...
    Setting up gstreamer1.0-plugins-bad:armhf (1.4.4-2.1+deb8u2) ...
    Setting up alacarte (3.11.91-2+rpi4) ...
    Setting up gstreamer1.0-alsa:armhf (1.4.4-2+deb8u1) ...
    Setting up gstreamer1.0-x:armhf (1.4.4-2+deb8u1) ...
    Setting up libopenblas-base (0.2.12-1+rpi1) ...
    update-alternatives: using /usr/lib/libblas/libblas.so.3 to provide /usr/lib/libblas.so.3 (libblas.so.3) in auto mode
    update-alternatives: using /usr/lib/lapack/liblapack.so.3 to provide /usr/lib/liblapack.so.3 (liblapack.so.3) in auto mode
    Setting up libpam-chksshpwd:armhf (1.1.8-3.1+deb8u2+rpi3) ...
    Installing new version of config file /etc/profile.d/sshpwd.sh ...
    Setting up pi-greeter (0.4) ...
    Setting up piclone (0.4) ...
    Setting up pix-plym-splash (0.9) ...
    Setting up raspberrypi-sys-mods (20170313) ...
    Updating documentation URL in /boot/config.txt...
    Setting up realvnc-vnc-server (6.0.2.26558) ...
    Updating /etc/pam.d/vncserver
    Updating /etc/pam.conf... done
    Looking for font path... not found.
    Generating private key... done
    Installed systemd unit for VNC Server in Service Mode daemon
    Start or stop the service with:
      systemctl (start|stop) vncserver-x11-serviced.service
    Mark or unmark the service to be started at boot time with:
      systemctl (enable|disable) vncserver-x11-serviced.service
    
    Installed systemd unit for VNC Server in Virtual Mode daemon
    Start or stop the service with:
      systemctl (start|stop) vncserver-virtuald.service
    Mark or unmark the service to be started at boot time with:
      systemctl (enable|disable) vncserver-virtuald.service
    
    
    (gconftool-2:19580): GConf-WARNING **: Client failed to connect to the D-BUS daemon:
    Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
    gconfd-2: no process found
    Setting up rpi-chromium-mods (20170317) ...
    Setting up wiringpi (2.44) ...
    Setting up raspberrypi-ui-mods (1.20170315) ...
    Setting up raspi-config (20170307) ...
    Processing triggers for libc-bin (2.19-18+deb8u7) ...
    root@signage:~# 
    
  • Reboot in case there are Kernel changes or library updates.
  • Strip extra packages that we’ll never use
    root@signage:~# apt-get remove --purge wolfram-engine cron logrotate dphys-swapfile xserver-common lightdm
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    The following packages were automatically installed and are no longer required:
      coinor-libipopt1 dc fontconfig-infinality fonts-droid fonts-roboto gtk2-engines-clearlookspix libboost-filesystem1.55.0
      libboost-program-options1.55.0 libboost-regex1.55.0 libffi5 libgmime-2.6-0 libmumps-seq-4.10.0 liboauth0 libraw10 libxfce4util-bin
      libxfce4util-common libxfce4util6 libxfconf-0-2 pi-greeter pimixer pipanel pishutdown pix-icons pix-plym-splash pixel-wallpaper point-rpi
      wolframscript xfconf
    Use 'apt-get autoremove' to remove them.
    The following packages will be REMOVED:
      dphys-swapfile* lightdm* logrotate* raspberrypi-ui-mods* wolfram-engine* xserver-common* xserver-xorg* xserver-xorg-core* xserver-xorg-input-all*
      xserver-xorg-input-libinput* xserver-xorg-video-fbdev* xserver-xorg-video-fbturbo*
    0 upgraded, 0 newly installed, 12 to remove and 0 not upgraded.
    After this operation, 693 MB disk space will be freed.
    Do you want to continue? [Y/n] y
    (Reading database ... 112367 files and directories currently installed.)
    Removing dphys-swapfile (20100506-1) ...
    Purging configuration files for dphys-swapfile (20100506-1) ...
    Removing raspberrypi-ui-mods (1.20170315) ...
    update-alternatives: using /usr/bin/startlxde to provide /usr/bin/x-session-manager (x-session-manager) in auto mode
    update-alternatives: using /usr/share/libgksu/debian/gconf-defaults.libgksu-su to provide /usr/share/gconf/defaults/10_libgksu (libgksu-gconf-defaults) in auto mode
    Purging configuration files for raspberrypi-ui-mods (1.20170315) ...
    Removing lightdm (1.10.3-3+rpi) ...
    Purging configuration files for lightdm (1.10.3-3+rpi) ...
    Removing user `lightdm' ...
    Warning: group `lightdm' has no more members.
    Done.
    Removing logrotate (3.8.7-1) ...
    Purging configuration files for logrotate (3.8.7-1) ...
    Removing wolfram-engine (11.0.1+2017031701) ...
    Purging configuration files for wolfram-engine (11.0.1+2017031701) ...
    Removing xserver-xorg (1:7.7+16) ...
    Purging configuration files for xserver-xorg (1:7.7+16) ...
    Removing xserver-xorg-video-fbturbo (1.20161111~122359) ...
    Removing xserver-xorg-video-fbdev (1:0.4.4-1+rpi2) ...
    Removing xserver-xorg-input-all (1:7.7+16) ...
    Removing xserver-xorg-input-libinput (0.20.0-1) ...
    Removing xserver-xorg-core (2:1.18.4-2+rpi1) ...
    Purging configuration files for xserver-xorg-core (2:1.18.4-2+rpi1) ...
    rm: cannot remove ‘/var/log/Xorg.*.log.old’: No such file or directory
    Removing xserver-common (2:1.18.4-2+rpi1) ...
    Processing triggers for man-db (2.7.0.2-5) ...
    Processing triggers for gnome-menus (3.13.3-6) ...
    Processing triggers for desktop-file-utils (0.22-1) ...
    Processing triggers for mime-support (3.58) ...
    Processing triggers for shared-mime-info (1.3-1) ...
    Processing triggers for hicolor-icon-theme (0.13-1) ...
    root@signage:~# apt-get autoremove 
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    The following packages will be REMOVED:
      coinor-libipopt1 dc fontconfig-infinality fonts-droid fonts-roboto gtk2-engines-clearlookspix libboost-filesystem1.55.0
      libboost-program-options1.55.0 libboost-regex1.55.0 libepoxy0 libevdev2 libffi5 libgmime-2.6-0 libinput-bin libinput10 liblightdm-gobject-1-0
      libmumps-seq-4.10.0 liboauth0 libpciaccess0 libraw10 libwacom-common libwacom2 libxfce4util-bin libxfce4util-common libxfce4util6 libxfconf-0-2
      lightdm-gtk-greeter pi-greeter pimixer pipanel pishutdown pix-icons pix-plym-splash pixel-wallpaper point-rpi wolframscript xfconf
    0 upgraded, 0 newly installed, 37 to remove and 0 not upgraded.
    After this operation, 65.2 MB disk space will be freed.
    Do you want to continue? [Y/n] y
    (Reading database ... 102396 files and directories currently installed.)
    Removing coinor-libipopt1 (3.11.9-2) ...
    Removing dc (1.06.95-9) ...
    Removing fontconfig-infinality (20130104-0ubuntu0ppa1+rpi) ...
    Removing fonts-droid (1:4.4.4r2-6+rpi1) ...
    Removing fonts-roboto (1:4.4.4r2-6+rpi1) ...
    Removing gtk2-engines-clearlookspix:armhf (1:2.20.4) ...
    Removing wolframscript (1.0.1-19) ...
    Removing libboost-filesystem1.55.0:armhf (1.55.0+dfsg-3) ...
    Removing libboost-program-options1.55.0:armhf (1.55.0+dfsg-3) ...
    Removing libboost-regex1.55.0:armhf (1.55.0+dfsg-3) ...
    Removing libepoxy0 (1.2-1) ...
    Removing libinput10:armhf (1.5.0-1) ...
    Removing libevdev2 (1.3+dfsg-1) ...
    Removing libffi5:armhf (3.0.10-3+rpi1) ...
    Removing libgmime-2.6-0:armhf (2.6.20-1) ...
    Removing libinput-bin (1.5.0-1) ...
    Removing pi-greeter (0.4) ...
    update-alternatives: using /usr/share/xgreeters/lightdm-gtk-greeter.desktop to provide /usr/share/xgreeters/lightdm-greeter.desktop (lightdm-greeter) in auto mode
    Removing lightdm-gtk-greeter (1.8.5-2) ...
    Removing liblightdm-gobject-1-0 (1.10.3-3+rpi) ...
    Removing libmumps-seq-4.10.0 (4.10.0.dfsg-3+b2) ...
    Removing liboauth0:armhf (1.0.1-1) ...
    Removing libpciaccess0:armhf (0.13.2-3) ...
    Removing libraw10:armhf (0.16.0-9+deb8u2) ...
    Removing libwacom2:armhf (0.22-1) ...
    Removing libwacom-common (0.22-1) ...
    Removing libxfce4util-bin (4.10.1-2) ...
    Removing pimixer (0.20160527~090638-1) ...
    Removing libxfconf-0-2 (4.10.0-3) ...
    Removing xfconf (4.10.0-3) ...
    Removing libxfce4util6 (4.10.1-2) ...
    Removing libxfce4util-common (4.10.1-2) ...
    Removing pipanel (20161206~130650) ...
    Removing pishutdown (0.7) ...
    Removing 'diversion of /usr/bin/lxde-pi-shutdown-helper to /usr/bin/lxde-pi-shutdown-helper.old by pishutdown'
    Removing pix-icons (0.4) ...
    Removing pix-plym-splash (0.9) ...
    Removing pixel-wallpaper (0.3) ...
    Removing point-rpi (0.20160905) ...
    Processing triggers for libc-bin (2.19-18+deb8u7) ...
    Processing triggers for install-info (5.2.0.dfsg.1-6) ...
    Processing triggers for man-db (2.7.0.2-5) ...
    Processing triggers for fontconfig (2.11.0-6.3+deb8u1) ...
    Processing triggers for shared-mime-info (1.3-1) ...
    Processing triggers for hicolor-icon-theme (0.13-1) ...
    Processing triggers for udev (215-17+deb8u6) ...
    Processing triggers for gnome-menus (3.13.3-6) ...
    Processing triggers for desktop-file-utils (0.22-1) ...
    Processing triggers for mime-support (3.58) ...
    root@signage:~# 
    root@signage:~# insserv -r x11-common; apt-get autoremove --purge
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
    root@signage:~# 
    
  • Replace log management with busybox logger. This will put log into circular memory buffer, you will able to see log using “logread” command.
    root@signage:~# apt-get install busybox-syslogd; dpkg --purge rsyslog
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    The following extra packages will be installed:
      busybox
    The following packages will be REMOVED:
      rsyslog
    The following NEW packages will be installed:
      busybox busybox-syslogd
    0 upgraded, 2 newly installed, 1 to remove and 0 not upgraded.
    Need to get 396 kB of archives.
    After this operation, 714 kB disk space will be freed.
    Do you want to continue? [Y/n] y
    Get:1 http://mirrordirector.raspbian.org/raspbian/ jessie/main busybox armhf 1:1.22.0-9+deb8u1 [373 kB]
    Get:2 http://mirrordirector.raspbian.org/raspbian/ jessie/main busybox-syslogd all 1:1.22.0-9+deb8u1 [23.4 kB]
    Fetched 396 kB in 1s (352 kB/s)            
    (Reading database ... 100170 files and directories currently installed.)
    Removing rsyslog (8.4.2-1+deb8u2) ...
    Processing triggers for man-db (2.7.0.2-5) ...
    Selecting previously unselected package busybox.
    (Reading database ... 100122 files and directories currently installed.)
    Preparing to unpack .../busybox_1%3a1.22.0-9+deb8u1_armhf.deb ...
    Unpacking busybox (1:1.22.0-9+deb8u1) ...
    Selecting previously unselected package busybox-syslogd.
    Preparing to unpack .../busybox-syslogd_1%3a1.22.0-9+deb8u1_all.deb ...
    Unpacking busybox-syslogd (1:1.22.0-9+deb8u1) ...
    Processing triggers for man-db (2.7.0.2-5) ...
    Processing triggers for systemd (215-17+deb8u6) ...
    Setting up busybox (1:1.22.0-9+deb8u1) ...
    Setting up busybox-syslogd (1:1.22.0-9+deb8u1) ...
    Processing triggers for systemd (215-17+deb8u6) ...
    (Reading database ... 100143 files and directories currently installed.)
    Removing rsyslog (8.4.2-1+deb8u2) ...
    Purging configuration files for rsyslog (8.4.2-1+deb8u2) ...
    root@signage:~# 
  • Disable swap and filesystem check and make the system read-only. Edit /boot/cmdline.txt and add “fastboot noswap ro” to the end of the line (see below) to disable filesystem check at boot, turn off swap file usage and make the system read-only.
    dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait fastboot noswap ro
    
  • Move some system files to tmp filesystem
    root@signage:~# rm -rf /var/lib/dhcp/ /var/run /var/spool /var/lock /etc/resolv.conf
    root@signage:~# ln -s /tmp /var/lib/dhcp
    root@signage:~# ln -s /tmp /var/run
    root@signage:~# ln -s /tmp /var/spool
    root@signage:~# ln -s /tmp /var/lock
    root@signage:~# touch /tmp/dhcpcd.resolv.conf; ln -s /tmp/dhcpcd.resolv.conf /etc/resolv.conf
    root@signage:~# 
    
  • The systemd file “random-seed” needs to be moved to a tmp filesystem as well. So do the following changes
    root@signage:~# rm /var/lib/systemd/random-seed
    root@signage:~# ln -s /tmp/random-seed /var/lib/systemd/random-seed
    root@signage:~# 
    
  • A small annoyance is the fact that sshd needs to read the logs and print out the Last Login information. We can disable that by modifying the file /etc/ssh/sshd_config and changing “PrintLastLog yes” to “PrintLastLog no”.
  • We also need to fix the DHCP startup script. Edit /etc/systemd/system/dhcpcd5 and change “PIDFile=/run/dhcpcd.pid” to “PIDFile=/var/run/dhcpcd.pid”. It should look like this when done:
    [Unit]
    Description=dhcpcd on all interfaces
    Wants=network.target
    Before=network.target
    
    [Service]
    Type=forking
    PIDFile=/var/run/dhcpcd.pid
    ExecStart=/sbin/dhcpcd -q -b
    ExecStop=/sbin/dhcpcd -x
    
    [Install]
    WantedBy=multi-user.target
    Alias=dhcpcd5
    
  • Now you need to fix the systemd service file to kickstart the random-seed service. For this we need to add the line ExecStartPre=/bin/echo "" >/tmp/random-seed to the service section of /lib/systemd/system/systemd-random-seed.service. The file will look like this once this is done:
    #  This file is part of systemd.
    #
    #  systemd is free software; you can redistribute it and/or modify it
    #  under the terms of the GNU Lesser General Public License as published by
    #  the Free Software Foundation; either version 2.1 of the License, or
    #  (at your option) any later version.
    
    [Unit]
    Description=Load/Save Random Seed
    Documentation=man:systemd-random-seed.service(8) man:random(4)
    DefaultDependencies=no
    RequiresMountsFor=/var/lib/systemd/random-seed
    Conflicts=shutdown.target
    After=systemd-readahead-collect.service systemd-readahead-replay.service systemd-remount-fs.service
    Before=sysinit.target shutdown.target
    
    [Service]
    Type=oneshot
    RemainAfterExit=yes
    ExecStartPre=/bin/echo "" >/tmp/random-seed
    ExecStart=/lib/systemd/systemd-random-seed load
    ExecStop=/lib/systemd/systemd-random-seed save
    
  • Run “systemctl daemon-reload” to reload and finalize the changes we just made.
  • Remove some of the startup scripts using “insserv -r bootlogs; insserv -r console-setup” and change the file /etc/fstab to reflect these changes. Mine looked like this to start with:
    proc            /proc           proc    defaults          0       0
    /dev/mmcblk0p1  /boot           vfat    defaults          0       2
    /dev/mmcblk0p2  /               ext4    defaults,noatime  0       1
    # a swapfile is not a swap partition, no line here
    #   use  dphys-swapfile swap[on|off]  for that
    
  • Now it looks like this:
    proc            /proc           proc    defaults             0       0
    /dev/mmcblk0p1  /boot           vfat    defaults,ro          0       2
    /dev/mmcblk0p2  /               ext4    defaults,noatime,ro  0       1
    # Our tmpfs filesystems. Everything else (above) is read only.
    # To set system to Read-Write use:
    # mount -o remount,rw /
    # and to set it back to Read-Only:
    # mount -o remount,ro /
    tmpfs           /tmp            tmpfs   nosuid,nodev         0       0
    tmpfs           /var/log        tmpfs   nosuid,nodev         0       0
    tmpfs           /var/tmp        tmpfs   nosuid,nodev         0       0
    
  • At this point you can reboot, BUT you’ll come back in read-only mode. You could continue and take the reboot later. To change the filesystem between read-only (ro) and read-write (rw) you can use “mount -o remount,rw /” and “mount -o remount,ro /” commands.
  • To make life simpler we add the following to the end of /etc/bash.bashrc to introduce the “rw” and “ro” aliases and add filesystem mode indication to the shell prompt:
    # set variable identifying the filesystem you work in (used in the prompt below)
    set_bash_prompt(){
        fs_mode=$(mount | sed -n -e "s/^\/dev\/.* on \/ .*(\(r[w|o]\).*/\1/p")
        PS1='\[\033[01;32m\]\u@\h${fs_mode:+($fs_mode)}\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
    }
    
    alias ro='sudo mount -o remount,ro / ; sudo mount -o remount,ro /boot'
    alias rw='sudo mount -o remount,rw / ; sudo mount -o remount,rw /boot'
    alias reboot='sudo mount -o remount,rw / && history -a && sudo mount -o remount,ro / && sudo /sbin/reboot'
    
    # setup fancy prompt"
    PROMPT_COMMAND=set_bash_prompt
  • Also important is saving shell history before logout. So add the following to the file /etc/bash.bash_logout (it might not exist so create it):
    sudo mount -o remount,rw /
    history -a
    sudo fake-hwclock save
    sudo mount -o remount,ro /
    sudo mount -o remount,ro /boot
    
  • Okay so if you’ve made it this far you should be able to reboot and get a stable read-only system up and running after the reboot. Remember that “rw” and “ro” commands will allow you to toggle between read-only and read-write mode. I will not be mentioning this anymore after this point. You WILL need to be in read-write mode to perform the rest of these tutorial.
  • The main script that will run the show is below. Copy and paste it into /root/signage.sh (Yes, the name and location is very important as the script recursively calls itself. You can change this, but you need to edit the contents of the file aswell……you’ve been warned):
    #!/bin/bash
    ## OMXPlayer auto restart script
    ##
    ## Assign location of this script to variable
    ## Used to restart script after connection is lost
    signscript=/root/signage.sh
    
    ## Need this to kick omxplayer to play the stream when in background. If fifo pipe doesn't exist, create it.
    
    if [ ! -f /run/omxfifo ] ; then
    	mkfifo /run/omxfifo
    	chmod 700 /run/omxfifo
    fi
    
    ## If number of arguments is 0 then just start the default channel (equivalent to passing "fcad" as first argument).
    if [ $# -eq 0 ]
    then
    	/usr/bin/omxplayer -r --no-osd --no-keys --live -o both rtmp://blackwood.fcad.ryerson.ca:1935/fcadsignage/live /dev/null 2>&1 &
     echo -n '' > /run/omxfifo
    ## If first argument is "fcad" switch to fcadsignage (default) channel
    elif [[ "$1" == fcad ]]; then
    	/usr/bin/omxplayer -r --no-osd --no-keys --live -o both rtmp://blackwood.fcad.ryerson.ca:1935/fcadsignage/live /dev/null 2>&1 &
     echo -n '' > /run/omxfifo
    ## If first argument is "jrn" switch to jrnsignage channel
    elif [[ "$1" == jrn ]]; then
    	/usr/bin/omxplayer -r --no-osd --no-keys --live -o both rtmp://blackwood.fcad.ryerson.ca:1935/jrnsignage/live /dev/null 2>&1 & 
    echo -n '' > /run/omxfifo
    ## If first argument is "gcn1" switch to GCN channel
    elif [[ "$1" == gcn1 ]]; then
    	/usr/bin/omxplayer -r --no-osd --no-keys --live -o both rtmp://blackwood.fcad.ryerson.ca:1935/gcn1/live /dev/null 2>&1 & echo -
    n '' > /run/omxfifo
    ## If first argument is "gcn2" switch to RUTV channel
    elif [[ "$1" == gcn2 ]]; then
    	/usr/bin/omxplayer -r --no-osd --no-keys --live -o both rtmp://blackwood.fcad.ryerson.ca:1935/gcn2/live /dev/null 2>&1 & echo -
    n '' > /run/omxfifo
    ## If first argument is "sl1" switch to spiritlive1 channel
    elif [[ "$1" == sl1 ]]; then
    	/usr/bin/omxplayer -r --no-osd --no-keys --live -o both rtmp://blackwood.fcad.ryerson.ca:1935/spiritlive/live /dev/null 2>&1 & 
    echo -n '' > /run/omxfifo
    ## If first argument is "sl2" switch to spiritlive2 channel
    elif [[ "$1" == sl2 ]]; then
    	/usr/bin/omxplayer -r --no-osd --no-keys --live -o both rtmp://blackwood.fcad.ryerson.ca:1935/spiritlive/live1 /dev/null 2>&1 &
     echo -n '' > /run/omxfifo
    ## If first argument is anything else switch to Wowza's internal VOD sample stream
    else
    	/usr/bin/omxplayer -r --no-osd --no-keys --live -o both rtmp://blackwood.fcad.ryerson.ca:1935/vod/sample.mp4 /dev/null 2>&1 & e
    cho -n '' > /run/omxfifo
    fi
    
    sleep 0.2
    
    ## omxplayer.bin simply exits if the network dies. We need to monitor this and restart it.
    ## Loop to test if connection is present every 0.5 seconds
    while [ -n "$(/usr/bin/pgrep -f -u root omxplayer.bin)" ];
    do
    	sleep 0.5
    done
    
    
    ## If network connection connection dies execute this shell script itself (recursive) with the original 
    ## command line parameters (channel selection keyword) every 0.2 seconds until we are successful. As we 
    ## spawn new shells to execute the script the old shell is destroyed, so we don't have to worry about 
    ## running out of process space.
    sleep 0.2
    exec "$signscript" $@
    
  • Note that you can change the stream links above to whatever you want. Also the main if…elif…else…fi loop should be changed if you decide to use other command line parameters. But assuming you’re here and want to do a quick check, save the file (remember I’m assuming you’re in rw mode from here on), change it’s permissions via “chmod 700 signage.sh” and run it “./signage.sh”. Hopefully you have 5Mb/s bandwidth and in a few seconds can see the default signage from my school. If not stop here and troubleshoot the script. Use omxplayer from command line to see what’s going on.
  • Next we need to “teach” our FLIRC USB dongle what buttons do what. Grab the remote control you have and plugin the FLIRC dongle into a Mac or PC. Download the software to configure it from FLIRC’s website. Now use the software to configure the following correspondence:
    • F1 to 1 (on remote)
    • F2 to 2 (on remote)
    • ……
    • F10 to 0 (on remote)
  • You Can add more commands to the dongle later, this is just to get us started.
  • Take the dongle and plug it into the Pi. Run “thd –dump /dev/input/event0” and start pressing buttons on your remote. Did you get output like below (If yes continue, otherwise unplug all USB devices from the Pi and replug JUST the FLIRC into USB, this should force it to become “event0” input device)? Good……onwards……
  • Triggerhappy (thd) runs under nobody in raspbian, so we need to give nobody some special sudo privileges. There might be other ways to do this, but I found this simple enough. Create a new file “/etc/sudoers.d/020_nobody-nopasswd” with the following line in it:
    nobody ALL=(ALL) NOPASSWD: /usr/bin/pkill*,/bin/sleep*,/root/signage.sh*,/sbin/shutdown*,/bin/sync*
    
  • Now we need to tell thd what to do when we press buttons on our remote. Remember FLIRC turns IR commands to keyboard presses (F1-F10), so here we configure Triggerhappy to run commands based on buttons pushed (incidentally the commands in this file are the ones we specified above to allow nobody group to sudo. Anyways, edit /etc/triggerhappy/triggers.d/signage.conf” file and add the following contents to it:
    KEY_F1  1       sudo pkill -f -u root omxplayer.bin ; sudo pkill -f -u root signage.sh
    KEY_F1  0       sudo sleep 0.2 ; sudo /root/signage.sh fcad
    KEY_F2  1       sudo pkill -f -u root omxplayer.bin ; sudo pkill -f -u root signage.sh
    KEY_F2  0       sudo sleep 0.2 ; sudo /root/signage.sh jrn
    KEY_F3  1       sudo pkill -f -u root omxplayer.bin ; sudo pkill -f -u root signage.sh
    KEY_F3  0       sudo sleep 0.2 ; sudo /root/signage.sh gcn1
    KEY_F4  1       sudo pkill -f -u root omxplayer.bin ; sudo pkill -f -u root signage.sh
    KEY_F4  0       sudo sleep 0.2 ; sudo /root/signage.sh gcn2
    KEY_F5  1       sudo pkill -f -u root omxplayer.bin ; sudo pkill -f -u root signage.sh
    KEY_F5  0       sudo sleep 0.2 ; sudo /root/signage.sh sl1
    KEY_F6  1       sudo pkill -f -u root omxplayer.bin ; sudo pkill -f -u root signage.sh
    KEY_F6  0       sudo sleep 0.2 ; sudo /root/signage.sh sl2
    #KEY_F7 1       command
    #KEY_F7 0       command
    #KEY_F8 1       command
    #KEY_F8 0       command
    #KEY_F9 1       command
    #KEY_F9 0       command
    KEY_F10 1       sudo pkill -f -u root omxplayer.bin ; sudo pkill -f -u root signage.sh
    KEY_F10 0       sudo sleep 0.2 ; sudo /root/signage.sh sample
    
  • At this point if you want to auto start the signage at boot (with option to change the stream using remote) add the following line to your /etc/rc.local file:
  • We can take a reboot now and make sure things are working. Your default channel (from last step) should autoload now. You should also be able to switch channels using remote. If you disconnect the ethernet cable and reconnect it again later the same stream should continue playing.
  • You’re done……Congratulations. Might want to make a image of this microsd card and then run “rpi-update” to update to the latest firmware/kernel. This is sometimes risky hence why I said make a image first.

Tiny ASCII animations in your browser’s address bar

datePosted on 15:55, February 1st, 2017 by Many Ayromlou

Extremely cool ascii animations in your URL bar. Works in Firefox and Chrome. Doesn’t work in Safari.

http://glench.com/hash/

Check out the Volumeter (listen) and the shooter game (pewpew). Use cursor keys and space bar in pewpew.

Media RSS (MRSS) generator script

datePosted on 10:35, March 17th, 2016 by Many Ayromlou

I came across a DOS batch file that generates the necessary xml manifest for Video files on BrightSign’s Developer Resources and Utilities page. Since I’m serving my video content to our BrightSign infrastructure from a LAMP stack I ended up rewriting their bat file as a shell script. This enables me to host the shell script in a local directory (/usr/local/bin) and run it from cron every 5 minutes against a folder full of mp4 files and have the MRSS manifest written to this folder as well. Then all that needs to be done is to point the BrightSign MRSS widget at the URL for the xml file (http://server-FQDN.com/VideoMRSS.xml). The crontab entry looks like:

*/5 * * * *   /usr/local/bin/VideoMRSS.sh /var/vhosts/jrnsignage/ >/var/vhosts/jrnsignage/VideoMRSS.xml

The script itself is pretty simple. I’ve tried to keep it almost as a exact copy of the dos batch file:


#!/bin/bash
# This script requires 1 argument. Argument 1 is the path to the folder containing the mp4 media files.
# Change this to the BaseURL of the site you'll be serving the XML file from. Omit the last forward slash.
baseurl=http://Server-FQDN.com
# You can change this to any number of minutes
refreshmin=5
guidnum=$(( RANDOM % 1000 ))
year=$(date +%Y)
month=$(date +%m)
day=$(date +%a)
hour=$(date +%H)
min=$(date +%M)
sec=$(date +%S)
header1="<?xml version=\"1.0\" encoding=\"utf-8\" ?>"
header2="<rss version=\"2.0\" xmlns:media=\"http://search.yahoo.com/mrss/\">"
header3="<channel>"
header4="  <title>Batch Custom Video MRSS template for BrightSign Players</title>"
header5="  <link>$baseurl/VideoMRSS.xml</link>"
header6="  <generator>Video MRSS Generation Batch File</generator>"
header7="  <ttl>$refreshmin</ttl>"
footer1="</channel>"
footer2="</rss>"
echo $header1
echo $header2
echo $header3
echo $header4
echo $header5
echo $header6
echo $header7
find $1 -type f -name "*.mp4" -print |while read FULLFILENAME
do
   FILESIZE=$(stat -c%s "$FULLFILENAME")
   FILENAME=$(basename "$FULLFILENAME")
   FNAME="${FILENAME%.*}"
   echo "<item>"
   echo "   <title></title>"
   echo "   <pubDate>$year-$month-$day"T"$hour:$min:$sec.000z</pubDate>"
   echo "   <link>$baseurl/$FILENAME</link>"
   echo "   <description>$FILENAME</description>"
   echo "   <guid isPermalink=\"false\">$FNAME$guidnum</guid>"
   echo "   <media:content url=\"$baseurl/$FILENAME\" filesize=\"$FILESIZE\" type=\"video/mp4\" medium=\"video\"/>"
   echo "</item>"
done

echo $footer1
echo $footer2

sweet captcha site has been hacked – rhpop javascript

datePosted on 18:20, June 23rd, 2015 by Many Ayromlou

Fresh after recovery, I figured I write a small piece before I go home. If you’re seeing ad pop-ups or pop-unders from sites that load up something like rhpop-xxxxxx.js then you might have the sweetcaptcha plugin installed on your wordpress site. Let’s hope you’re the one who installed it — not the hacker :-), you might want to de-activate it and remove it from your system. Their site has been compromised and the wordpress plugin has also been pulled off the list. More general info here:

https://blog.sucuri.net/2015/06/sweetcaptcha-service-used-to-distribute-adware.html

Happy hunting…..

So over christmas holidays I spent about 5 days to perfect my raspberry pi based internet radio player.Screen Shot 2015-01-21 at 9.05.44 AM Screen Shot 2015-01-21 at 9.06.13 AM

You’ll need the following hardware:

  1. Raspberry Pi model B
  2. USB Wifi dongle (something that works with Raspbian would be nice). I got this one (http://www.adafruit.com/products/1030) from Adafruit.
  3. SD card (I’m using a 16GB card, but I think 8GB should be good to start with)
  4. Bluetooth 4.0 dongle. I’m using this one from ASUS (http://www.asus.com/ca-en/Networking/USBBT400/) that seems to work fine in Linux/Raspbian
  5. PiTFT resistive touch screen assembled from Adafruit (http://www.adafruit.com/products/1601)
  6. Pack of 20 tactile buttons from Adafruit (http://www.adafruit.com/products/1489) for the above screen (You need to solder these in…..very simple)
  7. Appropriate power USB power supply. Again I’m using the one from Adafruit (http://www.adafruit.com/products/501)
  8. Standard A to micro-B USB cable (http://www.adafruit.com/products/592)
  9. (optional) PiTFT Enclosure from Adafruit (http://www.adafruit.com/products/1892). Highly recommended as it looks really nice and clean.

 

The screen (PiTFT) comes pre-assembled so all you need to do is solder the 4 buttons on the bottom. This literally takes 5 minutes (8 solder points if you’re keeping track). Once that’s done plugin the screen onto the Pi.

Now grab a copy of the custom Raspbian image off Adafruits website (I’ve grabbed the 9/18/2014 image from http://adafruit-download.s3.amazonaws.com/PiTFT28R_raspbian140909_2014_09_18.zip). There might be a newer one out by the time you read this. Note that this image is only for TFT resistive touch screen NOT the capacitive screen. Unzip the above file (you’ll get a .img file) and burn it onto a SD card (mine is 16GB) following the instructions at http://elinux.org/RPi_Easy_SD_Card_Setup.

I’m plugging in the USB wifi and USB Bluetooth devices into the PI. Also plugin a wired ethernet connection (hopefully you have DHCP on it).

Let’s ssh to the Pi to get it setup (IP is on the PiTFT). I’m logging in as user pi (password raspberry……make sure you change it) and immediately switching to root.

At this point (as root) do the following tasks by running “raspy-config” and using the screenshots as reference:

  1. Expand the file system and reboot.
    Screen Shot 2015-01-21 at 9.27.59 AM
  2. Change the “pi” user passwordScreen Shot 2014-12-29 at 7.47.36 PM
  3. (Optional) Change the internationalization options.Screen Shot 2014-12-29 at 7.47.43 PM Screen Shot 2014-12-29 at 7.47.49 PM Screen Shot 2014-12-29 at 7.51.52 PMNOTE: On the following screen I leave en_GB.UTF-8 as default, although I live in Canada. But I do select _CA and _US as well.Screen Shot 2014-12-29 at 7.52.32 PMBack to main screen and we go back to Internationalization options to change the timezone.Screen Shot 2014-12-29 at 7.54.24 PM Screen Shot 2014-12-29 at 7.56.21 PM Screen Shot 2014-12-29 at 7.55.01 PM
  4. At this point you can also change the Hostname (Under advanced). Once you’ve done that, reboot for good measure and login using “pi” and sudo -i to get to root. Next we want to configure the WIFI USB device.

Now that we have the basics configured, before we install the wifi config tool, it’s a great time to take a break and do a “apt-get update ; apt-get upgrade” cycle. Next we want to make sure that both our USB dongles are detected (WIFI, Bluetooth) by doing “lsusb”.

Screen Shot 2014-12-29 at 8.21.25 PM

We now install wicd-curses using “apt-get install wicd-curses”. Then we run it and not touch anything, you need to press the right keys here. First right off the back press P(references). Note that It’s CAPITAL P.

 

Screen Shot 2014-12-29 at 8.22.10 PM Screen Shot 2014-12-29 at 8.29.52 PM

Once things are setup like the above picture, press F10 key to save it. You might lose connection, just wait until ssh times out and re-ssh back in and sudo -i as well. Now we need to get back into wicd-curses (if the connection dropped) and find the SSID for our WIFI. Once there DO NOT press ENTER. Highlight the entry by using the cursor keys (up,down) and press the RIGHT cursor key (—>) to open the prefs for that SSID. NOTE: the WPA ½ entry has been changed as well.

 

Screen Shot 2014-12-29 at 8.39.10 PM

Press F10 to save. You might get disconnected (you’ll see the WIFI LEDS flashing). If you got timed out, relogin and sudo -i to get root. reboot NOW. Now we need to disconnect the wired connection. This will force the system to turn on WIFI. Once the machine is booted (it might take a bit longer, since we have to wait for wired DHCP to time out), you’ll find the WIFI IP on the TFT.

SSH to the IP and get root shell. We now need to configure bluetooth. Follow along with the pics below. First though we need to install a bunch of stuff with “apt-get install bluetooth bluez bluez-utils bluez-alsa” command. Remove unnecessary services that got installed (scanner, printer, avahi) and disable their autostart.

Screen Shot 2014-12-29 at 9.11.44 PM
Add the following Disable/Enable block (2 lines) to the [General] section of /etc/bluetooth/audio.conf file.
Screen Shot 2014-12-29 at 9.14.21 PM
Okay we need to reboot now and once back in continue as root. First we make sure our BT device is initialized.
Screen Shot 2014-12-29 at 9.22.32 PM
Then we turn on the BT speaker (BeatsPill) and put it in discover mode (hold the b button until the bluetooth LED on the back starts flashing…..might have to push the b button once before). Then we go on to discover the device.
Screen Shot 2014-12-29 at 9.23.18 PM
Note it’s address. We will need to copy and paste it into the next few commands. Put the following in /etc/asound.conf paying attention to replace the MAC address of the BD device with the correct one you copied in the last step.
Screen Shot 2014-12-30 at 12.36.55 AMScreen Shot 2014-12-29 at 9.25.46 PM
Once we get the output 1 from the last command it means that the device is trusted now and Linux will try to auto connect to it if the BT speaker is on when the machine is rebooted. You’ll also hear a beep when the bluetooth-agent command successfully connects. In the last step I’m just trying to establish an audio connection by restarting the bluetooth daemon (make it forget the connection) and using bluez-test-audio to connect back to the speaker. Again you’ll hear a beep when the Pi connects.
Screen Shot 2014-12-29 at 9.28.25 PM
Now we need to install mpd, mpc and the curses based ncmpcpp by using “apt-get install mpd mpc ncmpcpp”.
Once that’s done copy /etc/mpd.conf to /etc/mpd.conf.old and create /etc/mpd.conf with the following content:
# An example configuration file for MPD
# See the mpd.conf man page for a more detailed description of each parameter.
# Files and directories #######################################################
#
# This setting controls the top directory which MPD will search to discover the
# available audio files and add them to the daemon's online database. This 
# setting defaults to the XDG directory, otherwise the music directory will be
# be disabled and audio files will only be accepted over ipc socket (using
# file:// protocol) or streaming files over an accepted protocol.
#
music_directory	"/var/lib/mpd/music"
#
# This setting sets the MPD internal playlist directory. The purpose of this
# directory is storage for playlists created by MPD. The server will use 
# playlist files not created by the server but only if they are in the MPD
# format. This setting defaults to playlist saving being disabled.
#
playlist_directory	"/var/lib/mpd/playlists"
#
# This setting sets the location of the MPD database. This file is used to
# load the database at server start up and store the database while the 
# server is not up. This setting defaults to disabled which will allow
# MPD to accept files over ipc socket (using file:// protocol) or streaming
# files over an accepted protocol.
#
db_file	"/var/lib/mpd/tag_cache"
# 
# These settings are the locations for the daemon log files for the daemon.
# These logs are great for troubleshooting, depending on your log_level
# settings.
#
# The special value "syslog" makes MPD use the local syslog daemon. This
# setting defaults to logging to syslog, otherwise logging is disabled.
#
log_file	"/var/log/mpd/mpd.log"
#
# This setting sets the location of the file which stores the process ID
# for use of mpd --kill and some init scripts. This setting is disabled by
# default and the pid file will not be stored.
#
pid_file	"/var/run/mpd/pid"
#
# This setting sets the location of the file which contains information about
# most variables to get MPD back into the same general shape it was in before
# it was brought down. This setting is disabled by default and the server 
# state will be reset on server start up.
#
state_file	"/var/lib/mpd/state"
#
# The location of the sticker database.  This is a database which
# manages dynamic information attached to songs.
#
sticker_file                   "/var/lib/mpd/sticker.sql"
#
###############################################################################
# General music daemon options ################################################
#
# This setting specifies the user that MPD will run as. MPD should never run as
# root and you may use this setting to make MPD change its user ID after
# initialization. This setting is disabled by default and MPD is run as the
# current user.
#
user	"mpd"
#
# This setting specifies the group that MPD will run as. If not specified
# primary group of user specified with "user" setting will be used (if set).
# This is useful if MPD needs to be a member of group such as "audio" to
# have permission to use sound card.
#
#group                          "nogroup"
#
# This setting sets the address for the daemon to listen on. Careful attention
# should be paid if this is assigned to anything other then the default, any.
# This setting can deny access to control of the daemon. Choose any if you want
# to have mpd listen on every address
#
# For network
#bind_to_address	"any"
bind_to_address	“127.0.0.1"
#
# And for Unix Socket
#bind_to_address	"/var/run/mpd/socket"
#
# This setting is the TCP port that is desired for the daemon to get assigned
# to.
#
port	"6600"
#
# This setting controls the type of information which is logged. Available 
# setting arguments are "default", "secure" or "verbose". The "verbose" setting
# argument is recommended for troubleshooting, though can quickly stretch
# available resources on limited hardware storage.
#
#log_level	"default"
#
# If you have a problem with your MP3s ending abruptly it is recommended that 
# you set this argument to "no" to attempt to fix the problem. If this solves
# the problem, it is highly recommended to fix the MP3 files with vbrfix
# (available as vbrfix in the debian archive), at which
# point gapless MP3 playback can be enabled.
#
gapless_mp3_playback	"yes"
#
# This setting enables MPD to create playlists in a format usable by other
# music players.
#
#save_absolute_paths_in_playlists	"no"
#
# This setting defines a list of tag types that will be extracted during the 
# audio file discovery process. Optionally, 'comment' can be added to this
# list.
#
#metadata_to_use	"artist,album,title,track,name,genre,date,composer,performer,disc"
#
# This setting enables automatic update of MPD's database when files in 
# music_directory are changed.
#
auto_update    "yes"
#
# Limit the depth of the directories being watched, 0 means only watch
# the music directory itself.  There is no limit by default.
#
#auto_update_depth "3"
#
###############################################################################
# Symbolic link behavior ######################################################
#
# If this setting is set to "yes", MPD will discover audio files by following 
# symbolic links outside of the configured music_directory.
#
follow_outside_symlinks	"yes"
#
# If this setting is set to "yes", MPD will discover audio files by following
# symbolic links inside of the configured music_directory.
#
follow_inside_symlinks	"yes"
#
###############################################################################
# Zeroconf / Avahi Service Discovery ##########################################
#
# If this setting is set to "yes", service information will be published with
# Zeroconf / Avahi.
#
zeroconf_enabled	"yes"
#
# The argument to this setting will be the Zeroconf / Avahi unique name for
# this MPD server on the network.
#
zeroconf_name	"iradio"
#
###############################################################################
# Permissions #################################################################
#
# If this setting is set, MPD will require password authorization. The password
# can setting can be specified multiple times for different password profiles.
#
#password                        "password@read,add,control,admin"
#
# This setting specifies the permissions a user has who has not yet logged in. 
#
#default_permissions             "read,add,control,admin"
#
###############################################################################
# Input #######################################################################
#
input {
        plugin "curl"
#       proxy "proxy.isp.com:8080"
#       proxy_user "user"
#       proxy_password "password"
}
#
###############################################################################
# Audio Output ################################################################

# MPD supports various audio output types, as well as playing through multiple 
# audio outputs at the same time, through multiple audio_output settings 
# blocks. Setting this block is optional, though the server will only attempt
# autodetection for one sound card.
#
# See <http://mpd.wikia.com/wiki/Configuration#Audio_Outputs> for examples of 
# other audio outputs.
#
# An example of an ALSA output THIS IS THE DEFAULT:
#
audio_output {
type	"alsa"
name	"My ALSA Device"
device	"hw:0,0"	# optional
format	"44100:16:2"	# optional
mixer_device	"default"	# optional
mixer_control	"PCM"	# optional
mixer_index	"0"	# optional
}
#
# Example for Bluetooth A2DP
#
audio_output {
type            "alsa"
name            "ALSA"
format          "44100:16:2"    # optional
#options         "dev=dmixer"
device          "bluetooth"
}
#
# Enable FIFO Pipe for ncmpcpp Visualizer
#
audio_output {
    type                    "fifo"
    name                    "iradio"
    path                    "/tmp/mpd.fifo"
    format                  "44100:16:1"
}
#
# Example for USB class complaint Audio Card
#
#audio_output {
#	type	"alsa"
#	name	"Output"
#	device	"hw:0,0"	# optional
#	dsd_usb	"no"
#}
#
# An example of an OSS output:
#
#audio_output {
#	type	"oss"
#	name	"My OSS Device"
#	device	"/dev/dsp"	# optional
#	format	"44100:16:2"	# optional
#	mixer_device	"/dev/mixer"	# optional
#	mixer_control	"PCM"	# optional
#}
#
# An example of a shout output (for streaming to Icecast):
#
#audio_output {
#	type	"shout"
#	encoding	"ogg"	# optional
#	name	"My Shout Stream"
#	host	"localhost"
#	port	"8000"
#	mount	"/mpd.ogg"
#	password	"hackme"
#	quality	"5.0"
#	bitrate	"128"
#	format	"44100:16:1"
#	protocol	"icecast2"	# optional
#	user	"source"	# optional
#	description	"My Stream Description"	# optional
#	genre	"jazz"	# optional
#	public	"no"	# optional
#	timeout	"2"	# optional
#}
#
# An example of a recorder output:
#
#audio_output {
#       type            "recorder"
#       name            "My recorder"
#       encoder         "vorbis"                # optional, vorbis or lame
#       path            "/var/lib/mpd/recorder/mpd.ogg"
##      quality         "5.0"                   # do not define if bitrate is defined
#       bitrate         "128"                   # do not define if quality is defined
#       format          "44100:16:1"
#}
#
# An example of a httpd output (built-in HTTP streaming server):
#
#audio_output {
#	type	"httpd"
#	name	"My HTTP Stream"
#	encoder	"vorbis"	# optional, vorbis or lame
#	port	"8000"
#	quality	"5.0"	# do not define if bitrate is defined
#	bitrate	"128"	# do not define if quality is defined
#	format	"44100:16:1"
#}
#
# An example of a pulseaudio output (streaming to a remote pulseaudio server)
#
#audio_output {
#	type	"pulse"
#	name	"My Pulse Output"
#	server	"remote_server"	# optional
#	sink	"remote_server_sink"	# optional
#}
#
## Example "pipe" output:
#
#audio_output {
#	type	"pipe"
#	name	"my pipe"
#	command	"aplay -f cd 2>/dev/null"
## Or if you're want to use AudioCompress
#	command	"AudioCompress -m | aplay -f cd 2>/dev/null"
## Or to send raw PCM stream through PCM:
#	command	"nc example.org 8765"
#	format	"44100:16:2"
#}
#
## An example of a null output (for no audio output):
#
#audio_output {
#	type	"null"
#	name	"My Null Output"
#}
#
# This setting will change all decoded audio to be converted to the specified
# format before being passed to the audio outputs. By default, this setting is
# disabled.
#
#audio_output_format	"44100:16:2"
#
# If MPD has been compiled with libsamplerate support, this setting specifies 
# the sample rate converter to use.  Possible values can be found in the 
# mpd.conf man page or the libsamplerate documentation. By default, this is
# setting is disabled.
#
#samplerate_converter	"Fastest Sinc Interpolator"
#
###############################################################################
# Volume control mixer ########################################################
#
# These are the global volume control settings. By default, this setting will
# be detected to the available audio output device, with preference going to 
# hardware mixing. Hardware and software mixers for individual audio_output
# sections cannot yet be mixed.
#
# An example for controlling an ALSA, OSS or Pulseaudio mixer; If this
# setting is used other sound applications will be affected by the volume
# being controlled by MPD.
#
#mixer_type	"hardware"
#
# An example for controlling all mixers through software. This will control
# all controls, even if the mixer is not supported by the device and will not
# affect any other sound producing applications.
#
#mixer_type	"software"
#
# This example will not allow MPD to touch the mixer at all and will disable
# all volume controls.
#
#mixer_type	"disabled"
#mixer_type	"none"
#
###############################################################################
# Normalization automatic volume adjustments ##################################
#
# This setting specifies the type of ReplayGain to use. This setting can have
# the argument "album" or "track". See <http://www.replaygain.org> for more
# details. This setting is disabled by default.
#
#replaygain	"album"
#
# This setting sets the pre-amp used for files that have ReplayGain tags. By
# default this setting is disabled.
#
#replaygain_preamp	"0"
#
# This setting enables on-the-fly normalization volume adjustment. This will
# result in the volume of all playing audio to be adjusted so the output has 
# equal "loudness". This setting is disabled by default.
#
volume_normalization	"no"
#
###############################################################################
# MPD Internal Buffering ######################################################
#
# This setting adjusts the size of internal decoded audio buffering. Changing
# this may have undesired effects. Don't change this if you don't know what you
# are doing.
#
audio_buffer_size	"2048"
#
# This setting controls the percentage of the buffer which is filled before 
# beginning to play. Increasing this reduces the chance of audio file skipping, 
# at the cost of increased time prior to audio playback.
#
buffer_before_play	"20%"
#
###############################################################################
# Resource Limitations ########################################################
#
# These settings are various limitations to prevent MPD from using too many
# resources. Generally, these settings should be minimized to prevent security
# risks, depending on the operating resources.
#
#connection_timeout	"60"
#max_connections	"10"
#max_playlist_length	"16384"
#max_command_list_size	"2048"
#max_output_buffer_size	"8192"
#
###############################################################################
# Character Encoding ##########################################################
#
# If file or directory names do not display correctly for your locale then you 
# may need to modify this setting. After modification of this setting mpd 
# --create-db must be run to change the database.
#
filesystem_charset	"UTF-8"
#
# This setting controls the encoding that ID3v1 tags should be converted from.
#
id3v1_encoding	"UTF-8"
#
###############################################################################
# SIDPlay decoder #############################################################
#
# songlength_database:
#  Location of your songlengths file, as distributed with the HVSC.
#  The sidplay plugin checks this for matching MD5 fingerprints.
#  See http://www.c64.org/HVSC/DOCUMENTS/Songlengths.faq
#
# default_songlength:
#  This is the default playing time in seconds for songs not in the
#  songlength database, or in case you're not using a database.
#  A value of 0 means play indefinitely.
#
# filter:
#  Turns the SID filter emulation on or off.
#
#decoder {
#       plugin                  "sidplay"
#       songlength_database     "/media/C64Music/DOCUMENTS/Songlengths.txt"
#       default_songlength      "120"
#       filter "true"
#}
#
###############################################################################

There are 3 audio_output sections for the internal headphone jack, bluetooth audio and a third one for ncmpcpp’s spectrum analyzer (although I don’t use it in this project).

Next we need a playlist file in m3u format. You’ll find a good one below (contains di.fm, sky.fm, CBC and somafm AAC links). Copy this into /var/lib/mpd/playlist/something.m3u (remember the filename since we will then use mpc to load it):


http://pub6.di.fm/di_00sclubhits_aac
http://pub6.di.fm/di_ambient_aac
http://pub6.di.fm/di_bassnjackinhouse_aac
http://pub6.di.fm/di_bassline_aac
http://pub6.di.fm/di_bigbeat_aac
http://pub6.di.fm/di_bigroomhouse_aac
http://pub6.di.fm/di_breaks_aac
http://pub6.di.fm/di_chillhop_aac
http://pub6.di.fm/di_chilloutdreams_aac
http://pub6.di.fm/di_chillout_aac
http://pub6.di.fm/di_chillstep_aac
http://pub6.di.fm/di_chiptunes_aac
http://pub6.di.fm/di_classiceurodance_aac
http://pub6.di.fm/di_classiceurodisco_aac
http://pub6.di.fm/di_classictrance_aac
http://pub6.di.fm/di_classicvocaltrance_aac
http://pub6.di.fm/di_clubdubstep_aac
http://pub6.di.fm/di_club_aac
http://pub6.di.fm/di_cosmicdowntempo_aac
http://pub6.di.fm/di_darkdnb_aac
http://pub6.di.fm/di_darkpsytrance_aac
http://pub6.di.fm/di_deephouse_aac
http://pub6.di.fm/di_deepnudisco_aac
http://pub6.di.fm/di_deeptech_aac
http://pub6.di.fm/di_discohouse_aac
http://pub6.di.fm/di_djmixes_aac
http://pub6.di.fm/di_downtempolounge_aac
http://pub6.di.fm/di_drumandbass_aac
http://pub6.di.fm/di_drumstep_aac
http://pub6.di.fm/di_dub_aac
http://pub6.di.fm/di_dubstep_aac
http://pub6.di.fm/di_ebm_aac
http://pub6.di.fm/di_eclectronica_aac
http://pub6.di.fm/di_electro_aac
http://pub6.di.fm/di_electronicpioneers_aac
http://pub6.di.fm/di_electronics_aac
http://pub6.di.fm/di_electropop_aac
http://pub6.di.fm/di_electroswing_aac
http://pub6.di.fm/di_epictrance_aac
http://pub6.di.fm/di_eurodance_aac
http://pub6.di.fm/di_funkyhouse_aac
http://pub6.di.fm/di_futuregarage_aac
http://pub6.di.fm/di_futuresynthpop_aac
http://pub6.di.fm/di_gabber_aac
http://pub6.di.fm/di_glitchhop_aac
http://pub6.di.fm/di_goapsy_aac
http://pub6.di.fm/di_handsup_aac
http://pub6.di.fm/di_hardcore_aac
http://pub6.di.fm/di_harddance_aac
http://pub6.di.fm/di_hardstyle_aac
http://pub6.di.fm/di_hardtechno_aac
http://pub6.di.fm/di_house_aac
http://pub6.di.fm/di_jungle_aac
http://pub6.di.fm/di_latinhouse_aac
http://pub6.di.fm/di_liquiddnb_aac
http://pub6.di.fm/di_liquiddubstep_aac
http://pub6.di.fm/di_lounge_aac
http://pub6.di.fm/di_mainstage_aac
http://pub6.di.fm/di_minimal_aac
http://pub6.di.fm/di_moombahton_aac
http://pub6.di.fm/di_nightcore_aac
http://pub6.di.fm/di_nudisco_aac
http://pub6.di.fm/di_oldschoolacid_aac
http://pub6.di.fm/di_oldschoolhouse_aac
http://pub6.di.fm/di_oldschoolrave_aac
http://pub6.di.fm/di_classictechno_aac
http://pub6.di.fm/di_progressive_aac
http://pub6.di.fm/di_progressivepsy_aac
http://pub6.di.fm/di_psybient_aac
http://pub6.di.fm/di_psychill_aac
http://pub6.di.fm/di_russianclubhits_aac
http://pub6.di.fm/di_scousehouse_aac
http://pub6.di.fm/di_soulfulhouse_aac
http://pub6.di.fm/di_spacemusic_aac
http://pub6.di.fm/di_techhouse_aac
http://pub6.di.fm/di_techno_aac
http://pub6.di.fm/di_trance_aac
http://pub6.di.fm/di_trap_aac
http://pub6.di.fm/di_tribalhouse_aac
http://pub6.di.fm/di_ukgarage_aac
http://pub6.di.fm/di_umfradio_aac
http://pub6.di.fm/di_undergroundtechno_aac
http://pub6.di.fm/di_vocalchillout_aac
http://pub6.di.fm/di_vocallounge_aac
http://pub6.di.fm/di_vocaltrance_aac
http://pub7.radiotunes.com/radiotunes_00srnb_aac
http://pub7.radiotunes.com/radiotunes_60srock_aac
http://pub7.radiotunes.com/radiotunes_80sdance_aac
http://pub7.radiotunes.com/radiotunes_80srock_aac
http://pub7.radiotunes.com/radiotunes_hit90s_aac
http://pub7.radiotunes.com/radiotunes_90srnb_aac
http://pub7.radiotunes.com/radiotunes_beatles_aac
http://pub7.radiotunes.com/radiotunes_altrock_aac
http://pub7.radiotunes.com/radiotunes_rtambient_aac
http://pub7.radiotunes.com/radiotunes_americansongbook_aac
http://pub7.radiotunes.com/radiotunes_baroque_aac
http://pub7.radiotunes.com/radiotunes_bebop_aac
http://pub7.radiotunes.com/radiotunes_hit60s_aac
http://pub7.radiotunes.com/radiotunes_the80s_aac
http://pub7.radiotunes.com/radiotunes_bossanova_aac
http://pub7.radiotunes.com/radiotunes_cafedeparis_aac
http://pub7.radiotunes.com/radiotunes_rtchillout_aac
http://pub7.radiotunes.com/radiotunes_guitar_aac
http://pub7.radiotunes.com/radiotunes_classicalperiod_aac
http://pub7.radiotunes.com/radiotunes_classicalpianotrios_aac
http://pub7.radiotunes.com/radiotunes_christmas_aac
http://pub7.radiotunes.com/radiotunes_classicrap_aac
http://pub7.radiotunes.com/radiotunes_classicmotown_aac
http://pub7.radiotunes.com/radiotunes_classicrock_aac
http://pub7.radiotunes.com/radiotunes_clubbollywood_aac
http://pub7.radiotunes.com/radiotunes_christian_aac
http://pub7.radiotunes.com/radiotunes_country_aac
http://pub7.radiotunes.com/radiotunes_dancehits_aac
http://pub7.radiotunes.com/radiotunes_datempolounge_aac
http://pub7.radiotunes.com/radiotunes_davekoz_aac
http://pub7.radiotunes.com/radiotunes_discoparty_aac
http://pub7.radiotunes.com/radiotunes_downtempolounge_aac
http://pub7.radiotunes.com/radiotunes_dreamscapes_aac
http://pub7.radiotunes.com/radiotunes_edmfest_aac
http://pub7.radiotunes.com/radiotunes_eurodance_aac
http://pub7.radiotunes.com/radiotunes_hardrock_aac
http://pub7.radiotunes.com/radiotunes_hit70s_aac
http://pub7.radiotunes.com/radiotunes_holidaysmoothjazz_aac
http://pub7.radiotunes.com/radiotunes_indierock_aac
http://pub7.radiotunes.com/radiotunes_israelihits_aac
http://pub7.radiotunes.com/radiotunes_jazzclassics_aac
http://pub7.radiotunes.com/radiotunes_jpop_aac
http://pub7.radiotunes.com/radiotunes_lounge_aac
http://pub7.radiotunes.com/radiotunes_lovemusic_aac
http://pub7.radiotunes.com/radiotunes_meditation_aac
http://pub7.radiotunes.com/radiotunes_mellowjazz_aac
http://pub7.radiotunes.com/radiotunes_mellowsmoothjazz_aac
http://pub7.radiotunes.com/radiotunes_metal_aac
http://pub7.radiotunes.com/radiotunes_modernblues_aac
http://pub7.radiotunes.com/radiotunes_modernrock_aac
http://pub7.radiotunes.com/radiotunes_classical_aac
http://pub7.radiotunes.com/radiotunes_soundtracks_aac
http://pub7.radiotunes.com/radiotunes_mozart_aac
http://pub7.radiotunes.com/radiotunes_nature_aac
http://pub7.radiotunes.com/radiotunes_newage_aac
http://pub7.radiotunes.com/radiotunes_oldies_aac
http://pub7.radiotunes.com/radiotunes_oldschoolfunknsoul_aac
http://pub7.radiotunes.com/radiotunes_pianojazz_aac
http://pub7.radiotunes.com/radiotunes_popchristmas_aac
http://pub7.radiotunes.com/radiotunes_poppunk_aac
http://pub7.radiotunes.com/radiotunes_poprock_aac
http://pub7.radiotunes.com/radiotunes_reggaeton_aac
http://pub7.radiotunes.com/radiotunes_relaxation_aac
http://pub7.radiotunes.com/radiotunes_relaxingambientpiano_aac
http://pub7.radiotunes.com/radiotunes_relaxingexcursions_aac
http://pub7.radiotunes.com/radiotunes_romantica_aac
http://pub7.radiotunes.com/radiotunes_romantic_aac
http://pub7.radiotunes.com/radiotunes_rootsreggae_aac
http://pub7.radiotunes.com/radiotunes_russiandance_aac
http://pub7.radiotunes.com/radiotunes_russianpop_aac
http://pub7.radiotunes.com/radiotunes_salsa_aac
http://pub7.radiotunes.com/radiotunes_ska_aac
http://pub7.radiotunes.com/radiotunes_slowjams_aac
http://pub7.radiotunes.com/radiotunes_smoothbossanova_aac
http://pub7.radiotunes.com/radiotunes_smoothjazz247_aac
http://pub7.radiotunes.com/radiotunes_smoothjazz_aac
http://pub7.radiotunes.com/radiotunes_smoothlounge_aac
http://pub7.radiotunes.com/radiotunes_softrock_aac
http://pub7.radiotunes.com/radiotunes_solopiano_aac
http://pub7.radiotunes.com/radiotunes_tophits_aac
http://pub7.radiotunes.com/radiotunes_uptemposmoothjazz_aac
http://pub7.radiotunes.com/radiotunes_urbanjamz_aac
http://pub7.radiotunes.com/radiotunes_urbanpophits_aac
http://pub7.radiotunes.com/radiotunes_vocalchillout_aac
http://pub7.radiotunes.com/radiotunes_vocallounge_aac
http://pub7.radiotunes.com/radiotunes_vocalnewage_aac
http://pub7.radiotunes.com/radiotunes_vocalsmoothjazz_aac
http://pub7.radiotunes.com/radiotunes_world_aac
http://3023.live.streamtheworld.com:80/CBC_70S001_H_SC
http://9223.live.streamtheworld.com:80/CBC_80S001_H_SC
http://6093.live.streamtheworld.com:80/CBC_90S001_H_SC
http://6693.live.streamtheworld.com:3690/CBC_90S001_H_SC
http://1721.live.streamtheworld.com:80/CBC_ABORIG_H_SC
http://3163.live.streamtheworld.com:80/CBC_ADLTAL_H_SC
http://5853.live.streamtheworld.com:80/CBC_ADLTPO_H_SC
http://2903.live.streamtheworld.com:80/CBC_ALTCRY_H_SC
http://9233.live.streamtheworld.com:80/CBC_AMBIEN_H_SC
http://3143.live.streamtheworld.com:80/CBC_BAROQU_H_SC
http://2073.live.streamtheworld.com:80/CBC_BLCLAS_H_SC
http://2083.live.streamtheworld.com:80/CBC_BLUES1_H_SC
http://9213.live.streamtheworld.com:80/CBC_CANCOM_H_SC
http://1521.live.streamtheworld.com:80/CBC_CANSON_H_SC
http://4293.live.streamtheworld.com:80/CBC_CLSCRY_H_SC
http://1451.live.streamtheworld.com:3690/CBC_CLSCRY_H_SC
http://2953.live.streamtheworld.com:80/CBC_CONTRY_H_SC
http://2933.live.streamtheworld.com:80/CBC_ECLASS_H_SC
http://2062.live.streamtheworld.com:80/CBC_ELECTR_H_SC
http://2903.live.streamtheworld.com:80/CBC_GGSAMP_H_SC
http://2903.live.streamtheworld.com:80/CBC_HAROCK_H_SC
http://3023.live.streamtheworld.com:80/CBC_HIPHOP_H_SC
http://3163.live.streamtheworld.com:80/CBC_INDIE1_H_SC
http://2773.live.streamtheworld.com:80/CBC_JAZCDN_H_SC
http://2793.live.streamtheworld.com:80/CBC_JAZMAS_H_SC
http://2093.live.streamtheworld.com:80/CBC_JAZSMO_H_SC
http://2773.live.streamtheworld.com:80/CBC_JAZSON_H_SC
http://3413.live.streamtheworld.com:80/CBC_JUKEBO_H_SC
http://3153.live.streamtheworld.com:80/CBC_MODMAS_H_SC
http://3163.live.streamtheworld.com:80/CBC_OPERAT_H_SC
http://3153.live.streamtheworld.com:80/CBC_ORCHES_H_SC
http://3023.live.streamtheworld.com:80/CBC_PIANO1_H_SC
http://9233.live.streamtheworld.com:80/CBC_POP040_H_SC
http://1651.live.streamtheworld.com:80/CBC_R1_CGY_H_SC
http://2953.live.streamtheworld.com:80/CBC_R1_CHR_H_SC
http://3373.live.streamtheworld.com:80/CBC_R1_COR_H_SC
http://2073.live.streamtheworld.com:80/CBC_R1_EDM_H_SC
http://2783.live.streamtheworld.com:80/CBC_R1_EKW_H_SC
http://2913.live.streamtheworld.com:80/CBC_R1_FRD_H_SC
http://2893.live.streamtheworld.com:80/CBC_R1_GBA_H_SC
http://2093.live.streamtheworld.com:80/CBC_R1_GFA_H_SC
http://3383.live.streamtheworld.com:80/CBC_R1_HFX_H_SC
http://3593.live.streamtheworld.com:80/CBC_R1_INK_H_SC
http://1661.live.streamtheworld.com:80/CBC_R1_IQA_H_SC
http://3143.live.streamtheworld.com:80/CBC_R1_KAM_H_SC
http://9453.live.streamtheworld.com:80/CBC_R1_KEL_H_SC
http://3143.live.streamtheworld.com:80/CBC_R1_LDN_H_SC
http://1531.live.streamtheworld.com:80/CBC_R1_MCT_H_SC
http://6093.live.streamtheworld.com:80/CBC_R1_MTL_H_SC
http://3903.live.streamtheworld.com:3690/CBC_R1_MTL_H_SC
http://1591.live.streamtheworld.com:80/CBC_R1_N_MTL_H_SC
http://1671.live.streamtheworld.com:80/CBC_R1_OTT_H_SC
http://9453.live.streamtheworld.com:80/CBC_R1_PRG_H_SC
http://2953.live.streamtheworld.com:80/CBC_R1_QQU_H_SC
http://9453.live.streamtheworld.com:80/CBC_R1_REG_H_SC
http://3143.live.streamtheworld.com:80/CBC_R1_SNB_H_SC
http://6733.live.streamtheworld.com:80/CBC_R1_SNF_H_SC
http://2963.live.streamtheworld.com:3690/CBC_R1_SNF_H_SC
http://5463.live.streamtheworld.com:80/CBC_R1_SSK_H_SC
http://5463.live.streamtheworld.com:80/CBC_R1_SUD_H_SC
http://6093.live.streamtheworld.com:80/CBC_R1_SYD_H_SC
http://6693.live.streamtheworld.com:3690/CBC_R1_SYD_H_SC
http://1671.live.streamtheworld.com:80/CBC_R1_TBA_H_SC
http://6693.live.streamtheworld.com:80/CBC_R1_TOR_H_SC
http://1451.live.streamtheworld.com:3690/CBC_R1_TOR_H_SC
http://3903.live.streamtheworld.com:80/CBC_R1_VCR_H_SC
http://6093.live.streamtheworld.com:3690/CBC_R1_VCR_H_SC
http://1651.live.streamtheworld.com:80/CBC_R1_VIC_H_SC
http://2093.live.streamtheworld.com:80/CBC_R1_WDR_H_SC
http://1671.live.streamtheworld.com:80/CBC_R1_WHS_H_SC
http://1661.live.streamtheworld.com:80/CBC_R1_WPG_H_SC
http://2953.live.streamtheworld.com:80/CBC_R1_YKN_H_SC
http://1651.live.streamtheworld.com:80/CBC_R2CLAS_H_SC
http://9433.live.streamtheworld.com:80/CBC_R2_EDM_H_SC
http://3143.live.streamtheworld.com:80/CBC_R2_HFX_H_SC
http://8653.live.streamtheworld.com:80/CBC_R2_IET_H_SC
http://5523.live.streamtheworld.com:80/CBC_R2_IPT_H_SC
http://2073.live.streamtheworld.com:80/CBC_R2_TOR_H_SC
http://2793.live.streamtheworld.com:80/CBC_R2_VCR_H_SC
http://3023.live.streamtheworld.com:80/CBC_R2_WPG_H_SC
http://1942.live.streamtheworld.com:80/CBC_RBSOUL_H_SC
http://2973.live.streamtheworld.com:80/CBC_ROCK01_H_SC
http://2093.live.streamtheworld.com:80/CBC_ROCKCL_H_SC
http://1952.live.streamtheworld.com:80/CBC_SINSON_H_SC
http://2773.live.streamtheworld.com:80/CBC_WORLDM_H_SC
http://ice.somafm.com/bagel-64.aac
http://ice.somafm.com/beatblender-64.aac
http://uwstream2.somafm.com:2000
http://ice.somafm.com/bootliquor-64.aac
http://uwstream2.somafm.com:8048
http://ice.somafm.com/brfm-64.aac
http://ice.somafm.com/christmas-64.aac
http://ice.somafm.com/cliqhop-64.aac
http://ice.somafm.com/covers-64.aac
http://ice.somafm.com/deepspaceone-64.aac
http://ice.somafm.com/defcon-64.aac
http://uwstream2.somafm.com:8906
http://ice.somafm.com/digitalis-64.aac
http://ice.somafm.com/doomed-64.aac
http://uwstream2.somafm.com:8100
http://ice.somafm.com/dronezone-64.aac
http://ice.somafm.com/dubstep-64.aac
http://uwstream2.somafm.com:5106
http://ice.somafm.com/earwaves-64.aac
http://ice.somafm.com/folkfwd-64.aac
http://xstream1.somafm.com:3000
http://ice.somafm.com/groovesalad-64.aac
http://xstream1.somafm.com:8504
http://ice.somafm.com/illstreet-64.aac
http://xstream1.somafm.com:8070
http://ice.somafm.com/indiepop-64.aac
http://ice.somafm.com/jollysoul-64.aac
http://uwstream2.somafm.com:8808
http://ice.somafm.com/lush-64.aac
http://ice.somafm.com/missioncontrol-64.aac
http://ice.somafm.com/poptron-64.aac
http://xstream1.somafm.com:9010
http://ice.somafm.com/secretagent-64.aac
http://ice.somafm.com/sf1033-64.aac
http://ice.somafm.com/sonicuniverse-64.aac
http://xstream1.somafm.com:8200
http://ice.somafm.com/spacestation-64.aac
http://uwstream2.somafm.com:8854
http://ice.somafm.com/suburbsofgoa-64.aac
http://ice.somafm.com/thetrip-64.aac
http://uwstream2.somafm.com:2406
http://ice.somafm.com/u80s-64.aac
http://ice.somafm.com/xmasinfrisko-64.aac
http://ice.somafm.com/xmasrocks-64.aac

One last file we need to get setup is /etc/default/bluetooth and then we reboot (and make sure your BT speaker is in BT mode…..on the pill you need to press the big b button so the bluetooth LED turns on in the back).

Screen Shot 2014-12-29 at 10.09.06 PM

If you’ve made it this far, during the Pi boot cycle the Beatspill should have beeped signifying a bluetooth connection. Hopefully :-). If it doesn’t take the next step with the mpc commands. If it still doesn’t work after the mpc commands (to get mpd playing some streams) then something has gone wrong. You need to troubleshoot.
Now login and get to root shell and follow along for a quick audio test using mpc command.
Screen Shot 2014-12-30 at 11.45.47 AM
Hopefully you got everything working with BT and you’re hearing music now. If not, stop and do some googling. For sake of completeness I’ve put the commands I usually use to troubleshoot. Basically find the Beatspill MAC address, try connecting to it (mine barfs in the picture below since it’s already connected), disconnect and reconnect. Kick mpd since it can loose it’s mind if you take the audio interface away. Once mpd has restarted, get mpc to kick off the tunes by tuning into item 99 from the playlist (yeah I like the 80’s).
Screen Shot 2014-12-30 at 11.52.25 AM
Next we need to install python-pip (to get the “pip” command). Use “apt-get install python-pip” to install it (don’t worry about version 2.6 install of python, python 2.7 will still be the default).
Screen Shot 2014-12-30 at 3.04.15 PM
Okay, this next bit is a bit hairy. You need to follow it right until I finish editing /etc/modprobe.d/raspi-blacklist.conf and only then do you reboot……If you reboot like the picture shows below, you’ll end up with a white screen on the PiTFT. The Pi is still working, so worst case, put up with the white PiTFT screen, ssh, and make the three changes to the three files in /etc and give it another reboot…..and viola, PiTFT should be back and good to go. So lets update everything by doing the 3 commands in the below picture. REMEMBER DO NOT REBOOT…..KEEP GOING AND EDIT THE NEXT 3 FILES, THEN REBOOT.
Screen Shot 2014-12-30 at 2.51.49 PM Screen Shot 2014-12-29 at 11.39.14 PM
Add ipv6, stmpe_device, gpio_backlight_device, gpio_keys, gpio_keys_device and btusb to /etc/modules to make the kernel load them. We need these for later when we play around with the buttons using triggerhappy service. You don’t strictly need ipv6, but heck it might be useful later.
Screen Shot 2014-12-30 at 11.29.30 AM
Next we set the options for the modules we’re loading. If your took the reboot too soon and you screen went white the problem is this file. Note that I’ve commented the first line and put in the second line (I believe adafruit had their TFT named in their kernel module, but after the kernel update — above — the new module has pitft instead. There are some comments in there as well to explain the GPIO button assignment and it’s interface with triggerhappy (later).
Screen Shot 2014-12-31 at 4.09.58 PM
This file just needs a single comment. You’ll see later why we need this.
Screen Shot 2014-12-30 at 11.33.21 AM
Okay….still with me…..good. Now we need to configure the triggerhappy service so it can respond to the four PiTFT buttons.
Screen Shot 2014-12-30 at 12.44.21 PM
I’ve configured the buttons as (from left to right):
  1. shutdown -h now
  2. mpc play and start the pygame graphical UI (does not come up at boot. Only when you press this button). More on this later, below.
  3. mpc play and mpc prev. This button starts playing and then goes to the previous playlist item (previous radio station). The mpc play is not crucial. I just have it there to force start mpd if it’s not already playing something.
  4. mpc play and mpc next. This button starts playing and then goes to the next playlist item (next radio station). The mpc play is not crucial. I just have it there to force start mpd if it’s not already playing something.

If you want to configure your own commands you need the appropriate KEY_XXXX kernel strings and the key numbers are at this website (https://github.com/torvalds/linux/blob/master/include/uapi/linux/input.h). The numbers are options in /etc/modprobe.d/adafruit.conf file and the corresponding KEY_XXXX entries end up in /etc/triggerhappy/triggers.d/mpc.conf. More info on gpio_keys_device module is here (https://github.com/notro/fbtft_tools/wiki/gpio_keys_device). A good reference for triggerhappy and other PiTFT stuff is here (https://github.com/notro/fbtft/wiki/FBTFT-shield-image), under triggerhappy (thd) heading. Also check out the man pages for thd.

We also need to modify the system startup script for triggerhappy so that it starts as user root (by default it starts as nobody). If we don’t do this we will not be able to run our nice ui python file later on from the buttons. Make the changes to DAEMON_ARGS variable (I’ve commented the original in the pic below), change “nobody” to “root”.
Screen Shot 2014-12-30 at 3.29.49 PM
In the next step we’ll reconfigure the init process to bypass login on console 1 (on PiTFT) and disable all the other consoles (we’re not using them and they waste memory). Once login has been bypassed we can freely run ncmpcpp on the PiTFT during boot. For this we need to create two files in /root. First /root/.ncmpcpp/config and then a shell script (don’t forget to chmod 700 it so you can execute it) called ncmpcpp.sh which we’ll call from /etc/inittab later.
Screen Shot 2014-12-30 at 1.02.11 PMScreen Shot 2014-12-30 at 1.06.32 PM
Note: MAKE SURE YOU “chmod 700 /root/ncmpcpp.sh”, otherwise you could end up with a infinite boot loop which is not fun.
Screen Shot 2014-12-30 at 1.13.58 PM
The contents of my /etc/inittab are here (be extremely careful when changing things in here).

# /etc/inittab: init(8) configuration.
# $Id: inittab,v 1.91 2002/01/25 13:35:21 miquels Exp $
# The default runlevel.
id:2:initdefault:
# Boot-time system configuration/initialization script.
# This is run first except when booting in emergency (-b) mode.
si::sysinit:/etc/init.d/rcS
# What to do in single-user mode.
~~:S:wait:/sbin/sulogin
# /etc/init.d executes the S and K scripts upon change
# of runlevel.
#
# Runlevel 0 is halt.
# Runlevel 1 is single-user.
# Runlevels 2-5 are multi-user.
# Runlevel 6 is reboot.
l0:0:wait:/etc/init.d/rc 0
l1:1:wait:/etc/init.d/rc 1
l2:2:wait:/etc/init.d/rc 2
l3:3:wait:/etc/init.d/rc 3
l4:4:wait:/etc/init.d/rc 4
l5:5:wait:/etc/init.d/rc 5
l6:6:wait:/etc/init.d/rc 6
# Normally not reached, but fallthrough in case of emergency.
z6:6:respawn:/sbin/sulogin
# What to do when CTRL-ALT-DEL is pressed.
ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now
# Action on special keypress (ALT-UpArrow).
#kb::kbrequest:/bin/echo "Keyboard Request--edit /etc/inittab to let this work."
# What to do when the power fails/returns.
pf::powerwait:/etc/init.d/powerfail start
pn::powerfailnow:/etc/init.d/powerfail now
po::powerokwait:/etc/init.d/powerfail stop
# /sbin/getty invocations for the runlevels.
#
# The "id" field MUST be the same as the last
# characters of the device (after "tty").
#
# Format:
#  :::
#
# Note that on most Debian systems tty7 is used by the X Window System,
# so if you want to add more getty's go ahead but skip tty7 if you run X.
#
1:2345:respawn:/sbin/getty  --skip-login --login-program /root/ncmpcpp.sh 38400 tty1 
#1:2345:respawn:/sbin/getty --autologin pi --noclear 38400 tty1 
#1:2345:respawn:/sbin/getty --noclear 38400 tty1 
#2:23:respawn:/sbin/getty 38400 tty2
#3:23:respawn:/sbin/getty 38400 tty3
#4:23:respawn:/sbin/getty 38400 tty4
#5:23:respawn:/sbin/getty 38400 tty5
#6:23:respawn:/sbin/getty 38400 tty6
# Example how to put a getty on a serial line (for a terminal)
#
#T0:23:respawn:/sbin/getty -L ttyS0 9600 vt100
#T1:23:respawn:/sbin/getty -L ttyS1 9600 vt100
# Example how to put a getty on a modem line.
#
#T3:23:respawn:/sbin/mgetty -x0 -s 57600 ttyS3
#Spawn a getty on Raspberry Pi serial line
#T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100

Now, once more, before we reboot and screw it all up make sure you can run /root/ncmpcpp from command line ssh. You should see a clock. Press “q” to exit. Good…..now reboot and hopefully if you didn’t screwup you should see a nice console screen with the clock on you PiTFT.

IMG_1467

 

I’m playing something here. You will need to give Wifi a chance to get settled before pressing the previous/next buttons (3rd and 4th buttons from the left).

Now lets move onto getting the second button to work (i.e. the nice pygame gui). The original source for this came from https://github.com/ISO-B/pmb-pitft. I’ve done a bunch of changes, since I use the Pi for radio only and radio stations do not adhere to the Artist – Title standard. You can use the original code, but since the program is not getting the right info the last.fm pics and the info are wrong. The other change I’ve done is show the artist picture from last.fm if the album information is missing — which is the case when you’re playing internet radio. Almost all radio stations I’ve come across show Artist – Song Title, not Album Name.
You can download my version (https://dl.dropboxusercontent.com/u/3665206/pmb-pitft.tgz) as a tar file and open it up in /home/pi/ folder using “tar -zxvf ./pmb-pitft.tgz” (assuming the file is in /home/pi to start the tar extraction).
You’ll also need the pylast library to get lastfm information, so lets install it using “apt-get install python-pylast”. Once that’s done edit the ui.py file (in /home/pi/pmb-pitft/pmb-pitft folder) and change the API_KEY, API_SECRET, username and password to your accounts credentials (API_KEY and API_SECRET are at http://www.last.fm/api/account once you login to your account).
Screen Shot 2014-12-30 at 3.16.25 PM
Now let’s make sure the extraction went okay. Assuming you’ve followed my instructions if you issue “/usr/bin/python /home/pi/pmb-pitft/pmb-pitft/ui.py” from /home/pi folder, you should see a nice gui on pitft like below.
IMG_1469
Make sure this command works, since our 2nd button on pitft is hardwired to run this command when you press it.
Okay assuming you’re still with me. One more thing we need to do is to change the console fonts to make the ncmpcpp “clock” screen a bit better looking. This is the standard procedure that’s explained in other places as well (adafruit). You need to run the command “dpkg-reconfigure console-setup” and follow the screens.
Screen Shot 2014-12-30 at 3.48.46 PM Screen Shot 2014-12-30 at 3.48.52 PM Screen Shot 2014-12-30 at 3.49.10 PM Screen Shot 2014-12-30 at 3.49.19 PM
Once this process finishes, you’ll end up with a clock startup screen like this.
IMG_1470
And again from left to right the buttons will do “Shutdown -h now”, pygame ui, Previous Song, Next Song. As I type this I’m getting bad sectors on the Pi (cheap SD card I guess), so I’m off to backup everything. You should do the same RIGHT NOW :-).
At this point you can go off exploring (You did create a backup right?). I would check out adafruits page on pitft resistive (https://learn.adafruit.com/adafruit-pitft-28-inch-resistive-touchscreen-display-raspberry-pi?view=all) and start paying attention about halfway down the page around “sudo reboot and look at the console output” paragraph (Just search for it on the page), where it starts talking about calibrating the screen for X and stuff. Frankly I found the default calibration pretty good.
For a really good web interface that literally takes 2 minutes to setup check out ympd (http://www.ympd.org/). It’s so simple (specially if you grab the precompiled executable), no configuration, no rocket science……oh and did I say it looks great :-).
ympd_playlist

Not sure why this is such a mystery, but it took the better part of the day to troubleshoot. The main issue with forum posts is that people have the right idea/intention, but the forum software mistreats the actual command line/short code. Spacing really really (did I say really) matters. I’m assuming that you’re using the default player definition that comes with the plugin. If you need to change it then make the appropriate change to this code as well. The code to get both RTMP and HLS working depends on defining both of those sources. In my case the source is my Wowza Server and I have two URI’s:

1) For HLS I use http://wowza.server.ip.address:1935/live/many/playlist.m3u8

2) For RTMP I use rtmp://wowza.server.ip.address:1935/live/many

Obviously as you can see my Wowza application is “live” and the stream instance name is “many”. So for this to work transparently in HTML (HLS) and Flash (RTMP) environments you need the following code inserted into a post or page in wordpress (make sure you do it in Text view, NOT Visual view):

[player sources="{ file: 'http://wowza.server.ip.address:1935/live/many/playlist.m3u8'},{ file: 'rtmp://wowza.server.ip.address:1935/live/many'}"]

NOTE: The above code intentionally starts with [player….Please replace it with jwplayer instead. I can’t seem to put the code in properly without the plugin — installed on this site — interpreting the code as shortcode.

Also, I can not be more clear…..SPACES DO MATTER HERE…..SO PAY ATTENTION!!!

NAB2014 Report

datePosted on 15:11, April 18th, 2014 by Many Ayromlou

DEKTEC: DekTec introduced the DTA-2180 low profile PCIe H.264 encoder. The DTA-2180 is a low latency — 150 to 600 ms — H.264 hardware encoder based on the Magnum chipset. It supports MPEG-2 and H.264 and up to 16 channels of audio. Audio can be encoded as AC-3, AAC or MPEG-1 Layer 2. The DTA-2180 offers a 10 bit 4:2:2 option for contribution encoding.The DTA-2180 has a 3G –SDI and HDMI input and an ASI output. The compressed stream output — TS encapsulated H.264 or mpeg-2 — is also available on the PCIe for real time streaming, processing and recording.1

NIMBUS: The WiMi6400T and WiMi6400R provides high quality Full HD encoding/decoding function with low latency of 40ms for encoding and decoding, each. It supports wide range of encoding rate from 1Mbps ~ 30Mbps for the high quality video for video broadcasting. WiMi6400T provides RTSP streaming server functionality. WiMi6400T also can be used as an real-time MPEG-2 TS/UDP streaming server with linear PCM audio for IPTV network. It supports one-to-many multicasting function over Ethernet LAN or IP network. So, there is no restriction on the numbers of receiver in Ethernet LAN or IP networks.2

VIOLIN MEMORY: Violin Memory’s 6000 Series flash Memory Arrays are all-silicon shared storage systems built from the ground up, harnessing the power of flash memory and delivering industry-leading performance and ultra-low data access latencies. A single 3U array delivers more than 1 million IOPS with consistent, spike-free latencies in microseconds. Violin Memory is uniquely positioned to deliver flash memory systems that can compete with performance disk from a cost for raw capacity perspective, even before taking into account the potential benefits of features like deduplication. This is possible because 6000 Series flash Memory Arrays are purpose built with flash components sourced through Violin Memory’s unique and strategic alliance with industry leader Toshiba. The core of the 6000 is the Flash Memory Fabric. The Flash Memory Fabric is a resilient, highly available deep mesh of thousands of flash dies that work in concert to continuously optimize performance, latency, and longevity. All of the active components of the Flash Memory Fabric are hot-swappable for enterprise grade reliability and serviceability. 6000 Series flash Memory Arrays connect natively to existing 8Gb/s Fibre Channel, 10GE iSCSI, and 40Gb/s Infiniband network infrastructures.3

TOSHIBA: ExaEdge™ by Toshiba is a next generation SSD-based edge streaming server with extra low power consumption. It allows you to stream large numbers of concurrent high quality video streaming sessions with low host CPU and memory resource utilization. ExaEdge™ adopts Toshiba’s NPEngine™, the world’s first direct SSD-to-IP embedded hardware technology. ExaEdge™ ExaEdge offers direct storage access from SSD as an embedded hardware solution, in 2RU compact-size server. The resulting performance is capable of sending up to 64,000 simultaneous sessions with the total host CPU usage at less than 12%. Modern video distribution over IP, like OTT streaming, leverage the existing HTTP-based caching functionalities. Unlike the traditional IPTV network which is basically adopting specialized network architectures, in adaptive bitrate scenarios HTTP chunks can be cached by traditional cache server at the edge to be then redistributed with lower latency.4 5

NHK: NHK was at NAB this week, quietly showing off footage shot with a Super Hi-Vision 8K camera, affectionately known as the Cube. The Cube camera is surprisingly compact  at 2 kg, since, it records to one of the only 8K HEVC real-time encoders in the world. It’s essentially a housing where the mammoth sensor and lens mount live, along with necessary connections. But even though it’s a simple design, it delivers an amazing resolution of 7680 x 4320 pixels. 8K is a great format that could rival IMAX and be excellent for big events that can be beamed around the world and give spectators who can’t make an event the opportunity to experience it in a way that all other formats before it could only dream to do. And NHK is planning on broadcasting the 2016 Summer Olympics in Rio in 8K.6 7

4EVER: 4Ever showed demos at NAB 2014 of MPEG DASH. The DASH demo featured a way to deliver content that’s adaptive, bit-rate streaming. It has four different HEVC encodes of original 4K content that it encoded at several bit rates, including a 14.5 and 11.5 Mbps for 4K content, 5.8 and 3.7 Mbps for a 1080 version, and a 720 version of that, which can stream at 2.9 or 1.8 megabits per second. The monitor runs a Chrome browser with HTML5 support which can only show a 4K/30 frame image. To show adaptive streaming, they randomly switched from one bit stream to the other, showing this data on the monitor.  The changes were seamless, but you do see a change in picture quality.8

VISION 3 IMAGING: Vision III Imaging demonstrated 4K 60p parallax scanned imagery and its Real Shot™ parallax induction technology. Parallax scanning is a technique for capturing three-dimensional depth information over time using one  camera and one lens. V3 imagery can be displayed on a standard display without 3D glasses or special screens. Real Shot is a parallax induction technique that also embeds three-dimensional parallax information into Internet or mobile digital advertising. Parallax scanning is accomplished using a digital parallax scanner (DPS). The DPS is a moving iris mechanism that is inserted into the optical path of a lens. When the iris is moved off the center of the lens, it records a different point of view at the plane of focus. The DPS iris scans in a circle around the center of the lens, making it possible to capture 360° of parallax information using a single lens.

RENEWED VISION: With its new Multiple Screen functionality, ProVideoPlayer 2 ($999) makes it easier than ever to create multi-screen presentations from a single computer with support for multiple graphics cards and easy mapping within each card and across multiple cards. Users can also add external graphics processors to each one of these graphics card outputs for even more screens, as well as add outputs that are not yet connected to a physical output, allowing shows to be pre-built off-site prior to the event. PVP 2 supports Multiple Layers, which afford the flexibility to create unique looks and allow the user to take full advantage of multiple screens. A layer is merely a video channel, so multiple layers are also great for a single screen environment where layering, textures, or PIPs are desired.10

THUNDERBOLT 2 Mobile 4K Workflow: HP showing 4K real-time streaming off a BMDC and 4K real-time playback from thunderbolt 2 little big disk all run through HP’s new Z series Laptops on a 21:9 screen.11

SILICON POWER: Silicon Power Thunder T11 is not only the lightest but also the smallest Thunderbolt™ SSD on the market. Featuring extremely small and featherweight design, Thunder T11 is half the size of ordinary storage devices and only weights 65g. Silicon Power’s Thunder T11, which enhances storage solution with Thunderbolt™ SuperSpeed I/O technology, is three times the speed of USB 3.0 HDD and delivers transfer rates up to Read/Write 380MB/340MB/sec.12

360HEROS: 360 degree shooting Hexacopter using 3-D printed Go-Pro3 mounts.13

ERICSSON: Showing 100 Mb/s (4x25Mb/s) live UHDTV broadcast using DVB-S2 extensions to broadcast true 4Kp60 over the air.35

LACIE: The LaCie 8Big Rack is the company’s first Thunderbolt 2 rackmount storage solution, featuring up to eight 6TB 7200RPM hard drives and delivering speeds of up to 1330 MB/s. The 8big Rack also features easy access to components and tool-free maintenance of the included power supplies units, fans, and disks, all while offering a cooling system with three fans that conducts heat away from vital components. The 8big Rack will be offered in 4-disk (12TB) or 8-disk (24TB and 48TB) configurations.16

SKYPE: Skype has been an essential tool in the production of podcasts and newscasts for years, and today Microsoft has announced a professional-grade version of the app designed specifically for the media industry. It’s called Skype TX and is intended to be used in studio environments; you won’t be using this to record a podcast in your bedroom. Skype TX is described as an “easy-to-use hardware and software combination that allows Skype video calls from anywhere in the world to be seamlessly integrated into any production.” It plays nice with industry standards by outputting calls in full-frame HD-SDI formats.

LIVESTREAM: Livestream announced a pair of production switchers: the HD510 and HD1710. The HD510 is a portable version with an integrated touch display, yet it’s still full featured with 5 SDI inputs. The rack mounted HD1710 is at the other end of the spectrum. It features up to 17 inputs and can drive 4 displays. They also announced Livestream Studio Control Surface a modular control surface with 5 assignable tracks, T-Bar and audio mixer and USB connection to Livestream Studio.19

AJA: CION™ is the new 4K/UHD and 2K/HD production camera from AJA. Record directly to Apple ProRes 422 and 444 at up to 4K 60fps or output AJA Raw at up to 4K 120fps.20

DIGITAL BOLEX: Digital Bolexs’ new monochrome 16mm camera, dubbed the D16M, has the same form factor as the original D16, but there’s a significant change under the hood. D16M sports a native black and white sensor for highest quality monochromatic capture without the need to debayer, retaining a higher sensativity to light and preserving the full dynamic range of the sensor.

Here are the technical specs:

  • Kodak native monochrome sensor
  • Same resolution options as D16: Super 16mm (2K), 16mm (HD), and Super 8 (720p)
  • No OPLF filter to further maximize fine details
  • ISO 100, 200, 400, 800
  • 500GB Hard Drive21 22

 

 

BLACKMAGIC: The new Blackmagic 4K URSA camera is weird, featuring a 4K Super 35mm global shutter sensor, real camera form factor, a built-in 10.1″ 1920 x 1200 fold out display, and two 5” 800 x 480 displays. Not only that, but it has both interchangeable lenses and sensors, meaning you’ll be able to upgrade to a better sensor at home removing a few screws when a better one is available. Here are the specs: 

  • 21.12mm x 11.88mm — Super 35mm Global Shutter 4K CMOS Sensor (Probably the same as current Blackmagic Production Camera 4K)
  • Interchangeable Lens Block
  • 3840 x 2160 — 24/25/60fps
  • 1920 x 1080 — 24/25/30/50/60fps
  • ProRes HQ and Lossless Compressed RAW
  • 12 Stops Dynamic Range
  • EF/PL/B4/ or No Mount
  • Two CFast 2.0 Slots for Media Recording
  • 1 x 10.1” 1920 x 1200 Fold Out Non-Touch Screen
  • 2 x 5” 800 x 480 Touch Screens
  • SDI Video Output: 1 x 12G-SDI 10-bit 4:2:2. 1 x 3G-SDI down converted for external monitoring
  • SDI Video Input: 1 x 12G-SDI
  • Ref Input: 1 x Reference Input
  • Timecode In/Out
  • 2 XLR Inputs
  • 2 SDI Audio Out
  • Headphone Jack
  • 1 x 2.5mm LANC for Rec Start/Stop, Iris Control and Focus.
  • Power: 12V 4-pin XLR In/Out (Can take battery plates for Gold Mount and V Mount)
  • Availability: July?
  • Price: $6,000 for EF, $6,500 for PL23 24

Blackmagic also seeks entry into the broadcast-camera market with its newly announced Studio Camera, available in Full HD and 4K (Ultra HD) models. Designed for live broadcast applications, the Blackmagic Studio Camera sports a unique design with a massive 10″ LCD screen, built-in 4 hour battery, and a set of features you’d expect to see in large studio cameras, such as built-in talkback and tally indicators. Intended to meet the needs of a variety of live broadcast applications, the Blackmagic Studio Camera provides the connections required to fit into those environments. Connections include SDI (3G on the HD version and 12G on the 4K version) and optical fiber video inputs/outputs, XLR audio connections, reference, LANC remote control, and a 4-pin XLR power input. The camera features an active Micro Four Thirds lens mount that is compatible with a wide range of lenses via third-party adapters, opening the door for the use of common DSLR lenses to PL-mount cinema lenses, and even B4 ENG lenses.25

SOLOSHOT: The surprisingly affordable soloshot 2 ($399) will follow a tracker that someone can wear or you can slap on something so you don’t have to do a thing. Put on the tracker, set up your camera with SOLOSHOT 2, and catch a wave with the perfect video. It features vertical tracking, automatic zoom, and the kit even includes a tripod for you to get started. It’s got a range up to 2,000 feet and 360 degree horizontal tracking.26

 

BRUSHLESSGIMBALS: Gimbi is a lightweight, easy to carry, simple to use, power-and-go, 2 axis handheld brushless gimbal for the GoPro. With Gimbi™, you can shoot videos and photos as smooth as the pros.
Key Features
– Adjustable cellphone stand permits use of cellphone as monitor
– Super-smooth tilt control with thumb pad (Controllable pitch 90 degrees)
– Increased auto leveling accuracy and battery efficiency due to built-in brushless motor encoders.
– 2 hour use time on one charge
– Includes four rechargeable batteries and battery charger27

 

JIGABOT: Jigabot’s AIMe is a pill-shaped tripod mount that automatically follows your subject—keeping it in frame—in case you’re shooting video by yourself. It uses infrared markers and swivels and tilts using complex algorithms powered by a quad-core ARM processor.28

 

CEREVO: Crevos’ LiveWedge ($999) provides easy control via smartphone/tablet app. The rotary control unique to the app enables slow transition, which is more difficult with a physical T-Bar. LiveWedge supports PiP and chroma key as well as all the basic transitions such as wipe, fade, cut and etc. Livewedge has a SD card slot and users can record 1080/30p (H.264) Full HD Video on it while switching! You can also use videos and images from the SD card as the video source. Streaming is built into LiveWedge. 720/30p HD Live streaming and 1080p HD video switching are available in one device! Supported streaming platforms include Ustream, Youtube Live and your own servers are all supported.29

 

PESA: PESA showed their brand new Xstream Live Streaming mobile solution, co-developed by Ryerson students. They also received the NewBay Media Best of Show Award at NAB.

36

COMREX: Comrex LiveShot™ delivers live video over a range of IP networks. LiveShot is used by TV stations and networks to deliver high quality, low latency (200ms) video from anywhere Internet access is available. LiveShot is especially optimized to perform well on challenging IP networks like 3G, 4G and satellite links. For optimal video quality, LiveShot encodes with H.264 HIGH profile. In addition to standard AAC audio coding, LiveShot utilizes HE-AAC and AAC-ELD audio coding, both reducing network bandwidth and lowering delay. LiveShot can encode and decode an audio/video stream with less than 200mS delay. LiveShot delivers full-duplex video and stereo audio between the field portable and studio rackmount systems. In addition, a full-duplex cue channel is available between the portable and studio units. On the portable, the return audio/video channel is delivered via output connectors. The cue channel is accessible on the portable via wired headset or Bluetooth audio to a wireless headset30

 

PANASONIC: The Lumix GH4 camera body and its 16MP CMOS Micro Four Thirds sensor will cost $1700, while the optional YAGH pro audio/video interface unit is available for an extra $2,000. The GH4 can shoot 4K at 30/25/24fps at 100Mbps using ALL-Intra compression. At 1080p that rises way beyond broadcast standard to 200Mbps. There are two 4K formats available too: the standard 3840 x 2160 resolution at 30/25/24p, or the cinema widescreen 4096 x 2160 resolution available at 24p only. When writing to SD card the camera captures 4K video with 8-bit colour and the data rate is limited to 100Mbps. Use an optional accessory – the Panasonic DMW-YAGH, which is about as big as the GH4 body – and its four SDI ports that can be used in tandem to extract uncompressed 4K at 10-bit colour. Power input, independent volume adjustment and twin XLR sockets ensure everything a broadcast pro is here – but only via the DMW-YAGH.31

The HX-A500 shoots a resolution of 3840×2160; so ultra HD. Sub 4K resolutions include 1080 up to 50p, and 720 up to 100p. Un surprisingly it shoots to an MPEG-4 AVC/H.264 codec in an .mp4 wrapper.

The camera has a perhaps slightly disappointing variable bit rate, half that of the GoPro Hero 3+. Here’s the breakdown:

  • 3840×2160/25p (Max. 72Mbps / VBR)
  • 1920×1080/50p (Max. 28Mbps / VBR)
  • 1920×1080/25p (Average 15Mbps / VBR)
  • 1280×720/50p (Average 15Mbps / VBR)
  • 1280×720/25p (Average 9Mbps / VBR)

The camera has a fixed focal, fixed f/2.8 aperture lens. It has a few different white balance presets including Auto / Indoor1 / Indoor2 / Sunny / Cloudy / White set. The shutter is listed as variable, from 1/25th-1/12000. The HX-A500 has an in-built image stabilizer, with an angle of view currently listed as only 160°.32

 

JVC: JVC has now also entered the large sensor market. And that this intriguing little camera covers super35mm on an MFT mount. In terms of specs the JVC GY-LSX2 has some really intriguing figures to offer. Not only is it very small and looks very ergonomic to handle, but it offers 4K with frame rates up to 30p as well as a slow motion feature at 2K resolution that will go up to 240fps. The footage is being recorded internally with an h.264 kind of codec. The JVC GY-LSX2 is announced with a price point “under $6000″ and to come at the end of 2014.33

 

The bigger brother, called GY-LSX1 will feature a higher framerate (60p) at 4K resolution, offer a shoulder-mount form factor and seems to come in at around twice the price of the small one.34

 

That’s it for now……This years buzz words: 4K, UHDTV, HEVC, H.265, OTT (Over The Top)….see you all next year :-)

Proxmox VPS for web development recipe….

datePosted on 17:17, March 10th, 2014 by Many Ayromlou

A little while ago our web developer asked me to look into proxmox containers and how we could take advantage of it to setup a development environment for him. The idea was to use the power of linux containers and enable him to develop fully functional/accessible sites in a private container. Here are the steps we will cover in this article:

  • Install proxmox on a machine with a single public IP address
  • Secure the machine with ufw to only allow connections from a specific IP address space
  • Setup a admin user other than root for proxmox admin interface
  • Setup proxmox to use the single IP address and the vmbridge for masquerading
  • Setup two Linux Ubuntu 12.04 containers with private addresses and enable the to access the internet via the bridge
  • Setup Apache on the proxmox host and configure it to do reverse proxy for the two ubuntu containers
  • Setup DNS (for the container instances) to point to proxmox host and test to make sure the “private” containers are accessible from Internet
  • Tighten up security on the reverse proxy on the proxmox host
  • Optionally only allow access to the proxy from specific IP address space

To do all this you need to download proxmox ISO file and burn it to a CD. Go through the installation of proxmox and set up the “host” with the single pubic IP address. This is simple enough so I’m not gonna cover it here. Once you have this setup you should be able to point your browser at the IP address (https://aaa.bbb.ccc.ddd:8006). NOTE: I will use aaa.bbb.ccc.ddd as the representation of the publicly available IP throughout.

Next we need to secure access to the host to only allow connections from a specific IP address space. In my case that’s the University network — 141.117.0.0/16 — this is optional. We need to make sure ufw is installed. We also need to make sure ufw is allowing incoming connections by default and then block everything except access from the University network:

ufw default allow incoming
ufw allow proto tcp from 141.117.0.0/16 to any port 8006
ufw deny proto tcp from any to any port 8006
ufw allow proto tcp from 141.117.0.0/16 to any port 3128
ufw deny proto tcp from any to any port 3128
ufw allow proto tcp from 141.117.0.0/16 to any port 111
ufw deny proto tcp from any to any port 111
ufw allow proto tcp from 141.117.0.0/16 to any port 22
ufw deny proto tcp from any to any port 22
ufw enable

Note that I’m assuming your ssh connection to the host is via the University network (141.117.0.0/16). Make adjustments to this if it’s not, otherwise you might lock yourself out. These basic rules will plug all the holes accessible publicly and only allow connections from our University network (141.117.0.0/16).

Setting up users in proxmox is a bit weird. You have to add a regular Unix user to the proxmox host environment and then add the user to proxmox later and give it permissions and roles. Here I will use a user “myadmin” to create something for our web developer to use.

useradd -m -s /bin/bash -U -G sudo myadmin

This will create a account “myadmin”,  join it to primary group “myadmin”, assign it /bin/bash as shell and make it part of the group “sudo” — which will allow the user to use the sudo command in the future. Next on the proxmox web interface we need to create a Admin group called “Admin”. In the proxmox interface we click on the Datacentre in the left pane and go to Groups and click the Create button. Call the group “Admin”. Now go to Permissions tab in the right pane. We need to create a Administrator Group Permission to assign to our “Admin” group. Click Add Group Permission (right below the tabs in this pane) and fill it in like below:

Screen Shot 2014-03-10 at 3.02.51 PM

 

In this window the path: / means the entire Datacentre (including the host and the containers/VM’s). You might want to adjust this. The Role “Administrator” is a predefined role that is pretty much the same as root. Now that our group “Admin” has the “Administrator” role for the entire Datacentre, we want to make the user “myadmin” — which is a unix account right now — be part of that, effectively creating another “root” account for our web developer. So back to the Users tab we click Add and create our new user (really just add the Unix user to proxmox):

Screen Shot 2014-03-10 at 3.15.42 PM

 

Okay, so now test and make sure you can access the host via ssh using myadmin as user, also make sure you can sudo to root on the host and check the web interface and ensure the myadmin account can login and see all the goodies in the data centre. Otherwise stop and fix.

At this point login/ssh to the host as root or myadmin (plus “sudo -i” to become root). We need to modify the networking config in /etc/network/interfaces to setup all the masquerading jazz. Make a back up of your interfaces file first and note the public IP address that is in there (I’m gonna use aaa.bbb.ccc.ddd as my public address here). Once you have a backup replace everything in the file with the following:

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
        address  aaa.bbb.ccc.ddd
        netmask  255.255.255.0
        gateway  aaa.bbb.ccc.xxx

auto vmbr0
iface vmbr0 inet static
	address 10.10.10.1
	netmask 255.255.255.0
	bridge_ports none
	bridge_stp off
	bridge_fd 0

        post-up echo 1 > /proc/sys/net/ipv4/ip_forward
        post-up   iptables -t nat -A POSTROUTING -s '10.10.10.0/24' -o eth0 -j MASQUERADE
	post-up   iptables -A FORWARD -s '10.10.10.0/24' -o eth0 -j ACCEPT
	post-up   iptables -A FORWARD -d '10.10.10.0/24' -m state --state ESTABLISHED,RELATED -i eth0 -j ACCEPT
        post-down iptables -t nat -D POSTROUTING -s '10.10.10.0/24' -o eth0 -j MASQUERADE
	post-down iptables -D FORWARD -s '10.10.10.0/24' -o eth0 -j ACCEPT
	post-down iptables -D FORWARD -d '10.10.10.0/24' -m state --state ESTABLISHED,RELATED -i eth0 -j ACCEPT

So in the above I’m creating a separate private network (10.10.10.0/24) behind the publicly available IP address aaa.bbb.ccc.ddd and am doing some iptables commands to setup masquerading. This is sorta like setting up a home router to share a publicly available IP address you have at home. Once this is in place reboot the host and make sure you can log back into https://aaa.bbb.ccc.ddd:8006/ and get the proxmox interface. If you’re good to go, as next step spin off two Ubuntu containers (I won’t go into details on this…..lots of docs out there for this). Your OperVZ Container confirmation screen should look something like this:

Screen Shot 2014-03-10 at 4.25.05 PM

 

The only really important thing here is that you setup the networking under Network tab as Bridged mode and select vmbr0 as your bridge. Once that’s done ssh back to your host (aaa.bbb.ccc.ddd). Assuming you have two containers 100 and 101, enter one of them by using the vzctl command:

vzctl enter 100

Once inside the container you need to setup the networking. Again the file here is /etc/network/interfaces (assuming you’re container is Ubuntu/Debian flavoured). Backup this file first and replace the content with the following:

# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback

auto eth0
#iface eth0 inet dhcp
iface eth0 inet static
        address  10.10.10.2
        netmask  255.255.255.0
        gateway  10.10.10.1
        dns-nameservers 8.8.8.8
        fns-search      your.real.domain.name.com

Note here that I’m using google’s name server. You can use that or substitute your own “real” name servers. Once you reboot the container and enter it again via the host, you should be able to ping just about any real host (www.google.com, www.yahoo.com or whatever). This gives us a basic NAT running on the host and you just need to increment the IP address (10.10.10.2 in the above case) in the setup of the second container. At this point you should be able to enter either containers and ping something outside.

So the rest of this article describes how to setup a secure reverse proxy using apache on the proxmox host (aaa.bbb.ccc.ddd). This way you can just point arbitrary DNS names at aaa.bbb.ccc.ddd and choose (via apache config) which one of your containers will answer the call. You can even get fancy and have multiple hostnames proxied to the same container and do standard “Name based” virtual hosting inside the container. I will just show the one-to-one proxied connection here. Start by installing apache on the host (apt-get install apache). First we need to activate the proxy module. If you don’t have time to finish this entire procedure DO NOT CONTINUE. Literally in the time it takes to install and configure the proxy, script kiddies will hit your site and use you as a proxy to attack other sites. DO THE PROXY INSTALL AND CONFIG/SECURING PROCEDURE IN ONE SHOT.

Assuming apache is installed go to http://aaa.bbb.ccc.ddd and ensure you’re getting the apache “hello” screen. Now you can enable the three modules needed by issuing the following:

a2enmod proxy
a2enmod proxy_http
a2enmod headers

Once that’s done you need to make some changes to your proxmox hosts default apache config which is in /etc/apache2/sites-available/default. For the sake of completeness I’ve included my entire file here. Compare it to yours and modify accordingly:

# IMPORTANT: YOU NEED THIS
LoadFile /usr/lib/x86_64-linux-gnu/libxml2.so.2

<VirtualHost *:80>
	ServerAdmin webmaster@localhost

	DocumentRoot /var/www
	<Directory />
		Options FollowSymLinks
		AllowOverride None
	</Directory>
	<Directory /var/www/>
		Options Indexes FollowSymLinks MultiViews
		AllowOverride None
		Order allow,deny
		allow from all
	</Directory>

	ErrorLog ${APACHE_LOG_DIR}/error.log

	CustomLog ${APACHE_LOG_DIR}/access.log combined

	# IMPORTANT: YOU NEED THIS
	ProxyRequests Off
	# Block all requests 
	<Proxy *>
	  Order deny,allow
	  Deny from all
	</Proxy>

</VirtualHost>

<VirtualHost *:80>
	ServerName hosta.domain.ca
	RequestHeader set hosta.domain.ca Accept-Encoding
	ProxyPreserveHost On
	ProxyPass / http://10.10.10.2/
	ProxyPassReverse / http://10.10.10.2/
	# IMPORTANT: YOU NEED THIS
	<Proxy *>
	    Order deny,allow
	    Allow from all
	</Proxy>
</VirtualHost>
<VirtualHost *:80>
	ServerName hostb.domain.ca
	RequestHeader set hostb.domain.ca Accept-Encoding
	ProxyPreserveHost On
	ProxyPass / http://10.10.10.3/
	ProxyPassReverse / http://10.10.10.3/
	# IMPORTANT: YOU NEED THIS
	<Proxy *>
	    Order deny,allow
	    Allow from all
	</Proxy>
</VirtualHost>

Pay particular attention to parts that have the comment (# IMPORTANT: YOU NEED THIS)……Guess what…..YOU NEED THIS. The first one loads libxml2 which is needed. The second block of code makes sure you are in reverse proxy mode (not in forward proxy) and makes sure the main apache instance can’t be used for proxing. The third and fourth block enable reverse proxy for a particular virtual host name. Now we need to reload apache on our proxmox host and do some testing. Reload apache with (service apache2 reload) and for sanity sake change the index.html file in both containers (under /var/www/index.html) to reflect hosta and hostb. I’ve basically just added the words hosta and hostb to the html file. Register hosta.domain.ca and hostb.domain.ca as “A” fields in your DNS and point them at the IP address of the proxmox host (aaa.bbb.ccc.ddd).

If everything is working properly you should be able to use your browser and point at http://hosta.domain.ca and get the index.html page specific to that container and the same for hostb. At this point you should be more or less good to go. If you need more containers addressable from internet, just keep adding this block of code to the proxmox hosts /etc/apache2/sites-available/default and change the hostname and increment the private IP addresses:


<VirtualHost *:80>
	ServerName hostc.domain.ca
	RequestHeader set hostc.domain.ca Accept-Encoding
	ProxyPreserveHost On
	ProxyPass / http://10.10.10.4/
	ProxyPassReverse / http://10.10.10.4/
	# IMPORTANT: YOU NEED THIS
	<Proxy *>
	    Order deny,allow
	    Allow from all
	</Proxy>
</VirtualHost>

Optionally you can now go back and add a couple more ufw rules to only allow access from a particular IP address space (in my case the university network 141.117.0.0/16)

ufw allow proto tcp from 141.117.0.0/16 to any port 80
ufw deny proto tcp from any to any port 80

Again with this setup — since we’re preserving the request header and are passing it through the proxy back and forth — you can have hostd, hoste, hostf, all point to the same private IP address in the proxy and do a named virtual serving on the apache instance in the particular container, just like a standard named virtual host based setup. Hope this helps…..

Proving the Network is Not the Problem With iperf – Packet Life

datePosted on 15:35, November 24th, 2013 by Many Ayromlou

Proving the Network is Not the Problem With iperf – Packet Life: “When an application fails to perform as expected, the network is often the first thing blamed. I suppose this is because end users typically view the network as the sole limiting factor with regard to throughput, unaware of the intricacies of application, database, and storage performance. For some reason, the burden of proof always seems to fall onto networkers to demonstrate that the network is not at fault before troubleshooting can begin elsewhere. This article demonstrates how to simulate user traffic between two given points on a network and measure the achievable throughput.”

(Via.)

123... 636465Next