Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

Friday, May 1, 2015

Netflix in Kodi on Linux

I have a previous post about this, where an addon called NetfliXBMC is used. That works just fine, and fairly seamlessly. The only thing is, I don't really use it for browsing movies. I do that on my tablet or something, add it to my list and then play it from Kodi.

The thing is that Netflix has a pretty nice web-interface (ok, so there are some things I don't like about it, but nevertheless), and we are already using Chrome to play the movie from NetfliXBMC, so why not just open Chrome to Netflix and play it from there?

There is also an added benefit to to this, which is that it is possible to use a VPN-like extension to Chrome, which would allow you to view the US content from another country. Obviously, I'm neither suggesting or encouraging anybody to do that, I'm simply saying that it is possible.

The only downside is that when you click a TV-series, you won't be able to see and select season and episode, it'll simply start the first, or if you've watched the series before, the next, episode.

Unfortunately, it's not quite as easy as just installing chrome, we also need to be able to navigate and select a movie. If you are using a keyboard and mouse to control your HTPC, then that's fine, but I'm using a remote, so some extra effort is needed. Fortunately, others have had the same issues, and have developed some extensions for Chrome which, at least partly, solves the issue.

Anyway, here's how to do it.

First, follow my guide for setting up NetfliXBMC, except for actually installing the NetfliXBMC addon.

Next, start the Chrome Launcher addon, and add Netflix to the websites list. Start it up, press Ctrl+N to open a new window, which is not in fullscreen mode. Install the addons you want/need. There are several ones that can change the look and feel of the Netflix website if you like.

For browsing the website using a remote, install the "Netflix Navigator" extension. This is made to enable you to control it using an XBOX360 controller, but it seems to work pretty well with the default buttons in Kodi. Except for one thing, which is that when you open any page, there is an overlay telling you to press a button on the controller. So in order to get rid of that, we need to modify the addon slightly.

Now, if you modify an installed extension, chrome tends to think that it has been corrupted and disables it, so we need to make a copy of it, and install that copy.

Go to your Kodi users home folder (probably /var/lib/kodi), then further into .config/google-chrome/Default/Extensions/

Find the folder that contains the Netflix Navigator extension. The folders are named as a hash on this level, so you need to look more carefully. Check the version number of Netflix Navigator from the Chrome extensions settings, and look for the same version number one level down in the folder structure here.

Copy the extension to your Kodi user home directory (or some other good place), you need the whole thing, ie the folder with the hash name.

Edit the file driver.js

Find the bit of code that looks like this:

return function() {
            if (_this.controllers.length === 0) {
              overlay = new OverlayMessage();
              return overlay.show("Please press <img src='" + (chrome.extension.getURL("assets/Xbox360_Button_A.png")) + "' /> to begin"$
            }
          };


Replace it with this (just removing a part of it):

return function() {
            if (_this.controllers.length === 0) {
            }
          };


Now go to the Chrome extensions settings page and uninstall the original extension. Then click the "Developer mode" checkbox and then "Load unpacked extension...". Select the extension that you modified by browsing to that folder, and install it.

You should now be able to browse and start movies from the Netflix webpage.
ENJOY!

Friday, November 21, 2014

Netflix on standalone XBMC in Linux

For a long time, getting Netflix working on Linux was really tricky. On a standalone Linux XBMC HTPC system, it was virtually impossible, so much so that I didn't even try it. Now though, with Chrome supporting HTML5, it's a lot easier.

I used NetfliXBMC + Chrome Launcher. NetfliXBMC lets you browse the content in XBMC, and can then launch the selected content to play in Google Chrome.

I'm using Arch Linux, with XMBC, without a desktop environment, you may be able to skip some of these steps, or adapt them according to your configuration.

Anyway, here's how I did it.

Update: Edited to reflect that there is a new repository and a new thread for NetfliXBMC on the Kodi forums.

Update 2: In Helix, it is not possible to start/stop openbox at launch/close of chrome, it must be started before Kodi does. So I have updated the script and added step for how to do this.

Get Chrome and NetfliXBMC up and running

  1. Install the XBMC repository for Chrome Launcher, you can find a link to it on the Chrome Launcher Kodi forum thread
  2. Install Google Chrome (need at least version 37, AUR has version 38, and that's the one I installed)
    1. Download the package file from AUR
    2. Instruction for how to install from AUR can be found here. Make sure to use the -s argument when you do makepkg, since it includes dependencies.
  3. Install Openbox window manager and xdotool: sudo pacman -S openbox xdtool
  4. Edit your kodi startup script (probably /usr/bin/kodi-standalone), and add "openbox &" (without the quotation marks) as the first instruction in it (immediately after the copywrite stuff). OBS: It seems that this gets lost when you update the Kodi package, so it needs to be redone when that happens 
  5. Create a script for launching Google Chrome (I simply called it chrome.sh and placed it in the xbmc home folder). It moves the mouse pointer off screen and starts Google Chrome.
    #!/bin/bash
    xdotool mousemove 0 740 &
    /opt/google/chrome/google-chrome $*
  6. Make the script executable: chmod + x chrome.sh
  7. Set Chrome launcher to start using this script
    1. Go to Add-On Settings
    2. Toggle "Use custom chrome/script path"
    3. Select "Chrome/script path", browse and select your script
  8. Install NetfliXBMC, you'll find it in the repository here
  9. In the Add-on settings for NetfliXBMC, enter you Netflix username and password, the rest of the settings are up to you

Video settings

My system runs natively at 720p, but XBMC runs at 1080p, this means that it'll change to 720p when Chrome opens.
  1. To fix this issue, I placed a config file in /etc/X11/xorg.conf.d/ (actually I added to one I already had, named 20-intel.conf):
    Section "Screen"
        Identifier             "Screen0"
        Device                 "Intel Graphics"
        Monitor                "PANASONIC TV"
        DefaultDepth           24
        SubSection             "Display"
            Depth              24
            Modes              "1920x1080"
        EndSubSection
    EndSection

Audio settings

Looking at the forums, there seems to be a lot of users that have a problem with this.

While audio works fine in XBMC, it didn't work at all outside of it (ie in Chrome) for me. Having looked around the forums on this, there seems to be many for which this is the case.
  1. In XBMC, set "Settings -> System -> Audio output -> Keep audio device alive" to "Off"
  2. Install alsa-utils: pacman -S alsa-utils
  3. From command line: alsamixer
  4. Unmute and raise volume for the channels that you are using
  5. You need the card and device numbers for the soundcard that you are using (even if it is built in): aplay -l
  6. Create a file (if it doesn't already exist) in the xbmc home directory (for me, /var/lib/xbmc), called .asoundrc, and place this info in it (replace card and device numbers with your own found above)

    pcm.!default {
        type hw
        card 0
        device 3
    }

Controls

If you are using a remote control, you'll want to assign one of the buttons to Esc or Alt+F4, in order to close Chrome when you are done watching something.

Aside from that, both Enter and Space work as play/pause, and since I use Enter to select a movie to play in XBMC anyway, that works out. The left and right arrows step back and forward in the movie, so they work kind of like rewind/fast forward (actually, I prefer the steps).

I kind of wish that I could access the sound/subtitle settings as well, but I haven't yet found a (good) way to do this.

Finally, if you absolutely feel that you want to use "p" (ie the same as play button in XBMC) to play/pause, there is an extension for Chrome that can make this happen called Flix Plus.

Remaining issue

My one gripe is that I only get stereo sound, rather than surround. After googling a bit, it turns out that surround sound is not supported by Netflix when using a HTML5 browser... So basically, it's Netflix's fault. Still, I think I prefer a nice and convenient interface and stereo audio, to my BD players slow-a** interface with surround. Maybe fire up the BD or Xbox if there is a specific movie that I really want 5.1 audio on.

Wednesday, September 10, 2014

CyanogenMod 11 on Samsung Galaxy S III

A couple of weeks ago, I decided to update my phone to the latest version of CyanogenMod, version 11, running Android 4.4 KitKat. CM11 has not yet reached stable, so I decided to go with the "snapshot" from early august, M9. Since it wasn't in stable yet, I wasn't sure what to expect, but I have to say, I am very pleasantly surprised.

As I was already using an earlier version of CyanogenMod, I already had the correct recovery SW installed, and could skip a lot of the stuff I had to do last time. Installation was in fact, a snap.

Just download the firmware and Google Apps, copy them to the SD-card, boot into recovery mode (switch off, then Volume up + Home + Power), flash the CM11 and then the GApps zip-file, and perform a "Wipe data/factory reset".

Reboot, and I was welcomed by the setup screen for what felt like a brand new phone.

As I said, I've been using this for a couple of weeks now, and I have yet to find a single bug. There has been some talk of possible Bluetooth issues (poor Harald), and I can't really speak to it as I haven't used it yet. But in everyday use, it works perfectly. If anything, it's faster and smoother than CM10.2 (Jelly Bean), and the battery life has increased significantly (CM10.2 was by no means bad in this area).

I'm lovin' me some KitKat right now, and so should you.

Tuesday, August 12, 2014

New Arch Linux + XBMC Installation guide







I decided to upgrade my HTPC with a SSD system drive, and a larger HDD for storage. Since I'm changing the system drive, that means a reinstall. As I did it, I found that quite a few things had changed since last time, so I made a new guide.

Compared to before, some things are easier to do, and some are more difficult.


My installation has no window manager, it is just XBMC on top of Arch Linux. If you want to be able to switch to a "normal" desktop environment for using a web-browser etc, then you can easily do that in addition to the things described in this guide, Google is your friend here.

Some of the things in this guide are optional, or HW-dependent. For both these cases I have tried to clearly mark them as such, as well as describing what they are for.

Preparation

Download the latest version of ArchLinux from archlinux.org and burn onto a CD/DVD or use a tool like dd (Don't use Unetbootin, it doesn't work with Arch Linux) to install to a USB-drive. You can find instructions here.

Boot the computer from this drive and select the appropriate version.
Once booted into the live environment, you can open additional terminals and switch between them with ALT+Fx, where x is the number of the terminal, the original one is 1. Login is “root” with no password needed.

The procedure is a little different depending on if you are using UEFI or not, I'm not. If you are, then there are some additional steps needed. Please see the Beginners' guide on the ArchWiki for details.

Later on during the installation, I realized that I had forgotten to create a swap partition, so I'm using a swap file instead. If you want a swap partition, do that during the other partitioning.

Installation

  • If needed change keyboard layout with the “loadkeys” command, the available keymaps can be sound under /usr/share/kbd/keymaps
    • loadkeys sv-latin1 (Swedish keyboard in this case)
  • You might need to setup an internet connection at this stage. If you have a wired DHCP connection, it should work without doing anything, if not, then you'll need to do some work on it.
  • Partition disks
    • First find your disks, and which is which
      • lsblk -o NAME,FSTYPE,SIZE,LABEL
    • Decide if you are going to use MBR or GPT partition tables, for disks over 2 TB GPT is required (you can mix and match MBR and GPT disks)
      • MBR: fdisk /dev/sdx
        • Type "o" + ENTER to create partition table
        • Type "n" + ENTER to create partition
        • For the rest of the options, the only thing you really need to enter is the size of the partition (unless you are using the entire disk, the  you don't even need that), leave the rest as default
        • Repeat from "n" for more partitions
        • Type "p" + ENTER to preview the partitions
        • Type "w" + ENTER to write the partitions to the disk 
      • GPT: cgdisk /dev/sdx
        • Choose "New"
        • For the rest of the options, the only thing you really need to enter is the size of the partition (unless you are using the entire disk, the  you don't even need that), leave the rest as default
        • Choose "Write", then "Quit"
      • Replace x with the letter for the drive you want to partition
  • Format (to ext4 filesystem in this case) and name your root partitions
    • List your partitions
      • lsblk -o NAME,FSTYPE,SIZE,LABEL
    • Format
      • mkfs.ext4 /dev/sdxy
    • Label
      • e2lable /dev/sdxy <label>
    • Replace x with the drive letter and y with the number
  • Repeat previous step for any other partitions you want to format
  • Edit the mirrorlist and move your closest mirror to the top of the list
    • nano /etc/pacman.d/mirrorlist
  • Mount the new root partition under /mnt
    • mount /dev/sdxy /mnt
    • Again, replace x with the drive letter and y with the number for your root partition
  • Install the base system
    • pacstrap /mnt base base-devel
  • Generate basic fstab
    • genfstab -U -p /mnt >> /mnt/etc/fstab
  • chroot into the new system
    • arch-chroot /mnt
  • If you want to have other disks automounted, edit fstab and add drives, find the UUID with blkid. This can be done later during the setup or any other time as well.
    • nano /etc/fstab
#
# /etc/fstab: static file system information
#
# <file system> <dir> <type> <options> <dump> <pass>
# /dev/sdb6 LABEL=root
UUID=fb22b964-b38f-42df-bded-d9ac6df54ec5 / ext4 rw,relatime,data=ordered 0 1
# /dev/sdb5 LABEL=swap
UUID=21ecefbb-1c9d-48fa-a5f3-c9ba9a09b547 swap swap defaults 0 0
# /dev/sdb6 LABEL=home
UUID=d0e114fa-b428-4605-851d-504c86c0e7ac /home ext4 defaults 0 2 
  • Open /etc/hostname and add you computers name
    • echo XBMC > /etc/hostname
    • You can replace "XBMC" as the hostname with whatever you want of course
  • Symlink your local time with the correct timezone
    • ln -s /usr/share/zoneinfo/Europe/Stockholm /etc/localtime
  • Open locale.gen, uncomment the language profile you want and generate the profile
    • nano /etc/locale.gen
    • locale-gen
  • Add language config, I'm using english US here. Use the same as the one you uncommented above
    • echo LANG=en_US.UTF-8 > /etc/locale.conf
  • Export locale
    • export LANG=en_US.UTF-8 
  • Add permanent keyboard mapping (Swedish keyboard in this case)
    • echo KEYMAP=sv-latin1 > /etc/vconsole.conf
  • Set the HW clock to use UTC (careful with this if you are multibooting with other OS's)
    • hwclock --systohc --utc
  • Find NW-card interface, configure and start wired DHCP (again, if you are using something else, set that up), I'm using this temporarily, I'll setup static IP later on
    • Use ip link to find the name of the NW interface
    • systemctl enable dhcpcd@enp4s0.service
    • systemctl start dhcpcd@enp4s0.service
    • Replace enp4s0 with the name of your interface
  • If needed, edit mkinitcpio.conf
    • nano /etc/mkinitcpio.conf
    • HW-dependent: Add “i915” under MODULES if using compatible intel video-card
  • Generate initial RAM-disk
    • mkinitcpio -p linux
  • Install GRUB
    • pacman -S grub
    • grub-install --target=i386-pc –recheck /dev/sdx (where x is the device that root is on. DO NOT USE THE NUMBER THAT USUALLY FOLLOWS, this is installed on the device, not the partition.
  • Configure GRUB
    • If needed you can configure grub in /etc/default/grub
      • nano /etc/default/grub
      • Change GRUB_TIMEOUT to preferred value
      • HW-dependent: If using Intel Sandy Bridge  video drivers, change so that GRUB_CMDLINE_LINUX_DEFAULT="quiet i915.i915_enable_rc6=0" 
      • grub-mkconfig -o /boot/grub/grub.cfg
  • Install and enable ssh, you could do this later, but I like to do it here, so I can do the rest of the setup over ssh
    • pacman -Su openssh
    • systemctl enable sshd
  • Set root password
    • passwd
  • Change the NW setup from DHCP to static IP
    • systemctl stop dhcpcd@enp4s0.service
    • systemctl disable dhcpcd@enp4s0.service
    • cd /etc/netctl
    • cp examples/ethernet-static my_network
    • nano my_network
    • Change the values for the interface, ip-addr, gateway and DNS to ones you are using
    • I had some problem with it not working if the router wasn't on when I started the HTPC, to fix this, add the following line at the end of the file
      • SkipNoCarrier=yes
    • netctl enable my_network
  • Exit chroot
    • exit
  • Unmount root partition
    • umount /mnt
  • Reboot

Setup

  • You should be able to do the rest over ssh if you want now
  • Add multilib support if you are using 64-bit version and think you might need support for 32-bit applications
    • nano /etc/pacman.conf
    • Uncomment "Multilib" rows
  • Install additional packages (The ones marked in red are optional)
    • pacman -Syu mesa alsa-utils ntp avahi nss-mdns shairplay libplist polkit xbmc xorg-server xorg-xinit xorg-utils xorg-server-utils upower udisks
      • ntp: For synching the time with a network serve
      • avahi & nss-mdns & shairplay & libplist: For Airplay support
  • Install video drivers
    • HW-dependent: For Intel: pacman -Syu xf86-video-intel libva-intel-driver
  • HW-dependent: For intel video drivers, add config file to disable compositing
    • /etc/X11/xorg.conf.d/20-intel.conf
Section "Device"
Identifier "Intel Graphics"
Driver "intel"
# Option "AccelMethod" "sna"
# Option "TearFree" "true"
EndSection
Section "Extensions"
# fixes tearing
Option "Composite" "Disable"
EndSection
  • Add config file to enable XBMC to power off and reboot
    • /etc/polkit-1/rules.d/10-xbmc.rules
polkit.addRule(function(action, subject) {
if(action.id.match("org.freedesktop.login1.") && subject.isInGroup("power")) {
return polkit.Result.YES;
}
});
  • Add user and add that user to appropriate groups(replace username with your actual username)
    • useradd -m -g users -G video,audio,storage,power,games,network,optical username
  • Set password for new user (replace username with your actual username)
    • passwd username
  • Configure and enable services
    • Optional, perform if ntpd was installed: 
      • Change the ntp servers in /etc/ntp.conf to local ones
      • systemctl enable ntpd
    • Optional, perform if avahi was installed:
      • Not sure if it is needed or not, but I added mdns4 to the end of the hosts line in /etc/nsswitvh.conf
      • systemctl enable avahi-daemon
  • You might want to configure ssh and sftp, depending on how you want the setup to work.
    • nano /etc/ssh/sshd_config
  • Setup a swap file
    • fallocate -l 2048M /swapfile
    • chmod 600 /swapfile
    • mkswap /swapfile
    • swapon /swapfile
    • Add the line below to /etc/fstab
      • /swapfile       none    swap    defaults        0 0 
  • Finally, we need to set it up so that XBMC starts automatically. This got more difficult recently, when xorg-server 1.16 was released... There are a couple of ways of doing this, I chose this one because I found it the easiest.
    •  Add a file: /etc/X11/Xwrapper.config with the following text in it
      • allowed_users = anybody
        needs_root_rights = yes
    • Manually add the xbmc user
      • useradd -m -c 'XBMC user' -G audio,video,network,optical,storage,power,games -d /var/lib/xbmc -s /usr/bin/nologin xbmc
    • Create the xbmc service file: /etc/systemd/system/xbmc.service
      • [Unit]                                                                                                      
        Description = Starts instance of XBMC using xinit
        After = systemd-user-sessions.service network.target sound.target
        Conflicts=getty@tty7.service
        [Service]   
        User=xbmc
        Group=xbmc
        PAMName=login
        Type=simple
        TTYPath=/dev/tty7
        ExecStart=/usr/bin/xinit /usr/bin/dbus-launch --exit-with-session /usr/bin/xbmc-standalone -- :0 -nolisten tcp vt7
        Restart=on-abort

        [Install]                                                                                                       
        WantedBy = multi-user.target
    • Enable the service
      • systemctl enable xbmc
  • Reboot and enjoy









Saturday, July 26, 2014

Using the Zoom slider on Microsoft Natural Ergonomic Keyboard 4000 for scrolling

I got the Microsoft Natural Ergonomic Keyboard 4000 a while back, and thought about using the zoom slider for scrolling quite early on. After a bit of googling, it was clear that I wasn't the only one who had that idea. It did seem quite complicated though... so I kept putting it of. Now I decided to finally give it a real try, and due to some changes, it turns out to be quite simple :)

To be honest, this is not true scrolling, I'm mapping the zoom in and out to page up and down. Those buttons already exist, so some might think it redundant, but I find that the zoom slider is nicely placed in the middle of the keyboard, so it works for me. Also, you could, using this method, map it to just about any function.

The changes that have been made in Linux, in particular, the integration of systemd and udev, means that a lot of the older solutions you might find do not work. The keymap command no longer exists, for example.

  1. Create a file: /etc/udev/hwdb.d/61-keyboard-local.hwdb
  2. Paste the following text (exclude the "1."):
    1. # Microsoft Natural Ergonomic Keyboard 4000
      keyboard:usb:v045Ep00DB*
       KEYBOARD_KEY_c022d=pageup
       KEYBOARD_KEY_c022e=pagedown
  3.  In terminal, rebuild the HW DB index: sudo udevadm hwdb --update
  4. Reboot
  5. Your zoom in/out slider should now function as page up/down.

In case anyone is interested in how I came to this...

The reason I didn't need to fiddle about with evtest and event numbers etc, is that the work has already been done. If you look in  /lib/udev/hwdb.d/60-keyboard.hwdb, there is already an entry for this keyboard, and for these keys:
# Microsoft Natural Ergonomic Keyboard 4000
keyboard:usb:v045Ep00DB*
 KEYBOARD_KEY_c022d=zoomin
 KEYBOARD_KEY_c022e=zoomout
Now, you could just change it in that file, but that means that it will stop working if it is updated, better to add a separate file. So all that is needed is a hwdb file with a higher index (under etc rather than lib, to keep it separate). The point is that we can use the syntax, including VID, PID, and keycodes, in our new config file.

As I said in the beginning, you could map them to pretty much anything you like. I tried, but did not get scroll up/down to work for some reason... Anyway, if you feel like trying other things, here is a link to the list of key-mappings that you could use to map it to.
 

Sunday, June 1, 2014

LMDE Review

I've been using Linux Mint, on and off, for a number of years now, and I really like it. For quite a while I was on Linux Mint 16 (I realize that 17 just came out), but a couple of months ago I decided to give LMDE (Linux Mint Debian Edition) a try. 

Linux Mint Debian Edition
















Linux Mint Debian Edition, or LMDE, is a version of the very popular distribution Linux Mint. While the "normal", numbered, editions of Linux Mint are based of Ubuntu, LMDE is based on Debian Testing instead. Aside from what distro they are based on, the idea is that they should be the same.

First off, the installation procedure. It's different from the Ubuntu-based version, but I actually prefer this one. The Ubuntu installer (and the slightly modified one used in the main version of Linux Mint) is simply great, it's simple, intuitive, and looks nice to boot. The only problem I have with it, is that it's, in a sense, too simple. I feel like I'm not really the one in control, but rather I have to trust in that the Ubuntu team has done things correctly.

The LMDE installer still provides a nice, simple interface for installation. It does not by any means require you to be an expert in order to install it. It does show you a little bit more of what is going on, and provides you with just that little bit of added control of the process, which means that it feels very comfortable to use.

Once installed, there are only 2 visible indications that anything is different from the "normal" version. The first is the background, which has a Debian logo instead of the number of the LM version. Personally, I think the Debian logo looks better. The second is the font used for menu-button, icons, etc. Here I go the other way, the Ubuntu-based versions font is better. LMDE's font seems somehow smaller and thinner, making it slightly less readable. It is by no means a disaster, but it's not quite as good as the original.

For everyday use, things run smoothly and quickly, there is no sense that you are using a distro that is inferior to the Ubuntu-based version. The settings app and program manager look no different from that found in the "normal" version.

After a couple of months of use, I've only really found one bug. It's in the regional settings, and it's not as if that is something that you tend to mess with a lot.

I had a bit of trouble installing BankID due to the repositories being different from the Ubuntu-based ones. But then BankID is kind of a special case. I imagine that other applications which do not come from the default repositories might have similar problems in terms of dependencies.

All in all, I have to say that the Linux Mint team has succeeded very well in making LMDE the same as the "normal" version. There are a couple of very minor downsides, but then there is a major upside as well - LMDE is rolling distribution, which means that there is no need to reinstall when a new version becomes available. This seems especially beneficial now that Ubuntu only has 9 months support on their non-LTS versions. Only 9 months support means that you need to either run the LTS version, or reinstall every time a new version comes out (which has its own charm). I hear that Linux Mint may start to base each of their versions only on the Ubuntu LTS, so we'll see where that goes.

For now though, I'm sticking with LMDE. It is definitely good enough, that I don't see any reason to return to the numbered versions. And really, I don't think that there is any higher praise to give than that.

Sunday, April 13, 2014

BankID with card reader on LMDE

Update: This no longer works. It seems that the changes done for BankID have now gotten to the point that banks etc have upgraded and this old version no longer works...

I've previously made guides for doing this on Ubuntu 13.04 and 13.10. Today I installed LMDE (Linux Mint Debian Edition), and getting BankID to work there had some additional difficulties.

I know... BankID is very soon ending the support for Linux completely, but for now I want to be able to use it. So here's how.

The main problems under Debian, is that nspluginwrapper and one if the dependencies of the driver for the card reader (the i386 version) have been removed from the repositories. That means that there are a couple of fairly "ugly" tricks that I had to do in order to get this to work. Doing this means that some packages will not be updated, so if you don't feel comfortable with that, don't do this.

There is a lot of good information on the Ubuntu wiki for Nexus Personal, but since it tries to encompass everything, I find it a little difficult to follow. It's a good resource for debugging though.

The card reader that I have is a Digipass 920, so if you are using something else, you may need to change out the driver for the one appropriate for you device.


Do keep in mind that the BankID application will not be automatically updated. If you need to update to a new version you'll have to download and install it again as described below.
  • Get the BankID application from https://install.bankid.com/Download?defaultFileId=Linux (the website blocks 64-bit Linux from the "regular" download procedure, so if you're downloading from that you need to use this direct link)
  • Unzip the application
  • Open a terminal and go to the directory that you unzipped the application to, and type in the following command (Please note that the version number will change):
    • sudo ./install.4.19.1.11663.sh i
  •  Enable multiarch support
    • sudo dpkg --add-architecture i386
      sudo apt-get update
  • Install some needed packages
    • sudo apt-get install pkcs11-data:i386 libstdc++6:i386 libidn11:i386
  • Next we need to install nspluginwrapper, as I stated above, this is no longer part of the standard repositories, so it requires a bit more work. Basically we are adding an older repository in order to install it. You could also install it from source, but that would probably leave you with some problems with regards to dependencies, this is (in my opinion) the easiest way
    • open the config file for your repositories
      • sudo gedit /etc/apt/sources.list 
    • Add the following line to it
      • deb http://ftp.au.debian.org/debian/ squeeze main contrib non-free
    • Save and close
    • We can now install nspluginwrapper with its dependencies
      • sudo apt-get update
      • sudo apt-get install nspluginwrapper
  • Now to install the driver for the card reader. The actual driver is still there, but not one of its dependencies, so we will need to install that manually first
    • Now we can install the driver
      • sudo apt-get install pcscd:i386
  • The repository that we added in order to install nspluginwrapper conflicts with Linux Mints repository, so we need to remove it
    • Open /etc/apt/sources.list, in the same as as above, and remove the line that we added to it
  • Go back to the terminal and give the following command:
    • sudo nspluginwrapper -i /usr/local/lib/personal/libplugins.so
  • Start/restart Firefox, go to Tools -> Addons and check that you can see Nexus Personal under Plugins
  • Give it a try, it should now work

Tuesday, February 25, 2014

Black screen while playing game on ZSNES in XBMC

A while back, I posted a guide for setting up ZSNES SNES emulator on a Linux XBMC setup.

I noticed that after 10-20 minutes, the screen would go black, but a keypress would bring it back. I don't really play that much, and I didn't find an immediate solution to the problem, so I just let it lie. I happened to stumble upon the answer the other day, here. It's a little out of date though, in that it uses xorg.conf, so I'm putting an updated version here.

The problem is apparently X going into sleep. I'm not really sure why this happens when the emulator is on top, but not when XBMC is, but there is a fairly easy way to solve it.

  1. Open a Terminal
  2. Create a new Xorg config file: /etc/X11/xorg.conf.d/30-xnosleep.conf
  3. Place the following text in it:
Section "ServerFlags"
Option "BlankTime" "0"
Option "StandbyTime" "0"
Option "SuspendTime" "0"
Option "OffTime" "0"
EndSection
  1. Save, reboot, and enjoy "The Legend of Zelda: A Link to the Past" without interruptions.
 

Friday, February 7, 2014

CyanogenMod on Samsung Galaxy S III

I've been considering installing a custom ROM on my Samsung Galaxy S III for a while now. There are some advantages to leaving it as standard, for me the main reason was that I could sync the calendar and contacts with Outlook at work using Kies. That stopped working this week, and combined with the latest update, which made my phone even more laggy and greatly reduced my battery time, it made me decide to finally take the leap.

There is a huge number of custom ROMs available, the choice fell on CyanogenMod simply because it is one of the more well known and most used. I use this phone for work as well as home, so I wanted something at least fairly stable. This is also why I chose to go for version 10.2, which uses Android 4.3 Jelly Bean, rather than version 11 which uses Android 4.4 KitKat (which is still releasing nightly builds).

I've only used it for a day so far, but I'm quite happy with it. The 2 things that I wanted most to improve by installing CyanogenMod, battery life and speed, have surpassed my expectations. Battery life is hugely better, and there is no lag at all.Maybe I'll write up a more thorough review after using it for a while.

What is shown on the boot-screen after install

























So, here is how to install it. But before we begin, a couple of things to consider.
  • The standard renunciation of responsibility: I take no responsibility for anything that might happen as a result of your using this guide. By installing a custom ROM (like CyanogenMod) you will almost certainly be voiding your warranty. Also, there is a chance of bricking your phone when doing this (The phone will not work at all if this happens). I personally don't think the chances of bricking your phone are very large, as long as you follow the steps, but I take no responsibility if you do.
  • Make sure that the battery is fully charged before starting the procedure.
  • Copy any files that you want to be sure to keep from your phone to your computer before starting the procedure.
  • Any game progress, notes, etc will be lost, even if you reinstall the app afterwards.
  • I'm using Linux Mint 16 for the few steps that require a computer, if you are using Windows or Mac OS X, additional steps may be required to get the tools to work. 
  • CyanogenMod doesn't include Google apps by default, and yes, this includes the Play Store. Since you will probably want it (and because I do), I have included it in the steps below. If, for whatever reason, you do not want it, just ignore those steps.
  • I exported my contact to a vcf file before installing. As it turns out, the contacts app in CyanogenMod doesn't support this format for importing, so you might need to convert the file to vCard.
  • I used this entry from the CyanogenMod wiki as my main guide, it's a good idea to check in there, to see if there are updated versions of programs etc.

  1. Download the programs/files that you will need
    1. Heimdall, Used to transfer the recovery image to the phone. Choose the version corresponding to your OS. Even if Heimdall exists in your repositories, it is recommended to get it directly so that you are sure that it is the latest version.
    2. Koush's ClockworkMod Recovery, recovery image that allows you to flash the custom ROM.
    3. CyanogenMod, your new ROM. Choose the image you want, I went with  cm-10.2.0-i9300.zip, which is marked as "stable".
    4. Google apps, if you want Play Store, GMail etc.
  2. Install Heimdall on your PC.
  3. Connect your phone to your PC, and place the zip-files for CyanogenMod and Google apps on your SD-card.
  4. Switch off your phone, do not have it connected to the computer.
  5. On your phone, hold down the Volume down, Home, and Power buttons. It will start up in flash-mode. Accept the disclaimer, then connect the phone to your computer by USB.
  6. On your computer, rename your ClockworkMod recovery zip-file to "recovery.zip", open a Terminal and go to the directory where you have your ClockworkMod recovery zip-file. Give the following command: 
    1. sudo heimdall flash --RECOVERY recovery.img --no-reboot 
  7. Once the command has terminated and you're back to a command line on your computer, and your phone has a full blue progress indicator, unplug the USB, and pull the battery out from your phone.
    1. The reason for pulling the battery is that if the phone reboots at this point, the stock ROM can overwrite your new custom recovery.
  8. Put the battery back, and , hold down the Volume up, Home, and Power buttons. It will now start up in recovery-mode.It should clearly state that it is ClockworkMod Recovery, if it doesn't then the recovery image has probably been overwritten by the stock ROM, start again from step 4.
  9. Use the Volume up/down to navigate, and power button to select from the menu. You will probably want to select "Backup and restore", and perform a backup of your current ROM. This will allow you to go back to your stock ROM should you ever want to.
  10. Select "Wipe data/factory reset".
  11. Select "Install zip". The next selection depends on where you placed your file, internal or external sdcard. I used an external one (the one you insert next to the battery), so I chose "choose zip from /storage/sdcard1". Select the CyanogenMod zip-file and wait for it to finish installing.
  12. Go back the main menu and select "reboot system now".
  13. For installing Google apps, repeat steps 8 and 11.
  14. Start downloading apps and configuring you new phone!

Flash-mode, confirm to continue
Flash-mode, ready for new recovery image














ClockworkMod recovery mode



Wednesday, February 5, 2014

Pear OS is no more

Pear OS, or Pear Linux, as it used to be called, has gone from the world of Linux distros.

I first noticed that the website was down a few days ago, and today I, when I saw that it was still down, I did a search and found out why. The creator, David Tavares, released a statement saying that it will no longer be available and that  "Its future is now in hands of a company who wants to remain anonymous for the moment".

There has been quite a bit of speculation about which company it is that is being talked about, and perhaps we'll find out later on, but for now, the only ones who know are the ones involved.

Now, Pear OS was never a hugely successfull distro (in respect to the number of users), and I've read comments both from people who will miss it very much, and from people who had never hear of it before saying that it's a good thing that it's gone.

I wrote a review of the Beta release of Pear OS 8, which was to be the last version of Pear OS. After that, when the final version came out, I installed and used it for a month or so.

It was a nice looking distro which worked quite well. It was far from perfect though, having a "dodge windows" type dock at the bottom, without a panel there, means that I was often triggering the dock when trying to click on something at the bottom of a webpage. This latest version also had a lot more bugs than the 2 previous versions, which were almost as stable as the Ubuntu it was based on. The worst part (for me), and what made me move away from it after a month, was serious bugs, which when reported, was marked as solved with a comment in the bug-report about a command to be executed in the terminal in order to fix it.

All that said, I will actually miss it. It was one of a very small, and apparently diminishing, number of distros that focused on making a truly good looking OS. Obviously, looks aren't the most important part of an OS, but once you have the functionality and stability, looks are a nice little perk.


Sunday, November 24, 2013

SSH/SFTP login without password

I just finished setting up password-less login for SSH and SFTP, suing public key authentication. This is something I've been meaning to do for some time, but I could never seem to get around to it. Now though, it's done, and I thought I'd share some of my troubles, and, of course, the solutions to them.

I started by generating the SSH key-pair and transferring the public key to the server. This is quite simple, so I won't go into details, except to provide a link to the ArchWiki article I used as reference.

Next, edit the file /etc/ssh/sshd_config on the server side, and make sure that PubkeyAuthentication is set to Yes.

If you want to make things even more secure, you might want to think about disabling password login completely. Just remember, if you do that, and you loose you private key file, you won't be able to access the server remotely anymore.

After a restart of the ssh daemon on the server, it should now be possible to login without being prompted for a password. This was not the case however...

The problem turns out to be that SSH is a bit cranky when it comes to file permissions. After a fair bit of googling, it turns out that not only does this apply to the authorized_keys files, and the .ssh directory, but also to the $home directory used (this last one caused me a bit of trouble).

Here are the commands for setting the correct file permissions:

chmod go-w ~/
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
 Once this was done, I was able to access the server without providing a password, both for SSH and SFTP.

Yeay, no more Samba for me!



Tuesday, October 22, 2013

BankID with card reader on Ubuntu 13.10 64-bit

I made a guide for this for Ubuntu 13.04, but after installing it for Ubuntu 13.10, I found there were some differences (and difficulties for that matter), so I thought I'd write one for 13.10 as well.

The main difference is that ia32-libs is no longer available, which makes it much harder to figure out dependancies.

There is a lot of good information on the Ubuntu wiki for Nexus Personal, but since it tries to encompass everything, I find it a little difficult to follow. It's a good resource for debugging though.

The card reader that I have is a Digipass 920, so if you are using something else, you may need to change out the driver for the one appropriate for you device.

Do keep in mind that the BankID application will not be automatically updated. If you need to update to a new version you'll have to download and install it again as described below.
  • Get the BankID application from https://install.bankid.com/Download?defaultFileId=Linux (the website blocks 64-bit Linux from the "regular" download procedure, so if you're downloading from that you need to use this direct link)
  • Unzip the application
  • Open a terminal and go to the directory that you unzipped the application to, and type in the following command (Please note that the version number will change):
    • sudo ./install.4.19.1.11663.sh i
  • Install the needed packages (pcscd:i386 is the driver, in case you need a different one)
    • sudo apt-get install nspluginwrapper pcscd:i386 pkcs11-data:i386 libstdc++6:i386 libidn11:i386
    • There will be quite a few dependancies (mostly for nspluginwrapper), just accept them
  • Go back to the terminal and give the following command:
    • sudo nspluginwrapper -i /usr/local/lib/personal/libplugins.so
  • Start/restart Firefox, go to Tools -> Addons and check that you can see Nexus Personal under Plugins
  • Give it a try, it should now work

Update: Confirmed to work also on Linux Mint 17, i.e. it should also work on Ubuntu 14.04.

Sunday, September 1, 2013

Pear OS 8 Beta 1 Review

Pear OS is a distro based on Ubuntu, with a heavily customized version of Gnome Shell, such that it kinda sorta looks like Mac OS X.
















I've used Pear OS before, version 6, and I quite liked it. It was good looking, fast, and user friendly. 

My main problem with the "standard" Gnome Shell is that it tries to cram everything into one "hot corner", dock, program selector, workspace selector and program launchers. What Pear OS does, is separate these things so that it's less cluttered and easier to use. There's one hot corner for program selection, another for workspace selection, and the program launchers is accessed from an icon on the dock.

This new version brings quite a lot of changes, both in looks and functionality.

Gone is the standard black panel of Gnome Shell, it's have been replaced by a grey one, making it look a lot more like Mac OS X than before. Now, I quite liked the black, but the grey look pretty good too. Pear OS is still a very pretty distro. 

My favorite new thing is the menu bar integration into the panel, in the same way that it is in Ubuntu. It saves vertical space by utilizing what would otherwise be dead space in the panel. For a lot of people, the slight saving in desktop space probably doesn't matter, but on a small screen laptop, it can make a big difference. In addition, I like the fact that the menu items are always in the same place, regardless of where the window is.

This is a beta, and an early one at that, so of course there are bugs and things missing. The hot corners wouldn't work unless I logged in and out again (and selecting Pear OS 8 session). There aren't any really good wallpapers yet, previous versions have had really nice ones.

I won't go through the default programs that are included, if there's something you don't like, you can always replace it after all. Pear OS does come with a few bespoke applications though, such as for customization, PPA handling, system cleanup, and now also a cloud service.

In summary, Pear OS 8 Beta 1 still has a few bugs, it's clear that it isn't ready, but it looks like it'll be a great distro, one I'll probably be installing as my main OS once it's released.

Sunday, August 25, 2013

The root device is not configured to be read-write

"The root device is not configured to be read-write", this is the message that I was greeted with, during boot, when starting up my HTPC yesterday.

The HTPC is running Arch Linux with XBMC, and XBMC started up just fine afterwards and everything seemed to be working. Nevertheless, I thought it strange, since I hadn't updated the system or changed any settings recently.

First I thought it might be a one-off event, but rebooting displayed the same message. A little googling told me that at least a few others had seen the same thing and that the solution was simple: just rebuild the grub configuration file.
sudo grub-mkconfig -o /boot/grub/grub.cfg
It looks like somehow something had gone wrong with my GRUB installation, I noticed also that the changes that I had made to /etc/default/grub had also disappeared, so I made the changes and rebuilt the configuration file again.

It bugs me a bit that I don't know the cause of this, but at least it was fixed quickly and without any real difficulties.

Wednesday, July 17, 2013

Games emulator on xbmc

During my vacation, which is rapidly approaching its end, I have been meaning to get a games emulator installed onto my HTPC. Mostly I wanted it for nostalgic reasons, I have fond memories from playing Nintendo as a boy. Now, finally, I have stopped procrastinating, and have done it.

I'm running Arch Linux with XBMC (Frodo), and I bought an XBOX 360 USB controller for this purpose. I was a little concerned if it would work or not, since I don't have any window manager installed, bit it seems that X is running with just XBMC, and that is enough.

I decided to start with the SNES emulator zsnes, since it's been around a while and seems to be at least somewhat stable. After I got it working I noticed two things. Number 1, I had forgotten how bad 8-bit graphics were. And number 2, I really suck at Super Mario Bros games.

Anyway, here is how I did it.
  • Make sure that you are using a skin that supports the "Program" menu item
  • Start by installing zsnes
    • pacman -Su zsnes
  • Then install Advanced Launcher
  • Restart the HTPC, WITH THE CONTROLLER CONNECTED
    • I wasn't able to get the controller to be recognized until I did this.
  • Now it's time to start the zsnes configuration tool
    • If you have a GUI (other than XBMC) installed, use that to execute /usr/bin/zsnes, otherwise you will need to use the Advance Launcher for this as well
      • Go to the Programs menu, Advanced Launcher, and click Default, then add a standalone type launcher for /usr/bin/zsnes. For the choices that follow, make sure to remove the default arguments, the others don't really matter
      • Open the context menu for the new item and select Edit Launcher -> Advanced Modifications -> Toggle XBMC into Windowed Mode and set it to "On"
  • Open zsnes (whichever method you use)
    • Under Config -> Video, you can set the resolution
      • I wasn't able to get 1080p working so I had to settle for 720p
      • There are also a lot of teaks that you can do to the video settings, but I haven't touched them so far
    • Under Config -> Input you can setup your controller. As long as it has been detected, once you clock "Set Keys" you just press whatever key it asks you to and it works
  • We need some games to play as well of course.
    • How you get them is none of my business, but once you do, place them in a folder somewhere on you drive
    • Copy you game ROMs to the folder you created
    • Create a sub-folder names "Images" or "Art", or really anything you like. This is where the thumbnails and fanart will be placed
  • At this point you might want to make some configurations for Advanced Launcher, under Settings -> Addons, such as what scraper to use and so forth, since they are not enabled by default and changing them seems to remove the launcher for the games that we are about to add
  • Create a new launcher in Advanced Launcher, this time a "File Launcher" type
    • Name it whatever you want, in my case "SNES" (not much imagination, I know)
    • Select the executable as /usr/bin/zsnes
    • Set the path to the ROMs to wherever you placed them
    • The file types are zip|smc|sfc, this was the default value for me
    • The arguments should be -m -s -v 22 %rom%, again this was default for me
    • Select the "Super Nintendo Entertainment System" as the type
    • Select the "Images" folder (or whatever you chose to call it) for thumbnails and fanart
  • For this launcher also, go to the context menu for the new item and select Edit Launcher -> Advanced Modifications -> Toggle XBMC into Windowed Mode and set it to "On"
  • Now go to the context menu again, select Add Items -> Scan For New Items and it should find you games (do this again when you add new games)
  • You may have some problems getting the audio to work (I did)
    • Give the command aplay -l, and remember the card and device that you want to use.
    • Check the home directory for whatever user runs XBMC (in my case the default xbmc user, which has home directory /var/lib/xbmc) for the file .asoundrc. If it exists, make a backup first. Them create/edit it to read (with the numbers on the line pcm "hw:0,3" being the card and device number from above):
pcm.dmixer {
   type dmix
   ipc_key 1024
   ipc_key_add_uid false
   ipc_perm 0660
   slave {
      pcm "hw:0,3"
      rate 48000
      channels 2
      format S32_LE
      period_time 0
      period_size 1024
      buffer_time 0
      buffer_size 4096
   }
}

pcm.!default {
   type plug
   slave.pcm "dmixer"
}
    • Reboot the HTPC
    • Start zsnes with the correct audio settings
      • zsnes -ad sdl
      • If you system is like mine, you will need to reboot again at this point, since the screen will go black.
  • Now try playing a game, here's hoping it works. 
The whole "Toggle XBMC into Windowed Mode" feature seems to be a little bit buggy. If you start a game and the screen just stays black, try attaching a keyboard and pressing "\", that is the switch between windowed mode and full screen mode. The same advice applies if, after shutting down a game (done with "ESC") you get a non-fullscreen version of XBMC. For me, I made sure that I have both "ESC" and "\" mapped on my remote just in case.

Edit: If you get a black screen after playing for a little while, Follow this guide to fix it.

Wednesday, July 3, 2013

Installing a new HDD on Arch Linux

I decided to add some more storage to my HTPC, so I got a 2TB WD Green HDD, and this is what I did to install and configure it.

The hardware installation is the same as any hard drive, just mount it and add cables for power and SATA. In my case it's a little bit tight, I'd like to change out the power supply for a modular one, but I haven't been able to find one that is short enough to fit in the case yet.


Before
After













Anyway, now that the HDd is in place, it's time to set it up so that it is usable.

  • First find the device name of the new HDD
    • ls /dev
      • In my case it is "sdb"
  • Now the disk needs to be partitioned, I just need the one partition for the whole disk
    • fdisk sdb
    • o (creates a new, empty partition table)
    • n (create a new partition, in my case the default options are fine so I just hit enter for all of them)
    • p (shows the partition that has been created, just to make sure it looks ok)
    • w (write the partition table to disk and exit)
  • If we again check the devices with "ls /dev" we see that there is now a new device called sdb1, this is the new partition
  • Now that the partition exists, we can format it, I'll use the ext4 filesystem
    • mkfs -t ext4 /dev/sdb1
  • I also prefer to give it a name, in this case "storage"
    • e2label /dev/sdb1 storage
  • Next I want to add the new partition to fstab, so that it is automounted in future
    • Create a directory to mount it to
      • mkdir /media/storage
    • Find the UUID of the partition
      • blkid (Response as below)
      • /dev/sda3: LABEL="home" UUID="d0e114fa-b428-4605-851d-504c86c0e7ac" TYPE="ext4"
        /dev/sda5: UUID="21ecefbb-1c9d-48fa-a5f3-c9ba9a09b547" TYPE="swap"
        /dev/sda6: LABEL="root" UUID="fb22b964-b38f-42df-bded-d9ac6df54ec5" TYPE="ext4"
        /dev/sdb1: LABEL="storage" UUID="5d003827-efca-4dfe-955d-bbec787a454a" TYPE="ext4"
    • Now we just need to add it to fstab, so open /etc/fstab and add the line
      • UUID=5d003827-efca-4dfe-955d-bbec787a454a       /media/storage    ext4            defaults        0 2
Now, unfortunately I didn't really set up the system for additional HDD's from the start. The partition of the 1st HDD that is used for storage is mounted as /home, which works quite well, but I can't mount additional ones in the same spot now can I.

Originally, I planned to solve this by mounting it in /media/storage, and then create a symlink to that from my home folder. This led to me finding out about a bug/feature of samba, which is how I usually access the media from my "normal" computer. Samba always reports the remaining space of the root drive so even though it is a separate drive, the file browser thinks of it as only one, and with the remaining space of the first one. So it seems that Samba does not agree with more than one partition on the same share. The only way around it, that I could find, was simply to create a second share.

Since I'm the only user, I set up samba in such a way as to get full permission, for all users, for the files. This is my share configuration in /etc/samba/smb.conf:
[XBMC2]
    comment = XBMC media 2
    path = /media/storage
    public = yes
    browseable = yes
    force user = <username>
    force group = <groupname>
    force create mode = 777
    force directory mode = 777
    available = yes
    writable = yes

And that's it, the new HDD is up and running.

Tuesday, June 25, 2013

Linux Mint 15 - Cinnamon


I was a big fan of Linux Mint back when I first started using Linux, but for the last few years I've been trying various distros, trying to find "the best". Since then, I've found the "classic" desktop a little bit boring, but a few days ago I decided to go back, and it's almost like I never left (in a good way).

In my opinion, Linux Mint has always had two main strengths, stability and usability, and that still holds true with this, the latest incarnation. 

Being based on Ubuntu, it inherits that solid base. It then adds on the Cinnamon window manager, which is smooth, not too hard on the eyes, and easy to work with.

I haven't really used Cinnamon a lot before, but this latest version is really nice. It shows that there is a reason that the "classic" desktop was the way it was for such a long time, but at the same time it combines it with some of the nicer features from the more innovative window managers. I'm thinking specifically about the use of "hot corner" to select active window and workspace, which I really like.

Basically, this is an operating system that you can put in front of just about anyone, and they will be able to use it. There is nothing difficult, or even tricky, it just works. 


Sunday, June 16, 2013

Script for changing name and/or numbering of anime files

I have an HTPC running XBMC, and I like anime, which tends to lead to a problem (very much a luxury problem, but still).

Anime series often have files that use absolute numbering, ie just an episode number, they are not divided into seasons. The problem is that the scrapers used by XBMC are not able to handle this, since their sources do use the "normal" season & episode format.

Now if a show is just 10 or 20 episodes, this is a minor inconvenience, just rename the files and it's done. If the show has 40 or 50 episodes, it's a bit more of an inconvenience. But if the show has a large number of episodes, it's a real pain. I remember renaming the show "Bleach" (which is a quite popular anime) in this way, it has 366 episodes (not counting the specials), and let me tell you, it was not particularly entertaining.

So in order to avoid this in future, I decided to make a bash script capable of handling this. Yes, I know, I could have done it as a full on program, with a GUI, but I felt like learning more about bash scripting and regular expressions.

Anyway, here it is. If you want to use it, just copy-paste it to a textfile (I named it chNamNum), then make the file executable using "chmod u+x chNamNum" in terminal. To execute the script, open terminal, go to the folder you saved the script in, and enter "./chNamNum <path to the folder the files are in>". The script will then ask questions about what you want to change in the filename:
  • Do you want to change the name of the show? (y/n)
    • Please enter the new name of the show
  • Do you want to keep the name part after the episode#? (y/n)
  • Do you want to change the numbering from absolute to seasons&episodes? (y/n)
    • Please enter the number of seasons
    • How many episodes are there in season <x>
The last one is repeated for each of the number of seasons specified.

Now, I can't really cover all eventualities of how the filename is formatted beforehand, so there are some limitations to the script. It assumes that the filename is something along the lines of "name01description.mkv". It can handle quite a few variations, but the important thing for it to work is that the first numbers in the filename is the episode number. So if the name of the show you want to use it on contains a number, I'm afraid you are out of luck (though you could adapt the script specifically for that pattern).

Tuesday, June 4, 2013

BankID with card reader on Ubuntu 13.04 64-bit

I had a fair bit of problems getting this to work, so here is how I did it.

There is a lot of good information on the Ubuntu wiki for Nexus Personal, but since it tries to encompass everything, I find it a little difficult to follow.

The card reader that I have is a Digipass 920, so if you are using something else, you may need to change out the driver for the one appropriate for you device.

Do keep in mind that the BankID application will not be automatically updated. If you need to update to a new version you'll have to download and install it again as described below.
  • Get the BankID application from https://install.bankid.com/Download?defaultFileId=Linux (the website blocks 64-bit Linux from the "regular" download procedure, so if you're downloading from that you need to use this direct link)
  • Unzip the application
  • Open a terminal and go to the directory that you unzipped the application to, and type in the following command (Please note that the version number will change):
    • sudo ./install.4.19.0.11351.sh i
  • Open Synaptic Package Manager and install the needed packages (Synaptic is not installed by default in Ubuntu these days, so if you don't already have it, install it from Ubuntu Software Center):
    • ia32-libs - Needed to run 32-bit programs
    • pkcs11-data - Needed for Firefox to be able to read the certificate file
    • pcscd (NOTE: Make sure that it is the 32-bit version! Easiest is to select "Architecture" on the bottom left, and then "arch:i386" on the top left, then type in "pcscd" in the Quick filter) - Driver for the Digipass
      • Edit: I notice that on Linux Mint, there is no option to filter by architecture in Synaptic, the name of the package you need is pcscd:i386. Either reboot and filter by name in Synaptic or use the terminal command: sudo apt-get install pcscd:i386
    • nspluginwrapper - Needed for Firefox to be able to use the 32-bit plugin
  • Go back to the terminal and give the following command:
    • sudo nspluginwrapper -i /usr/local/lib/personal/libplugins.so
  • Check that the plugin has been registerd by nspluginwrapper
    • nspluginwrapper -l
    • The output should be something like this:
       /home/user/.mozilla/plugins/npwrapper.libplugins.so
         Original plugin: /usr/lib/xulrunner-addons/plugins/libplugins.so
         Wrapper version string: 1.1.2
  • Start/restart Firefox, go to Tools -> Addons and check that you can see Nexus Personal under Plugins
  • Give it a try, it should now work
Edit: I've tried this on Ubuntu, Linux Mint and Pear OS so far, and it's worked on all of them.