Difference between revisions of "XBMC"

From Amahi Wiki
Jump to: navigation, search
(Added mysql usage with xbmc)
Line 42: Line 42:
 
     mv /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname  -r)-nouveau.img
 
     mv /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname  -r)-nouveau.img
 
     dracut /boot/initramfs-$(uname -r).img $(uname -r)
 
     dracut /boot/initramfs-$(uname -r).img $(uname -r)
 +
 +
=== Setup XBMC to use MySQL ===
 +
'''Note''' Before using this create an export of the all the media you have imported/scanned/etc. We'll be importing it when we're done.
 +
 +
First we need to create a user and 2 databases which will hold the indexed media (video and music):
 +
 +
Log into the MySQL core using the root account (it will ask you for the password)
 +
{{Code|mysql -uroot -p}}
 +
 +
Create the user "xbmc"
 +
{{Code|CREATE USER 'xbmc' IDENTIFIED BY 'xbmc';}}
 +
 +
Create the databases "xbmc_video" and "xbmc_music"
 +
{{Code|CREATE database xbmc_video;
 +
CREATE database xbmc_music;}}
 +
 +
Grant the user "xbmc" access to these databases
 +
{{Code|GRANT ALL ON xbmc_music.* TO 'xbmc'@'localhost' identified by 'xbmc';
 +
GRANT ALL ON xbmc_video.* TO 'xbmc'@'localhost' identified by 'xbmc';}}
 +
 +
Make sure the MySQL knows the changes made
 +
{{Code|flush privileges;}}
 +
 +
Now to have XMBC make use of the MySQL databases:
 +
 +
{{Code|cat > /home/xbmcuser/.xbmc/userdata/advancedsettings.xml << 'EOF'
 +
<advancedsettings>
 +
  <videodatabase>
 +
    <type>mysql</type>
 +
    <host>localhost</host>
 +
    <port>3306</port>
 +
    <user>xbmc</user>
 +
    <pass>xbmc</pass>
 +
    <name>xbmc_video</name>
 +
  </videodatabase>
 +
 +
  <musicdatabase>
 +
    <type>mysql</type>
 +
    <host>localhost</host>
 +
    <port>3306</port>
 +
    <user>xbmc</user>
 +
    <pass>xbmc</pass>
 +
    <name>xbmc_music</name>
 +
  </musicdatabase>
 +
</advancedsettings>
 +
EOF}}
 +
 +
Done! Restart XBMC to enable the new settings.
 +
Import the media export you have made before implementing this.
  
 
=== Setup autologin for the xbmcuser ===
 
=== Setup autologin for the xbmcuser ===

Revision as of 22:58, 25 January 2011

This was mainly tested on a fairly basic test system, HP a282n, 2gb ram, 40gb hd, nvidia mx-440 8xAGP using the Fedora 12 based, 32bit Amahi express cd.

Initial system setup with Gnome

  1. Install Amahi (via express cd)
  2. Once you get a login prompt, login as admin/admin
   su -
   yum -y groupinstall "GNOME Desktop Environment"
   yum -y install Xorg

Adding XBMC to the system

  1. From another pc, open the hda webpage http://hda, and add the user xbmcuser:xbmcuser and check to enable admin[I haven't tried doing this without admin yet on the xbmcuser account]
  2. Go to the webapps section on the hda page http://hda/setup?sub=available&tab=app and add rpmfusion and rpmfusion nonfree in the web apps secion
  3. Back to the console
   yum -y install xbmc
  1. XBMC also needs an addition to the Xorg server, otherwise it crashes every time you run it.
   yum -y install xorg-x11-utils

Required for nvidia driver

   yum -y install kernel-devel
   yum -y install kernel-headers
   yum -y install kernel
   yum -y install gcc

Obtaining and installing the driver

Download the nvidia driver, in my case, I used used the links text based web browser, however this method is a bit tricky, I would suggest you do not disable the nouveau driver and use 'yum -y install firefox' and goto the nvidia web page, skipping this section and saving it for later. I also needed the older 96.xx driver because I was using an older video card.

   yum -y install links
   links www.nvidia.com 
   chmod +x nvidiadrivername

You may have to reboot after disabling the nouveau driver before installing the driver

   ./nvidiadrivername

Removing the nouveau driver completely

This line will add rdblacklist=nouveau to the kernel line in grub.conf

   sed -i '/root=/s|$| rdblacklist=nouveau|' /boot/grub/grub.conf

Add blacklist nouveau to /etc/modprobe.d/blacklist, I'm sure there is a sed command for this, will get to it later, I used this next command and added it manually.

   nano /etc/modprobe.d/blacklist.conf

If the nouveau driver still causes problems

This line failed for me, so I rebooted and logged back in, then it worked fine. maybe the nouveau has to be disabled before it's possible to remove it. also, this is the section I suggest you skip if you were unable to download the proper driver using links.

   yum erase xorg-x11-drv-nouveau
   mv /lib/modules/$(uname -r)/kernel/drivers/gpu/drm/nouveau/nouveau.ko /lib/modules/$(uname -r)/kernel/drivers/gpu/drm/nouveau/nouveau.txt
   mv /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname  -r)-nouveau.img
   dracut /boot/initramfs-$(uname -r).img $(uname -r)

Setup XBMC to use MySQL

Note Before using this create an export of the all the media you have imported/scanned/etc. We'll be importing it when we're done.

First we need to create a user and 2 databases which will hold the indexed media (video and music):

Log into the MySQL core using the root account (it will ask you for the password)

bash code
​mysql -uroot -p​


Create the user "xbmc"

bash code
​CREATE USER 'xbmc' IDENTIFIED BY 'xbmc';


Create the databases "xbmc_video" and "xbmc_music"

bash code
​CREATE database xbmc_video; CREATE database xbmc_music;


Grant the user "xbmc" access to these databases

bash code
​GRANT ALL ON xbmc_music.* TO 'xbmc'@'localhost' identified by 'xbmc'; GRANT ALL ON xbmc_video.* TO 'xbmc'@'localhost' identified by 'xbmc';


Make sure the MySQL knows the changes made

bash code
​flush privileges;


Now to have XMBC make use of the MySQL databases:

bash code
​cat > /home/xbmcuser/.xbmc/userdata/advancedsettings.xml << 'EOF' <advancedsettings> <videodatabase> <type>mysql</type> <host>localhost</host> <port>3306</port> <user>xbmc</user> <pass>xbmc</pass> <name>xbmc_video</name> </videodatabase> <musicdatabase> <type>mysql</type> <host>localhost</host> <port>3306</port> <user>xbmc</user> <pass>xbmc</pass> <name>xbmc_music</name> </musicdatabase> </advancedsettings> EOF


Done! Restart XBMC to enable the new settings. Import the media export you have made before implementing this.

Setup autologin for the xbmcuser

   cat >> /etc/gdm/custom.conf <<EOF
   [daemon]
   TimedLoginEnable=true
   TimedLogin=xbmcuser
   TimedLoginDelay=5
   EOF

Change initial runlevel to 5

This is what tells Amahi to boot into X instead of console.

   sed -i 's/^id:3:/id:5:/' /etc/inittab

Add xbmc to X startup

   echo xinit /usr/bin/xbmc >/home/xbmcuser/xbmcstartup
   chmod a+x /home/xbmcuser/xbmcstartup
   chown xbmcuser:users /home/xbmcuser/xbmcstartup

Now just reboot, it should come up to the normal desktop. Log out of the system using the top left button, then hit escape a few times to cancel the auto login. Now click on xbmcuser, then at the bottom of the screen it has "sessions", select xbmc instead of gnome, then type in your xmbcuser password and click login.

You're done. The next time you reboot, it should come right back up in xbmc.

A Few Suggestions

  1. Install the DLNA server, it works perfectly with any movies you put in the movies share, photos you put in the pictures share, and any music in the music folder. I've heard mention that mkv files might not work with dlna, but I have not verified this.
  2. If you have a noisy server, remember you don't have to have the pc in the same room as the TV, I don't and it works great, or put the server in a closet or something on the other side of the wall and run a cable to the back of the tv.
  3. Setup VNC on your Amahi server, it really is nice to have remote control of xbmc, I don't ever actually try to watch movies through vnc, but It's a great remote until we get the webserver working

Troubleshooting

If you lose video, try hitting CTRL+ALT+F2, CTRL+ALT+backspace, or ssh into the amahi server and change /etc/inittab back to runlevel 3.

One file that can easily make or break your video, is /etc/X11/xorg.conf and one of the most common things to have to edit is the vertical refresh, or the resolution lines. for instance my tv doesn't like 1600x1200, and every time I did this how-to on this particular pc, I had to remove the 1600x1200 from the xorg.conf before it would work right, but this is not going to happen to everyone.

Xbmc-logo.png

Xbmc-ss.png