From 861af36840b1d67fad70baf3b032b243937bae16 Mon Sep 17 00:00:00 2001 From: Alexander Grothe Date: Sat, 4 Nov 2017 15:24:09 +0100 Subject: [PATCH] Deduplicate kodi role code, use simple file instead of org-mode code block --- Manual.org | 718 ++--------------------------------------------------- 1 file changed, 23 insertions(+), 695 deletions(-) diff --git a/Manual.org b/Manual.org index 3791ef6..3647320 100644 --- a/Manual.org +++ b/Manual.org @@ -3243,712 +3243,40 @@ Problem: woher kommt der Treiber (AFAIK noch nicht im Kernel)? Die Firmware soll ** kodi *** tasks **** Install KODI -#+BEGIN_SRC yaml :tangle roles/kodi/tasks/main.yml :mkdirp yes :padline no -- include: install-kodi.yml tags=install,update,kodi:install -- include: configure-kodi.yml tags=install,update,kodi:configure -#+END_SRC -#+BEGIN_SRC yaml :tangle roles/kodi/tasks/install-kodi.yml :mkdirp yes :padline no ---- - -- name: apt | install kodi packages - apt: - name: '{{ item }}' - state: present - install_recommends: no - with_items: - - kodi - - kodi-pvr-vdr-vnsi - - kodi-eventclients-xbmc-send -#+END_SRC -#+BEGIN_SRC yaml :tangle roles/kodi/tasks/configure-kodi.yml :mkdirp yes :padline no -- name: create kodi.service for the user session - template: - src: 'templates/kodi.service.j2' - dest: '{{ vdr.home }}/.config/systemd/user/kodi.service' - mode: 0644 - owner: '{{ vdr.user }}' - group: '{{ vdr.group }}' - -- name: create kodi user directory - file: - dest: '{{ vdr.home }}/{{ item }}' - state: directory - owner: '{{ vdr.user }}' - group: '{{ vdr.group }}' - mode: "0775" - with_items: - - .kodi - - .kodi/userdata - - .kodi/userdata/keymaps - -- name: copy Lircmap.xml if it does not exist yet - copy: - dest: '{{ vdr.home }}/.kodi/userdata/Lircmap.xml' - src: 'files/userdata/Lircmap.xml' - owner: '{{ vdr.user }}' - group: '{{ vdr.group }}' - mode: "0664" - force: no - -- name: copy remote.xml if it does not exist yet - copy: - dest: '{{ vdr.home }}/.kodi/userdata/keymaps/remote.xml' - src: 'files/userdata/keymaps/remote.xml' - owner: '{{ vdr.user }}' - group: '{{ vdr.group }}' - mode: "0664" - force: no -# TODO: Add configuration files -#+END_SRC +***** main.yml +:PROPERTIES: +:UNNUMBERED: t +:END: +#+INCLUDE: "roles/kodi/tasks/main.yml" src yaml +***** install-kodi.yml +#+INCLUDE: "roles/kodi/tasks/install-kodi.yml" src yaml +***** configure-kodi.yml +#+INCLUDE: "roles/kodi/tasks/configure-kodi.yml" src yaml *** templates **** kodi.service -#+BEGIN_SRC conf :tangle roles/kodi/templates/kodi.service.j2 :mkdirp yes :padline no -[Unit] -Description=Start kodi in user session +This systemd unit for the user session starts (and stops) kodi. +#+INCLUDE: "roles/kodi/templates/kodi.service.j2" src conf -[Service] -Type=simple -PassEnvironment=DISPLAY XDG_RUNTIME_DIR DBUS_SESSION_BUS_ADDRESS -ExecStartPre=-/usr/bin/set-kodi-display -ExecStart=/usr/bin/kodi -l /run/lirc/lircd -ExecStop=/bin/bash -c "/usr/bin/kodi-send --action=QUIT; while /usr/bin/pgrep kodi; do sleep 1; done; sleep 1" -TimeoutStopSec=10 -SuccessExitStatus=0 127 -Restart=on-failure -#+END_SRC *** files +Those configuration files provide a preconfiguration for kodi which overrides the system wide configuration **** Lircmap.xml -#+BEGIN_SRC xml :tangle roles/kodi/files/userdata/Lircmap.xml :padline no :mkdirp yes - - - cx23885_remote - devinput - KEY_UP - KEY_DOWN - KEY_MENU - - KEY_ESC - KEY_LEFT - KEY_RIGHT - KEY_RED - KEY_GREEN - KEY_YELLOW - KEY_BLUE - KEY_0 - KEY_1 - KEY_2 - KEY_3 - KEY_4 - KEY_5 - KEY_6 - KEY_7 - KEY_8 - KEY_9 - KEY_INFO - KEY_PLAY - KEY_PLAYPAUSE - KEY_PAUSE - KEY_STOP - KEY_RECORD - KEY_FASTFORWARD - KEY_REWIND - KEY_NEXT - KEY_BACK - KEY_POWER2 - KEY_CHANNELUP - KEY_CHANNELDOWN - KEY_PROG3 - KEY_VOLUMEUP - KEY_VOLUMEDOWN - KEY_TEXT - KEY_MUTE - KEY_SELECT - KEY_SUBTITLE - - KEY_MUTE - KEY_VIDEO - KEY_AUDIO - KEY_IMAGES - KEY_PVR - KEY_EPG - KEY_SCREEN - KEY_PROG4 - KEY_ZOOM - KEY_CHANNEL - KEY_TV - KEY_FN - - -#+END_SRC +This file allows to map keys sent by remotes via eventlircd (which uses the name ~devinput~) to kodi key names. +#+INCLUDE: "roles/kodi/files/userdata/Lircmap.xml" src nxml **** keymaps +This file maps the keys defined in Lircmap.xml to actions within kodi. ***** remote.xml -#+BEGIN_SRC xml :tangle roles/kodi/files/userdata/keymaps/remote.xml :padline no :mkdirp yes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - XBMC.ejecttray() - Playlist - - - PlayPause - Pause - Stop - FastForward - Rewind - Left - Right - Up - Down - - PageUp - PageDown - ParentDir - PreviousMenu - ContextMenu - Info - SkipNext - SkipPrevious - FullScreen - PreviousMenu - Screenshot - VolumeUp - VolumeDown - Mute - XBMC.Quit() - XBMC.ActivateWindow(MyVideos) - XBMC.ActivateWindow(MyMusic) - XBMC.ActivateWindow(MyPictures) - - XBMC.ActivateWindowAndFocus(MyPVR, 34,0, 13,0) - - XBMC.ActivateWindowAndFocus(MyPVR, 31,0, 10,0) - - XBMC.ActivateWindowAndFocus(MyPVR, 32,0, 11,0) - - XBMC.ActivateWindowAndFocus(MyPVR, 33,0, 12,0) - XBMC.ActivateWindow(Home) - XBMC.ActivateWindow(MyVideos) - XBMC.ActivateWindow(MyMusic) - - Number0 - Number1 - JumpSMS2 - JumpSMS3 - JumpSMS4 - JumpSMS5 - JumpSMS6 - JumpSMS7 - JumpSMS8 - JumpSMS9 - - ShowSubtitles - FullScreen - ContextMenu - XBMC.ActivateWindow(MyMusicPlaylist) - - - - - XBMC.Skin.ToggleSetting(HomeViewToggle) - XBMC.ActivateWindow(SystemInfo) - XBMC.ActivateWindow(Weather) - XBMC.ActivateWindow(Settings) - FullScreen - FullScreen - - - - - Delete - - - - - Playlist - Delete - - - - - Queue - - - - - Queue - Queue - ContextMenu - - - - - Queue - Queue - - - - - FullScreen - Number0 - Number1 - Number2 - Number3 - Number4 - Number5 - Number6 - Number7 - Number8 - Number9 - Rewind - FastForward - Play - Pause - StepForward - StepBack - CodecInfo - OSD - OSD - XBMC.ActivateWindow(PVROSDChannels) - XBMC.ActivateWindow(PVROSDChannels) - AspectRatio - - XBMC.ActivateWindow(Teletext) - SkipNext - SkipPrevious - XBMC.PlayerControl(Record) - - - - - FullScreen - Rewind - FastForward - Play - Pause - StepForward - StepBack - AspectRatio - CodecInfo - - OSD - - - - - Close - Close - - - - - XBMC.ActivateWindow(MyMusicPlaylist) - - - FullScreen - AnalogSeekForward - AnalogSeekBack - CodecInfo - Rewind - FastForward - SkipNext - SkipPrevious - Play - Pause - XBMC.ActivateWindow(PVROSDChannels) - XBMC.ActivateWindow(MyMusicPlaylist) - - XBMC.ActivateWindow(MusicOSD) - XBMC.ActivateWindow(MusicOSD) - - - - - Close - Close - Close - CodecInfo - - - - - Close - Close - - - - - Close - Close - - - - - ZoomNormal - ZoomLevel1 - ZoomLevel2 - ZoomLevel3 - ZoomLevel4 - ZoomLevel5 - ZoomLevel6 - ZoomLevel7 - ZoomLevel8 - ZoomLevel9 - CodecInfo - ZoomIn - ZoomOut - - Pause - Play - PreviousMenu - - - - - - NextCalibration - ResetCalibration - NextResolution - NextResolution - - - - - - NextCalibration - ResetCalibration - - - - - Close - - - - - PreviousMenu - Close - Close - - - - - OSD - PreviousMenu - Info - CodecInfo - Number0 - Number1 - Number2 - Number3 - Number4 - Number5 - Number6 - Number7 - Number8 - Number9 - - - - - Close - Close - Close - - - - - Close - Close - Close - - - - - Close - Close - Close - Delete - - - - - Queue - Delete - ToggleWatched - Queue - - - - - Queue - Queue - ContextMenu - ToggleWatched - Queue - - - - - Queue - Queue - ContextMenu - - - - - Playlist - Delete - Delete - - - - - BackSpace - Shift - Symbols - Number0 - Number1 - Number2 - Number3 - Number4 - Number5 - Number6 - Number7 - Number8 - Number9 - CursorLeft - CursorRight - - - - - Close - Close - - - - - Close - - - - - XBMC.ActivateWindow(ScriptsDebugInfo) - - - - - Info - - - - - Number0 - Number1 - Number2 - Number3 - Number4 - Number5 - Number6 - Number7 - Number8 - Number9 - BackSpace - - - - - PreviousMenu - - - - - PreviousMenu - - - - - PreviousMenu - - - - - PreviousMenu - - - - - PreviousMenu - - - - - PreviousMenu - - - - - PreviousMenu - - - - - PreviousMenu - - - - - PreviousMenu - - - - - PreviousMenu - - - - - PreviousMenu - - - - - PreviousMenu - - - - - PreviousMenu - - - - - PreviousMenu - - - - - Close - - - - - Close - - - - - Close - PreviousMenu - - - - - Close - PreviousMenu - - - - - NextPicture - PreviousPicture - Close - Close - - - - - number0 - number1 - number2 - number3 - number4 - number5 - number6 - number7 - number8 - number9 - Red - Green - Yellow - Blue - Info - Close - Close - Close - Close - - - - - Close - - - -#+END_SRC +#+INCLUDE: "roles/kodi/files/userdata/keymaps/remote.xml" src xml ** dvd *** tasks **** install libdvd-pkg, allow programs to eject optical media -#+BEGIN_SRC yaml :tangle roles/dvd/tasks/main.yml :mkdirp yes :padline no ---- -# file: roles/dvd/tasks/main.yml - -- name: preconfigure libdvd-pkg - shell: | - echo 'libdvd-pkg libdvd-pkg/post-invoke_hook-install boolean true' | debconf-set-selections - echo 'libdvd-pkg libdvd-pkg/build boolean true' | debconf-set-selections - -- name: apt | install libdvd-pkg - apt: - name: '{{ item }}' - state: present - install_recommends: no - with_items: - - libdvd-pkg - -- name: change udev rule to allow KODI to eject optical disks - shell: sed 's/--lock-media //' /lib/udev/rules.d/60-cdrom_id.rules > /etc/udev/rules.d/60-cdrom_id.rules - args: - creates: /etc/udev/rules.d/60-cdrom_id.rules -#+END_SRC +:PROPERTIES: +:UNNUMBERED: t +:END: +#+INCLUDE: "roles/dvd/tasks/main.yml" src yaml ** template-test +:PROPERTIES: +:EXPORT: nil +:END: #+BEGIN_SRC yaml :tangle roles/template-test/tasks/main.yml :padline no ---