Deduplicate kodi role code, use simple file instead of org-mode code block

This commit is contained in:
Alexander Grothe 2017-11-04 15:24:09 +01:00
parent 744e8dfc4d
commit 861af36840

View File

@ -3243,712 +3243,40 @@ Problem: woher kommt der Treiber (AFAIK noch nicht im Kernel)? Die Firmware soll
** kodi ** kodi
*** tasks *** tasks
**** Install KODI **** Install KODI
#+BEGIN_SRC yaml :tangle roles/kodi/tasks/main.yml :mkdirp yes :padline no ***** main.yml
- include: install-kodi.yml tags=install,update,kodi:install :PROPERTIES:
- include: configure-kodi.yml tags=install,update,kodi:configure :UNNUMBERED: t
#+END_SRC :END:
#+BEGIN_SRC yaml :tangle roles/kodi/tasks/install-kodi.yml :mkdirp yes :padline no #+INCLUDE: "roles/kodi/tasks/main.yml" src yaml
--- ***** install-kodi.yml
#+INCLUDE: "roles/kodi/tasks/install-kodi.yml" src yaml
- name: apt | install kodi packages ***** configure-kodi.yml
apt: #+INCLUDE: "roles/kodi/tasks/configure-kodi.yml" src yaml
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
*** templates *** templates
**** kodi.service **** kodi.service
#+BEGIN_SRC conf :tangle roles/kodi/templates/kodi.service.j2 :mkdirp yes :padline no This systemd unit for the user session starts (and stops) kodi.
[Unit] #+INCLUDE: "roles/kodi/templates/kodi.service.j2" src conf
Description=Start kodi in user session
[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 *** files
Those configuration files provide a preconfiguration for kodi which overrides the system wide configuration
**** Lircmap.xml **** Lircmap.xml
#+BEGIN_SRC xml :tangle roles/kodi/files/userdata/Lircmap.xml :padline no :mkdirp yes This file allows to map keys sent by remotes via eventlircd (which uses the name ~devinput~) to kodi key names.
<lircmap> #+INCLUDE: "roles/kodi/files/userdata/Lircmap.xml" src nxml
<remote device="linux-input-layer">
<altname>cx23885_remote</altname>
<altname>devinput</altname>
<up>KEY_UP</up>
<down>KEY_DOWN</down>
<menu>KEY_MENU</menu>
<select>KEY_OK</select>
<back>KEY_ESC</back>
<left>KEY_LEFT</left>
<right>KEY_RIGHT</right>
<red>KEY_RED</red>
<green>KEY_GREEN</green>
<yellow>KEY_YELLOW</yellow>
<blue>KEY_BLUE</blue>
<zero>KEY_0</zero>
<one>KEY_1</one>
<two>KEY_2</two>
<three>KEY_3</three>
<four>KEY_4</four>
<five>KEY_5</five>
<six>KEY_6</six>
<seven>KEY_7</seven>
<eight>KEY_8</eight>
<nine>KEY_9</nine>
<info>KEY_INFO</info>
<play>KEY_PLAY</play>
<play>KEY_PLAYPAUSE</play>
<pause>KEY_PAUSE</pause>
<stop>KEY_STOP</stop>
<record>KEY_RECORD</record>
<forward>KEY_FASTFORWARD</forward>
<reverse>KEY_REWIND</reverse>
<skipplus>KEY_NEXT</skipplus>
<skipminus>KEY_BACK</skipminus>
<power>KEY_POWER2</power>
<channelplus>KEY_CHANNELUP</channelplus>
<channelminus>KEY_CHANNELDOWN</channelminus>
<title>KEY_PROG3</title>
<volumeplus>KEY_VOLUMEUP</volumeplus>
<volumeminus>KEY_VOLUMEDOWN</volumeminus>
<teletext>KEY_TEXT</teletext>
<mute>KEY_MUTE</mute>
<start>KEY_SELECT</start>
<subtitle>KEY_SUBTITLE</subtitle>
<audio>KEY_MODE</audio>
<mute>KEY_MUTE</mute>
<myvideo>KEY_VIDEO</myvideo>
<mymusic>KEY_AUDIO</mymusic>
<mypictures>KEY_IMAGES</mypictures>
<recordedtv>KEY_PVR</recordedtv>
<guide>KEY_EPG</guide>
<display>KEY_SCREEN</display>
<enter>KEY_PROG4</enter>
<playlist>KEY_ZOOM</playlist>
<livetv>KEY_CHANNEL</livetv>
<mytv>KEY_TV</mytv>
<liveradio>KEY_FN</liveradio>
</remote>
</lircmap>
#+END_SRC
**** keymaps **** keymaps
This file maps the keys defined in Lircmap.xml to actions within kodi.
***** remote.xml ***** remote.xml
#+BEGIN_SRC xml :tangle roles/kodi/files/userdata/keymaps/remote.xml :padline no :mkdirp yes #+INCLUDE: "roles/kodi/files/userdata/keymaps/remote.xml" src xml
<!-- This file contains the mapping of keys (gamepad, remote, and keyboard) to actions within XBMC -->
<!-- The <global> section is a fall through - they will only be used if the button is not -->
<!-- used in the current window's section. Note that there is only handling -->
<!-- for a single action per button at this stage. -->
<!-- For joystick/gamepad configuration under linux/win32, see below as it differs from xbox -->
<!-- gamepads. -->
<!-- The format is: -->
<!-- <device> -->
<!-- <button>action</button> -->
<!-- </device> -->
<!-- To map keys from other remotes using the RCA protocol, you may add <universalremote> blocks -->
<!-- In this case, the tags used are <obc#> where # is the original button code (OBC) of the key -->
<!-- You set it up by adding a <universalremote> block to the window or <global> section: -->
<!-- <universalremote> -->
<!-- <obc45>Stop</obc45> -->
<!-- </universalremote> -->
<!-- To find out the OBC's of your remote, try enabling the <displayremotecodes> tag in AdvancedSettings.xml -->
<!-- Note that the action can be a built-in function. -->
<!-- eg <B>XBMC.ActivateWindow(MyMusic)</B> -->
<!-- would automatically go to My Music on the press of the B button. -->
<!-- Joysticks / Gamepads: -->
<!-- See the sample PS3 controller configuration below for the format. -->
<!-- -->
<!-- Joystick Name: -->
<!-- Do 'cat /proc/bus/input/devices' or see your xbmc log file to find the names of -->
<!-- detected joysticks. The name used in the configuration should match the detected name. -->
<!-- -->
<!-- Button Ids: -->
<!-- 'id' is the button ID used by SDL. Joystick button ids of connected joysticks appear -->
<!-- in xbmc.log when they are pressed. Use your log to map custom buttons to actions. -->
<!-- -->
<!-- Axis Ids / Analog Controls -->
<!-- Coming soon. -->
<keymap>
<global>
<universalremote>
<obc150>XBMC.ejecttray()</obc150>
<obc151>Playlist</obc151>
</universalremote>
<remote>
<play>PlayPause</play>
<pause>Pause</pause>
<stop>Stop</stop>
<forward>FastForward</forward>
<reverse>Rewind</reverse>
<left>Left</left>
<right>Right</right>
<up>Up</up>
<down>Down</down>
<select>Select</select>
<pageplus>PageUp</pageplus>
<pageminus>PageDown</pageminus>
<back>ParentDir</back>
<menu>PreviousMenu</menu>
<title>ContextMenu</title>
<info>Info</info>
<skipplus>SkipNext</skipplus>
<skipminus>SkipPrevious</skipminus>
<display>FullScreen</display>
<start>PreviousMenu</start>
<record>Screenshot</record>
<volumeplus>VolumeUp</volumeplus>
<volumeminus>VolumeDown</volumeminus>
<mute>Mute</mute>
<power>XBMC.Quit()</power>
<myvideo>XBMC.ActivateWindow(MyVideos)</myvideo>
<mymusic>XBMC.ActivateWindow(MyMusic)</mymusic>
<mypictures>XBMC.ActivateWindow(MyPictures)</mypictures>
<!--- <mytv>XBMC.ActivateWindow(Home)</mytv> -->
<recordedtv>XBMC.ActivateWindowAndFocus(MyPVR, 34,0, 13,0)</recordedtv>
<!-- PVR: EPG -->
<guide>XBMC.ActivateWindowAndFocus(MyPVR, 31,0, 10,0)</guide>
<!-- PVR: Channellist -->
<livetv>XBMC.ActivateWindowAndFocus(MyPVR, 32,0, 11,0)</livetv>
<!-- PVR: Radio -->
<liveradio>XBMC.ActivateWindowAndFocus(MyPVR, 33,0, 12,0)</liveradio>
<red>XBMC.ActivateWindow(Home)</red>
<yellow>XBMC.ActivateWindow(MyVideos)</yellow>
<green>XBMC.ActivateWindow(MyMusic)</green>
<!-- <blue>XBMC.ActivateWindow(MyPictures)</blue> -->
<zero>Number0</zero>
<one>Number1</one>
<two>JumpSMS2</two>
<three>JumpSMS3</three>
<four>JumpSMS4</four>
<five>JumpSMS5</five>
<six>JumpSMS6</six>
<seven>JumpSMS7</seven>
<eight>JumpSMS8</eight>
<nine>JumpSMS9</nine>
<audio>AudioNextLanguage</audio>
<subtitle>ShowSubtitles</subtitle>
<enter>FullScreen</enter>
<blue>ContextMenu</blue>
<playlist>XBMC.ActivateWindow(MyMusicPlaylist)</playlist>
</remote>
</global>
<Home>
<remote>
<menu>XBMC.Skin.ToggleSetting(HomeViewToggle)</menu>
<info>XBMC.ActivateWindow(SystemInfo)</info>
<clear>XBMC.ActivateWindow(Weather)</clear>
<blue>XBMC.ActivateWindow(Settings)</blue>
<red>FullScreen</red>
<back>FullScreen</back>
</remote>
</Home>
<MyFiles>
<remote>
<clear>Delete</clear>
</remote>
</MyFiles>
<MyMusicPlaylist>
<remote>
<back>Playlist</back> <!-- Close playlist -->
<clear>Delete</clear>
</remote>
</MyMusicPlaylist>
<MyMusicPlaylistEditor>
<remote>
<zero>Queue</zero>
</remote>
</MyMusicPlaylistEditor>
<MyMusicFiles>
<remote>
<zero>Queue</zero>
<star>Queue</star>
<start>ContextMenu</start>
</remote>
</MyMusicFiles>
<MyMusicLibrary>
<remote>
<zero>Queue</zero>
<star>Queue</star>
</remote>
</MyMusicLibrary>
<FullscreenVideo>
<remote>
<back>FullScreen</back>
<zero>Number0</zero>
<one>Number1</one>
<two>Number2</two>
<three>Number3</three>
<four>Number4</four>
<five>Number5</five>
<six>Number6</six>
<seven>Number7</seven>
<eight>Number8</eight>
<nine>Number9</nine>
<left>Rewind</left>
<right>FastForward</right>
<up>Play</up>
<down>Pause</down>
<yellow>StepForward</yellow>
<green>StepBack</green>
<blue>CodecInfo</blue>
<menu>OSD</menu>
<start>OSD</start>
<info>XBMC.ActivateWindow(PVROSDChannels)</info>
<title>XBMC.ActivateWindow(PVROSDChannels)</title>
<display>AspectRatio</display>
<select>Info</select>
<teletext>XBMC.ActivateWindow(Teletext)</teletext>
<channelplus>SkipNext</channelplus>
<channelminus>SkipPrevious</channelminus>
<record>XBMC.PlayerControl(Record)</record>
</remote>
</FullscreenVideo>
<FullscreenInfo>
<remote>
<back>FullScreen</back>
<left>Rewind</left>
<right>FastForward</right>
<up>Play</up>
<down>Pause</down>
<yellow>StepForward</yellow>
<green>StepBack</green>
<display>AspectRatio</display>
<info>CodecInfo</info>
<select>Close</select>
<menu>OSD</menu>
</remote>
</FullscreenInfo>
<PlayerControls>
<remote>
<back>Close</back>
<menu>Close</menu>
</remote>
</PlayerControls>
<Visualisation>
<universalremote>
<obc151>XBMC.ActivateWindow(MyMusicPlaylist)</obc151>
</universalremote>
<remote>
<red>FullScreen</red>
<yellow>AnalogSeekForward</yellow>
<green>AnalogSeekBack</green>
<blue>CodecInfo</blue>
<left>Rewind</left>
<right>FastForward</right>
<pageplus>SkipNext</pageplus>
<pageminus>SkipPrevious</pageminus>
<up>Play</up>
<down>Pause</down>
<info>XBMC.ActivateWindow(PVROSDChannels)</info>
<back>XBMC.ActivateWindow(MyMusicPlaylist)</back>
<select>Info</select>
<menu>XBMC.ActivateWindow(MusicOSD)</menu>
<start>XBMC.ActivateWindow(MusicOSD)</start>
</remote>
</Visualisation>
<MusicOSD>
<remote>
<back>Close</back>
<menu>Close</menu>
<start>Close</start>
<info>CodecInfo</info>
</remote>
</MusicOSD>
<VisualisationSettings>
<remote>
<back>Close</back>
<menu>Close</menu>
</remote>
</VisualisationSettings>
<VisualisationPresetList>
<remote>
<back>Close</back>
<menu>Close</menu>
</remote>
</VisualisationPresetList>
<SlideShow>
<remote>
<zero>ZoomNormal</zero>
<one>ZoomLevel1</one>
<two>ZoomLevel2</two>
<three>ZoomLevel3</three>
<four>ZoomLevel4</four>
<five>ZoomLevel5</five>
<six>ZoomLevel6</six>
<seven>ZoomLevel7</seven>
<eight>ZoomLevel8</eight>
<nine>ZoomLevel9</nine>
<info>CodecInfo</info>
<pageplus>ZoomIn</pageplus>
<pageminus>ZoomOut</pageminus>
<select>Rotate</select>
<up>Pause</up>
<down>Play</down>
<back>PreviousMenu</back>
</remote>
</SlideShow>
<ScreenCalibration>
<remote>
<select>NextCalibration</select>
<enter>NextCalibration</enter>
<zero>ResetCalibration</zero>
<display>NextResolution</display>
<xbox>NextResolution</xbox>
</remote>
</ScreenCalibration>
<GUICalibration>
<remote>
<select>NextCalibration</select>
<enter>NextCalibration</enter>
<zero>ResetCalibration</zero>
</remote>
</GUICalibration>
<SelectDialog>
<remote>
<back>Close</back>
</remote>
</SelectDialog>
<VideoOSD>
<remote>
<back>PreviousMenu</back>
<menu>Close</menu>
<start>Close</start>
</remote>
</VideoOSD>
<VideoMenu>
<remote>
<menu>OSD</menu>
<back>PreviousMenu</back>
<info>Info</info>
<title>CodecInfo</title>
<zero>Number0</zero>
<one>Number1</one>
<two>Number2</two>
<three>Number3</three>
<four>Number4</four>
<five>Number5</five>
<six>Number6</six>
<seven>Number7</seven>
<eight>Number8</eight>
<nine>Number9</nine>
</remote>
</VideoMenu>
<OSDVideoSettings>
<remote>
<back>Close</back>
<menu>Close</menu>
<start>Close</start>
</remote>
</OSDVideoSettings>
<OSDAudioSettings>
<remote>
<back>Close</back>
<menu>Close</menu>
<start>Close</start>
</remote>
</OSDAudioSettings>
<VideoBookmarks>
<remote>
<back>Close</back>
<menu>Close</menu>
<start>Close</start>
<zero>Delete</zero>
</remote>
</VideoBookmarks>
<MyVideoLibrary>
<remote>
<zero>Queue</zero>
<clear>Delete</clear>
<green>ToggleWatched</green>
<yellow>Queue</yellow>
</remote>
</MyVideoLibrary>
<MyVideoFiles>
<remote>
<zero>Queue</zero>
<star>Queue</star>
<blue>ContextMenu</blue>
<green>ToggleWatched</green>
<yellow>Queue</yellow>
</remote>
</MyVideoFiles>
<MyPictures>
<remote>
<zero>Queue</zero>
<star>Queue</star>
<start>ContextMenu</start>
</remote>
</MyPictures>
<MyVideoPlaylist>
<remote>
<back>Playlist</back> <!-- Close playlist -->
<clear>Delete</clear>
<zero>Delete</zero>
</remote>
</MyVideoPlaylist>
<VirtualKeyboard>
<remote>
<back>BackSpace</back>
<star>Shift</star>
<hash>Symbols</hash>
<zero>Number0</zero>
<one>Number1</one>
<two>Number2</two>
<three>Number3</three>
<four>Number4</four>
<five>Number5</five>
<six>Number6</six>
<seven>Number7</seven>
<eight>Number8</eight>
<nine>Number9</nine>
<pageminus>CursorLeft</pageminus>
<pageplus>CursorRight</pageplus>
</remote>
</VirtualKeyboard>
<ContextMenu>
<remote>
<blue>Close</blue>
<back>Close</back>
</remote>
</ContextMenu>
<FileStackingDialog>
<remote>
<back>Close</back>
</remote>
</FileStackingDialog>
<Scripts>
<remote>
<info>XBMC.ActivateWindow(ScriptsDebugInfo)</info>
</remote>
</Scripts>
<ScriptsDebugInfo>
<remote>
<info>Info</info> <!-- clears debug python info -->
</remote>
</ScriptsDebugInfo>
<NumericInput>
<remote>
<zero>Number0</zero>
<one>Number1</one>
<two>Number2</two>
<three>Number3</three>
<four>Number4</four>
<five>Number5</five>
<six>Number6</six>
<seven>Number7</seven>
<eight>Number8</eight>
<nine>Number9</nine>
<back>BackSpace</back>
</remote>
</NumericInput>
<Weather>
<remote>
<back>PreviousMenu</back>
</remote>
</Weather>
<Settings>
<remote>
<back>PreviousMenu</back>
</remote>
</Settings>
<MyPicturesSettings>
<remote>
<back>PreviousMenu</back>
</remote>
</MyPicturesSettings>
<MyProgramsSettings>
<remote>
<back>PreviousMenu</back>
</remote>
</MyProgramsSettings>
<MyWeatherSettings>
<remote>
<back>PreviousMenu</back>
</remote>
</MyWeatherSettings>
<MyMusicSettings>
<remote>
<back>PreviousMenu</back>
</remote>
</MyMusicSettings>
<SystemSettings>
<remote>
<back>PreviousMenu</back>
</remote>
</SystemSettings>
<MyVideosSettings>
<remote>
<back>PreviousMenu</back>
</remote>
</MyVideosSettings>
<NetworkSettings>
<remote>
<back>PreviousMenu</back>
</remote>
</NetworkSettings>
<AppearanceSettings>
<remote>
<back>PreviousMenu</back>
</remote>
</AppearanceSettings>
<Profiles>
<remote>
<back>PreviousMenu</back>
</remote>
</Profiles>
<systeminfo>
<remote>
<back>PreviousMenu</back>
</remote>
</systeminfo>
<shutdownmenu>
<remote>
<back>PreviousMenu</back>
</remote>
</shutdownmenu>
<submenu>
<remote>
<back>PreviousMenu</back>
</remote>
</submenu>
<MusicInformation>
<remote>
<back>Close</back>
</remote>
</MusicInformation>
<MovieInformation>
<remote>
<back>Close</back>
</remote>
</MovieInformation>
<LockSettings>
<remote>
<menu>Close</menu>
<back>PreviousMenu</back>
</remote>
</LockSettings>
<ProfileSettings>
<remote>
<menu>Close</menu>
<back>PreviousMenu</back>
</remote>
</ProfileSettings>
<PictureInfo>
<remote>
<skipplus>NextPicture</skipplus>
<skipminus>PreviousPicture</skipminus>
<info>Close</info>
<back>Close</back>
</remote>
</PictureInfo>
<Teletext>
<remote>
<zero>number0</zero>
<one>number1</one>
<two>number2</two>
<three>number3</three>
<four>number4</four>
<five>number5</five>
<six>number6</six>
<seven>number7</seven>
<eight>number8</eight>
<nine>number9</nine>
<red>Red</red>
<green>Green</green>
<yellow>Yellow</yellow>
<blue>Blue</blue>
<info>Info</info>
<back>Close</back>
<menu>Close</menu>
<start>Close</start>
<teletext>Close</teletext>
</remote>
</Teletext>
<Favourites>
<remote>
<back>Close</back>
</remote>
</Favourites>
</keymap>
#+END_SRC
** dvd ** dvd
*** tasks *** tasks
**** install libdvd-pkg, allow programs to eject optical media **** install libdvd-pkg, allow programs to eject optical media
#+BEGIN_SRC yaml :tangle roles/dvd/tasks/main.yml :mkdirp yes :padline no :PROPERTIES:
--- :UNNUMBERED: t
# file: roles/dvd/tasks/main.yml :END:
#+INCLUDE: "roles/dvd/tasks/main.yml" src yaml
- 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
** template-test ** template-test
:PROPERTIES:
:EXPORT: nil
:END:
#+BEGIN_SRC yaml :tangle roles/template-test/tasks/main.yml :padline no #+BEGIN_SRC yaml :tangle roles/template-test/tasks/main.yml :padline no
--- ---