XBMC

From Network Security Wiki


Kodi Shortcuts

Kodi/XBMC Shortcuts

Feature Shorcut Key
Audio delay control A
Play P
Stop X
Rewind (2x, 4x) R
Fast forward F
Rewind 30s
Forward 30s
Seek forward 10min, Next track
Step back 10min, Previous track
Variable seek backwards Ctrl+←
Variable seek forward Ctrl+→
Move subtitles up Ctrl+↑
Move subtitles down Ctrl+↓
Toggle Subtitles T
Previous Menu or Home Screen Esc
Volume Down, Volume Up, Mute + plus, – minus, F8
Shut down Menu S
Pause / Play Space bar / P
Zoom / Aspect Ratio Z
Add to Queue Q
Page up PageUp
Page down PageDown
Jump to that time in playback 1+2+3+4+Enter will jump to 12 min 34s
Jump backward in amount of time 1+0+← will jump back 10 seconds
Jump forward in amount of time 1+0+→ will jump forward 10 seconds
Jump to that letter in a list Shift + Letter
Zoom Picture Level 1-9 Picture View
Next Picture . period Picture View
Previous Picture , comma Picture View
Zoom In, Zoom Out + plus, – minus Picture View
Toggle Watched W
  • Video Information Shortcuts:
O
Ctrl + Shift + O



OpenELEC Dual Boot on PC

How to dual boot(actually Triple boot) OpenELEC with Ubuntu and Windows.

  • OpenELEC itself requires at least 2 partitions.
  • Create the first partition, EXT4
  • Label it 'OE_SYSTEM', size 512MB to 1GB.
  • The OE_SYSTEM partition must be flagged as bootable.
  • Both operating system files, SYSTEM and KERNEL, must be placed into the OE_SYSTEM partition (assume /dev/sda6)
  • Create the second partition, EXT4
  • Label it 'OE_DATA', size.
  • Here all local OpenELEC/XBMC data will be placed, such as databases and thumbnails (assume /dev/sda7)
  • Write down the linux drive letters & update the below file with it
  • Unlike Grub, Grub2 starts partition counting from 1 not 0.
  • Now update Grub2:
sudo gedit /etc/grub.d/40_custom
#!/bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.
#
menuentry "OpenELEC" {
   search --set=root --label OE_SYSTEM --hint hd0,msdos6
   linux /KERNEL boot=LABEL=OE_SYSTEM disk=LABEL=OE_DATA quiet
}
menuentry "OpenELEC debugging" {
   search --set=root --label OE_SYSTEM --hint hd0,msdos6
   linux /KERNEL boot=LABEL=OE_SYSTEM disk=LABEL=OE_DATA debugging
}

Now finalize the grub menu additions:

sudo update-grub



LibreElec Shutdown Button

Source: libreelec.tv, lowpowerlab.com, libreelec.tv

  • Install Raspberry Pi Tools from libreELEC UI:
Program ---> Get more ... ---> Raspberry Pi Tools ---> install
  • Create shutdown script:
nano /storage/.config/shutdown_pi.py
#!/bin/python  
import RPi.GPIO as GPIO  
import time  
import os
import sys

sys.path.append("/storage/.kodi/addons/virtual.rpi-tools/lib")

# Use the Broadcom SOC Pin numbers  
# Setup the Pin with Internal pullups enabled and PIN in reading mode.
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)  
GPIO.setup(3, GPIO.IN, pull_up_down = GPIO.PUD_UP)  

# Our function on what to do when the button is pressed  
def Shutdown(channel):  
  os.system("poweroff")  

# Add our function to execute when the button pressed event happens  
GPIO.add_event_detect(3, GPIO.FALLING, callback = Shutdown, bouncetime = 2000)  

# Now wait!  
while 1:  
  time.sleep(1)
  • Create Autostart Script:
nano /storage/.config/autostart.sh
#!/bin/bash
(
/storage/.config/shutdown_pi.py
)&
  • Make files executable
chmod +x shutdown_pi.py 
chmod +x autostart.sh
  • Enable UART for the Status LED:
mount -o remount,rw /flash
nano /flash/config.txt
enable_uart=1
  • Reboot


OSMC

OSMC Shutdown Button

Source: discourse.osmc.tv

  • Install Raspberry Pi Tools from CLI:
sudo apt update
sudo apt install python3-pip python3-dev gcc python3-setuptools
sudo pip3 install wheel
sudo pip3 install rpi.gpio
  • Create shutdown script:
nano /home/osmc/.config/shutdown_pi.py
#!/usr/bin/python3
import RPi.GPIO as GPIO
import time
import os
import sys

sys.path.append("/storage/.kodi/addons/virtual.rpi-tools/lib")

# Use the Broadcom SOC Pin numbers
# Setup the Pin with Internal pullups enabled and PIN in reading mode.
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
GPIO.setup(3, GPIO.IN, pull_up_down = GPIO.PUD_UP)

# Our function on what to do when the button is pressed
def Shutdown(channel):
  os.system("poweroff")

# Add our function to execute when the button pressed event happens
GPIO.add_event_detect(3, GPIO.FALLING, callback = Shutdown, bouncetime = 2000)

# Now wait!
while 1:
  time.sleep(1)


  • Make files executable
sudo chmod +x shutdown_pi.py 
  • Test Script:
./home/osmc/.config/shutdown_pi.py
  • Auto Start as a Service

Create systemd service file:

sudo nano /lib/systemd/system/shutdownpi.service
[Unit]
Description = GPIO shutdown button

[Service]
Type = idle
ExecStart = /home/osmc/.config/shutdown_pi.py

[Install]
WantedBy = multi-user.target

Enable the service:

sudo systemctl enable shutdownpi

Start the service:

sudo systemctl start shutdownpi


  • Enable UART for the Status LED:
sudo nano /boot/config.txt
enable_uart=1
  • Reboot


Netflix Addon

  • Install Netflix Addon in Kodi:
https://troypoint.com/netflix-kodi/
  • If you get Cryptodome.Random missing Error [1]:
pip install pycryptodome
  • If you get Incorrect Password error [2]:
pip3 install pycryptodomex
pip3 install websocket-client

Download the NFAuthenticationKey.py file:

https://www.dropbox.com/sh/ls3veptflvneub1/AABz9Tt3EqKUb90PQXNarNxga?dl=0

Run the script and follow the instructions:

python3 NFAuthenticationKey.py

SCP the file into Kodi's home dir and enter the PIN & Password.

Patch for MPEG2 & VC1 Codecs

Source: reddit.com

Verify patching

  • Convert Binary to Hex & grep the file contents:
xxd -u start_x.elf > /tmp/start_x.elf.hex
grep '47 *E9 *33 *36 *32 *48' /tmp/start_x.elf.hex
  00b9db0: 47E9 4341 4C46 2118 47E9 3336 3248 1D18  G.CALF!.G.362H..

Method 1

  • Backup files:
cp /boot/start_x.elf /boot/start_x.elf_backup
cp /boot/start_x.elf ~/start_x.elf
cd ~
cp start_x.elf start_x.elf_backup
  • Convert \x1D\x18 -> \x1D\x1F:
perl -pne 's/\x47\xE9362H\x1D\x18/\x47\xE9362H\x1D\x1F/g' < start_x.elf_backup > start_x.elf
diff start_x.elf start_x.elf_backup              # This should show binaries are different
  • Replace the binary:
mv ~/start_x.elf /boot/start_x.elf
reboot

Method 2

  • Create script:
nano patch_codec.sh
#!/bin/bash
 
function do_patch() {
        if [ -f "/boot/${1}" ]; then
                cp "/boot/${1}" "/boot/${1}_backup"
                perl -pne 's/\x47\xE9362H\x'${2}'\x18/\x47\xE9362H\x'${2}'\x1F/g' < "/boot/${1}_backup" > "/boot/${1}"
                echo "Patched /boot/${1}..."
        fi
}
 
do_patch start.elf 3C
do_patch start_x.elf 1D
  • Execute it:
sudo chmod +x patch_codec.sh
sudo ./patch_codec.sh
sudo reboot

Check Codecs

for codec in H264 MPG2 WVC1 MPG4 MJPG WMV9; do echo -e "$codec:\t$(vcgencmd codec_enabled $codec)"; done




{{#widget:DISQUS |id=networkm |uniqid=XBMC |url=https://aman.awiki.org/wiki/XBMC }}