Migrating from mythtv to tvheadend

Over the years i have become increasingly annoyed at the various instabilities with mythtv when used with Kodi.  Live tv often would lock up the client even after i moved kodi to separate machine.  And the speed at which it would load a live channel was never that good. I never used most of the features in mythtv.

I think mythtv developers should be focused more on being a wonderful dvr and less on all the weird addons like music bluray player voip etc.  I think it would be good if they also made kodi support a priority

I have transitioned to tvheadend running on a pi 2.  And quite frankly it is amazing. So simple to setup and its obvious they have focused on kodi support a lot.

I have exported 750gb of tv for my sons and will make it available in kodi until tvheadend builds up a good back log of recorded shows

i now have a pi 2 for tvheadend, pi 3 for kodi and an old pi b for a ufdb squid kids internet filter.

My old ubuntu box that used to host mythtv is going into the workshop 🙂

A 4 year old boy and his Ubuntu 14.04 laptop

I have setup Edubuntu 14.04 for my 4 year old boy to play games, watch some childrens TV shows (from the Mythtv based HTPC), learn mouse skill etc.

I first of all setup a staticically assigned IP address for both his WIFI and Ethernet Mac addresses on the DHCP server on our router to disallow any internet traffic.

I then installed squid on the HTPC server with a white list specific for his IP addresses.  His laptop was then configured to use a proxy pointing at the squid server.  He can browse only to a set of sites that either his mum or myself check first.

I have restricted his access to mythweb (to only the recordings area, used apache location filters to disallow anything else unless authenticated.

I have configured Chrome to immediately start playing the ASX streamed content (see here for details on what I needed to do)

We actually only use mythweb for his TV shows, as I don’t really like watching much commercial TV and I use youtube for anything I do watch.  My wife watches Q&A and Tom would never voluntarily click on those links as he finds the shows boring 🙂

I have recently been trialling the idea of installing XBMC 13.2 on his laptop instead of mythweb.  He is already familiar with the XBMC experience from the LCD screen on our TV.

I have installed XBMC 13.2beta1 on my laptop and successfully setup remote access to the mythtv configuration.  All I needed to do was enable access to the mythconverg mysql db remotely as I must have configured the mythtv service ports in the past for external access (Don’t remember doing it, but the 6544 and 6543 ports are both accessible outside of the myth box)

My main issue with XBMC is the Exit menu which allows restarting or shutting down the laptop, something I think my son would certainly have a go at clicking on.

I also want to lock down the settings menu’s so I don’t have to keep fixing up the configuration.  He won’t be able to install new addons because I have locked down internet access, but he certainly could stuff up the configuration and force me to reapply it.

So for the Shutdown / Restart menu options, the main ways that have been suggested are hacking the xml for the menu skin.  This is not an option as it would get overwritten when I next update XBMC.

More google searching highlighted an option to completely disallow the use of the shutdown / restart menus via the local policy kit stuff in ubuntu.

http://askubuntu.com/questions/453479/how-to-disable-shutdown-reboot-from-lightdm-in-14-04

I can target a specific user or group and disable access to the various power options.  And imagine my surprise when XBMC automatically removed these options from the menu once the policy settings were applied.  They don’t even need a restart or a logout/login cycle.

I added a file:

/etc/polkit-1/localauthority/50-local.d/restrict-login-powermgmt.pkla

[Disable lightdm PowerMgmt]
Identity=unix-group:users
Action=org.freedesktop.login1.reboot;org.freedesktop.login1.reboot-multiple-sessions;org.freedesktop.login1.power-off;org.freedesktop.login1.power-off-multiple-sessions;org.freedesktop.login1.suspend;org.freedesktop.login1.suspend-multiple-sessions;org.freedesktop.login1.hibernate;org.freedesktop.login1.hibernate-multiple-sessions
ResultAny=no
ResultInactive=no
ResultActive=no

I added my son to the users group. (I could just as easily have just specified unix-user: thomas as well)  Works very well for XBMC. It’s a shame though that it also disables access to the power off button on his laptop.

Next step is to see if I can force XBMC to run as a particular user and just restrict access to the power buttons to that user, rather than my sons user.

 

 

MythWeb ASX Streaming on Ubuntu 14.04

I want to be able to click on a ASX link in Google Chrome and instantly launch SMPLAYER.

Unfortunately the default mime type for these files is audio/x-ms-asx.  

This is defined in the /usr/share/mime/packages/freedesktop.org.xml

<mime-type type="audio/x-ms-asx">
 <comment>Microsoft ASX playlist</comment>
---- snip -----
<glob pattern="*.asx"/>
<glob pattern="*.wax"/>
<glob pattern="*.wvx"/>
<glob pattern="*.wmx"/>
<magic priority="51">
<match value="ASF " type="string" offset="0"/>
<match value="&lt;ASX" type="string" offset="0:64"/>
<match value="&lt;asx" type="string" offset="0:64"/>
<match value="&lt;Asx" type="string" offset="0:64"/>
</magic>
</mime-type>

Since this is a video play list coming from Myth, it seems strange that it’s defined as audio/x-ms-asx.

The default type for audio/x-ms-asx is Totem:

~ $ xdg-mime query default audio/x-ms-asx
totem.desktop

But really I wanted to fix it so that the asx files coming from myth would be identified as video/x-ms-asx

So I created a xml file:

<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
 <mime-type type="video/x-ms-asx">
 <comment>Microsoft ASX Video playlist</comment>
 <magic priority="100">
 <match value="&lt;ASX" type="string" offset="0:64"/>
 </magic>
 <glob weight="100" pattern="*.asx"/>
 </mime-type>
</mime-info>

I then installed that via xdg-mime:

xdg-mime install x-ms-asx.xml
 ~ $ xdg-mime query filetype 1404712800
video/x-ms-asx

Good so far, but now we need to associate the video/x-ms-asx.  By default its still totem.desktop.

 ~ $ xdg-mime query default video/x-ms-asx
totem.desktop

We can override this like so:

xdg-mime default smplayer.desktop video/x-ms-asx
~ $ xdg-mime query default video/x-ms-asx
smplayer.desktop

 

Gnome 3

After several months using gnome 3 its little annoyances and terrible support for java ui apps is really starting to drive me crazy.

I recently installed vanilla Ubuntu on my sons laptop. I really like it. I need to see how well it supports java. If its better than gnome 3 I might jump ship again. I don’t really want to go back to mint as I like having a Ubuntu distro with the Ubuntu apps like nautilus rather than forked for the sake of it mint apps like nemo

Might have to install eclipse and soapui on my sons laptop and see how they behave before I make the jump

Oops /boot partition deleted

I had an oops moment when I momentarily booted back into Windows to build a cygwin offline installer for work (for OpenSSH).  For some reason I had chosen the D: drive to download the temp packages.  The D: drive was also the drive letter than ExtFS associated with my linux /boot partition.

In a moment of brainlessness I deleted the files on the D:\ drive, not even realising what I was doing until I tried to boot back into my Ubuntu.

But as is the case with most things in linux, Google came to the rescue.

I hunted up my Ubuntu Gnome USB install key and booted into that.  I then used fdisk to find the right /dev/Xda drive for my installation and then…

sudo mkdir /mnt/sysimage

sudo mount /dev/sda7 /mnt/sysimage

sudo mount /dev/sda5 /mnt/sysimage/boot

sudo chroot /mnt/sysimage/

sudo apt-get install linux-image-`uname -r` linux-image-extra-`uname -r`

And a reboot later and I am back in business.

Phew

 

Ubuntu Gnome 14.04

Last weekend I decided to take the plunge and return to a core Ubuntu release.  I have never liked the fact Canonical forked Gnome, and lately I am no longer happy to support Mint’s obsession with forking every gnome app!

My first impressions of Gnome 3 were not that good to be honest, but because I had actual work to do and I did not have the time to go back to Mint 16, I decided to persevere.

I am so glad I did.  I have come to appreciate Gnome 3’s simplicity and extension driven customisation.

I installed the frippery move clock extension, dask-to-dock, workspace-to-dock.  Enabled the native window placement and removable drive menu.

I also installed HTitle Firefox extension which remove the title bar in firefox.

The gripes I have so far, is it was a real pain to add launchers for my custom apps that are not installed.  Especially getting the icons working, I manually created the files in /usr/share/applications and that seemed to work.  Alacarte ignored the extension of my icon, which I did not understand.

 

I have had a couple of freezes, but ALT-F2, R, Enter gets around them, and I think they were mostly to do with earlier extensions I have added and now removed.

 

I tried quite a few extensions for stuff, (I don’t remember the complete list) but the ones I have listed above work for me.

I will post additional comments based on my experiences in the coming weeks.  But it is nice to be back with a proper ubuntu release, sorry mint.

 

As an aside….

It would be so nice to see Cinnamon re-merged back into gnome 3 instead of duplicating all that effort.  The same goes for Mate to contribute to the gnome classic mode.  It’s upsetting to see so much UI fragmentation.  Yet another reason why I don’t see Linux ever getting that ‘year of the desktop’

 

 

Supporting WCF UsernamePassword WS-Profile spec violations in CXF

If you have clients using .Net connecting to your CXF web service, they may encounter the following exception:

An invalid security token was provided (An error happened processing a Username Token “{0}”)

This is actually due to Microsoft .Net violating the WS-BasicProfile spec for the username token.  They are qualifying the Type attribute which is not allowed.

A few posts on the subject:

http://marc.info/?l=wss4j-dev&m=124386256631302&w=2

http://mail-archives.apache.org/mod_mbox/servicemix-users/201004.mbox/%3C28242884.post@talk.nabble.com%3E

https://issues.apache.org/jira/browse/WSS-148

 

A work around is to provide a custom WSSConfig object and inject it.  I am using a feature.

https://github.com/pellcorp/cxf/commit/0797863188ebf90beddf0d704eadf8208f916d5a

WS Policy Config

This approach only works where you are not using WS-Policy.  If you are using WS-Policy the code overwrites the custom WSSConfig object.

The call chain is:

com.pellcorp.server.ReadonlyWSSConfig.setAllowNamespaceQualifiedPasswordTypes(ReadonlyWSSConfig.java:27)
 at org.apache.ws.security.handler.WSHandler.doReceiverAction(WSHandler.java:297)
 at org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor.handleMessage(WSS4JInInterceptor.java:258)
 at org.apache.cxf.ws.security.wss4j.PolicyBasedWSS4JInInterceptor.handleMessage(PolicyBasedWSS4JInInterceptor.java:120)
 at org.apache.cxf.ws.security.wss4j.PolicyBasedWSS4JInInterceptor.handleMessage(PolicyBasedWSS4JInInterceptor.java:105)

 

So instead of the custom WSSConfig object, you need to pass in some properties to the endpoint definition, either in the application context:

<jaxws:properties>
 <entry key="allowNamespaceQualifiedPasswordTypes" value="true" />
 <entry key="isBSPCompliant" value="false" />
 </jaxws:properties>

You can also add the following code to the ServerConfigFeature:

properties.put(WSHandlerConstants.ALLOW_NAMESPACE_QUALIFIED_PASSWORD_TYPES, "true");
 properties.put(WSHandlerConstants.IS_BSP_COMPLIANT, "false");

 

 

 

Using Docker for light weight app deployments on linux

A couple of articles on using docker for lightweight app deployments from linux.  I am finding this interesting as a potential way to manage multiple versions of our app on a single environment, as well as potentially multiple instances without having to worry about directory naming conventions, etc.

Deploy Java Apps With Docker = Awesome – Atlassian Blogs.

http://www.infoq.com/articles/docker-containers/

 

Random Notes – Noah.org

Random Notes – Noah.org.

Oracle JDBC Debugging

You will need the _g version of the jdbc driver, the standard jdbc drivers don’t support enabling logging.

In order to get some low level debugging from the Oracle JDBC drivers you need some java util logging magic.  I am not sure if this is just because our app uses SLF4J and LOG4J, but I had to add the following environment variables to the jsw wrapper.con file.  I could not get the logging working without all 3 of those lines

wrapper.java.additional.6=-Doracle.jdbc.Trace=true
wrapper.java.additional.7=-Djava.util.logging.configureByLoggingPropertiesFile=true
wrapper.java.additional.8=-Djava.util.logging.config.file=/tmp/OracleLog.properties

And then the contents of the OracleLog.properties file are:

handlers = java.util.logging.FileHandler
java.util.logging.FileHandler.pattern = /tmp/jdbc.log
java.util.logging.FileHandler.formatter = java.util.logging.SimpleFormatter
oracle.jdbc.driver.level = FINE

But the problem is that all I actually wanted was the OracleDriver connect entries to find out how long a connection was taking to construct.  Time for some grep magic I think.

Unfortunately I am restricted to java 6 for this particular installation and so the log file outputs entries on more than one line so its harder to parse.