Tuesday, September 16, 2014

Sabayon radeon open-source driver

If you prefer open source drivers on your setup which became necessary after GDM issue with fglrx follow the steps below.
equo install xf86-video-ati
edit sabayon-grub
nano /etc/default/sabayon-grub
make sure the lines below are removed
console = tty1, quiet splash = **** and vga = ****
edit grub
nano /etc/default/grub
make sure nomodeset is not defined anywhere Regenerate grub.cfg
grub2-mkconfig -o /boot/grub/grub.cfg
Edit and make necessary changes on xorg.conf
nano /etc/X11/xorg.conf
add the following lines
Section "Device" VendorName "ATI" Identifier "X700OS" Driver "radeon" EndSection
Change opengl setting if not yet.
eselect opengl set xorg-x11

Monday, March 10, 2014

Crackling audio with Chrome/Chromium any build any version !

I want to say,  I can not believe this is not butter. This issue has been around for more than 3 years at least and still with the latest versions I am having the same issue over and over again. At least there is a simple but annoying solution.

Start chrome with --audio-buffer-size=2048 option. If you do not want to open terminal every time you open the browser you can add this option to the .desktop shortcut.

$ nano /usr/share/applications/google-chrome.desktop

and add the --audio-buffer-size=2048 to the Exec lines.

Exec=/usr/bin/google-chrome-stable --audio-buffer-size=2048 %U
Exec=/usr/bin/google-chrome-stable --audio-buffer-size=2048
Exec=/usr/bin/google-chrome-stable --audio-buffer-size=2048 --incognito

Do not forget to modify the file again when chrome updates. Actually it has a crackling reminder so you wont forget. I do not understand why do I hate chrome this much but still use it. Oh well ...


Remap the buttons of your remote to use with XBMC/MythTV/Media_Player

Because of the Vestel TV that I purchased, I had an airmouse lying around which I did not have any use for it until today. I decided to use it for XBMC. It turned out to be perfect.

First, test your remote mouse/keyboard/device by plugging in to the computer. If it is USB you can check through lsusb devices. As you can see below, in my case,  the dongle of the remote is recognized by the kernel.

$ lsusb
Bus 002 Device 003: ID 4853:4b66  




You can search for the device in 

$ ls /dev/input/by-id/usb-4853_4b66-event-kbd

Your connected device will probably be have a similar name. Next you need the codes of the buttons that you want to remap. For this purpose we use ir-keytable from v4l-utils package.

$ equo install v4l-utils

then try, 

$ ir-keytable -d /dev/input/by-id/usb-4853_4b66-event-kbd -t

The command above will let you to test the buttons. When you hit buttons on your remote, you will see entries similar to the lines shown below.

1394490580.520636: event type EV_MSC(0x04): scancode = 0xc0041
1394490580.520636: event type EV_KEY(0x01) key_down: KEY_ENTER(0x0001)

The scancode (highlighted as green) is what we are looking for. Write down all the scancodes and their actual purpose on the remote. If the list is long, things can get easily mixed up.

Now we want to match the scancodes with their new purposes. For example I want to assign the scancode 0xc0041 to ENTER key. Open up a file preferably named remap.keys.

$ nano remap.keys

add lines with your scancodes and some explanation for debugging purposes. 

scancode 0xc0041 = KEY_ENTER # Actually it was OK button
scancode 0xc0011 = KEY_SPACE # Actually it was P+ button

If you are looking for the word of a key you can run the command below

$ irrecord -l | grep ENTER

or you can list all keys 

$ irrecord -l

Save the file with your scancodes and it is time for magic. 

$ ir-keytable -d /dev/input/by-id/usb-4853_4b66-event-kbd --write=/path/to/remap.keys

Now you can test and enjoy your perfect remote for XBMC. You have to run this command in every boot so it would be a good idea to add it in your .bashrc.


Here is my remote.keys if you have a similar airmouse.

scancode 0xc0041 = KEY_ENTER # OK            # Select in XBMC
scancode 0xc0196 = KEY_MEDIA # WWW       # Open XBMC
scancode 0xc0040 = KEY_ESC      # MENU       # ESC
scancode 0xc009c = KEY_I             # P+              # Info
scancode 0xc00a0 = KEY_S            # SOURCE  # Shutdown Menu
scancode 0xc009d = KEY_SPACE # P-               # Play/Pause
# 0xc0224 # BACK #back is back nothing changed
# Volume buttons are not changed


Sunday, March 9, 2014

Add a custom systemd service

We will write a startup script for mt-daapd in this section. This way, the music server will start at boot and "restart itself if crashes anytime". I guess I am tarting to like systemd. Anyway here is how to do it.

First create a service.

nano /etc/systemd/system/mt-daapd.service

Copy the lines given below and make changes as necessary

[Unit]
Description=Mt-daapd service

[Service]
PIDFile=/var/run/mt-daapd.pid
ExecStart=/usr/local/sbin/mt-daapd -c /usr/local/mt-daapd-svn-1696/contrib/mt-daapd.conf -P /var/run/mt-daapd.pid

Restart=on-abort

[Install]
WantedBy=multi-user.target

We can test the service by just typing

systemctl start mt-daapd.service

Then check the status of the service

systemctl status mt-daapd.service

If everything works as it should enable it at the boot level. It just creates a symbolic link, nothing fancy.

systemctl enable mt-daapd.service

MT-DAAPD with FLAC and OGG support

Serve your music files to MAC, Windows, Linux, Android and Iphone. Basically you can listen to them from any platform . It is a great little application. We will install it with FLAC and OGG support thus we will not use the repository edition but compile it.

Dependencies 

Check the dependencies before you start

equo install dev-db/sqlite  media-libs/libid3tag media-libs/libvorbis media-libs/flac

Download, Compile, Install

Download mt-daapd

wget http://ftp.momo-i.org/pub/other/mt-daapd-svn-1696.tar.gz

or you can download from here

https://drive.google.com/file/d/0ByyLo2VHCtYpQ01ZYVF2VE5MTk0/edit?usp=sharing

then open the tar file and build

tar -xvzf mt-daapd-svn-1696.tar.gz
cd mt-daapd-svn-1696/
./configure --enable-flac --enable-ogg --enable-sqlite3
make
make install

Configuration File

Edit the configuration file

nano /usr/local/mt-daapd-svn-1696/contrib/mt-daapd.conf 

Do not forget to change database to sqlite3 and change passwords in the configuration file.

You can start the server by showing the path to the config

 /usr/local/sbin/mt-daapd -c /usr/local/mt-daapd-svn-1696/contrib/mt-daapd.conf -P /var/run/mt-daapd.pid -f

The -f in the end runs it in the foreground so you can see the errors. After clearing all the warnings and errors you can remove the -f and read my next post about writing a custom service for mt-daapd to start at boot.

You can check the web interface to check if everything works as expected.
http://localhost:3689/

Download TV shows automatically (Flexget + ShowRSS + Yahoo Pipes + Transmission)

In this tutorial, we are going to setup a  system which will download the new episodes of the shows we wanted. We will need Flexget, Transmission installed in our system and a ShowRSS and YahooPipes accounts.

Transmission

Install Transmission. For sabayon you can simply

equo install transmission-gtk 

Setup the transmission web interface. Put a username and password for the web interface and that is it. You can either start transmission as a daemon or as you login autostart. I prefer it to start when I login (to gnome) as a user and, I have autologin for the specific user. Add transmission to the gnome startup by 

"ALT+F2" -> gnome-session-properties. 

This is just a preference but daemon mode is better if you ask me. You can go either route. 

Flexget

We will start with installing Flexget. You have many directions to go at this point but I will cover only the installation without root privileges. It is almost directly from their website but in a compact way.

I assume you have python and virtualenv installed in your system.

virtualenv ~/flexget/
cd ~/flexget
bin/pip install flexget

Now create a very simple task which will download all the torrent files from the rss and put in a folder.

nano ~/.flexget/config.yml

We will generate this rss address using yahoo pipes which is I think the most useful web service I have ever seen. Just make sure that download section in this configuration is the check folder for new torrents folder of transmission. Basically we are sending all the torrent files to transmission check folder.

tasks:
  download:
    rss: http://pipes.yahoo.com/pipes/pipe.info?_id=91234400ce80xxxxxxxxxxxxxxx
    accept_all: yes
    download: /home/bla/bla/Torrent_check_folder/



Then you can run flexget as a deamon or cronjob. In this case I was using cron but the daemon mode just works. You can add the daemon to startup programs

"ALT+F2" -> gnome-session-properties. 

~/flexget/bin/flexget daemon start

ShowRss

Simple. Open up a web browser and go to 

http://showrss.karmorra.info/

open an account and select the shows you want to download. It will generate an RSS address for you that you can test if it is what you wanted. Write down your RSS address for now, we will use it with Yahoo pipes.

Yahoo Pipes

The best service I have ever seen. Basically you can do whatever you want with this service. What I do is I have multiple RSS feeds from torrent servers, I compare, search strings, combine them etc then in the end generate a filtered one link. This one link only includes the torrents I wanted at the specific quality. Use ShowRSS link in here, if you want to combine another torrent server add that as well and generate your RSS address.

Use this yahoo pipes RSS address at Flexget configuration given above.

All set. You have a full automatic torrent machine which can be controlled online.
Bon appetit.

PS. There are many ways to do this job. Someone may argue with me that this Pipes is unnecessary as flexget can combine and filter RSS too. However, flexget runs on my computer and I do not want to put stress on my guys if I can get it done free.


References
1) http://flexget.com/
2) http://www.transmissionbt.com/
3) http://showrss.karmorra.info/‎
4) http://pipes.yahoo.com

Mount USB HDD by uuid on boot automatically

To find the UUID of the external hdd

ls -lah /dev/disk/by-uuid/

You will find the UUID of the drive by that command. Then add a similar line like given below by changing the UUID of your partition to the /etc/fstab

nano /etc/fstab

UUID=4886310c-6381-4dcfe2eb4c85d /home/USER/MOUNT/LOCATION   ext3  defaults    0 0

Also to hide the icons of the mounted drives from Desktop, from dconf

org.gnome.nautilus.desktop 
uncheck "volumes_visible"