(Qt) Use new URL for scraping thumbnails

This commit is contained in:
libretroadmin 2022-06-17 19:10:29 +02:00
parent 0fe694665c
commit e3a716d06a
2 changed files with 8 additions and 14 deletions

View File

@ -271,6 +271,9 @@ static void download_pl_thumbnail(pl_thumb_handle_t *pl_thumb)
transf->user_data = (void*)pl_thumb; transf->user_data = (void*)pl_thumb;
strlcpy(transf->path, path, sizeof(transf->path)); strlcpy(transf->path, path, sizeof(transf->path));
RARCH_LOG("url: %s\n", url);
RARCH_LOG("transf path: %s\n", transf->path);
/* Note: We don't actually care if this fails since that /* Note: We don't actually care if this fails since that
* just means the file is missing from the server, so it's * just means the file is missing from the server, so it's
* not something we can handle here... */ * not something we can handle here... */

View File

@ -34,11 +34,8 @@ extern "C" {
#define TEMP_EXTENSION ".tmp" #define TEMP_EXTENSION ".tmp"
#define THUMBNAILPACK_URL_HEADER "http://thumbnailpacks.libretro.com/" #define THUMBNAILPACK_URL_HEADER "http://thumbnailpacks.libretro.com/"
#define THUMBNAILPACK_EXTENSION ".zip" #define THUMBNAILPACK_EXTENSION ".zip"
#define THUMBNAIL_URL_HEADER "https://github.com/libretro-thumbnails/" #define THUMBNAIL_URL_HEADER "https://thumbnails.libretro.com/"
#define THUMBNAIL_URL_BRANCH "/blob/master/"
#define THUMBNAIL_IMAGE_EXTENSION ".png" #define THUMBNAIL_IMAGE_EXTENSION ".png"
#define THUMBNAIL_URL_FOOTER THUMBNAIL_IMAGE_EXTENSION "?raw=true"
static void extractThumbnailPackCB(retro_task_t *task, static void extractThumbnailPackCB(retro_task_t *task,
void *task_data, void *user_data, const char *err) void *task_data, void *user_data, const char *err)
@ -567,7 +564,6 @@ void MainWindow::downloadThumbnail(QString system, QString title, QUrl url)
QNetworkRequest request; QNetworkRequest request;
QByteArray urlArray; QByteArray urlArray;
QString downloadType; QString downloadType;
QString systemUnderscore = system;
QNetworkReply *reply = NULL; QNetworkReply *reply = NULL;
const char *urlData = NULL; const char *urlData = NULL;
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
@ -577,13 +573,11 @@ void MainWindow::downloadThumbnail(QString system, QString title, QUrl url)
title = getScrubbedString(title); title = getScrubbedString(title);
downloadType = m_pendingThumbnailDownloadTypes.takeFirst(); downloadType = m_pendingThumbnailDownloadTypes.takeFirst();
systemUnderscore = systemUnderscore.replace(" ", "_");
urlString = QString(THUMBNAIL_URL_HEADER) urlString = QString(THUMBNAIL_URL_HEADER)
+ systemUnderscore + system + "/"
+ THUMBNAIL_URL_BRANCH
+ downloadType + "/" + downloadType + "/"
+ title + title
+ THUMBNAIL_URL_FOOTER; + THUMBNAIL_IMAGE_EXTENSION;
if (url.isEmpty()) if (url.isEmpty())
url = urlString; url = urlString;
@ -855,7 +849,6 @@ void MainWindow::onPlaylistThumbnailDownloadReadyRead()
void MainWindow::downloadNextPlaylistThumbnail( void MainWindow::downloadNextPlaylistThumbnail(
QString system, QString title, QString type, QUrl url) QString system, QString title, QString type, QUrl url)
{ {
QString systemUnderscore = system;
QString urlString; QString urlString;
QNetworkRequest request; QNetworkRequest request;
QNetworkReply *reply = NULL; QNetworkReply *reply = NULL;
@ -865,16 +858,14 @@ void MainWindow::downloadNextPlaylistThumbnail(
return; return;
title = getScrubbedString(title); title = getScrubbedString(title);
systemUnderscore = systemUnderscore.replace(" ", "_");
urlString = urlString =
QString(THUMBNAIL_URL_HEADER) QString(THUMBNAIL_URL_HEADER)
+ systemUnderscore + system + "/"
+ THUMBNAIL_URL_BRANCH
+ type + type
+ "/" + "/"
+ title + title
+ THUMBNAIL_URL_FOOTER; + THUMBNAIL_IMAGE_EXTENSION;
if (url.isEmpty()) if (url.isEmpty())
url = urlString; url = urlString;