View Full Version : remove item from GAC+ playlist?

April 10th, 2006, 12:38 PM
I have been using a button in my GAC loopindex that if clicked, removes an entry from the playlist.
I now have my playlist using GAC+ but I'm unable to find an equivalent command for 'remove'

I tried this:
NR Basic: Execute Lua Code (on release) mygacp:Action(<LoopIndex>,'REMOVE')

no workee..

April 14th, 2006, 02:51 AM
bump - anyone?

Ben S
April 14th, 2006, 06:56 AM
Does it error out or do nothing?

When you execute this (if no error), what does MediaBridge show as it's action in the log?

April 14th, 2006, 10:03 AM
Nope, no error, it just doesn't have any effect. This worked fine on my older GAC-based ccf, so I thought I could use it and modify it a bit an still use it. I'm probably not calling the correct action, therefore it does nada..

I had two very handy functions on my GAC-based ccf playlist: The buttons are part of the loopindex and appear on every item in the index.

button 1 "Play"> would allow me to select any item in the list and 'play' using:
Generic MediaBridge Command> LX PLAY {MP.PNCAlbumPath_<LoopIndex>} -1

button 2 "Del"> would allow me to delete any selected item in the playlist using:
Generic MediaBridge Command> LX REMOVE {MP.PNCAlbumPath_<LoopIndex>} -1
Execute a GAC Request> GAC {MP.PNCScheme} {MP.PNCStart} {MP.PNCCount} {MP.PNCSize} "PNC"

So I am just trying to re-create these for GAC+

April 19th, 2006, 10:04 AM
Just a bump on this- I know everyone is busy with the 2.0 release and bugs, etc. so no rush..

April 22nd, 2006, 10:45 AM
Did you get this working? I am doing it with:


But, I am executing that within a lua subroutine that gets called by button release.

April 22nd, 2006, 01:19 PM
Did you get this working? I am doing it with:


But, I am executing that within a lua subroutine that gets called by button release.

Nope, i've still been waiting for help- Thanks for the reply.

So does your method allow you to remove an individual song from the GAC+ playlist and then refresh the list to take the entry out of the list? (that's what my old method for GAC used to do)
Can you give me an example of how you are doing this so I can try it out?

April 24th, 2006, 08:54 PM
Yes, that is what I am doing. Instead of separate buttons for the songs, I use the titles ( in the portion of the playlist displayed) as buttons to display a popup with options for play, remove, move song up, move song down, and the cover art (which is also a button that can bring up a new popup with lyrics/band info).

function nrjbPNPopupRemove()
debug_print(">>REMOVE " .. nrjbGacPlaying.start .. "+" .. pnItem);

pnItem is the song that was selected to bring up the popup.
NRJB.WaitVisiblePN displays a semitransparent 'processing' overlay
nrjbGacPlaying:Request() gets the updated info
nrjbPNPopupClose() cleans up and closes the popup

April 24th, 2006, 09:07 PM
pretty cool- you are getting way more detailed than I will (since you obviously know this stuff much better than me)-
I'll be happy if I can get a simple 'remove' and 'play' button, and some of the other bugs worked out- Thanks for the examples to play with!

btw, do you have focus issues with the GAC+ 'now playing' song highlight feature? I borrowed Ben's code that makes the current song playing in the list always show a highlight color-But when I change pages the highlight color loses focus and ends up on a not-playing listed track, so it's not totally stable.

Also having issues with pre-loading the page with current now playing tracks prior to jumping to that page. Thinking of going back to GAC!

April 24th, 2006, 09:42 PM
Yes, it's tricky to keep the highlighting correct but it can be done! Have to handle what someone is touching on the screen plus use a watch on MP.PlaylistPosition to be able to find your way back to the proper song since it could be on another page.

By preloading it sounds like you are trying to do a page up/down to display another group of x songs in the playlist? I have CUR/TOP/UP/DOWN/END buttons to move around the playlist without changing the song that is playing. Don't think I do much special with that except I use nrjbGacPlaying.OnReceive to point to a function which resets NRJB.WaitVisible to 0 (to remove the 'processing' popup).

I did have a version working with the original GAC and was able to convert it more easily than I expected, and now do much more, so I think you should be able to get yours working.

This is how I initialize the 'playing now' object (I use separate ones for adding songs/smartlists, and info popups)...

nrjbGacPlaying = GAC:new{ start = 0,
var = 'GACPN',
count = pnListLen,
imageSize = 'S',
includeSubItemCount = 0,
ClearOnChange = 1,
useGP = 1
nrjbGacPlaying.OnReceive = OnReceivePN;
nrjbGacPlaying:SetScheme("Playing Now"); -- 'playing now' list

This is my 'UP' function...

function nrjbPNUp()
local pp = NetRemote.GetVariable("MP.PlaylistPosition") - 1;
local pp2;
if (nrjbGacPlaying.start == 0) then
print(">>>SKIPPING"); -- already top page
elseif (nrjbGacPlaying.start > pnScrollCount) then -- full page up
pp2 = nrjbGacPlaying.start - pnScrollCount;
nrjbGacPlaying:SetStart(0); -- first page
if (pp >= nrjbGacPlaying.start and pp < nrjbGacPlaying.start + nrjbGacPlaying.count) then
selectPN(pp - nrjbGacPlaying.start);

Ben S
April 24th, 2006, 10:01 PM
WTF - nice script, but with NR 2 the GAC+ system can take care of this for you.

In Lua

pngac = GAC&#58;new&#123; var='PNGAC',scheme='Playing Now', count=9, useGP = 1&#125;

This will set up this gac as a Playing Now gac. It is -very important- to include the scheme as Playing Now here versus a SetScheme later, as it uses this info to register variable hooks for the things it's going to need to keep the right item highlighted.

The state to use for playing now (to show a graphic or change color, etc)


If you want to have it show items around the current playing track, do the following before your jump to the queue page

pngac.start = tonumber&#40;NetRemote.GetVariable&#40;'MP.PlaylistPositio n'&#41;&#41;-2;
if &#40;pngac.start < 0&#41; then
pngac.start = 0;

April 24th, 2006, 10:10 PM
Interesting - I haven't attempted to move to NR 2 yet. But I still probably have to handle highlighting myself since now I highlight an entry before its popup is displayed. Though, I could also probably do without that.

April 24th, 2006, 10:19 PM
Hey- thanks for all of the extra info guys, but this still doesn't help me with my original question for the thread.

Ben- I'm using the LUA code from your latest NR demo ccf with the GAC+ pages and I want to add a 'delete' and 'play' button to each entry in the Now Playing list. I don't see how to do this in GAC+
The highlight focus is not consistent and loses focus if the playlist changes page, and the Now playing page does not load the playlist before jumping to the page. I'm using the exact code from your jump-to-page buttons, which use an onRelease refresh method prior to page jump. - Just looking to tune this up a bit.

WTF- Thanks so much but you are way over my head- your script is much different than mine, and i'm afraid i don't understant everything very well yet. I'm still at the 'copy and paste' stage...

Ben S
April 24th, 2006, 10:31 PM
Kurt - my Lua code in the demo ccf does not currently do what I'm suggesting you can do with NetRemote 2 and GAC.lua. This is why I said I'd be putting together a new sample ccf soon.

To remove you should be able to do:


for a play button



for a remove button

April 24th, 2006, 10:43 PM
thanks Ben- oddly, though, your latest CCF does have highlighting and refresh functions enabled. They work, just not consistently. i'm sure you are aware of that though and I look forward to yout next release :)

So if I run the REMOVE action will the list refesh automatically or do I need to specify that as well in the button command?

Ben S
April 24th, 2006, 10:45 PM
It does but it's some luascript I wrote similar to WTF's that did that. The new method is much more reliable and robust.

This list should refresh automatically when you remove a track. If should refresh when the playlist size changes.

April 24th, 2006, 10:48 PM
Thanks Ben- i'll try it out and do my best not to break anything :P

April 25th, 2006, 12:51 PM
Ben- my playlist is called mygac in the lua.
so, I used mygac:Action(<LoopIndex>,'REMOVE') on the button action. did not work
I also tried pngac:Action(<LoopIndex>,'REMOVE') and gacp:Action(<LoopIndex>,'REMOVE')

none of these work to remove a np list item...

Ben S
April 29th, 2006, 05:33 PM
I'll look into it, Kurt.

April 29th, 2006, 05:41 PM
Thanks Ben-

Ben S
May 14th, 2006, 02:05 PM
Hi Kurt -
I've just confirmed that this works with the latest version.

As long as the scheme is playing now, _and_ you're using JRMC (that's what I confirmed it with) you can reference the gac object and do


If this doesn't work, can you post your CCF here so I can see what's different between mine and yours?

May 16th, 2006, 10:26 AM
Thanks Ben- I got it to work. This new version did make a diff!

Ben S
May 22nd, 2006, 05:29 PM
Great! Thanks!