Difference between revisions of "Kodi"

From ArchWiki
Jump to: navigation, search
(Starting XBMC through initscripts: out of date)
(ConsoleKit Issues with Automatic Login via /etc/inittab: starting X via /etc/inittab is totally broken - you need to do a pam login)
Line 115: Line 115:
 
});</nowiki>
 
});</nowiki>
 
}}
 
}}
 
===ConsoleKit Issues with Automatic Login via /etc/inittab===
 
 
[[ConsoleKit]] is known to have problems registering a session as both local and active when logging in directly via the {{ic|/etc/inittab}} method described above.  If you would like to be able to shutdown and reboot your machine directly from XBMC while logging in via {{ic|/etc/inittab}}, perform the autologin via mingetty (note: this method requires '''mingetty''' and '''upower''' to be installed).  There are two steps involved:
 
* 1. Comment out the line {{ic|x:5:wait:login -f <YOUR_XBMC_USERNAME> </dev/tty7 &>/dev/tty7}} from above and, in the consoles section of {{ic|/etc/inittab}}, append the following:
 
{{bc|c7:2345:wait:/sbin/mingetty --autologin <YOUR_XBMC_USERNAME> tty7 linux}}
 
 
* 2. Then, in your XBMC user's {{ic|~/.bash_profile}}, include the following (in place of the {{ic|.bash_profile}} line indicated above) (source: [https://bbs.archlinux.org/viewtopic.php?pid=887022#p887022 Arch forums]):
 
{{bc|<nowiki>[[ $(tty) = "/dev/tty7" ]] && exec xinit ~/.xinitrc -- /usr/bin/X -nolisten tcp vt08 &>/dev/null</nowiki>}}
 
  
 
==Resources==
 
==Resources==
  
 
* [http://wiki.xbmc.org/index.php?title=Main_Page XBMC Wiki]: An excellent resource with much information about Arch Linux specifically (upon which the original version of this article was largely based).
 
* [http://wiki.xbmc.org/index.php?title=Main_Page XBMC Wiki]: An excellent resource with much information about Arch Linux specifically (upon which the original version of this article was largely based).

Revision as of 17:00, 24 October 2012

XBMC (formerly "Xbox Media Center") is a free, open source (GPL) multimedia player that originally ran on the first-generation XBox, (not the newer Xbox 360), and now runs on computers running Linux, Mac OS X, Windows, and iOS. XBMC can be used to play/view the most popular video, audio, and picture formats, and many more lesser-known formats, including:

  • Video - DVD-Video, VCD/SVCD, MPEG-1/2/4, DivX, XviD, Matroska
  • Audio - MP3, AAC.
  • Picture - JPG, GIF, PNG.

These can all be played directly from a CD/DVD, or from the hard-drive. XBMC can also play multimedia from a computer over a local network (LAN), or play media streams directly from the Internet. For more information, see the XBMC FAQ.

Installation

Note: These instructions assume you have a working X installation. If you have not done this yet, please consult Beginners_Guide#Graphical_User_Interface.

The stable version of XBMC is available in the community repo:

# pacman -Syu xbmc
Note: You may want to install D-Bus and upower to enable Shutdown-Suspend-Hibernate out of XBMC.

The SVN (testing) version of XBMC can be downloaded from the AUR (XBMC-git), e.g. using yaourt:

# yaourt -Syua xbmc-git
Warning: This is not the recommended way of using XBMC, as svn versions are always on the bleeding edge of development and thus can break sometimes. If you want a stable media center experience, go with the stable releases.

Configuration

Autostarting at Boot

To use XBMC on HTPC you may want to start XBMC automatically on boot. There are a different ways to accomplish this.

Setting up a service user for XBMC

To add a new user named xbmc and set a login password for it:

# useradd -m -U -G audio,video,storage,optical,power -s /bin/bash xbmc
# passwd xbmc

To use an existing user make sure you add your user (or whatever user will run xmbc on your system) to at least groups audio, video, and storage.

# for x in audio video storage; do sudo gpasswd -a $USER $x; done
Note: If you do not run Sudo, simply run the above command as root. You may also need to swap out $USER for another username if you are not logged in as the xbmc user.

Starting XBMC through systemd

Note: These instructions assume your system uses systemd as init System. Make sure to consult systemd.

If your system is setup for systemd you can also start XBMC outside any session using xinit. To install xinit:

# pacman -S xorg-xinit

Now you have to create a new service file.

/etc/systemd/system/xbmc.service
[Unit]
Description = Starts instance of XBMC using xinit
After = remote-fs.target

[Service]
User = xbmc
Type = simple
ExecStart = /usr/bin/xinit /usr/bin/xbmc-standalone -- :0

[Install]
WantedBy = multi-user.target

To activate this service at boot:

# systemctl enable xbmc.service

If you want to use the power functions through XBMC make sure to set up a polkit rule like described here.

Using a Remote

As XBMC is geared toward being a remote-controlled media center, if your computer has an IR receiver, you will probably want to set up a remote using LIRC. Once you are sure your remote is working properly (tested with $ irw), add lircd to your DAEMONS Array and you'll be ready to create an Lircmap.xml file for it.

Using your favorite text editor, you'll need to go in and create an XML file at ~/.xbmc/userdata/Lircmap.xml (note the capital 'L'). Lircmap.xml format is as follows:

<lircmap>
  <remote device="devicename">
      <XBMC_button>LIRC_button</XBMC_button>
      ...
  </remote>
</lircmap>
  • Device Name is whatever LIRC calls your remote. This is set using the Name directive in lircd.conf and can be viewed by running $ irw and pressing a few buttons on the remote. IRW will report the name of the button pressed and the name of the remote will appear on the end of the line.
  • XBMC_button is the name of the button as defined in keymap.xml.
  • LIRC_button is the name as defined in lircd.conf. If you automatically generated your lircd.conf using # irrecord, these are the names you selected for your button then. Refer back to LIRC for more information.
  • You may want to check out the very thorough Lircmap.xml page over at the XBMC Wiki for more help and information on this subject.

Fullscreen mode stretches XBMC accross multiple displays

If you have got a multi-monitor setup and don't want XBMC to stretch accross all screens, you can restrict the fullscreen mode to one display, by setting the environment variable SDL_VIDEO_FULLSCREEN_HEAD to the number of the desired target display. For example if you want XBMC to show up on display 0 you can add the following line to your Bashrc:

SDL_VIDEO_FULLSCREEN_HEAD=0

Troubleshooting

Shutdown-Suspend-Hibernate does not work

If you have problems with shutdown, suspend or hibernate within XBMC make sure your user is in the wheel group and also that the upower package is installed.

In case XBMC was configured to be started outside any session, you need to explicitely give the appropriate rights by creating a polkit rule. Create a new policy rule with the following contents (assuming xbmc as user running xbmc):

/etc/polkit-1/rules.d/50-xbmc.rules
polkit.addRule(function(action, subject) {
    if (( (action.id.indexOf("org.freedesktop.udisks.") == 0) || (action.id.indexOf("org.freedesktop.upower.")== 0) || (action.id.indexOf("org.freedesktop.consolekit.")== 0) ) &&
        subject.user=="xbmc") {
        return polkit.Result.YES;
    }
});

Resources

  • XBMC Wiki: An excellent resource with much information about Arch Linux specifically (upon which the original version of this article was largely based).