Moode Forum
Add Clear/Add option - Printable Version

+- Moode Forum (https://moodeaudio.org/forum)
+-- Forum: moOde audio player (https://moodeaudio.org/forum/forumdisplay.php?fid=3)
+--- Forum: Feature requests (https://moodeaudio.org/forum/forumdisplay.php?fid=8)
+--- Thread: Add Clear/Add option (/showthread.php?tid=3410)

Pages: 1 2


RE: Add Clear/Add option - Stephanowicz - 02-12-2021

(02-11-2021, 10:06 PM)Tim Curtis Wrote: If the Queue is not checked first then duplicates accumulate in the Queue each time an album or track is added, played, etc it doesn't take too long before you have 100's of duplicates. Very messy...

Well - I just tested it... it's already like that  Big Grin 
- not with the 'play next' option, but with all the others I'm able to clutter it with duplicates...so,hmm...
for a huge playlist it's a nice idea to search the pl for the selected title - but this assumes, that it is a 'static' list for the whole day (maybe like for a restaurant ) - one that shouldn't be changed

Whatever - by testing I realized that it's not the 'play next' but the 'add next' option that I was looking for   Big Grin


RE: Add Clear/Add option - Stephanowicz - 02-12-2021

Actually it's already implemented in moode.php but not in the context menu...  Smile

So, for a single item it's simply adding


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

to

Code:
<div id="context-menu-folder-item" class="context-menu">
 <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_item_next"><i class="fal fa-plus-circle sx"></i> Add next</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="track_info_folder"><i class="fal fa-music sx"></i> Track info</a></li>
 </ul>
</div>

in the indextpl.html

The same for adding a folder is not properly working with the actual script - it adds the first song and puts the rest at the end - but this should be easily fixed...


RE: Add Clear/Add option - Stephanowicz - 02-14-2021

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;