Skip to content

Commit

Permalink
chore: update formatting and typo
Browse files Browse the repository at this point in the history
  • Loading branch information
AlvinSchiller committed Apr 2, 2024
1 parent fca354f commit 711d605
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion components/bluetooth-sink-switch/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ If no bluetooth device is connected, the output defaults back to speakers. After

### Limitations

This feature only works for the *Classic* Edition. Why? It relies on the mpd multiple output channels feature to switch between outputs. This is no available in mopidy, which is used in the Spotify Edition.
This feature only works for the *Classic* Edition. Why? It relies on the mpd multiple output channels feature to switch between outputs. This is not available in mopidy, which is used in the Spotify Edition.

## Installation

Expand Down
40 changes: 20 additions & 20 deletions htdocs/inc.processCheckCardEditRegister.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,27 +109,27 @@ function fillRfidArrAvailWithUsed($rfidAvailArr, $rfidUsedArr=array()) {
$messageSuccess = "";

if($post['delete'] == "delete") {
$messageAction .= "<p>The card with the ID '".$post['cardID']." has been deleted.
If you made a mistake, this is your chance to press 'Submit' to restore the card settings.
$messageAction .= "<p>The card with the ID '".$post['cardID']." has been deleted.
If you made a mistake, this is your chance to press 'Submit' to restore the card settings.
Else: Go <a href='index.php' class='mainMenu'><i class='mdi mdi-home'></i> Home</a>.</p>";
// remove $fileshortcuts to cardID file in shortcuts
$exec = "rm ".$fileshortcuts;
if($debug == "true") {
print "<pre>deleting shortcut:\n";
print $exec;
print "</pre>";
}
}
exec($exec);
} elseif($post['submit'] == "submit") {
/*
* error check
*/

// posted too little?
if(
(!isset($post['streamURL']) || !isset($post['streamType']))
&& !isset($post['audiofolder'])
&& !isset($post['YTstreamURL'])
(!isset($post['streamURL']) || !isset($post['streamType']))
&& !isset($post['audiofolder'])
&& !isset($post['YTstreamURL'])
&& !isset($post['TriggerCommand'])
) {
$messageError .= $lang['cardRegisterErrorStreamOrAudio']." (error 002)";
Expand Down Expand Up @@ -161,9 +161,9 @@ function fillRfidArrAvailWithUsed($rfidAvailArr, $rfidUsedArr=array()) {
}

// streamFolderName not given
if(
(isset($post['streamURL']) || isset($post['YTstreamURL']))
&& !isset($post['audiofolder'])
if(
(isset($post['streamURL']) || isset($post['YTstreamURL']))
&& !isset($post['audiofolder'])
&& !isset($post['audiofolderNew'])
) {
$messageError .= $lang['cardRegisterErrorSuggestFolder']." (error 006)";
Expand All @@ -172,7 +172,7 @@ function fillRfidArrAvailWithUsed($rfidAvailArr, $rfidUsedArr=array()) {
}

//wrong spotify url, convert to mopidy format
if((isset($post['streamURL']) && $post['streamType'] == "spotify") && (strpos($post['streamURL'], "https://open.spotify.com/") !== false)){
if((isset($post['streamURL']) && $post['streamType'] == "spotify") && (strpos($post['streamURL'], "https://open.spotify.com/") !== false)){
$patterns = array();
$patterns[0] = '/https\:\/\/open.spotify.com/';
$patterns[1] = '/\/(playlist|album|track|artist)\//';
Expand Down Expand Up @@ -200,15 +200,15 @@ function fillRfidArrAvailWithUsed($rfidAvailArr, $rfidUsedArr=array()) {
* Stream URL to be created
*/
// 20200512 included code from removed the old include('inc.processAddNewStream.php');

// create new folder
$streamfolder = $Audio_Folders_Path."/".$post['audiofolderNew']."/";
$exec = "mkdir -p '".$streamfolder."'";
exec($exec);
// New folder is created so we link a RFID to it. Write $post['audiofolderNew'] to cardID file in shortcuts
$exec = "rm ".$fileshortcuts."; echo '".$post['audiofolderNew']."' > ".$fileshortcuts."; chmod 777 ".$fileshortcuts;
exec($exec);

// figure out $streamfile depending on $post['streamType']
switch($post['streamType']) {
case "spotify":
Expand All @@ -223,7 +223,7 @@ function fillRfidArrAvailWithUsed($rfidAvailArr, $rfidUsedArr=array()) {
default:
$streamfile = "url.txt";
}

// write $post['streamURL'] to $streamfile and make accessible to anyone
$exec = "echo '".$post['streamURL']."' > '".$streamfolder."/".$streamfile."'; sudo chmod -R 777 '".$streamfolder."'";
exec($exec);
Expand All @@ -235,15 +235,15 @@ function fillRfidArrAvailWithUsed($rfidAvailArr, $rfidUsedArr=array()) {
* RFID triggers system commands
*/
// 20200512 included code from removed the old include('inc.processAddTriggerCommand.php');

// Replace the potential existing RFID value with the posted one
//print $post['cardID']."->".$post['TriggerCommand'];
$fillRfidArrAvailWithUsed[$post['TriggerCommand']] = $post['cardID'];

/******************************************
* Create new conf file based on posted values
*/

// copy sample file to conf file
exec("cp ../settings/rfid_trigger_play.conf.sample ../settings/rfid_trigger_play.conf; chmod 777 ../settings/rfid_trigger_play.conf");
// replace posted values in new conf file
Expand All @@ -255,13 +255,13 @@ function fillRfidArrAvailWithUsed($rfidAvailArr, $rfidUsedArr=array()) {
}
// success message
$messageSuccess = $lang['cardRegisterTriggerSuccess']." ".$post['TriggerCommand'];
}
}
elseif(isset($post['YTstreamURL'])) {
/*******************************************************
* YouTube Download
*/
// 20200512 included code from removed the old include('inc.processAddYT.php');

if(isset($post['audiofolderNew'])) {
// create new folder
$exec = "mkdir --parents '".$Audio_Folders_Path."/".$post['audiofolderNew']."'; chmod 777 '".$Audio_Folders_Path."/".$post['audiofolderNew']."'";
Expand All @@ -283,7 +283,7 @@ function fillRfidArrAvailWithUsed($rfidAvailArr, $rfidUsedArr=array()) {
exec("{ ".$exec." } > /dev/null &");
// success message
$messageSuccess = $lang['cardRegisterDownloadingYT'];
}
}
elseif(isset($post['audiofolder']) && trim($post['audiofolder']) != "false") {
/*******************************************************
* connect card with existing audio folder
Expand Down

0 comments on commit 711d605

Please sign in to comment.