]> Some of my projects - aniplayer.git/commitdiff
LML: Only mark a file once
authorAPTX <marek321@gmail.com>
Sun, 18 Feb 2018 03:00:03 +0000 (12:00 +0900)
committerAPTX <marek321@gmail.com>
Sun, 18 Feb 2018 03:00:03 +0000 (12:00 +0900)
featureplugins/feature_localmylist/featurelocalmylist.cpp
featureplugins/feature_localmylist/featurelocalmylist.h

index 2f76de60ee77cb4adfa9fa64a821294c8de22354..5e9cbea3e58f0b596588598c96a3c22db5383ca5 100644 (file)
@@ -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) {
index 6bc4957f8c24abd1d876af0f6954c14c37a57f3e..017df70251d94efdcc6e5e4997823c9b661641b6 100644 (file)
@@ -42,6 +42,7 @@ private:
   int m_fid;
   QString m_path;
   double m_duration;
+  bool m_marked = false;
 };
 
 #endif // FEATURELOCALMYLIST_H