Bilderrahmen mit Ethernetanschluß
gibt es fast keine auf dem Markt
Mit dem Raspberry Pi ist das nun preiswert möglich
Zunächst werfen wir einen Blick auf meinen Mini Bilderrahmen
die Legomaus und der Legoara sind nicht wirklich für die Funktion notwendig
Tastatur und Maus braucht man auch nicht
Zunächst werfen wir einen Blick auf meinen Mini Bilderrahmen
die Legomaus und der Legoara sind nicht wirklich für die Funktion notwendig
Tastatur und Maus braucht man auch nicht
Vorgehensweise:
- Ramdisk erstellen
- Powermanagment abschalten
- Programm FEH installieren
- Python Script für googlemail
- Script zum laden der neuen Bilder usw.
- mail mit Bild oder mehreren Bildern als Anhang an den google Mailaccount schicken
- script ausführen
- die Bilder werden nun automatisch auf den Bildschirm gezeigt
1. Ramdisk erstellen
cat /etc/fstabproc /proc proc defaults 0 0
/dev/mmcblk0p1 /boot vfat defaults 0 2
/dev/mmcblk0p2 / ext4 defaults,noatime 0 1
tmpfs /var/log tmpfs nodev,nosuid,size=50M 0 0
tmpfs /home/pi/ram tmpfs nodev,nosuid,size=50M 0 0
/dev/mmcblk0p1 /boot vfat defaults 0 2
/dev/mmcblk0p2 / ext4 defaults,noatime 0 1
tmpfs /var/log tmpfs nodev,nosuid,size=50M 0 0
tmpfs /home/pi/ram tmpfs nodev,nosuid,size=50M 0 0
eine für die log Dateien und eine für die Bilder
2. Powermanagment abschalten
# General configuration
# Seat defaults
#
[SeatDefaults]
xserver-command=X -s 0 -dpms
cat /etc/X11/xinit/xinitrc
#!/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
xset s off # don't activate screensaver
xset -dpms # disable DPMS (Energy Star) features.
xset s noblank # don't blank the video device
3. FEH installieren
sudo apt-get install feh
4. Google Mail Account erstellen
Programm getmail.py
cat getmail.py #!/usr/bin/env python
# import smtplib
import imaplib, email
#log in and select the inbox
mail = imaplib.IMAP4_SSL('imap.gmail.com')
mail.login('loginname', 'password')
mail.select('inbox')
#get uids of all messages
result, data = mail.uid('search', None, 'ALL')
uids = data[0].split()
#read the lastest message
result, data = mail.uid('fetch', uids[-1], '(RFC822)')
m = email.message_from_string(data[0][1])
if m.get_content_maintype() == 'multipart': #multipart messages only
for part in m.walk():
#find the attachment part
if part.get_content_maintype() == 'multipart': continue
if part.get('Content-Disposition') is None: continue
#save the attachment in the program directory
filename = part.get_filename()
fp = open(filename, 'wb')
fp.write(part.get_payload(decode=True))
fp.close()
print '%s saved!' % filename
cat getmail.py #!/usr/bin/env python
# import smtplib
import imaplib, email
#log in and select the inbox
mail = imaplib.IMAP4_SSL('imap.gmail.com')
mail.login('loginname', 'password')
mail.select('inbox')
#get uids of all messages
result, data = mail.uid('search', None, 'ALL')
uids = data[0].split()
#read the lastest message
result, data = mail.uid('fetch', uids[-1], '(RFC822)')
m = email.message_from_string(data[0][1])
if m.get_content_maintype() == 'multipart': #multipart messages only
for part in m.walk():
#find the attachment part
if part.get_content_maintype() == 'multipart': continue
if part.get('Content-Disposition') is None: continue
#save the attachment in the program directory
filename = part.get_filename()
fp = open(filename, 'wb')
fp.write(part.get_payload(decode=True))
fp.close()
print '%s saved!' % filename
5. Script zum Laden aktueller Bilder aus der Mailbox
kill -sigterm `ps ax | grep "feh" | cut -d ' ' -f 2 | head -1`
sudo rm /home/pi/ram/*
cd /home/pi/ram
/home/pi/getmail.py
export DISPLAY=:0 && feh -D 5 -Z -F -x -Y /home/pi/ram &
Zunächst das Programm "feh" beenden, dann alle Bilder auf der Ramdisk löschen. neue Bilder mit "getmail.py" holen und dann das Programm "feh" wieder starten. Den Script kann man wunderbar in einen Cronjob packen.
Die Bilder kann man auch bequem der Mutti auf den Fernseher werfen, auch aus der Ferne.
Ein toller 42" Bilderrahmen haben wir uns da gebastelt. Ersetzt den Diaabend
Keine Kommentare:
Kommentar veröffentlichen