Removing Google Analytics, as well

Posted on 01 May 2018  •  Permalink  •  Category misc

Shortly after I received Google’s request for reviewing the new Google Analytics data processing terms for the GDPR, I read Jesse Squires’ post about him removing Google Analytics from his site. This led me to ask the same questions as Jesse, and Ash Furrow who also asked himself whether he should be collecting data on visitors of his blog. I have no better answers to these questions then they have.

Instead of accepting the new GDPR data processing terms, I simply deleted my account — as of today codemuse.co is not using Google Analytics anymore.

Remote Control for Kodi and XBMC 3.3.0

Remote Control for Kodi and XBMC version 3.3.0 is available on the App Store. This version brings support for the latest Kodi 17.x releases and contains some fixes to support iOS 9 and iOS 10. Also, you can now swipe left to mark any TV show, season, episode and movie as watched or unwatched. For iPad long-press movies to mark them watched or unwatched.

Replacing my Media PC

Posted on 12 September 2015  •  Permalink  •  Category htpc

After five great years of service, mbox, my first HTPC, was starting to show signs of decay: a hard drive with bad sectors. A good time — ahem, excuse — to replace it. I wanted to go fanless five years ago, but the options were limited and expensive back then. However, with Intel’s latest Core M Broadwell series it is now possible to build a better performing, but also more power efficient media and server computer, without any fans.

Like I did for my original setup, I’ll document the process of setting up my new little box here as part of the htpc series.

Hardware

A good friend recommended watching out for the Zotac ZBOX nano series to be updated with Intel’s Broadwell CPUs. I took his advice and the moment it became availble, I ordered the following parts:

  1. Zotac ZBOX CI521 nano
  2. Samsung 850 EVO 500 GB 2.5” SATA III SSD
  3. Toshiba 5 TB Canvio Desktop External Hard Drive

At a grand total of € 716,49 it’s slightly more expensive than my previous setup, though that’s an unfair comparison, as my previous setup neither included 5 TB of external storage nor an SSD. After only two months of use I can confirm it has been worth every penny so far for me.

Installation

Installing Ubuntu server on this machine is as simple as downloading the 64-bit install image, and “burning” it to a memory stick. I used my Mac to create the bootable memory stick as follows:

hdiutil convert -format UDRW -o target.img ubuntu-14.04.2-server-amd64.iso
sudo dd if=target.img.dmg of=/dev/rdisk$N bs=1m

Where for $N you should use the device that holds the memory stick.

After I hooked up the Zotac ZBOX to an ethernet cable and my TV (I don’t have a spare monitor laying around, except for a display that requires Thunderbolt), I plugged in the memory stick and the system booted and installed smoothly. Working on a command prompt on a TV isn’t the most comfortable, so I instructed the installer to include OpenSSH. After just a few minutes I was remotely logged in to a freshly installed, fully working Linux system. Modern times.

Configuration

At first boot, I ran a dist-upgrade to get the latest and greatest software and security patches. I adapted .bashrc to my wishes (especially $PS1), and set locales to squash certain Perl warnings:

sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
sudo dpkg-reconfigure locales

I use byobu a lot for running tasks in the background, or as a screen multiplexer when I’m logged in remotely. It’s installed by default with Ubuntu, but I usually tweak a couple of things. I enabled it’s custom colored prompt:

enable-byobu-prompt

Icconfigured the different status items, fixed monitoring the right ethernet adapter, set the network transfer units to bytes and set to monitor the right thermal device to show CPU temperature (of the first core). These settings can all be modified in ~/.byobu/status and ~/.byobu/statusrc. For the latter, these are the settings I use:

MONITORED_NETWORK=p4p1
NETWORK_UNITS=bytes
MONITORED_TEMP=/sys/class/hwmon/hwmon1/temp1_input

I use mDNS for easy reference to systems on my home network. With mDNS, machines in a network that support it can be resolved on the .local domain. It’s part of OS X and Ubuntu Desktop by default, but with Ubuntu Server the avahi-daemon package needs to be installed manually:

sudo apt-get install avahi-daemon

There we go, the new machine is now available using it’s hostname on the .local domain directly. That’s pretty much the most important configuration changes that got me where I wanted, so let’s turn this thing into a real media PC.

Kodi

I have been using XBMC — recently renamed to Kodi — from the moment I built my first media box in 2010. In my opinion it is the best open source media software. The installation instructions for Kodi for Ubuntu based distributions are as simple as:

sudo add-apt-repository ppa:team-xbmc/ppa
sudo apt-get update
sudo apt-get install kodi

Kodi needs an X server, which for this specific Zotac ZBOX works right out of the box (no pun intended) with the Intel specific drivers:

sudo apt-get install xserver-xorg xserver-xorg-video-intel

X11 needs to be configured in such a way that anyone is allowed to launch its own X server (I am going to create a specific kodi user for automatic boot later on). This can be done as follows:

sudo dpkg-reconfigure x11-common

I use nodm to login automatically and start Kodi on boot:

sudo apt-get install nodm

In /etc/default/nodm change the following values to enable it and to use the kodi user to login with:

NODM_ENABLED=true
NODM_USER=kodi

Unfortunately there is an issue between Plymouth and nodm grabbing terminals, which is why I had to apply the workaround described in this Ubuntu launchpad issue to get it working correctly.

With nodm set up, the kodi user that will login automatically needs to be added still. I set it up without a password, just to be sure. The next step is very important, otherwise Kodi will be severely limited (no hardware acceleration, no audio, etc.). The new kodi user needs to be in the right groups to grant it access to the resources it needs:

sudo usermod -a -G cdrom,audio,video,plugdev kodi

The final step to get Kodi to boot automatically, is to create ~kodi/.xsession with the following content:

#!/bin/sh
kodi

The new file needs to be executable:

chmod +x ~kodi/.xsession

There’s one thing I also set up for audio, which is alsamixer, because I still use an old stereo amplifier (which has served me well for more than 20 years already).

sudo apt-get install alsa-utils
sudo alsamixer

I mute all other channels except for the PCM audio and the set the master volume. With alsa-utils installed the mixer levels are automatically saved and restored on a reboot.

That did the trick for me, after all these steps you should have a full blown media PC.

Backups

Last but not least, since this box is also my home server, I use a very simple crontab to backup my most important assets, namely my git repositories. The backups have daily, weekly and monthly copies and are synced daily to a remote Linode VPS instance I own and manage. This is what my crontab looks like:

# Daily, weekly and monthly repository backups.
0 5 * * * rsync -a --delete $DIRECTORY_WITH_GIT_REPOSITORIES $HOME/backup/daily
30 5 * * 5 rsync -a --delete $HOME/backup/daily/ $HOME/backup/weekly
0 6 1 * * cd $HOME/backup/daily && tar cjf $HOME/backup/monthly/`date +\%Y\%m\%d`.tar.bz2 *

# Sync everything daily to my Linode VPS.
0 6 * * * rsync -a --delete $HOME/backup/*ly -e ssh $REMOTE_BACKUP_HOST:backup/

Replace $DIRECTORY_WITH_GIT_REPOSITORIES, $HOME and $REMOTE_BACKUP_HOST with whatever is applicable.

There’s one thing to configure to complete this setup, which is a simple mail server so cron can tell you when something is wrong. I have configured both Sendmail and Exim in the past, and I really don’t like to be remembered about that, so luckily there’s sSMTP:

sudo apt-get install ssmtp

Then edit /etc/ssmtp/ssmtp.conf and put in either your ISP’s SMTP host, or any other SMTP host you can send email from. The command line tool ssmtp can be used to test if it works.

Data

Besides the internal 500 GB SSD, I also bought a 5 TB Toshiba Canvio Desktop external 3.5” drive. Yep, 5 TB. Five. Terra. Bytes. For less than € 150,-. It replaces my 2 TB drive, which was chock-full, plus I wanted a USB 3.0 capable drive to connect to my new machine. So that’s going to be a whole lotta stuff to copy. More on that in a minute, first a word about partitioning.

I partitioned the drive using cgdisk with a GPT partition table (tip: I always used cfdisk so I like cgdisk a lot better than parted). I used a single partition with an ext4 filesystem covering the entire disk. However, I found ext4 reserved over 300 GB of space (for root, for system processes, and to avoid defragmentation) that is not counted towards free space. This external drive is for media only, so it’s definitely not needed to reserve space for system processes and certainly not 300 GB. As it turns out this can be tuned with tune2fs:

sudo tune2fs -m 0 /dev/sd$D$N

Use your specific device $D and partition number $N. Before running tune2fs the 4.6 TB sized drive, had 4.3 TB of free space. After running the above command, it shows 4.6 TB free. That’s better. Back to copying 2 TB of data.

The quickest way I know — and like — to copy large amounts of data from one system to another is using netcat. I normally use scp for most of my day-to-day data transfers, but for many gigabytes of data it does not make sense to encrypt everything, especially if you control the wire between the two ends. Here’s how I do it. On the one system move into the directory that you want to copy, and run the following command:

tar -cv . | nc -q 10 -l 45454

Go to the other system and fire up the following command:

nc -w 10 $REMOTE_HOST 45454 | tar -xv

Where for $REMOTE_HOST you need to use the hostname (thank you, mDNS) or IP address of the host you are copying from. Using netcat I got between 35 and 45 MB/s data transfer, from the eSATA connected 2 TB drive to the USB 3.0 connected 5 TB drive, using a Gigabit Ethernet connection.

With all the data present on the new disk, I added it to /etc/fstab to be automatically mounted. I like to put drives in /etc/fstab by UUID (to find the UUID of a partition, check /dev/disk/by-uuid/). As a result, I could re-use the external drive UUID entries from my old machine directly on the new machine’s /etc/fstab.

Silent, Cool and Low-Power

To conclude, some statistics. On the old system, the CPU temperature usually stayed close to around 76°C. Only on hot summer days or when in heavy use, the readings sometimes went above 80°C. The temperature would never go below 70°C, even on cold winter days with a room temperature of only 15°C. As for power use, the old machine used between 22 and 23 W when in use and approximately 20 W when idle. The old 2 TB external hard drive used 10 W when spinning, adding up to a total of 33 W when in full use.

The CPU temperature on the new system stays around just 54°C, the influence of room temperature seems to be pretty much gone, though I do not have readings on very cold winter days yet. The new machine is definitely much more power efficient; it uses only 9 W when idle. That includes 1 W of idle power the external drive draws when in standby mode. That’s only 8W for the PC itself, which is less than half of the idle power that the old system used. Playing music from the SSD with Kodi uses between 10 to 14 W. Watching a video from the external drive consumes between 17 and 22W.

So the new system is silent, cool and uses less than half the power when idle and about two-thirds of the power when in use. Not bad. Not bad at all.

Remote Control for Kodi and XBMC 3.2.0

Remote Control for Kodi and XBMC version 3.2.0 is available on the App Store. The new version fully supports Kodi 14.x, iOS 8, and iPhone 6 and iPhone 6 Plus. Also, support for pull to refresh is added to the library sections.

I am still looking for more beta testers for future versions, email remote@codemuse.co if you are interested. But for now, enjoy this new version!

Looking for Beta Testers

It has been more than a year since the last release of Remote Control for XBMC. The release of iOS 8 happened, iPhone 6 and 6 Plus were announced, and shipped. XBMC got renamed to Kodi and Kodi 14 was released. I worked on supporting iOS 8. I tried out Kodi. I got my own iPhone 6. I worked on supporting both the new 4.7” and 5.5” iPhones. But I also added support for pull to refresh and many other minor fixes and improvements.

On top of it all there was also this little guy that happened and changed my life last year. Needless to say, I like programming, but I absolutely love spending time with my kid. Development on my app is limited by that, but I am still motivated to continue on a good pace.

Back to the upcoming release. To support iOS 8, I completely modernized the networking backend, for iPhones 6 support I adopted auto layout in several parts of the UI. How things change in just several years, from the time of my initial commit, to where I am now. Back then, I started development on XBMC Remote Control for iPad targeting iOS 3.2. Today, by adopting all the latest iOS technologies, I was able to shrink the number of lines of code, even though I added the significant functionality and features. That’s what I call progress.

So a lot has happened the past year, and I am preparing for a new release of what will be Remote Control for Kodi and XBMC soon. But before the new version will be available I would love to get it into the hands of more beta testers. With Apple’s new TestFlight program, this has never been easier. All you need to do is install Apple’s TestFlight app, and all I need is your email address.

Interested? Send me an email at remote@codemuse.co.

Featured in Apple TV Concept

About a month ago I was skimming through the MacRumors WWDC 2014 roundup, where I first saw the Apple TV concept, originally published by German technology magazine Curved. An interesting concept, especially the remote controls UI, which obviously is inspired, if not based directly on my Remote Control for XBMC app. I reached out to @curved_de and quickly got a reply from Martin @deplaatjesmaker Hajek who is the original designer of the 3D concept.

Apple TV concept

He actually thought he found an image of the UI of Apple’s own remote app through a Google image search, but in fact it was a screenshot of my app. That may well be the best compliment to get as an iOS app developer!

After my reaching out, Martin immediately updated both his Apple TV piece on his website as well as the article on Curved with a link attributing the UI design to Remote Control for XBMC. For that I’d like to publicly thank him. So thanks @deplaatjesmaker!

Also, don’t forget to check out his latest iPhone 6 concepts on http://www.martinhajek.com.

Remote Control for XBMC 3.1.0

Remote Control for XBMC version 3.1.0 is available for download on the App Store. This version contains several UI and stability improvements. I also implemented some significant improvements in downloading TV show information. With larger TV show libraries or when using slower hardware to run XBMC (a Raspberry Pi for example), this new version will improve responsiveness and should fix possible timeouts.

Remote Control for XBMC 3.0.0

I am pleased to announce that the redesigned version of Remote Control for XBMC is now available for download on the App Store.

Remote Control for XBMC on iOS 7

This morning I submitted a new version of Remote Control for XBMC for iOS 7. Finally. It’s completely redesigned from the ground up, which took me more than four months.

Why did it take that long? I wanted to bring consistency in the design of the app on iPhone and iPad and I tried to work out the best experience for iOS 7 on both devices. No pixel of the app has been left untouched by this update. It was a lot of work, but I am very happy with the result.

I started with the overall design and remote controls. I liked the connection panel I introduced for the iPhone version, so I decided to keep it in and bring it to iPad as well. The remote and library icons as well as the remote control buttons needed a more iOS 7 design aesthetic, so I redesigned these from scratch. Likewise, the player and volume controls buttons are also redesigned to fit the overall iOS 7 look. [1]

Launching the app into the remote controls view immediately shows the difference between the new design for iOS 7 and it’s original counterpart.

Remote controls on iOS 6 Remote controls on iOS 7 Remote controls on iOS 6 Remote controls on iOS 7

The player and volume controls are part of the root view on iPad, on iPhone they are on the now playing view, which got its own redesign. With iOS 7, there’s a nice depth-blur effect when the artwork slides in from the bottom of the screen. On iPad the artwork slides in underneath the toolbar and on iPhone it slides in underneath the player and volume controls.

Now playing on iOS 6 Now playing on iOS 7

The original interface design for iPhone had a lot of custom designed interface chrome, but stock iOS 7 actually looks very good already. As a result I could remove a lot of images from the application bundle (shrinking from almost 15Mb down to only 2.9Mb). Also many custom UI tweaks could be removed from the source code. I loved that part. Nothing feels better than cleaning up and removing things while actually making the app better. Hopefully the iOS 7 stock UI elements look and feel don’t wear too quickly. The music library browsing views are pretty much the same with fresh coat of paint:

Albums on iOS 6 Albums on iOS 7 Artists on iOS 6 Artists on iOS 7 Album on iOS 6 Album on iOS 7 Artist on iOS 6 Artist on iOS 7

The TV shows section on iPad got a full make over, to make it more consistent with it’s iPhone counterpart. On iPhone, the TV shows view only got a cleaner look, except for the number of unwatched episodes badges. I have tried to make these more consistent with the way Apple’s iOS apps shows unread, unwatched and unlistened items. The screenshots show the banner style lists (which I personally like more), however TV show posters are still supported as well.

TV Shows on iOS 6 TV Shows on iOS 7 TV Shows on iOS 6 TV Shows on iOS 7

The detailed TV show view is mostly a design make-over on both iPhone and iPad, again except for the unwatched episode indicator.

TV Show on iOS 6 TV Show on iOS 7 TV Show on iOS 6 TV Show on iOS 7

Finally the movies view also got the new style of flagging unwatched ones. On iPad the movies browser got a more significant redesign to make it more consistent with iPhone, similar to the TV shows redesign:

Movies on iOS 6 Movies on iOS 7 Movies on iOS 6 Movies on iOS 7

The new version will be a free update, available on all devices that support iOS 7. As I mentioned before, I’m very content with the new looks and I enjoy using my own app almost daily. I hope everyone out there who is using or who will be using Remote Control for XBMC will enjoy it as much as I do.

[1]I originally did my design work in Inkscape, but since I’ve bought Sketch, I’ve recently done all design work with it. It’s really the best UI design tool I know and well worth the purchase. With this full app redesign I’ve moved over all pixel based UI design work for Remote Control for XBMC to Sketch.