Skip to content

Commit 41e1a08

Browse files
authored
Merge branch 'master' into doc_update
2 parents 607054e + e48df2e commit 41e1a08

7 files changed

Lines changed: 32 additions & 12 deletions

File tree

docs/CLIHELP.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,10 @@ If you have a rom that Skyscraper doesn't even try to gather data for, it might
224224
**Example(s)**
225225

226226
```
227-
Skyscraper -p snes -s thegamesdb --addext *.ext
227+
Skyscraper -p snes -s thegamesdb --addext '*.ext'
228228
Skyscraper -p snes -s thegamesdb --addext '*.ext1 *.ext2'
229+
# or even
230+
Skyscraper -p snes -s thegamesdb --addext '.ext1 ext2'
229231
```
230232

231233
### --cache <COMMAND[:OPTIONS]>

docs/CONFIGINI.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -846,7 +846,7 @@ Allowed in sections: `[<PLATFORM>]`
846846

847847
#### addExtensions
848848

849-
Adds the rom extensions to the ones that are already supported by the platform, use a space between each extension.
849+
Adds the rom extensions to the ones that are already supported by the platform, use a space between each extension. You may omit the `*` or even `*.` when providing an extension.
850850

851851
!!! info
852852

hints.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,12 @@
3131
<hint>You can scrape game manuals with Skyscraper and display them if your frontend supports this. Use manuals=true in config.ini.</hint>
3232
<hint>You can make Skyscraper use the XDG Base Directories on Linux systems. See the https://gemba.github.io/skyscraper/XDG documentation.</hint>
3333
<hint>Skyscraper supports the ES-DE frontend gamelist format.</hint>
34-
<hint>You can add new platforms (i.e., systems to scrape) with configuration file edits. See https://gemba.github.io/skyscraper/PLATFORMS</hint>
34+
<hint>You can add new platforms (i.e., systems to scrape) by editing configuration files. See https://gemba.github.io/skyscraper/PLATFORMS</hint>
3535
<hint>You can scrape data from GameBase DB files with Skyscraper. GameBase DBs are a well of information especially for indie or homebrew games for retro systems.</hint>
3636
<hint>Skyscraper supports ten scraping modules: 7 for online sources and 3 for local sources.</hint>
3737
<hint>Pizza and beer go well together.</hint>
3838
<hint>Skyscraper debuted at June, 11th 2017.</hint>
3939
<hint>Skyscraper runs on Linux, macOS and Windows.</hint>
4040
<hint>You can use relative paths for almost every path related option. See https://gemba.github.io/skyscraper/PATHHANDLING</hint>
41+
<hint>For a file extension/suffix option value like '*.ext', you can use the shorter forms '.ext' or even only 'ext'.</hint>
4142
</hints>

src/cli.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ void Cli::createParser(QCommandLineParser *parser, QString platforms) {
154154
QCommandLineOption addextOption(
155155
"addext",
156156
"Add this or these file extension(s) to accepted file extensions "
157-
"during a scraping run. (example: '*.zst' or '*.zst *.ext')",
157+
"during a scraping run. (ex.: '*.zst *.ext', also valid: '.zst ext')",
158158
"EXTENSION(S)", "");
159159
QCommandLineOption flagsOption(
160160
"flags",

src/platform.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,15 +154,13 @@ QString Platform::getFormats(QString platform, QString extensions,
154154
addExts = addExtensions.split(" ", QString::SkipEmptyParts);
155155
#endif
156156
for (auto f : addExts) {
157-
if (f.startsWith("*.")) {
158-
formats << f;
159-
}
157+
formats << f;
160158
}
161159

162160
QStringList myFormats = peas[platform].toHash()["formats"].toStringList();
163161
for (auto f : myFormats) {
164162
if (f.trimmed().startsWith("*.")) {
165-
formats << f.trimmed();
163+
formats << f.trimmed().toLower();
166164
}
167165
}
168166

src/settings.cpp

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ void RuntimeCfg::applyConfigIni(CfgType type, QSettings *settings,
155155
if (v.isEmpty())
156156
continue;
157157
if (k == "addExtensions") {
158-
config->addExtensions = v;
158+
config->addExtensions = parseExtensions(v);
159159
continue;
160160
}
161161
if (k == "artworkXml") {
@@ -191,7 +191,7 @@ void RuntimeCfg::applyConfigIni(CfgType type, QSettings *settings,
191191
continue;
192192
}
193193
if (k == "extensions") {
194-
config->extensions = v;
194+
config->extensions = parseExtensions(v);
195195
continue;
196196
}
197197
if (k == "gameListFilename") {
@@ -321,7 +321,8 @@ void RuntimeCfg::applyConfigIni(CfgType type, QSettings *settings,
321321
continue;
322322
}
323323
if (k == "videoConvertExtension") {
324-
config->videoConvertExtension = v;
324+
config->videoConvertExtension =
325+
parseExtensions(v).replace("*.", "");
325326
continue;
326327
}
327328
} else if (conv == "bool") {
@@ -611,7 +612,7 @@ void RuntimeCfg::applyCli(bool &inputFolderSet, bool &gameListFolderSet,
611612
}
612613
}
613614
if (parser->isSet("addext")) {
614-
config->addExtensions = parser->value("addext");
615+
config->addExtensions = parseExtensions(parser->value("addext"));
615616
}
616617
if (parser->isSet("refresh")) {
617618
config->refresh = true;
@@ -815,3 +816,20 @@ QString RuntimeCfg::toAbsolutePath(bool isCliOpt, QString optionVal) {
815816
}
816817
return Config::lexicallyNormalPath(optionVal);
817818
}
819+
820+
QString RuntimeCfg::parseExtensions(const QString &optionVal) {
821+
// --addext, addExtension, extensions
822+
// 'foo .bar *.bAZ' --> '*.foo *.bar *.baz'
823+
QStringList exts = optionVal.simplified().split(" ");
824+
QStringList ret;
825+
for (const auto &e : exts) {
826+
if (e.startsWith("*.")) {
827+
ret.append(e.toLower());
828+
} else if (e.startsWith(".")) {
829+
ret.append("*" % e.toLower());
830+
} else {
831+
ret.append("*." % e.toLower());
832+
}
833+
}
834+
return ret.join(" ");
835+
}

src/settings.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ class RuntimeCfg : public QObject {
185185
bool scraperAllowedForMatch(const QString &providedScraper,
186186
const QString &opt);
187187
QString toAbsolutePath(bool isCliOpt, QString optionVal);
188+
QString parseExtensions(const QString &optionVal);
188189

189190
Settings *config;
190191
const QCommandLineParser *parser;

0 commit comments

Comments
 (0)