|
|
@ -31,8 +31,8 @@ |
|
|
|
#include <QRegExp> |
|
|
|
#include <QRegExp> |
|
|
|
#include <QDebug> |
|
|
|
#include <QDebug> |
|
|
|
#include <QDir> |
|
|
|
#include <QDir> |
|
|
|
#include <QStringRef> |
|
|
|
#include <QString> |
|
|
|
#include <QVector> |
|
|
|
#include <QStringList> |
|
|
|
|
|
|
|
|
|
|
|
#include "base/preferences.h" |
|
|
|
#include "base/preferences.h" |
|
|
|
#include "base/utils/fs.h" |
|
|
|
#include "base/utils/fs.h" |
|
|
@ -155,12 +155,10 @@ bool DownloadRule::matches(const QString &articleTitle) const |
|
|
|
QStringList eps = f.cap(2).split(";"); |
|
|
|
QStringList eps = f.cap(2).split(";"); |
|
|
|
int sOurs = s.toInt(); |
|
|
|
int sOurs = s.toInt(); |
|
|
|
|
|
|
|
|
|
|
|
foreach (const QString &epStr, eps) { |
|
|
|
foreach (QString ep, eps) { |
|
|
|
if (epStr.isEmpty()) |
|
|
|
if (ep.isEmpty()) |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
|
|
|
|
|
|
|
|
QStringRef ep( &epStr); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// We need to trim leading zeroes, but if it's all zeros then we want episode zero.
|
|
|
|
// We need to trim leading zeroes, but if it's all zeros then we want episode zero.
|
|
|
|
while (ep.size() > 1 && ep.startsWith("0")) |
|
|
|
while (ep.size() > 1 && ep.startsWith("0")) |
|
|
|
ep = ep.right(ep.size() - 1); |
|
|
|
ep = ep.right(ep.size() - 1); |
|
|
@ -192,7 +190,7 @@ bool DownloadRule::matches(const QString &articleTitle) const |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
else { // Normal range
|
|
|
|
else { // Normal range
|
|
|
|
QVector<QStringRef> range = ep.split('-'); |
|
|
|
QStringList range = ep.split('-'); |
|
|
|
Q_ASSERT(range.size() == 2); |
|
|
|
Q_ASSERT(range.size() == 2); |
|
|
|
if (range.first().toInt() > range.last().toInt()) |
|
|
|
if (range.first().toInt() > range.last().toInt()) |
|
|
|
continue; // Ignore this subrule completely
|
|
|
|
continue; // Ignore this subrule completely
|
|
|
|