예제 #1
0
	bool DBUpdateThreadWorker::AddItem (const Item_ptr& item, const Channel_ptr& channel,
			const QVariantMap& channelDataMap, const Feed::FeedSettings& settings)
	{
		if (item->PubDate_.isValid ())
		{
			if (item->PubDate_.daysTo (QDateTime::currentDateTime ()) >= settings.ItemAge_)
				return false;
		}
		else
			item->FixDate ();

		item->ChannelID_ = channel->ChannelID_;
		SB_->AddItem (item);

		RegexpMatcherManager::Instance ().HandleItem (item);

		QVariantList itemData;
		itemData << GetItemMapItemPart (item).unite (channelDataMap);
		emit hookGotNewItems (Util::DefaultHookProxy_ptr (new Util::DefaultHookProxy),
				itemData);

		if (settings.AutoDownloadEnclosures_)
			for (const auto& e : item->Enclosures_)
			{
				auto de = Util::MakeEntity (QUrl (e.URL_),
						XmlSettingsManager::Instance ()->
							property ("EnclosuresDownloadPath").toString (),
						0,
						e.Type_);
				de.Additional_ [" Tags"] = channel->Tags_;
				emit gotEntity (de);
			}

		return true;
	}
예제 #2
0
	bool DBUpdateThreadWorker::AddItem (const Item_ptr& item, const Channel_ptr& channel,
			const Feed::FeedSettings& settings)
	{
		if (item->PubDate_.isValid ())
		{
			if (item->PubDate_.daysTo (QDateTime::currentDateTime ()) >= settings.ItemAge_)
				return false;
		}
		else
			item->FixDate ();

		item->ChannelID_ = channel->ChannelID_;
		SB_->AddItem (item);

		emit hookGotNewItems (std::make_shared<Util::DefaultHookProxy> (), { item });

		const auto iem = Proxy_->GetEntityManager ();
		if (settings.AutoDownloadEnclosures_)
			for (const auto& e : item->Enclosures_)
			{
				auto de = Util::MakeEntity (QUrl (e.URL_),
						XmlSettingsManager::Instance ()->
							property ("EnclosuresDownloadPath").toString (),
						0,
						e.Type_);
				de.Additional_ [" Tags"] = channel->Tags_;
				iem->HandleEntity (de);
			}

		return true;
	}