Make functions more generic

This commit is contained in:
Tobias Fella 2020-05-18 21:00:05 +02:00
parent b2d10e578a
commit b338f017c9
2 changed files with 5 additions and 5 deletions

View File

@ -144,7 +144,7 @@ void Fetcher::processEnclosure(Syndication::EnclosurePtr enclosure, Syndication:
QString Fetcher::image(QString url)
{
QString path = imagePath(url);
QString path = filePath(url);
if (QFileInfo::exists(path)) {
return path;
}
@ -167,11 +167,11 @@ QString Fetcher::image(QString url)
void Fetcher::removeImage(QString url)
{
qDebug() << imagePath(url);
QFile(imagePath(url)).remove();
qDebug() << filePath(url);
QFile(filePath(url)).remove();
}
QString Fetcher::imagePath(QString url)
QString Fetcher::filePath(QString url)
{
return QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + QStringLiteral("/") + QString::fromStdString(QCryptographicHash::hash(url.toUtf8(), QCryptographicHash::Md5).toHex().toStdString());
}

View File

@ -42,7 +42,7 @@ private:
Fetcher();
Fetcher(const Fetcher &);
QString imagePath(QString);
QString filePath(QString);
void processFeed(Syndication::FeedPtr feed, QUrl url);
void processEntry(Syndication::ItemPtr entry, QUrl url);
void processAuthor(Syndication::PersonPtr author, Syndication::ItemPtr entry, QUrl url);