]> git.sur5r.net Git - minitube/blobdiff - src/channelaggregator.cpp
New upstream version 3.8
[minitube] / src / channelaggregator.cpp
index 2fcf42b5d0f8fdca1430e819e78535159477fc3a..d13779202f50cf714ca63689e96ec0c053931ab1 100644 (file)
@@ -81,9 +81,6 @@ void ChannelAggregator::run() {
     updatedChannels.clear();
     updatedChannels.squeeze();
 
-    if (!Database::instance().getConnection().transaction())
-        qWarning() << "Transaction failed" << __PRETTY_FUNCTION__;
-
     processNextChannel();
 }
 
@@ -175,9 +172,6 @@ void ChannelAggregator::reallyProcessChannel(YTChannel *channel) {
 void ChannelAggregator::finish() {
     currentChannel = 0;
 
-    QSqlDatabase db = Database::instance().getConnection();
-    if (!db.commit()) qWarning() << "Commit failed" << __PRETTY_FUNCTION__;
-
 #ifdef Q_OS_MAC
     if (newVideoCount > 0 && unwatchedCount > 0 && mac::canNotify()) {
         QString channelNames;
@@ -207,8 +201,10 @@ void ChannelAggregator::videosLoaded(const QVector<Video *> &videos) {
 
     if (!videos.isEmpty()) {
         YTChannel *channel = YTChannel::forId(videos.at(0)->getChannelId());
-        channel->updateNotifyCount();
-        emit channelChanged(channel);
+        if (channel) {
+            channel->updateNotifyCount();
+            emit channelChanged(channel);
+        }
         updateUnwatchedCount();
         for (Video *video : videos)
             video->deleteLater();
@@ -324,7 +320,7 @@ void ChannelAggregator::videoWatched(Video *video) {
     if (!success) qWarning() << query.lastQuery() << query.lastError().text();
     if (query.numRowsAffected() > 0) {
         YTChannel *channel = YTChannel::forId(video->getChannelId());
-        channel->updateNotifyCount();
+        if (channel) channel->updateNotifyCount();
     }
 }