Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:MiczFlor/RPi-Jukebox-RFID into d…
Browse files Browse the repository at this point in the history
…evelop
  • Loading branch information
MiczFlor committed May 27, 2020
2 parents b457bf9 + e9668be commit 7ab0286
Show file tree
Hide file tree
Showing 8 changed files with 364 additions and 350 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ A contactless jukebox for the Raspberry Pi, playing audio files, playlists, podc

* **Gitter Community** we got ourselves a gitter community; chat us up at https://gitter.im/phoniebox

* **Phoniebox [2.0](https://github.com/MiczFlor/RPi-Jukebox-RFID/milestone/1?closed=1) released (2020-05-xx)**
* **Phoniebox [2.0](https://github.com/MiczFlor/RPi-Jukebox-RFID/milestone/1?closed=1) released (2020-05-24)**

The 2.0 release was pushed through the doors with *countless additions and great oversight* from @s-martin and *substantial input* by @ZyanKLee together alongside many other contributors (some of which in alphabetical order): @andreasbrett @BerniPi @ctietze @danielhammer @fredg02 @Groovylein @MalteHST @patrickweigelt @Piehti @SimonChelkowski @veloxidSchweiz @xn--nding-jua and starring @splitti as *the great hotfix*. [List of all contributors](https://github.com/MiczFlor/RPi-Jukebox-RFID/graphs/contributors)

Expand Down
582 changes: 300 additions & 282 deletions components/displays/HD44780-i2c/i2c_lcd.py

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion components/gpio_control/gpio_control.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /usr/bin/python3
#!/usr/bin/env python3
import configparser
import os
import logging
Expand Down
78 changes: 39 additions & 39 deletions htdocs/cardRegisterNew.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
?>
<body>
<div class="container">

<?php
include("inc.navigation.php");

Expand All @@ -46,23 +46,23 @@

if($debug == "true") {
print "file upload";
print "<pre>";
print $conf['upload_abs'];
print "<pre>";
print $conf['upload_abs'];
print "\n";
print $uploadFileType;
print $uploadFileType;
print "\n";
print "</pre>";
}
// check if csv
if($uploadFileType == "csv") {
if(move_uploaded_file($_FILES['importFileUpload']['tmp_name'], $conf['upload_abs'] . "/rfidImport.csv")) {
if(move_uploaded_file($_FILES['importFileUpload']['tmp_name'], $conf['upload_abs'] . "./rfidImport.csv")) {
$messageSuccess .= "<p>" . $lang['cardImportFileSuccessUpload'] . basename( $_FILES['importFileUpload']['name']). "</p>";
/*
* read RFID into array
*/
$rfidPostedAudio = array();
$rfidPostedCommands = array();
$fn = fopen($conf['upload_abs'] . "/rfidImport.csv","r");
$fn = fopen($conf['upload_abs'] . "./rfidImport.csv","r");
while(! feof($fn)) {
$pair = explode("\",\"", fgets($fn));
// ignore header and empty lines
Expand All @@ -83,10 +83,10 @@
}
fclose($fn);
if($debug == "true") {
print "<pre>rfidPostedCommands: \n";
print "<pre>rfidPostedCommands: \n";
print_r($rfidPostedCommands);
print "\nrfidPostedAudio: \n";
print_r($rfidPostedAudio);
print_r($rfidPostedAudio);
print "\nshortcuts: \n";
print_r($shortcuts);
print "</pre>";
Expand All @@ -97,11 +97,11 @@
*/
if($_POST['importFileDelete'] == "all" || $_POST['importFileDelete'] == "commands") {
// delete commands => create array of available commands with not array of used commands
$fillRfidArrAvailWithUsed = fillRfidArrAvailWithUsed($rfidAvailArr);
$fillRfidArrAvailWithUsed = fillRfidArrAvailWithUsed($rfidAvailArr);
if($debug == "true") {
print "<pre>delete commands - fillRfidArrAvailWithUsed:\n"; print_r($fillRfidArrAvailWithUsed); print "</pre>";
}
$messageSuccess .= $lang['cardImportFileDeleteMessageCommands'];
$messageSuccess .= $lang['cardImportFileDeleteMessageCommands'];
} else {
// keep commands
if($debug == "true") {
Expand All @@ -119,9 +119,9 @@
$result = exec($exec);
}
}
$messageSuccess .= $lang['cardImportFileDeleteMessageAudio'];
$messageSuccess .= $lang['cardImportFileDeleteMessageAudio'];
}

// which files to replace?
if($_POST['importFileOverwrite'] != "audio") {
// create commands
Expand All @@ -132,7 +132,7 @@
}
$fillRfidArrAvailWithUsed[trim($value, '%')] = $key;
}

/******************************************
* Create new conf file based on posted values
*/
Expand All @@ -145,7 +145,7 @@
exec("sed -i 's/%".$key."%/".$val."/' '../settings/rfid_trigger_play.conf'");
}
}
$messageSuccess .= $lang['cardImportFileOverwriteMessageCommands'];
$messageSuccess .= $lang['cardImportFileOverwriteMessageCommands'];
}
if($_POST['importFileOverwrite'] != "commands") {
// create audio files
Expand All @@ -154,14 +154,14 @@
exec($exec);
}
exec("chmod 777 ../shared/shortcuts/*");
$messageSuccess .= $lang['cardImportFileOverwriteMessageAudio'];
$messageSuccess .= $lang['cardImportFileOverwriteMessageAudio'];
}
} else{
$messageError .= $lang['cardImportFileErrorUpload'];
}
} else {
$messageError .= $lang['cardImportFileErrorFiletype'];
}
}
} else {
if($debug == "true") {
print "no file upload";
Expand All @@ -181,7 +181,7 @@
</a> |
<a href="#RFIDimport" class="btn xbtn-info ">
<i class='mdi mdi-plus-circle'></i> <?php print $lang['cardImportAnchorLink']; ?>
</a>
</a>
</div>
</div>
<br/>
Expand All @@ -202,7 +202,7 @@
*/
if ($messageAction == "" && $messageError == "") {
$messageAction = $lang['cardRegisterMessageDefault'].$lang['cardRegisterManualLinks'];
}
}
if(isset($messageSuccess) && $messageSuccess != "") {
print '<div class="alert alert-success">'.$messageSuccess.'<p>'.$lang['cardRegisterMessageSwipeNew'].'</p></div>';
unset($post);
Expand Down Expand Up @@ -253,8 +253,8 @@
</div><!-- /.panel-body -->

</div><!-- /.panel -->
</div><!-- /.panel-group -->
</div><!-- /.panel-group -->


<div class="panel-group">
<div class="panel panel-default">
Expand All @@ -275,7 +275,7 @@
</div><!-- /.panel-body -->

</div><!-- /.panel -->
</div><!-- /.panel-group -->
</div><!-- /.panel-group -->

<div class="panel-group">
<div class="panel panel-default">
Expand All @@ -287,21 +287,21 @@

<div class="panel-body">
<div class="row">
<div class="col-lg-12">
<div class="col-lg-12">
<form name='upload' enctype='multipart/form-data' method='post' action='<?php print $_SERVER['PHP_SELF']; ?>'>
<fieldset>
<fieldset>
<!-- Form Name -->
<!--legend><?php print $lang['']; ?></legend-->
<!-- File Upload -->
<div class="form-group">
<label class="col-md-4 control-label" for="importFileUpload"><?php print $lang['cardImportFileLabel']; ?></label>
<label class="col-md-4 control-label" for="importFileUpload"><?php print $lang['cardImportFileLabel']; ?></label>
<div class="col-md-6">
<input type="file" name="importFileUpload" id="importFileUpload"class="form-control input-md" >
<span class="help-block"> </span>
<span class="help-block"> </span>
</div>
</div>
</fieldset>
</fieldset>

<!-- Select Basic -->
<div class="form-group">
<label class="col-md-4 control-label" for="importFileOverwrite"><?php print $lang['cardImportFormOverwriteLabel']; ?></label>
Expand All @@ -311,10 +311,10 @@
<option value="commands"><?php print $lang['cardImportFormOverwriteCommands']; ?></option>
<option value="audio"><?php print $lang['cardImportFormOverwriteAudio']; ?></option>
</select>
<span class="help-block"><?php print $lang['cardImportFormOverwriteHelp']; ?></span>
</div>
</div>
<span class="help-block"><?php print $lang['cardImportFormOverwriteHelp']; ?></span>
</div>
</div>

<!-- Select Basic -->
<div class="form-group">
<label class="col-md-4 control-label" for="importFileDelete"><?php print $lang['cardImportFormDeleteLabel']; ?></label>
Expand All @@ -325,11 +325,11 @@
<option value="commands"><?php print $lang['cardImportFormDeleteCommands']; ?></option>
<option value="audio"><?php print $lang['cardImportFormDeleteAudio']; ?></option>
</select>
<span class="help-block"><?php print $lang['cardImportFormDeleteHelp']; ?></span>
</div>
<span class="help-block"><?php print $lang['cardImportFormDeleteHelp']; ?></span>
</div>
</div>


<!-- Button (Double) -->
<div class="form-group">
<label class="col-md-4 control-label" for="submit"></label>
Expand All @@ -338,15 +338,15 @@
<br clear='all'><br>
</div>
</div>

</form>
</div><!-- / .col-lg-12 -->
</div><!-- /.row -->
</div><!-- /.panel-body -->

</div><!-- /.panel -->
</div><!-- /.panel-group -->
</div><!-- /.panel-group -->

</div><!-- /.container -->

<script>
Expand All @@ -357,7 +357,7 @@
}, 1000);
});

</script>
</script>

</body>
</html>
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[Unit]
Description=Phoniebox Rotary Encoder Service
After=network.target iptables.service firewalld.service

[Service]
User=pi
Group=pi
Restart=always
WorkingDirectory=/home/pi/RPi-Jukebox-RFID
ExecStart=/home/pi/RPi-Jukebox-RFID/scripts/rotary-encoder.py

[Install]
WantedBy=multi-user.target
[Unit]
Description=Phoniebox Rotary Encoder Service
After=network.target iptables.service firewalld.service
[Service]
User=pi
Group=pi
Restart=always
WorkingDirectory=/home/pi/RPi-Jukebox-RFID
ExecStart=/home/pi/RPi-Jukebox-RFID/scripts/rotary-encoder.py
[Install]
WantedBy=multi-user.target
10 changes: 7 additions & 3 deletions scripts/Reader.py.experimental
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,13 @@ import RPi.GPIO as GPIO
import logging

from evdev import InputDevice, categorize, ecodes, list_devices
import pirc522
from py532lib.i2c import *
from py532lib.mifare import *
# Workaround: when using RC522 reader with pirc522 pkg the py532lib pkg may not be installed and vice-versa
try:
import pirc522
from py532lib.i2c import *
from py532lib.mifare import *
except ImportError:
pass

logger = logging.getLogger(__name__)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1041,7 +1041,7 @@ autohotspot() {
# adapted from https://www.raspberryconnect.com/projects/65-raspberrypi-hotspot-accesspoints/158-raspberry-pi-auto-wifi-hotspot-switch-direct-connection

# required packages
sudo apt-get install dnsmasq hostapd
${apt_get} install dnsmasq hostapd
sudo systemctl unmask hostapd
sudo systemctl disable hostapd
sudo systemctl disable dnsmasq
Expand Down
12 changes: 2 additions & 10 deletions scripts/installscripts/buster-install-default.sh
Original file line number Diff line number Diff line change
Expand Up @@ -781,14 +781,6 @@ install_main() {
sudo python3 -m pip install -q -r "${jukebox_dir}"/requirements-spotify.txt
fi

local raw_github="https://raw.githubusercontent.com/MiczFlor/RPi-Jukebox-RFID"
# I comment the following lines out for now. I think they come from splitti when he applied a hotfix in Feb 2020?
# Back then the master install script needed develop branch files. I think this is from that time...?
#sudo rm "${jukebox_dir}"/misc/sampleconfigs/phoniebox-rfid-reader.service.stretch-default.sample
#wget -P "${jukebox_dir}"/misc/sampleconfigs/ "${raw_github}"/develop/misc/sampleconfigs/phoniebox-rfid-reader.service.stretch-default.sample
#sudo rm "${jukebox_dir}"/scripts/RegisterDevice.py
#wget -P "${jukebox_dir}"/scripts/ "${raw_github}"/develop/scripts/RegisterDevice.py

# Install more required packages
echo "Installing additional Python packages..."
sudo python3 -m pip install -q -r "${jukebox_dir}"/requirements.txt
Expand All @@ -810,11 +802,11 @@ install_main() {
echo "RESTART" > "${jukebox_dir}"/settings/Second_Swipe
echo "${jukebox_dir}/playlists" > "${jukebox_dir}"/settings/Playlists_Folders_Path
echo "ON" > "${jukebox_dir}"/settings/ShowCover

# sample file for debugging with all options set to FALSE
sudo cp "${jukebox_dir}"/settings/debugLogging.conf.sample "${jukebox_dir}"/settings/debugLogging.conf
sudo chmod 777 "${jukebox_dir}"/settings/debugLogging.conf

# The new way of making the bash daemon is using the helperscripts
# creating the shortcuts and script from a CSV file.
# see scripts/helperscripts/AssignIDs4Shortcuts.php
Expand Down

0 comments on commit 7ab0286

Please sign in to comment.