Commit 55a05373 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

MediaLibrary: Don't check for the amount of modified media when clearing the history

When no media is present, we still might want to clear the stream
history.
parent 57ea9939
......@@ -549,7 +549,7 @@ std::vector<MediaPtr> Media::fetchHistory( MediaLibraryPtr ml )
return fetchAll<IMedia>( ml, req );
}
bool Media::clearHistory(MediaLibraryPtr ml)
void Media::clearHistory( MediaLibraryPtr ml )
{
auto dbConn = ml->getConn();
static const std::string req = "UPDATE " + policy::MediaTable::Name + " SET "
......@@ -558,7 +558,7 @@ bool Media::clearHistory(MediaLibraryPtr ml)
"progress = 0";
// Clear the entire cache since quite a few items are now containing invalid info.
clear();
return sqlite::Tools::executeUpdate( dbConn, req );
sqlite::Tools::executeUpdate( dbConn, req );
}
}
......@@ -110,7 +110,7 @@ class Media : public IMedia, public DatabaseHelpers<Media, policy::MediaTable>
static std::vector<MediaPtr> listAll(MediaLibraryPtr ml, Type type , SortingCriteria sort, bool desc);
static std::vector<MediaPtr> search( MediaLibraryPtr ml, const std::string& title );
static std::vector<MediaPtr> fetchHistory( MediaLibraryPtr ml );
static bool clearHistory( MediaLibraryPtr ml );
static void clearHistory( MediaLibraryPtr ml );
private:
......
......@@ -452,8 +452,7 @@ std::vector<MediaPtr> MediaLibrary::lastMediaPlayed() const
bool MediaLibrary::clearHistory()
{
auto t = getConn()->newTransaction();
if ( Media::clearHistory( this ) == false )
return false;
Media::clearHistory( this );
if ( History::clearStreams( this ) == false )
return false;
t->commit();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment