Qt: scrub thumbnail titles according to No-Intro before downloading, fixes #7149

This commit is contained in:
Brad Parker 2018-08-29 00:42:34 -04:00
parent c746115bbd
commit 95ad8798ee
4 changed files with 15 additions and 0 deletions

View File

@ -201,6 +201,7 @@ void MainWindow::downloadNextPlaylistThumbnail(QString system, QString title, QS
if (!settings)
return;
title = getScrubbedString(title);
systemUnderscore = systemUnderscore.replace(" ", "_");
urlString = QString(THUMBNAIL_URL_HEADER) + systemUnderscore + THUMBNAIL_URL_BRANCH + type + "/" + title + THUMBNAIL_URL_FOOTER;

View File

@ -221,6 +221,7 @@ void MainWindow::downloadThumbnail(QString system, QString title, QUrl url)
if (!settings || m_pendingThumbnailDownloadTypes.isEmpty())
return;
title = getScrubbedString(title);
downloadType = m_pendingThumbnailDownloadTypes.takeFirst();
systemUnderscore = systemUnderscore.replace(" ", "_");

View File

@ -3152,6 +3152,18 @@ int MainWindow::onExtractArchive(QString path, QString extractionDir, QString te
return returnerr;
}
QString MainWindow::getScrubbedString(QString str)
{
const QLatin1Literal chars("&*/:`\"<>?\\|");
foreach (QChar ch, chars)
{
str.replace(ch, "_");
}
return str;
}
static void* ui_window_qt_init(void)
{
ui_window.qtWindow = new MainWindow();

View File

@ -287,6 +287,7 @@ public:
static double lerp(double x, double y, double a, double b, double d);
QString getSpecialPlaylistPath(SpecialPlaylist playlist);
QVector<QPair<QString, QString> > getPlaylists();
QString getScrubbedString(QString str);
signals:
void thumbnailChanged(const QPixmap &pixmap);