thesoundsmith
Active Coder
My "radio station" works just great, except for a selection question. Try it here: DashRadio
I am trying to select from a series of XML files for music playlists. Here is a typical XML entry:
When selecting a "New" file, isAlbum is set False, and I want it to always select a different 'Link' from the current AND previous link, so the choice doesn't select this same link OR the previous one.
When pressing the "More" button, isAlbum is set True. It matches the Description field and opens a specific playlist for THAT project. Now all the link AND Descriptions are the same so I want to select a different Title, again not from the current or last titles. I hope this is clear. All XML files have each item twice just to prevent search issues.
The selection works perfectly except it allows repeats of tracks. I try to prevent picking a duplicate "Title" but it's not working. (It's best to test on Rhinoblossom, it has the fewest tracks so repeats will happen quickly) - select "New" till a Rhinoblossoom track plays, then press 'More' Now press 'New' to look for duplicates...
Here is the function, it is triggered by clicking New or More: I thought this was correct, but pressing New still finds duplicate projects AND titles. I did not condense it down to avoid confusion - didn't help...
Thanks in advance for your help.
I am trying to select from a series of XML files for music playlists. Here is a typical XML entry:
XML:
<item>
<media:content url="https://www.davidkempton.com/wp-content/uploads/02-By-The-Time-I-Get-To-Phoenix.mp3" />
<media:thumbnail url="pix/esp4web.gif" />
<title>By The Time I Get To Phoenix</title>
<description>Especially For Groovers</description>
<link>https://www.davidkempton.com/rec/esp4/</link>
</item>
When selecting a "New" file, isAlbum is set False, and I want it to always select a different 'Link' from the current AND previous link, so the choice doesn't select this same link OR the previous one.
When pressing the "More" button, isAlbum is set True. It matches the Description field and opens a specific playlist for THAT project. Now all the link AND Descriptions are the same so I want to select a different Title, again not from the current or last titles. I hope this is clear. All XML files have each item twice just to prevent search issues.
The selection works perfectly except it allows repeats of tracks. I try to prevent picking a duplicate "Title" but it's not working. (It's best to test on Rhinoblossom, it has the fewest tracks so repeats will happen quickly) - select "New" till a Rhinoblossoom track plays, then press 'More' Now press 'New' to look for duplicates...
Here is the function, it is triggered by clicking New or More: I thought this was correct, but pressing New still finds duplicate projects AND titles. I did not condense it down to avoid confusion - didn't help...
JavaScript:
function swapAlbum() {
var newProj = jwplayer(radio).getPlaylistItem().link;
newTitle == newProj.title;
if (((isAlbum == false) && (newProj == thisProj)) || thisTitle== prevTitle) || thisTitle== newTitle)) {
newProj = jwplayer(radio).playlistNext();
newTitle == newProj.title;
} else {
prevTitle = thisTitle;
thisTitle = newTitle;
prevProj = thisProj;
thisProj = newProj;
}
}
Thanks in advance for your help.