From ca595c985c18e267d93095c0d3f564f54824ac12 Mon Sep 17 00:00:00 2001 From: Bart De Vries Date: Wed, 13 Oct 2021 20:40:22 +0200 Subject: [PATCH] Make parsing of chapter timestamps more robust Solves #19 --- src/updatefeedjob.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/updatefeedjob.cpp b/src/updatefeedjob.cpp index cf65f080..22595b35 100644 --- a/src/updatefeedjob.cpp +++ b/src/updatefeedjob.cpp @@ -276,8 +276,15 @@ bool UpdateFeedJob::processEntry(Syndication::ItemPtr entry) QDomElement element = nodelist.at(i).toElement(); QString title = element.attribute(QStringLiteral("title")); QString start = element.attribute(QStringLiteral("start")); - QTime startString = QTime::fromString(start, QStringLiteral("hh:mm:ss.zzz")); - int startInt = startString.hour() * 60 * 60 + startString.minute() * 60 + startString.second(); + QStringList startParts = start.split(QStringLiteral(":")); + // Some podcasts use colon for milliseconds as well + while (startParts.count() > 3) { + startParts.removeLast(); + } + int startInt = 0; + for (QString part : startParts) { + startInt = part.toInt() + startInt * 60; + } QString images = element.attribute(QStringLiteral("image")); processChapter(entry->id(), startInt, title, entry->link(), images); }