Skip to content

Commit

Permalink
Fix some cases where leadins are run twice, playlist started, immedia…
Browse files Browse the repository at this point in the history
…tely stopped, then started again

Add warning on File Manager if free space is < 5%
  • Loading branch information
dkulp committed Oct 30, 2019
1 parent 1a69c3b commit 567a490
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 11 deletions.
1 change: 0 additions & 1 deletion src/Scheduler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,6 @@ void Scheduler::PlayListLoadCheck(void)

playlist->Play(m_Schedule[m_currentSchedulePlaylist.ScheduleEntryIndex].playList,
0, m_Schedule[m_currentSchedulePlaylist.ScheduleEntryIndex].repeat, 1);
playlist->Start();
}
}
}
Expand Down
24 changes: 16 additions & 8 deletions src/playlist/Playlist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ Playlist::Playlist(void *parent, int subPlaylist)
m_fileTime(0),
m_configTime(0),
m_currentState("idle"),
m_currentSection(nullptr),
m_currentSectionStr("New"),
m_sectionPosition(0),
m_startPosition(0)
Expand Down Expand Up @@ -222,6 +223,7 @@ int Playlist::Load(Json::Value &config)
}

m_sectionPosition = 0;
m_currentSection = nullptr;

if ((logLevel & LOG_DEBUG) && (logMask & VB_PLAYLIST))
Dump();
Expand Down Expand Up @@ -521,6 +523,7 @@ int Playlist::StopNow(int forceStop)
SetIdle();

m_forceStop = forceStop;
m_currentSection = nullptr;

return 1;
}
Expand Down Expand Up @@ -612,12 +615,11 @@ int Playlist::Process(void)
{
ReloadIfNeeded();

if (m_leadOut.size())
{
if (m_leadOut.size()) {
LogDebug(VB_PLAYLIST, "Stopping Gracefully\n");
SwitchToLeadOut();
}
else {
} else {
m_currentSection = nullptr;
SetIdle();
}
return 1;
Expand Down Expand Up @@ -733,6 +735,7 @@ int Playlist::Process(void)
else
{
LogDebug(VB_PLAYLIST, "No more playlist entries, switching to idle.\n");
m_currentSection = nullptr;
SetIdle();
}
}
Expand Down Expand Up @@ -835,6 +838,7 @@ int Playlist::Cleanup(void)
m_loopCount = 0;
m_startTime = 0;
m_currentSectionStr = "New";
m_currentSection = nullptr;

return 1;
}
Expand Down Expand Up @@ -862,18 +866,21 @@ int Playlist::Play(const char *filename, const int position, const int repeat, c
fullfilename += filename;
fullfilename += ".json";

if ((m_filename == fullfilename) && (repeat == m_repeat)) {
if ((m_filename == fullfilename)
&& (repeat == m_repeat)
&& m_currentSection) {
//the requested playlist is already running and loaded, we can jump right to the index
if (m_currentSection->at(m_sectionPosition)->IsPlaying())
if (m_currentSection->at(m_sectionPosition)->IsPlaying()) {
m_currentSection->at(m_sectionPosition)->Stop();
}

m_sectionPosition = 0;
SetPosition(position);
FPPstatus = FPP_STATUS_PLAYLIST_PLAYING;
m_currentState = "playing";
Start();
return 1;
} else {
} else if (m_currentSection) {
hadToStop = 1;
StopNow(1);
sleep(1);
Expand All @@ -893,8 +900,9 @@ int Playlist::Play(const char *filename, const int position, const int repeat, c
FPPstatus = FPP_STATUS_PLAYLIST_PLAYING;
m_currentState = "playing";

if (hadToStop)
if (hadToStop) {
Start();
}

return 1;
}
Expand Down
2 changes: 1 addition & 1 deletion www/backup.php
Original file line number Diff line number Diff line change
Expand Up @@ -1336,7 +1336,7 @@ function is_array_empty($InputVariable)
<legend>FPP Settings Backup</legend>
<ul>
<li>
<span style="color: #AA0000"><b>Backups made from FPP v1.x are incompatible with the FPP 2.x system.</b></span>
<span style="color: #AA0000"><b>Backups made from FPP v1.x are incompatible with the FPP 3.x system.</b></span>
</li>
</ul>
<?php if ($restore_done == true) {
Expand Down
13 changes: 12 additions & 1 deletion www/uploadfile.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@
?>
<head>
<?php include 'common/menuHead.inc'; ?>


<?php
exec($SUDO . " df -k /home/fpp/media/upload |awk '/\/dev\//{printf(\"%d\\n\", $5);}'", $output, $return_val);
$freespace = $output[0];
unset($output);
?>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><? echo $pageTitle; ?></title>

Expand Down Expand Up @@ -200,7 +207,11 @@ function AbortScriptChange()
<?php include 'menu.inc'; ?>
<div id="fileManager">
<br />
<div class='title'>File Manager</div>
<div class='title'>File Manager
<? if ($freespace > 95) { ?>
&nbsp;&nbsp;-&nbsp;&nbsp;<b><font color='red'>WARNING: storage device is almost full!</font></b>
<? } ?>
</div>
<div id="tabs">
<ul>
<li><a href="#tab-sequence">Sequences</a></li>
Expand Down

0 comments on commit 567a490

Please sign in to comment.