| 1 |
/* |
| 2 |
SPDX-FileCopyrightText: 2010 Andreas Scherf <[email protected]> |
| 3 |
|
| 4 |
SPDX-License-Identifier: GPL-2.0-or-later |
| 5 |
*/ |
| 6 |
|
| 7 |
#include "ffmpegthumbnailer.h" |
| 8 |
#include "ffmpegthumbnailersettings5.h" |
| 9 |
|
| 10 |
#include <QCoreApplication> |
| 11 |
#include <QFileInfo> |
| 12 |
#include <QMimeDatabase> |
| 13 |
#include <QStringList> |
| 14 |
#include <iostream> |
| 15 |
|
| 16 |
using namespace std; |
| 17 |
|
| 18 |
int main(int argc, char **argv) |
| 19 |
{ |
| 20 |
QCoreApplication app(argc, argv); |
| 21 |
QStringList arguments = app.arguments(); |
| 22 |
|
| 23 |
if (arguments.count() > 1) { |
| 24 |
QString inputFilename(arguments.last()); |
| 25 |
FFMpegThumbnailer thumbnailer(&app, QVariantList()); |
| 26 |
QMimeDatabase db; |
| 27 |
const QString mime = db.mimeTypeForFile(inputFilename).name(); |
| 28 |
KIO::ThumbnailRequest request(QUrl::fromLocalFile(inputFilename), QSize(128, 128), mime, 0, 0); |
| 29 |
const auto res = thumbnailer.create(request); |
| 30 |
QFileInfo fileInfo(inputFilename); |
| 31 |
res.image().save(fileInfo.baseName() + QStringLiteral(".png")); |
| 32 |
} else { |
| 33 |
cout << "Usage:" << arguments.at(0).toLocal8Bit().data() << " filename" << endl; |
| 34 |
} |
| 35 |
return 0; |
| 36 |
} |