Thank you for your donation!


Add Clear/Add option
#13
Ok, for a folder it's a bit more work...

in the indextpl.html it's one line like for an item as mentioned before:


Code:
       <ul class="dropdown-menu" role="menu">
           <li><a href="#notarget" data-cmd="add_item"><i class="fal fa-plus sx"></i> Add</a></li>
           <li><a href="#notarget" data-cmd="play_item"><i class="fal fa-play sx"></i> Play</a></li>

           <li><a href="#notarget" data-cmd="add_folders_next"><i class="fal fa-plus-circle sx"></i> Add next</a></li>

           <li><a href="#notarget" data-cmd="clear_add_item"><i class="fal fa-plus-square sx"></i> Clear/Add</a></li>
           <li><a href="#notarget" data-cmd="clear_play_item"><i class="fal fa-chevron-square-right sx"></i> Clear/Play</a></li>
           <li><a href="#notarget" data-cmd="update_folder"><i class="fal fa-sync sx"></i> Update this folder</a></li>
       </ul>

In playerlib.js

function mpdDbCmd(cmd, path)  

needs to be extended:

Code:
   var cmds = [... 'add_folders_next'];

...

(~line 2061)

   else if ($(this).data('cmd') == 'add_folders_next') {
       mpdDbCmd($(this).data('cmd'), path);
       notify('add_item');
 }

in moode.php:

$playqueue_cmds = array('add_item', ... , 'add_folders_next');

(~ line 167)


Code:
case 'add_folders_next':
$status = parseStatus(getMpdStatus($sock));
$plLengthOld=$status['playlistlength'];
workerLog('moode.php: $plLengthOld: ' . $plLengthOld);
sendMpdCmd($sock, 'add "' . html_entity_decode($_POST['path']) . '"');
$resp = readMpdResp($sock);
workerLog('moode.php: $resp: ' . print_r($resp));
$status = parseStatus(getMpdStatus($sock));
$plLengthNew=$status['playlistlength'];
workerLog('moode.php: $plLengthNew: ' . $plLengthNew);
$cmds = 'move ' . $plLengthOld . ':' . $plLengthNew . ' ' . ($status['song'] + 1);
workerLog('moode.php: $cmds: ' . $cmds);
sendMpdCmd($sock, $cmds);
break;
Reply


Messages In This Thread
Add Clear/Add option - by Macdelf - 01-22-2021, 03:38 PM
RE: Add Clear/Add option - by TheOldPresbyope - 01-22-2021, 03:52 PM
RE: Add Clear/Add option - by Macdelf - 01-22-2021, 03:54 PM
RE: Add Clear/Add option - by the_bertrum - 01-22-2021, 04:05 PM
RE: Add Clear/Add option - by TheOldPresbyope - 01-22-2021, 04:15 PM
RE: Add Clear/Add option - by Tim Curtis - 01-22-2021, 04:18 PM
RE: Add Clear/Add option - by Stephanowicz - 02-09-2021, 10:03 AM
RE: Add Clear/Add option - by Tim Curtis - 02-09-2021, 01:08 PM
RE: Add Clear/Add option - by Stephanowicz - 02-11-2021, 09:40 PM
RE: Add Clear/Add option - by Tim Curtis - 02-11-2021, 10:06 PM
RE: Add Clear/Add option - by Stephanowicz - 02-12-2021, 10:27 AM
RE: Add Clear/Add option - by Stephanowicz - 02-12-2021, 03:05 PM
RE: Add Clear/Add option - by Stephanowicz - 02-14-2021, 07:46 PM

Forum Jump: