Skip to content

Commit

Permalink
merge feature: support for Recalbox PC
Browse files Browse the repository at this point in the history
update install script to detect arch
move library functions to separate file
 can also be used by 'after upgrade' script
update 'after upgrade' instructions
README applies to RasPi & PC
add manual install guide for PC
add script to assist user finding video outputs
add PC-specific config file

other changes:
make scaled video play script executable
include all docs in releases
init script: start program with python3 -m dynquee
  • Loading branch information
poppadum committed Mar 16, 2023
1 parent b2fad4b commit 012742f
Show file tree
Hide file tree
Showing 22 changed files with 745 additions and 144 deletions.
12 changes: 11 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,14 @@ BUILD
examples/
info/
scripts/
todo.md
todo.md

# ignore files copied from install/ by install scripts
xrandr_cmd.txt
startup_pc.sh

# ignore files created when testing PC install script
tests/xinitrc
tests/rc.xml
tests/rc.xml.dynquee.orig
tests/xinitrc.dynquee.orig
54 changes: 32 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,49 +46,53 @@ I wanted a solution which would be:


### How Does It Work?
On Raspberry Pi it works very like [Recalbox]'s built-in mini TFT support:
it listens to [Recalbox's MQTT broker][recalbox-mqtt] for events, and it writes media files direct to the framebuffer using `fbv2` for still images and `ffmpeg` for videos.
It works very like [Recalbox]'s built-in mini TFT support:
it listens to [Recalbox's MQTT broker][recalbox-mqtt] for events,
and displays still images or videos in response to those events.

With the Pi4's default KMS graphics driver both HDMI displays share a single framebuffer, so marquee images are also visible on the primary display for a second or two when an emulator launches or exits. While this is a bit annoying, it doesn't seem to break anything so I'll put up with it.
On PC it uses `mpv` to display media on the secondary screen.
On Raspberry Pi it writes media files direct to the framebuffer using `fbv2` for still images and `ffmpeg` for videos.

*dynquee* is mostly written in Python 3.
With the Pi4's default KMS graphics driver both HDMI displays share a single framebuffer, so marquee images are also visible on the primary display for a second or two when an emulator launches or exits. While this is a bit annoying, it doesn't seem to break anything so I put up with it.

*dynquee* is written in Python 3 with a few supporting bash scripts.


### Requirements
- [Recalbox] v8.1.1 Electron or later
- Python v3.7 or later (Recalbox 8.1.1 ships with Python v3.9.5)
- EITHER:
- one of:
- a Raspberry [Pi 4B][pi4] or [Pi 400][pi400] with a second display connected to the Pi's second HDMI port
- OR:
- a PC with dual video outputs and two displays
- a separate device with a connected display: an older Pi or [Pi Zero][pi-zero] should be ideal

I have tested *dynquee* running on a different device on the same network as the Recalbox machine.
It works fine but needs a few config file changes: see [Running *dynquee* on a different device][different-device].
It works fine but needs a few config file changes: see [Running *dynquee* on a different device][install-different-device].


### Status
*dynquee* is now pretty stable but there may still be bugs.

I've tried to minimise the risk of displaying the same image for a long period of time
because I'm concerned about [image persistence or burn-in][screen-burn-in].
While this shouldn't be too much of a problem if you're using an LCD display for your marquee,
I still recommend keeping an eye on it.
because I'm concerned about [image persistence or burn-in][screen-burn-in] (probably a habit I picked up in the 1980s).
While this shouldn't be too much of a problem if you're using a modern LCD display for your marquee, I still recommend keeping an eye on it.


### Tested Platforms
*dynquee* has been tested on:
* Recalbox on [Raspberry Pi 4B][pi4]: working
* Recalbox on PC: working
* Raspberry Pi 1 (separate device): working, but a bit too slow to be useable
*dynquee* has been tested on the following platforms:

* Running on Recalbox:
* Recalbox v8.1.1 & v9.0 on Raspberry Pi 4B: working
* Recalbox v9.0.1 on PC: working

* Running on a separate device:
* Raspberry Pi Zero: working
* Raspberry Pi 1B: working, but a bit too slow to be useable

---

## Getting Started

* To get *dynquee* running on Recalbox on Raspberry Pi 4 follow the instructions below.

* To get *dynquee* running on Recalbox on PC see [installing on Recalbox PC][install-recalbox-pc].
* To get *dynquee* running on Recalbox follow the instructions below.

* To get *dynquee* running on a different machine see [installing on a different device][install-different-device].

Expand All @@ -108,9 +112,10 @@ Follow these steps to install *dynquee* using the install script:


### Manual Installation
If you prefer to install everything manually, follow [this guide][manual-install].
If you prefer to install everything manually,
follow [this guide for Raspberry Pi][manual-install-rpi]
or [this guide for PC][manual-install-pc].

---

## Usage
Most settings can be configured in the config file [`dynquee.ini`](dynquee.ini).
Expand All @@ -126,6 +131,8 @@ If things aren't working, first check the log files in the `logs/` directory:

The logs should provide some clues as to what is wrong.

If you are having trouble getting *dynquee* to start on PC, also check the file `/tmp/dynquee_start.log`.

If you still can't get it working, post on the [Recalbox forum][recalbox-forum-commproj] and I will try to help.
Please paste your config file and debug log file on [pastebin][pastebin] and provide a link when reporting issues.

Expand All @@ -142,6 +149,7 @@ For convenience, releases include some starter images collected from various sou
Most of these are not my work: credit remains with the original authors.
See the [artwork README file][artwork-readme] for sources.

Many thanks to @toniosj for Recalbox PC testing.

## To Do
- [ ] Genre matching is very dumb: make it more useful.
Expand All @@ -160,11 +168,13 @@ This project is released under the [MIT Licence][licence].
[DV190FBM]: https://www.panelook.com/DV190FBM-NB0_BOE_19.1_LCM_overview_32860.html
[emulationstation]: https://wiki.recalbox.com/en/basic-usage/getting-started/emulationstation
[install-different-device]: doc/Running_on_separate_device.md
[install-recalbox-pc]: doc/install_on_Recalbox_PC.md
[install-recalbox-pc]: doc/manual_install_pc.md
[licence]: LICENSE.txt
[LTA149B780F]: https://www.panelook.com/LTA149B780F_Toshiba_14.9_LCM_parameter_10941.html
[manual-install]: doc/manual_install.md
[manual-install-rpi]: doc/manual_install_rpi.md
[manual-install-pc]: doc/manual_install_pc.md
[media-readme]: media/README.md
[mpv]: https://mpv.io/
[pastebin]: https://pastebin.com/
[pi4]: https://www.raspberrypi.com/products/raspberry-pi-4-model-b/
[pi400]: https://www.raspberrypi.com/products/raspberry-pi-400-unit/
Expand Down
3 changes: 1 addition & 2 deletions build/MANIFEST
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,4 @@ media/default.png
media/README.md
logs/
install/*
doc/EmulationStation_events.md
doc/Running_on_separate_device.md
doc/*
11 changes: 6 additions & 5 deletions doc/Running_on_separate_device.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@ Follow these steps to install *dynquee* using the install script:
```

1. When prompted, type the hostname or IP address of your Recalbox (default hostname: `recalbox`)
**Note**: if you supply an IP address, make sure that IP address won't change
**Note**: if you use an IP address, make sure that IP address won't change
because *dynquee* will try to connect to that IP address every time it starts.

---

## Manual Installation
If you prefer to install everything manually, follow these instructions.
They assume you are installing *dynquee* on a Raspberry Pi running Raspberry Pi OS, but should apply to any debian-like OS.
They assume you are installing *dynquee* on a Raspberry Pi running Raspberry Pi OS, but should apply to any debian-like Linux OS.


### Install Packages
Expand Down Expand Up @@ -106,7 +106,7 @@ sudo apt install python3 python3-paho-mqtt fbi ffmpeg
cd /opt/dynquee
```

1. Download the *dynquee* release and unzip it:
1. Download the latest *dynquee* release and unzip it:
```sh
sudo wget -O dynquee.zip https://github.com/poppadum/dynquee/releases/latest/download/dynquee.zip
sudo unzip dynquee.zip
Expand All @@ -117,7 +117,7 @@ sudo apt install python3 python3-paho-mqtt fbi ffmpeg

1. Copy the config file for remote running:
```sh
sudo cp install/dynquee-remote.ini ./dynquee.ini
sudo cp -f install/dynquee-remote.ini ./dynquee.ini
```


Expand Down Expand Up @@ -172,7 +172,8 @@ Recent releases of Raspberry Pi OS use [systemd][systemd] so that's what I recom

If you don't want to use `systemd`, you could add the startup command to `root`'s crontab e.g.
`@reboot /opt/dynquee/dynquee.py`
or add it to `/etc/rc.local`
or add it to `/etc/rc.local`,
but bear in mind it needs the network to be up when it starts so it can communicate with your Recalbox.

To test, reboot your marquee machine and check that *dynquee* starts automatically.

Expand Down
4 changes: 2 additions & 2 deletions doc/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ files matching those search terms.
sends another action (usually `gamelistbrowsing`) immediately after
1. The `wakeup` action causes *dynquee* to repeat the action that occurred immediately before the `sleep` event
1. The `blank` search term causes dynquee to stop processing a search rule, so you can't combine it with other search terms

1. If you want *dynquee* to ignore an action completely, comment out or remove its search rule.

## Filename Matching
Media filename matching works as follows:
Expand Down Expand Up @@ -128,7 +128,7 @@ I recommend `png` for still images, and `mp4` or `mkv` with the H.264 codec for
## Scaling Media
With default settings, still images are zoomed to fit the marquee screen but keep their original aspect ratio; videos are not resized.

If you want to scale videos to the height of the marquee, a helper script [`play_video_scaled.sh`](../play_video_scaled.sh) is provided. The comments in the config file explain how to use it. Note that the script uses the `marquee_width` & `marquee_height` settings in the config file to calculate video output size, so change those settings to match your marquee screen. Bear in mind that video scaling can tax the CPU which will leave Recalbox fewer CPU cycles available to run emulators[^cpu-usage].
If you want to scale videos to the height of the marquee, a helper script [`play_video_scaled.sh`](../play_video_scaled.sh) is provided for Raspberry Pi. The comments in the config file explain how to use it. Note that the script uses the `marquee_width` & `marquee_height` settings in the config file to calculate video output size, so change those settings to match your marquee screen. Bear in mind that video scaling can tax the CPU which will leave Recalbox fewer CPU cycles available to run emulators[^cpu-usage].

[^cpu-usage]: Here is the abbreviated output of `top` when running a scaled video at the same time as the Libretro Mame2003+ emulator on my Pi4 2GB: `ffmpeg` is using ~120% of the 400% available on a four-core CPU:

Expand Down
Loading

0 comments on commit 012742f

Please sign in to comment.