diff --git a/README.md b/README.md index 06efe1a..8722dd9 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,38 @@ # mptv MPV front-end for IPTV channels to use on Raspberry Pi. -Uses [PiIR](https://github.com/ts1/PiIR) for reading TV remote IR signals \ No newline at end of file +Convert Your Raspberry Pi into IPTV receiver. Anything that MPV can play. + +## Stack + +Java Swing application that crawls and parses M3U playlists, displaying them in graphical menu and opening them in MPV. +Reads IR commands from any TV remote, controlling menu, opening and managing MPV player state. + +Example configuration ```config.json.example```, rename to ```config.json```. Take look and configure the way You like it. May have multiple IR bind sets, so You can switch between them with ```currentBindSet``` variable. Use ```piir dump``` to dump IR commands from Your TV remote. + +Uses [PiIR](https://github.com/ts1/PiIR) for reading TV remote IR signals +```pigpio``` must be present in system, and its daemon ```pigpiod``` must be running. Enable it with ```sudo systemctl enable pigpiod``` + +Recommended to use Xorg and PulseAudio. PulseAudio default sink must be set to HDMI output. + +Some configurations files could be found in linux folder to ease Your setup. + +## Configuration +The configuration is a JSON file ```config.json``` + +- ```frame``` - GUI window parameters. Note that ```fullscreen`` may not work well in Xorg. +- ```db``` - DB configuration. Only supports SQLite. +- ```piir``` - PiIR configuration. You must provide path to piir executable in ```exec``` field. ```gpio``` corresponds to GPIO pin. +Note that You must have pigpiod service running. Enable it with ```sudo systemctl enable pigpiod``` +```bindSet``` decribes binds for each remote, select current remote bind set with ```currentBindSet``` field. For bind explanation refer to ```config.json.example``` +- ```sources``` - Here You write Your M3U playlist sources. May be either local file or remote URL. Take look at ```config.json.example``` +- ```tasks``` - Adjust here intervals for each task to be executed. If You experience frequent MPV restarts, You may want to adjust ```processService``` to 2 second interval. ```crawler``` task will be executed at 24 hour interval. + +### Recommended IR connection to GPIO +![](assets/rpi-ir.webp) + +## Photos + +![](assets/pic1.webp) + +![](assets/pic2.webp) \ No newline at end of file diff --git a/assets/pic1.webp b/assets/pic1.webp new file mode 100644 index 0000000..72e7636 Binary files /dev/null and b/assets/pic1.webp differ diff --git a/assets/pic2.webp b/assets/pic2.webp new file mode 100644 index 0000000..14b4156 Binary files /dev/null and b/assets/pic2.webp differ diff --git a/assets/rpi-ir.webp b/assets/rpi-ir.webp new file mode 100644 index 0000000..2d8b8cb Binary files /dev/null and b/assets/rpi-ir.webp differ diff --git a/config.json.example b/config.json.example index db4e225..2e392d3 100644 --- a/config.json.example +++ b/config.json.example @@ -16,33 +16,41 @@ "piir": { "exec": "/home/iptv/.local/bin/piir", "gpio": 17, - "binds": [ - { - "data": "45 03", - "menuAction": "up" - }, - { - "data": "45 5E", - "menuAction": "down" - }, - { - "data": "45 02", - "menuAction": "left" - }, - { - "data": "45 40", - "menuAction": "right" - }, - { - "data": "45 5F", - "menuAction": "open" - }, - { - "preData": "45 BA", - "data": "60", - "menuAction": "close" - } - ] + "currentBindSet": "gi", + "bindSet": { + "gi": [ + { + "preData": "45 BA", + "data": "03", + "menuAction": "up" + }, + { + "preData": "45 BA", + "data": "5E", + "menuAction": "down" + }, + { + "preData": "45 BA", + "data": "02", + "menuAction": "left" + }, + { + "preData": "45 BA", + "data": "40", + "menuAction": "right" + }, + { + "preData": "45 BA", + "data": "5F", + "menuAction": "open" + }, + { + "preData": "45 BA", + "data": "60", + "menuAction": "close" + } + ] + } }, "sources": [ diff --git a/linux/.profile b/linux/.profile new file mode 100644 index 0000000..4484e77 --- /dev/null +++ b/linux/.profile @@ -0,0 +1,30 @@ +# ~/.profile: executed by the command interpreter for login shells. +# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login +# exists. +# see /usr/share/doc/bash/examples/startup-files for examples. +# the files are located in the bash-doc package. + +# the default umask is set in /etc/profile; for setting the umask +# for ssh logins, install and configure the libpam-umask package. +#umask 022 + +# if running bash +if [ -n "$BASH_VERSION" ]; then + # include .bashrc if it exists + if [ -f "$HOME/.bashrc" ]; then + . "$HOME/.bashrc" + fi +fi + +# set PATH so it includes user's private bin if it exists +if [ -d "$HOME/bin" ] ; then + PATH="$HOME/bin:$PATH" +fi + +# set PATH so it includes user's private bin if it exists +if [ -d "$HOME/.local/bin" ] ; then + PATH="$HOME/.local/bin:$PATH" +fi + +# start X with MPTV +startx -- -nocursor diff --git a/linux/.xinitrc b/linux/.xinitrc new file mode 100755 index 0000000..06552f1 --- /dev/null +++ b/linux/.xinitrc @@ -0,0 +1,13 @@ +#!/bin/sh + +# /etc/X11/xinit/xinitrc +# +# global xinitrc file, used by all X sessions started by xinit (startx) + +# invoke global X session script +#. /etc/X11/Xsession + +# MPTV +# unclutter to remove cursor pointer appearing on screen +unclutter -idle 0 & +/home/iptv/mptv/mptv.sh diff --git a/linux/xorg.conf b/linux/xorg.conf new file mode 100644 index 0000000..9a808ef --- /dev/null +++ b/linux/xorg.conf @@ -0,0 +1,27 @@ +Section "Monitor" + Identifier "Monitor0" + Option "PreferredMode" "auto" +EndSection + +Section "Screen" + Identifier "Screen0" + Monitor "Monitor0" + Device "Device0" + DefaultDepth 24 + SubSection "Display" + Depth 24 + Modes "auto" + EndSubSection +EndSection + +Section "Device" + Identifier "Device0" + Driver "modesetting" + Option "PrimaryGPU" "true" +EndSection + +Section "ServerLayout" + Identifier "Main Layout" + Screen 0 "Screen0" 0 0 + Option "BlankTime" "0" +EndSection