Skip to content

Commit

Permalink
Implement Prev/Next commands
Browse files Browse the repository at this point in the history
  • Loading branch information
dkulp committed Oct 27, 2018
1 parent 6cdc641 commit 452a5b3
Showing 1 changed file with 50 additions and 7 deletions.
57 changes: 50 additions & 7 deletions src/playlist/Playlist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -835,21 +835,64 @@ void Playlist::Dump(void)
*/
void Playlist::NextItem(void)
{
if (m_currentState == "idle")
if (m_currentState == "idle") {
return;

// FIXME PLAYLIST
}
if (FPPstatus != FPP_STATUS_PLAYLIST_PLAYING) {
return;
}

int pos = GetPosition() - 1;
if (m_currentSectionStr == "MainPlaylist") {
if (pos < (m_leadIn.size() + m_mainPlaylist.size())) {
pos++;
} else {
pos = m_leadIn.size();
}
}


std::string name = m_name;
std::string desc = m_desc;
int repeat = m_repeat;
StopNow();
m_absolutePosition = pos;
m_repeat = repeat;
m_desc = desc;
m_name = name;
Start();
}

/*
*
*/
void Playlist::PrevItem(void)
{
if (m_currentState == "idle")
return;

// FIXME PLAYLIST
if (m_currentState == "idle") {
return;
}
if (FPPstatus != FPP_STATUS_PLAYLIST_PLAYING) {
return;
}

int pos = GetPosition() - 1;
if (m_currentSectionStr == "MainPlaylist") {
if (pos > m_leadIn.size()) {
pos--;
} else {
pos = m_leadIn.size() + m_mainPlaylist.size() - 1;
}
}

std::string name = m_name;
std::string desc = m_desc;
int repeat = m_repeat;
StopNow();
m_absolutePosition = pos;
m_repeat = repeat;
m_desc = desc;
m_name = name;
Start();
}

/*
Expand Down

0 comments on commit 452a5b3

Please sign in to comment.