From 2b8e992742ef7d2ab65aba8d485a681103e53a63 Mon Sep 17 00:00:00 2001 From: junior Date: Sat, 18 Apr 2020 15:28:55 -0400 Subject: [PATCH 1/4] Make the skipsong buttons not show active if the function is aborted --- minimal.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/minimal.js b/minimal.js index aef05f8..8a05c18 100755 --- a/minimal.js +++ b/minimal.js @@ -347,8 +347,8 @@ function toggleMute(callingElement, show) { function skipSong (callingElement) { callingElement.blur(); - callingElement.addClass("buttonactive"); if ( gettingJukeboxList || gettingSongList ) return false; + callingElement.addClass("buttonactive"); $.ajax({ url: 'ajax_skipsong.php', async: false, From b7d0d79ec50ba638ae3f71527529b4395e2c267d Mon Sep 17 00:00:00 2001 From: junior Date: Wed, 15 May 2024 12:36:32 -0400 Subject: [PATCH 2/4] Updates prior to switching to new Jukebox computer --- index.php | 4 ++-- minimal.js | 20 ++++++++++++++++++-- 2 files changed, 20 insertions(+), 4 deletions(-) mode change 100644 => 100755 index.php diff --git a/index.php b/index.php old mode 100644 new mode 100755 index 811dd8f..77f9c4c --- a/index.php +++ b/index.php @@ -44,7 +44,7 @@ $queues = Queue::getList();
-

+

@@ -56,7 +56,7 @@ $queues = Queue::getList();

-

+

diff --git a/minimal.js b/minimal.js index 8a05c18..93f2f80 100755 --- a/minimal.js +++ b/minimal.js @@ -21,8 +21,9 @@ $(document).ready(function() { }); $('#max_btn').click(function() { setSliderVolume(maxVolume); }); $('#min_btn').click(function() { setSliderVolume(minVolume); }); - $('#skipsong_btn').click(function() { skipSong($(this)); }); - $('#skipsong_playing_btn').click(function() { skipSong($(this)); }); + //$('#skipsong_btn').click(function() { skipSong($(this)); }); + //$('#skipsong_playing_btn').click(function() { skipSong($(this)); }); + $('.skipsong_btn').click(function() { skipSong($(this)); }); $('#dropsong_btn').click(function() { dropSong($(this)); }); $('#mute_btn').click(function() { toggleMute($(this)); }); $('#mute_playing_btn').click(function() { toggleMute($(this)); }); @@ -169,6 +170,9 @@ function toggleChristmas(callingElement) { success: function(data, stat, jqo) { callingElement.removeClass("buttonactive"); updateChristmasButton(data.christmas); + }, + error: function(jqo, stat, err) { + callingElement.removeClass("buttonactive"); } }); } @@ -341,6 +345,9 @@ function toggleMute(callingElement, show) { success: function(data, stat, jqo) { callingElement.removeClass("buttonactive"); updateMuteButton(data.muted); + }, + error: function(jqo, stat, err) { + callingElement.removeClass("buttonactive"); } }); } @@ -355,6 +362,9 @@ function skipSong (callingElement) { success: function (data, stat, jqo) { callingElement.removeClass("buttonactive"); getSongList(); + }, + error: function(jqo, stat, err) { + callingElement.removeClass("buttonactive"); } }); } @@ -368,6 +378,9 @@ function emptyJukebox (callingElement) { callingElement.removeClass("buttonactive"); getJukeboxList(); //skipSong(); + }, + error: function(jqo, stat, err) { + callingElement.removeClass("buttonactive"); } }); } @@ -382,6 +395,9 @@ function dropSong (callingElement) { success: function (data, stat, jqo) { callingElement.removeClass("buttonactive"); getSongList(); + }, + error: function(jqo, stat, err) { + callingElement.removeClass("buttonactive"); } }); } From 1b09cd404a4e7918b3cae58afbda399fc8ef75f4 Mon Sep 17 00:00:00 2001 From: junior Date: Wed, 15 May 2024 12:37:22 -0400 Subject: [PATCH 3/4] Just a utility script --- scripts/homeaudio_utils.php | 89 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 scripts/homeaudio_utils.php diff --git a/scripts/homeaudio_utils.php b/scripts/homeaudio_utils.php new file mode 100644 index 0000000..789a82b --- /dev/null +++ b/scripts/homeaudio_utils.php @@ -0,0 +1,89 @@ + 'jpg', + 'image/jpeg' => 'jpg', + 'image/png' => 'png', + 'image/gif' => 'gif' +); + +function search() { + global $globaldbh, $argv; + + $target = $argv[2]; + switch ($target) { + case "song": + case "songs": + $terms = array(); + for ( $i=3; $i 2 ) $terms[] = $argv[$i]; + } + if ( count($terms) == 0 ) { + echo "Searching requires search terms as command line parameters\n\n"; + exit(); + } + $query = "SELECT id, path, song, artist, album, title FROM songs WHERE (PATH LIKE :term1"; + for ( $i=1; $iprepare($query); + for ( $i=0; $ibindValue(":term".($i+1), "%".$terms[$i]."%", PDO::PARAM_STR); + } + $sth->execute(); + if ( $sth->rowCount() > 0 ) { + echo " ID | Path | Song | Title | Artist\n"; + echo "-------|----------------------------------------|------------------------------|---------------------------|----------------------\n"; + } + while ( $row = $sth->fetch(PDO::FETCH_ASSOC) ) { + echo str_pad(strval($row['id']), 7) . "|"; + echo " " . str_pad(substr($row['path'], 0, 37), 39) . "|"; + echo " " . str_pad(substr($row['song'], 0, 27), 29) . "|"; + echo " " . str_pad(substr($row['title'], 0, 24), 26) . "|"; + echo " " . substr($row['artist'], 0, 25) . "\n"; + } + break; + } +} + +switch ($argv[1]) { + case "search": + search(); + break; + default: + echo "Nothing to do\n"; +} +echo "\n"; + +// vim: ts=3:sw=3 From 3a3bc000fde710809353855ad81ba13d09140391 Mon Sep 17 00:00:00 2001 From: junior Date: Wed, 15 May 2024 12:38:06 -0400 Subject: [PATCH 4/4] Helper shell script to run homeaudio_utils.php --- scripts/hu | 3 +++ 1 file changed, 3 insertions(+) create mode 100755 scripts/hu diff --git a/scripts/hu b/scripts/hu new file mode 100755 index 0000000..90bf6a0 --- /dev/null +++ b/scripts/hu @@ -0,0 +1,3 @@ +#!/bin/bash + +php homeaudio_utils.php $1 $2 $3 $4 $5 $6