Skip to content

Commit

Permalink
Feature: Support for random wallpapers, see minor caviat in readme, b…
Browse files Browse the repository at this point in the history
…ut this is possible to program around in the future. As requested by u/ENzeRNER on reddit
  • Loading branch information
sigboe committed Feb 16, 2021
1 parent 76d8af4 commit 6550a59
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ You will find the precompiled binary in the release section here on github.

MiSTress runs on boot and checks the rss feed for news, this is really quick but not instant, after MiSTress has updated your wallpaper it will restart the menu core, which results in a small flicker one time each boot. This does not happen when you go from a core back to the menu core.

Also if you use multiple wallpapers, you lose the ability to go to random wallpaper by pressing F1 on the keyboard. This feature I can add back in but it wasn't just a few lines.

# Requirements

1. Internet
Expand All @@ -24,7 +26,7 @@ MiSTress runs on boot and checks the rss feed for news, this is really quick but
# Uninstallation

1. Run mistress from the menu core, and say yes to remove the service
2. Rename your wallpaper back from wallpaper.png to menu.png
2. Rename your wallpaper back from wallpaper.png to menu.png, or if you use the wallpaper folder, just remove the menu.png


# Compilation
Expand All @@ -42,8 +44,10 @@ pyinstaller --hidden-import=packaging.requirements --add-data="Roboto-Regular.tt

Currently I don't have any short term plans to improve this programs, as I don't have time on my hands. But some of the things that I want to do if I get more spare time soon:

- [] Improved handling of the current wallpaper wallaper file, so its easier to install and uninstall.
- [] Improve the text handling, to fix edge cases where some text isn't formatted correctly when written on the picture
- [] Add an optional options file, to override things like what RSS feed to fetch, how many posts, and maybe more
- [ ] Improved handling of the current wallpaper wallaper file, so its easier to install and uninstall.
- [ ] Improve the text handling, to fix edge cases where some text isn't formatted correctly when written on the picture
- [ ] Add an optional options file, to override things like what RSS feed to fetch, how many posts, and maybe more
- [ ] Better handling of multiple wallpapers (random wallpaper feature)
- [ ] supporr for alternate config wallpapers, and folders for random wallpapers for alternate configs.

I don't remember everything, but there is more that I wanted to do
9 changes: 7 additions & 2 deletions mistress.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
import feedparser, sys, os, argparse, locale, ssl, textwrap, time
import feedparser, sys, os, argparse, locale, ssl, textwrap, time, random
from subprocess import run, PIPE
from PIL import Image, ImageFont, ImageDraw
from dialog import Dialog
Expand Down Expand Up @@ -27,8 +27,13 @@
# Setup the rss feed
rss = feedparser.parse('https://misterfpga.org/feed.php?t=147')
feed = ''
# Pick image random png from /media/fat/wallpapers if present, if not pick /media/fat/wallpaper.png
if os.path.isdir('/media/fat/wallpapers'):
wallpapers = [os.path.join('/media/fat/wallpapers', _) for _ in os.listdir('/media/fat/wallpapers') if _.endswith(r".png")]
image = Image.open(random.choice(wallpapers)).convert('RGB')
else:
image = Image.open('/media/fat/wallpaper.png').convert('RGB')
# Settup pillow for drawing
image = Image.open('/media/fat/wallpaper.png').convert('RGB')
draw = ImageDraw.Draw(image)
font = ImageFont.truetype('./Roboto-Regular.ttf', 23)
color = "black"
Expand Down

0 comments on commit 6550a59

Please sign in to comment.