Browse Source

Merge branch 'master' of git.notice.at:redplanet/discobert

master
Andreas Demmelbauer 5 years ago
parent
commit
7e471422c8
5 changed files with 139 additions and 17 deletions
  1. +16
    -4
      README.md
  2. +58
    -2
      discobert.py
  3. +65
    -11
      lircrc
  4. BIN
     
  5. BIN
     

+ 16
- 4
README.md View File

@@ -1,13 +1,14 @@
Discobert is a multimedial toilet experience device

The Setup is pretty custom. It includes:

* Raspberry Pi 3b+
* Relay Board for switching 220V Devices
* Relay 1:
* Light Bulb
* Light Bulb
* Relay 3:
* DMX Light
* Disco Ball + Motor
* DMX Light
* Disco Ball + Motor
* PIR sensor
* Door open/closed Sensor
* IR Receiver
@@ -16,6 +17,10 @@ The Setup is pretty custom. It includes:
* A random remote
* some speakers

![Discobert Work in Progress](project-images/work-in-progress.jpg)

![Discobert Work in Progress](project-images/final.jpg)

## Install

Use Debian, install apt dependencies
@@ -34,26 +39,33 @@ cd discobert
```

configure mpd

```
sudo cp mpd.conf /etc/mpd.conf
```

configure samba share

```
sudo cp smb.conf /etc/samba/smb.conf
```

install pip modules

```
pip3 install -r requirements.txt
```

add systemd service

```
sudo cp disco.service /lib/systemd/system/disco.service
sudo systemctl daemon-reload
```

### Setting up a random remote
Use `irrecord` to create a lirc Config file and copy the generated file in `/etc/lirc/lircd.conf.d/your-remotes-name.lircd.conf`
Use `irrecord` to create a lirc Config file and copy the generated file in
`/etc/lirc/lircd.conf.d/your-remotes-name.lircd.conf`
You can find and edit the used keycodes: `~/discobert/lircrc`




+ 58
- 2
discobert.py View File

@@ -130,6 +130,20 @@ def startMusic(playlist, single=False, shuffle=True, repeat=True):
client.setvol(80)# set volume
client.play() # play

def playMusic():
try:
client.play()
except Exception:
client.connect("localhost", 6600)
client.play()

def pauseMusic():
try:
client.pause()
except Exception:
client.connect("localhost", 6600)
client.pause()

def stopMusic():
try:
client.stop()
@@ -137,6 +151,20 @@ def stopMusic():
client.connect("localhost", 6600)
client.stop()

def nextSong():
try:
client.next()
except Exception:
client.connect("localhost", 6600)
client.next()

def previousSong():
try:
client.previous()
except Exception:
client.connect("localhost", 6600)
client.previous()

def muteMusic():
global uservolume
if getMpdVolume() != 0: # if not muted
@@ -201,6 +229,13 @@ def setMpdVolume(vol):
uservolume = vol
return True

def seek(secs):
try:
client.seekcur(secs)
except Exception:
client.connect("localhost", 6600)
client.seekcur(secs)
return True

def getTrackInfo():
try:
@@ -271,6 +306,7 @@ def closeService(sleepsecs=0):
changeVolume(-5)
sleep(0.1)
stopMusic()
inUseBefore = False # Pfusch pfusch!
setMode('off')
sleep(sleepsecs)

@@ -373,7 +409,6 @@ while True:
if doorstate == 1:
if (time.time() > (starttime + 15) and inUse == True):
doorShutdown()
inUseBefore = False # Pfusch pfusch!


if pirstate == 1:
@@ -413,19 +448,40 @@ while True:
startMusic('http://185.85.29.141:8000')
if(code == "mode_play_oe1"):
startMusic('http://185.85.29.142:8000')

if(code == "mode_music_previous"):
previousSong()
if(code == "mode_music_next"):
nextSong()
if(code == "mode_music_play"):
playMusic()
if(code == "mode_music_stop"):
stopMusic()
if(code == "mode_music_mute"):
muteMusic()
if(code == "mode_music_pause"):
pauseMusic()
if(code == "mode_music_rewind"):
seek(-30)
if(code == "mode_music_back"):
seek(-5)
if(code == "mode_music_forward"):
seek(5)
if(code == "mode_music_fastforward"):
seek(30)
if(code == "mode_volume_up"):
changeVolume(5)
if(code == "mode_volume_down"):
changeVolume(-5)
if(code == "mode_music_info"):
getTrackInfo()
if(code == "mode_record"):
say("I'm sorry, I'm afraid I can't do that!")
if(code == "mode_home"):
if(code == "mode_help"):
tour()




+ 65
- 11
lircrc View File

@@ -59,52 +59,106 @@ begin
end

begin
button = KEY_HOME
button = KEY_CD
prog = disco
config = mode_home
config = mode_help
end


begin
button = KEY_RADIO
button = KEY_VCR2
prog = disco
config = mode_play_fm4
end

begin
button = KEY_SETUP
button = KEY_VCR
prog = disco
config = mode_play_oe1
end

begin
button = KEY_VIDEO
button = BTN_START
prog = disco
config = mode_disco
end

begin
button = KEY_PICTURES
button = KEY_STOP
prog = disco
config = mode_work
end

begin
button = KEY_MUSIC
button = KEY_STOPCD
prog = disco
config = mode_work
end

begin
button = KEY_RECORD
prog = disco
config = mode_music_info
end

begin
button = KEY_PAUSE
prog = disco
config = mode_music_pause
end

begin
button = KEY_PLAY
prog = disco
config = mode_music_play
end

begin
button = KEY_FORWARD
prog = disco
config = mode_music_forward
end

begin
button = KEY_POWER
button = KEY_FASTFORWARD
prog = disco
config = mode_power
config = mode_music_fastforward
end

begin
button = KEY_RECORD
button = KEY_BACK
prog = disco
config = mode_music_back
end

begin
button = KEY_REWIND
prog = disco
config = mode_music_rewind
end


begin
button = KEY_REWIND
prog = disco
config = mode_music_rewind
end

begin
button = KEY_NEXT
prog = disco
config = mode_record
config = mode_music_next
end

begin
button = KEY_PREVIOUS
prog = disco
config = mode_music_previous
end


begin
button = KEY_POWER
prog = disco
config = mode_power
end

BIN
View File


BIN
View File


Loading…
Cancel
Save