Skip to content

Commit 11722f9

Browse files
committed
apply maxLength on description also for ES and derivates
1 parent 5ef538a commit 11722f9

4 files changed

Lines changed: 13 additions & 4 deletions

File tree

docs/CLIHELP.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ Skyscraper -p snes -i "/path/to/your/snes/roms"
130130

131131
### -l <0-10000>
132132

133-
Sets the maximum length of returned game descriptions. This is a convenience option if you feel like game descriptions are too long. By default it is set to 2500 (which is approx. two-thirds of a typewriter page). Consider setting this in [`config.ini`](CONFIGINI.md#maxlength) instead.
133+
Sets the maximum length of returned game descriptions. This is a convenience option if you feel like game descriptions are too long. By default it is set to 2500 (approx. two-thirds of a typewriter page). Consider setting this in [`config.ini`](CONFIGINI.md#maxlength) instead.
134134

135135
**Example(s)**
136136

docs/CONFIGINI.md

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

639639
#### maxLength
640640

641-
Sets the maximum length of returned game descriptions. This is a convenience option if you feel like game descriptions are too long. By default it is set to 2500. Allowed range is 0 to 10000 characters. A truncated text will end with [...] (Ellipsis).
641+
Sets the maximum length of returned game descriptions. This is a convenience option if you feel like game descriptions are too long. By default it is set to 2500 (approx. two-thirds of a typewriter page). Allowed range is 0 to 10000 characters. A truncated text will end with [...] (Ellipsis). The text is only truncated in the gamelist/frontend output. The cache will hold the full text.
642642

643643
Default value: `2500`
644644
Allowed in sections: `[main]`, `[<PLATFORM>]`, `[<FRONTEND>]`, `[<SCRAPER>]`

src/emulationstation.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,8 @@ QString EmulationStation::createXml(GameEntry &entry) {
344344
l.append(elem(GameEntry::getTag(GameEntry::Elem::RATING), entry.rating,
345345
addEmptyElem));
346346
l.append(elem(GameEntry::getTag(GameEntry::Elem::DESCRIPTION),
347-
entry.description, addEmptyElem));
347+
StrTools::shortenText(entry.description, config->maxLength),
348+
addEmptyElem));
348349

349350
QString released = entry.releaseDate;
350351
QRegularExpressionMatch m = isoTimeRe().match(released);

src/esgamelist.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,15 @@ void ESGameList::getGameData(GameEntry &game) {
8787
game.rating = getElementText(GameEntry::Elem::RATING);
8888
game.tags = getElementText(GameEntry::Elem::TAGS);
8989
game.description = getElementText(GameEntry::Elem::DESCRIPTION);
90-
90+
if (game.description.endsWith("[...]")) {
91+
qWarning()
92+
<< QString(
93+
"Game title '%1' has shortened description '[...]' at %2 "
94+
"chars. Consider using a different source than esgamelist "
95+
"when the current maxLength setting is higher than %2.")
96+
.arg(game.title)
97+
.arg(game.description.length());
98+
}
9199
if (config->cacheWheels) {
92100
// ES uses XML "marquee" but content is wheel (logo)
93101
game.wheelData =

0 commit comments

Comments
 (0)