From: APTX Date: Sun, 18 Feb 2018 03:00:03 +0000 (+0900) Subject: LML: Only mark a file once X-Git-Url: https://gitweb.aptx.org/?a=commitdiff_plain;h=15410f264ff35ddd5b727bfd9c85ec411261cf5b;p=aniplayer.git LML: Only mark a file once --- diff --git a/featureplugins/feature_localmylist/featurelocalmylist.cpp b/featureplugins/feature_localmylist/featurelocalmylist.cpp index 2f76de6..5e9cbea 100644 --- a/featureplugins/feature_localmylist/featurelocalmylist.cpp +++ b/featureplugins/feature_localmylist/featurelocalmylist.cpp @@ -27,6 +27,8 @@ FeatureLocalMyList::createInstance(QObject *instance, } void FeatureLocalMyListInstance::sourceChanged(const QUrl &source) { + m_marked = false; + if (!source.isLocalFile()) return; const auto path = source.toLocalFile(); @@ -52,12 +54,15 @@ void FeatureLocalMyListInstance::sourceChanged(const QUrl &source) { } void FeatureLocalMyListInstance::durationChanged(double duration) { - qCDebug(lmlCategory) << "Duration changed for " << sender(); + qCDebug(lmlCategory) << "Duration changed for" << sender(); m_duration = duration; } void FeatureLocalMyListInstance::positionChanged(double position) { + if (m_marked) + return; + if (m_duration < 1.0) return; @@ -69,6 +74,7 @@ void FeatureLocalMyListInstance::positionChanged(double position) { qCInfo(lmlCategory) << "Marking file" << m_path << "watched"; LocalMyList::instance()->markWatchedIfUnwatched(m_fid); + m_marked = true; } double FeatureLocalMyListInstance::readDuration(QObject *obj) { diff --git a/featureplugins/feature_localmylist/featurelocalmylist.h b/featureplugins/feature_localmylist/featurelocalmylist.h index 6bc4957..017df70 100644 --- a/featureplugins/feature_localmylist/featurelocalmylist.h +++ b/featureplugins/feature_localmylist/featurelocalmylist.h @@ -42,6 +42,7 @@ private: int m_fid; QString m_path; double m_duration; + bool m_marked = false; }; #endif // FEATURELOCALMYLIST_H