Skip to content

Commit

Permalink
Merge pull request #187 from MiczFlor/develop
Browse files Browse the repository at this point in the history
Upgrading to version 1.1.0
  • Loading branch information
MiczFlor authored Sep 10, 2018
2 parents 684da9e + 28ebcd3 commit e55c36c
Show file tree
Hide file tree
Showing 32 changed files with 1,200 additions and 226 deletions.
4 changes: 3 additions & 1 deletion docs/CONFIGURE-stretch.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ Once you finished with the configuration, read the [manual](MANUAL.md) to add au

The RFID reader is connected to your RPi via USB. As you plug it in, it should have made a 'beep'. And each time you swipe a keyring or card across the card reader, it should also make a 'beep'.

**Troubleshooting:** When you buy the RFID reader and the chips, make sure that they match. There are different standards. It happened to me that the reader made the *beep* as if it reads the card - but it didn't.
**NOTE:** if you are using **non-USB chip readers**, please take a look at these two threads for the [RDM6300 serial RFID module](https://github.com/MiczFlor/RPi-Jukebox-RFID/issues/175) and the [RC522 module](https://github.com/MiczFlor/RPi-Jukebox-RFID/issues/11). This will migrate to the docs eventually. And if you have cooked up your own solution for other devices, please share them in an [issue thread](https://github.com/MiczFlor/RPi-Jukebox-RFID/issues).

(Back to the plug'n'play USB readers)

Let's see if your reader is probably connected and recognised by your RPi. Check the following:

Expand Down
41 changes: 41 additions & 0 deletions docs/MANUAL.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,34 @@ You can do this by creating a symbolic link to the USB stick with the following
ln -s /media/usb0/* /home/pi/RPi-Jukebox-RFID/shared/audiofolders/
~~~

To make the USB stick fully accessible to the web app, too, here is what you need to do:

#### Read and write to USB via web app

Assuming your USB stick has been formatted to FAT32 (which is the common format allowing easy access in Windows and OSX), you need to install `usbmount` to mount the stick automatically.
~~~
sudo apt-get install usbmount
~~~
In Rasbian `stretch` change the config file:
~~~
sudo nano /lib/systemd/system/systemd-udevd.service
~~~
and change `MountFlags=slave` to `MountFlags=shared`.
Now you can see the USB stick under `/media/usb0`. But it is read only, not writeable. To change that, edit the config:
~~~
sudo nano /etc/usbmount/usbmount.conf
~~~
And add the following:
~~~
FS_MOUNTOPTIONS="-fstype=vfat,flush,gid=users,uid=33,umask=007,iocharset=utf8"
~~~
The problem are the access rights for the user `pi` and `www-data` (the webserver). The above line fixes this, because:

* `pi` is part of `gid=users`
* `www-data` has the `uid=33`

This is work in progress, please share more insights in the [issue section](https://github.com/MiczFlor/RPi-Jukebox-RFID/issues).

### <a name="webstreams"></a>Adding webradio station and other online streams

In short:
Expand Down Expand Up @@ -614,3 +642,16 @@ keycode 115 = F105
keycode 114 = F106
~~~
and add it to the end of the /etc/rc.local to autostart it and make sure that the pi user is loged in so that the key inputs work with raspi-config->Boot Options->Autologin Text Console

## Recoder functionality
If you are using a external sound card with micro line in, phoniebox is able to record the audio.
The recordings can be controlled with the commands STARTRECORD600 (starts recording for max 10 minutes) and STOPRECORD. A RFID card can be assigned in rfid_trigger_play.conf

~~~
STARTRECORD600 ="%STARTRECORD600%"
STOPRECORD = "%STOPRECORD%"
~~~

If a recording is already is runnig, no other recording will be started.
The recordings will be stored in the $audiofiles/Recordings, the filename contains date and time of the record start.

22 changes: 22 additions & 0 deletions docs/UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,28 @@ Some elements of the installation depend on the OS (like 'Jessie' vs. 'Stretch')

There is a file `settings/version` containing the version number.

**Note:*** This is work in progress, please share experience, improvements and insights in the [issue section](https://github.com/MiczFlor/RPi-Jukebox-RFID/issues).

# Upgrade from Version 1.0.0 to 1.1.0

This upgrade brings the web app UI for file management, recursive folder management, wifi switch off and more. The latest [one-line Phoniebox install script](INSTALL-stretch.md#oneLineInstall) contains all the necessary steps, but will treat your upgrade like a new install. Manual upgrade:
~~~
cd
cd RPi-Jukebox-RFID
git fetch
git checkout master
git pull
# settings for php.ini to support upload
# make backup
sudo cp /etc/php/7.0/fpm/php.ini /etc/php/7.0/fpm/php.ini.backup
# replace file
sudo cp /home/pi/RPi-Jukebox-RFID/misc/sampleconfigs/php.ini.stretch-default.sample /etc/php/7.0/fpm/php.ini
sudo chown root:root /etc/php/7.0/fpm/php.ini
sudo chmod 644 /etc/php/7.0/fpm/php.ini
sudo service lighttpd force-reload
sudo service php7.0-fpm restart
~~~

# Upgrade to Version 1.0

As of version 1.0 there is a much simpler install procedure: copy and paste one line into your terminal and hit *enter*. Find out more about the [one-line Phoniebox install script](INSTALL-stretch.md#oneLineInstall).
Expand Down
2 changes: 1 addition & 1 deletion htdocs/_assets/MaterialDesign-Webfont-master/css/materialdesignicons.min.css
100755 → 100644

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Binary file modified htdocs/_assets/MaterialDesign-Webfont-master/fonts/materialdesignicons-webfont.eot
100755 → 100644
Binary file not shown.
341 changes: 319 additions & 22 deletions htdocs/_assets/MaterialDesign-Webfont-master/fonts/materialdesignicons-webfont.svg
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified htdocs/_assets/MaterialDesign-Webfont-master/fonts/materialdesignicons-webfont.ttf
100755 → 100644
Binary file not shown.
Binary file modified htdocs/_assets/MaterialDesign-Webfont-master/fonts/materialdesignicons-webfont.woff
100755 → 100644
Binary file not shown.
Binary file modified htdocs/_assets/MaterialDesign-Webfont-master/fonts/materialdesignicons-webfont.woff2
100755 → 100644
Binary file not shown.
Empty file modified htdocs/_assets/MaterialDesign-Webfont-master/license.md
100755 → 100644
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
@charset "UTF-8";
/*
* jQuery File Upload UI Plugin CSS
* https://github.com/blueimp/jQuery-File-Upload
*
* Copyright 2010, Sebastian Tschan
* https://blueimp.net
*
* Licensed under the MIT license:
* https://opensource.org/licenses/MIT
*/

.fileupload-buttonbar .btn,
.fileupload-buttonbar .toggle {
margin-bottom: 5px;
}
.progress-animated .progress-bar,
.progress-animated .bar {
background: url("../img/progressbar.gif") !important;
filter: none;
}
.fileupload-process {
float: right;
display: none;
}
.fileupload-processing .fileupload-process,
.files .processing .preview {
display: block;
width: 32px;
height: 32px;
background: url("../img/loading.gif") center no-repeat;
background-size: contain;
}
.files audio,
.files video {
max-width: 300px;
}

@media (max-width: 767px) {
.fileupload-buttonbar .toggle,
.files .toggle,
.files .btn span {
display: none;
}
.files .name {
width: 80px;
word-wrap: break-word;
}
.files audio,
.files video {
max-width: 80px;
}
.files img,
.files canvas {
max-width: 100%;
}
}
37 changes: 37 additions & 0 deletions htdocs/_assets/jQuery-File-Upload-9.22.0/css/jquery.fileupload.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
@charset "UTF-8";
/*
* jQuery File Upload Plugin CSS
* https://github.com/blueimp/jQuery-File-Upload
*
* Copyright 2013, Sebastian Tschan
* https://blueimp.net
*
* Licensed under the MIT license:
* https://opensource.org/licenses/MIT
*/

.fileinput-button {
position: relative;
overflow: hidden;
display: inline-block;
}
.fileinput-button input {
position: absolute;
top: 0;
right: 0;
margin: 0;
opacity: 0;
-ms-filter: 'alpha(opacity=0)';
font-size: 200px !important;
direction: ltr;
cursor: pointer;
}

/* Fixes for IE < 8 */
@media screen\9 {
.fileinput-button input {
filter: alpha(opacity=0);
font-size: 100%;
height: 100%;
}
}
2 changes: 1 addition & 1 deletion htdocs/cardEdit.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
$exec = "rm ".$fileshortcuts."; echo '".$post['audiofolder']."' > ".$fileshortcuts."; chmod 777 ".$fileshortcuts;
exec($exec);
// success message
$messageSuccess = "<p>".$lang['cardRegisterFolder2Card']." ".$lang['globalFolder']." '".$post['streamFolderName']."' ".$lang['globalCardId']." '".$post['cardID']."'</p>";
$messageSuccess = "<p>".$lang['cardRegisterFolder2Card']." ".$lang['globalFolder']." '".$post['audiofolder']."' ".$lang['globalCardId']." '".$post['cardID']."'</p>";
}
} else {
/*
Expand Down
2 changes: 1 addition & 1 deletion htdocs/cardRegisterNew.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@
$exec = "rm ".$fileshortcuts."; echo '".$post['audiofolder']."' > ".$fileshortcuts."; chmod 777 ".$fileshortcuts;
exec($exec);
// success message
$messageSuccess = "<p>".$lang['cardRegisterFolder2Card']." ".$lang['globalFolder']." '".$post['streamFolderName']."' ".$lang['globalCardId']." '".$post['cardID']."'</p>";
$messageSuccess = "<p>".$lang['cardRegisterFolder2Card']." ".$lang['globalFolder']." '".$post['audiofolder']."' ".$lang['globalCardId']." '".$post['cardID']."'</p>";
}
} else {
/*
Expand Down
58 changes: 36 additions & 22 deletions htdocs/fileUpload.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,24 +71,24 @@
// see if we have a folder selected that exists
isset($post['folder'])
&& $post['folder'] != ""
&& file_exists($Audio_Folders_Path."/".$post['folder'])
&& is_dir($Audio_Folders_Path."/".$post['folder'])
){
// yes, a folder was selected
$messageAction .= "Will move files to folder: '".$post['folder']."'";
$moveFolder = $Audio_Folders_Path."/".$post['folder'];
&& file_exists($post['folder'])
&& is_dir($post['folder'])
){
// yes, a folder was selected
$messageAction .= "Will move files to folder: '".$post['folder']."'";
$moveFolder = $post['folder'];
} elseif(
// if not, see if we have a new folder to create
isset($post['folderNew'])
&& $post['folderNew'] != ""
&& ! file_exists($Audio_Folders_Path."/".$post['folderNew'])
){
// yes, valid new folder
$messageAction .= "Will create new folder and move files to: '".$post['folderNew']."'";
// create folder
$exec = 'sudo mkdir "'.$Audio_Folders_Path.'/'.$post['folderNew'].'"; sudo chown -R pi:www-data "'.$Audio_Folders_Path."/".$post['folderNew'].'"; sudo chmod 775 "'.$Audio_Folders_Path."/".$post['folderNew'].'"';
exec($exec);
$moveFolder = $Audio_Folders_Path."/".$post['folderNew'];
){
// yes, valid new folder
$messageAction .= "Will create new folder and move files to: '".$post['folderNew']."'";
// create folder
$exec = 'sudo mkdir "'.$Audio_Folders_Path.'/'.$post['folderNew'].'"; sudo chown -R pi:www-data "'.$Audio_Folders_Path."/".$post['folderNew'].'"; sudo chmod 775 "'.$Audio_Folders_Path."/".$post['folderNew'].'"';
exec($exec);
$moveFolder = $Audio_Folders_Path."/".$post['folderNew'];
} else {
$messageWarning .= "<p>No folder selected nor a valid new folder specified.</p>";
}
Expand All @@ -98,12 +98,11 @@
foreach($uFiles['ufile'] as $key => $values) {
$targetName = $moveFolder.'/'.$values['name'];
$exec = 'sudo mv "'.$values['tmp_name'].'" "'.$targetName.'"; sudo chown -R pi:www-data "'.$targetName.'"; sudo chmod 775 "'.$targetName.'"';
//print $exec;
exec($exec);
}
$messageSuccess = "<p>Files were successfully uploaded.</p>";
}


}

/*******************************************
Expand Down Expand Up @@ -199,9 +198,24 @@

<option value="false"><?php print $lang['cardFormYTSelectDefault']; ?></option>
<?php
// read the subfolders of $Audio_Folders_Path
$audiofolders = array_filter(glob($Audio_Folders_Path.'/*'), 'is_dir');
usort($audiofolders, 'strcasecmp');
/*
* read the subfolders of $Audio_Folders_Path
*/
$audiofolders_abs = dir_list_recursively($Audio_Folders_Path);
usort($audiofolders_abs, 'strcasecmp');
/*
* get relative paths for pulldown
*/
$audiofolders = array();
foreach($audiofolders_abs as $audiofolder){
/*
* get the relative path as value, set the absolute path as key
*/
$relpath = substr($audiofolder, strlen($Audio_Folders_Path) + 1, strlen($audiofolder));
if($relpath != "") {
$audiofolders[$audiofolder] = substr($audiofolder, strlen($Audio_Folders_Path) + 1, strlen($audiofolder));
}
}

// check if we can preselect an audiofolder if NOT a foldername was posted
if(! isset($fpost['folder'])) {
Expand All @@ -214,13 +228,13 @@
$idcounter = 0;

// go through all folders
foreach($audiofolders as $audiofolder) {
foreach($audiofolders as $keyfolder => $audiofolder) {

print " <option value='".basename($audiofolder)."'";
if(basename($audiofolder) == $post['folder']) {
print " <option value='".$keyfolder."'";
if($keyfolder == $post['folder']) {
print " selected=selected";
}
print ">".basename($audiofolder)."</option>\n";
print ">".$audiofolder."</option>\n";

}
?>
Expand Down
Loading

0 comments on commit e55c36c

Please sign in to comment.