Skip to content

Commit 635b24a

Browse files
committed
Batch of fanart/Batocera support
- Scraping for fanart in import, TGDB and Screenscraper - Copy media files with Batocera filename convention - Enable output of manuals automatically when frontend ESDE (manual must be present in cache) - Enable output of manuals,fanart automatically when frontend Batocera (manual must be present in cache) - Flat artwork file (batocera-artwork.xml) for compositor (see also config.ini.example) - Set fanart and manual flags when gamelistvariants of ES are used - Import module automagically imports fanart, manuals and videos when provided in import folder - Add Batocera usage in FRONTENDS.md doc
1 parent 9164071 commit 635b24a

41 files changed

Lines changed: 652 additions & 200 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

VERSION.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
VERSION="3.17.5"
1+
VERSION="3.18.0-dev"

batocera-artwork.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!-- Just the screenshot without any decorations or scaling -->
3+
<artwork>
4+
<output type="screenshot"/>
5+
</artwork>

config.ini.example

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,3 +187,6 @@
187187
cacheRefresh="true"
188188
; https://github.com/RetroPie/RetroPie-Setup/pull/3704
189189
cacheScreenshots="false"
190+
191+
[batocera]
192+
artworkXml="batocera-artwork.xml"

docs/CACHE.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Preferred way of editing the cache is via the various [`--cache`](CLIHELP.md#-ca
3535
If you decide to add your own files to the subfolders, you risk them being deleted by Skyscraper later on if it is run with one of the cache cleanup command line options. You've been warned!
3636

3737

38-
**Other cool stuff you CAN DO**: Each subfolder in the `/home/<USER>/.skyscraper/cache/` folder is self-contained and can be copied to other Skyscraper installations at your convenience. Just copy the folder itself over to some other computer that has Skyscraper 1.6.0 or later installed, and you can make use of the data when generating game lists. If you add it at a non-default location, set the custom folder with `-d <FOLDER>`.
38+
**Other cool stuff you CAN DO**: Each subfolder in the `/home/<USER>/.skyscraper/cache/` folder is self-contained and can be copied to other Skyscraper installations at your convenience. Just copy the folder itself over to some other computer that has Skyscraper v1.6 or later installed, and you can make use of the data when generating game lists. If you add it at a non-default location, set the custom folder with `-d <FOLDER>`.
3939

4040
### Resource Cache Format
4141

@@ -52,10 +52,6 @@ The database consists of resource entries connected to a unique id. The id is ca
5252
timestamp="<UNIX TIMESTAMP IN MSECS>">Resource data</resource>
5353
```
5454

55-
!!! note
56-
57-
Pre-3.3.0 versions of Skyscraper used `sha1` as the name of the unique id key. Later versions use `id`.
58-
5955
#### Resource Types
6056

6157
##### title
@@ -124,4 +120,8 @@ A video file filename for a game (file exists in `videos` subfolder)
124120

125121
##### manual
126122

127-
A manual (PDF) file filename for a game (file exists in `manuals` subfolder)
123+
(Since v3.12) A manual (PDF) file filename for a game (file exists in `manuals` subfolder)
124+
125+
##### fanart
126+
127+
(Since v3.18) A background image displayed in some frontends (e.g. Batocera) and themes for a game (file exists in `fanarts` subfolder)

docs/CLIHELP.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,10 @@ From Skyscraper 3.5.0 all command-line options that change the scraping behaviou
448448

449449
To enable multiple flags separate them by commas (eg. `--flags FLAG1,FLAG2`) or apply `--flags` option multiple times.
450450

451+
#### fanart
452+
453+
By default Skyscraper doesn't scrape and cache game fanart resources because not all scraping sites provide this data and also only some frontends support fanart display. You can enable it by using this flag. Consider setting this in [`config.ini`](CONFIGINI.md#fanart) instead.
454+
451455
#### forcefilename
452456

453457
This flag forces Skyscraper to use the filename (excluding extension) instead of the cached titles when generating a game list. Consider setting this in [`config.ini`](CONFIGINI.md#forcefilename) instead.
@@ -540,6 +544,10 @@ Only relevant when generating an EmulationStation, a Retrobat or a Pegasus game
540544

541545
When generating gamelists, skip processing covers that already exist in the media output folder.
542546

547+
#### skipexistingfanart
548+
549+
When generating gamelists, skip copying fanart files that already exist in the media output folder.
550+
543551
#### skipexistingmanuals
544552

545553
When generating gamelists, skip copying manuals that already exist in the media output folder.

docs/CONFIGINI.md

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ This is an alphabetical index of all configuration options their usage level and
8181
| [excludeFrom](CONFIGINI.md#excludefrom) | Advanced | Y | Y | | |
8282
| [excludePattern](CONFIGINI.md#excludepattern) | Advanced | Y | Y | Y | |
8383
| [extensions](CONFIGINI.md#extensions) | Expert | | Y | | |
84+
| [fanart](CONFIGINI.md#fanart) | Basic | Y | | | |
8485
| [forceFilename](CONFIGINI.md#forcefilename) | Advanced | Y | Y | Y | |
8586
| [frontend](CONFIGINI.md#frontend) | Basic | Y | | | |
8687
| [gameBaseFile](CONFIGINI.md#gamebasefile) | Expert | | Y | | |
@@ -290,7 +291,8 @@ Cleans up some misformatting in scraped description:
290291
2. Multiple spaces between sentences are reduced to one space
291292
3. Bulletpoint beginning with \* or ● are replaced with a dash
292293
4. Stylized ellipsis (… Unicode:`&#8230;`) is replaced with three dot characters
293-
5. Multiple exclamation marks are reduced to one, unless for game titles are explicitly typed like that, like 'Super Punch-Out!!'.
294+
5. Multiple exclamation marks are reduced to one, unless for game titles are
295+
explicitly typed like that, like 'Super Punch-Out!!'.
294296

295297
!!! quote
296298

@@ -424,7 +426,7 @@ Allowed in sections: `[main]`, `[<PLATFORM>]`, `[<FRONTEND>]`
424426

425427
#### videos
426428

427-
By default Skyscraper doesn't scrape and cache video resources because of the significant disk space required to save them. You can enable videos using this option.
429+
By default Skyscraper doesn't scrape and cache video resources because of the significant disk space required to save them. You can enable videos using this option. If your frontend supports video display also explicitly set this option to true. See also the option to [symlink video files](#symlink) instead of copying, if space is a premium.
428430

429431
Default value: `false`
430432
Allowed in sections: `[main]`, `[<PLATFORM>]`, `[<FRONTEND>]`, `[<SCRAPER>]`
@@ -1060,9 +1062,32 @@ Allowed in sections: Only for frontends `[emulationstation]`, `[esde]` or `[retr
10601062

10611063
---
10621064

1065+
#### fanart
1066+
1067+
By default Skyscraper doesn't scrape and cache game fanart resources because not
1068+
all scraping sites provide this data and also only some frontends support fanart
1069+
display. If enabled Skyscraper will collect game manuals for the scraping
1070+
modules that provide this data. For frontend Batocera no further option must be
1071+
set to enable the output of fanart in the gamelist and into the appropriate
1072+
folder during gamelist creation. For other EmulationStation forks where themes
1073+
support the display of fanart, see also option
1074+
[gameListVariants](CONFIGINI.md#gamelistvariants).
1075+
1076+
Default value: false
1077+
Allowed in sections: `[main]`, `[<PLATFORM>]`
1078+
1079+
---
1080+
10631081
#### manuals
10641082

1065-
By default Skyscraper doesn't scrape and cache game manuals resources because not all scraping sites provide this data and also only some frontends support PDF display of these game manuals. If enabled Skyscraper will collect game manuals for the scraping modules that provide this data. For frontend ES-DE no further option must be set to enable the output of the PDF manuals to the appropriate folder. For other EmulationStation forks see also option [gameListVariants](CONFIGINI.md#gamelistvariants).
1083+
By default Skyscraper doesn't scrape and cache game manuals resources because
1084+
not all scraping sites provide this data and also only some frontends support
1085+
PDF display of these game manuals. If enabled Skyscraper will collect game
1086+
manuals for the scraping modules that provide this data. For frontend ES-DE and
1087+
Batocera no further option must be set to enable the output of the PDF manuals
1088+
to the appropriate folder during gamelist creation. For other EmulationStation
1089+
forks which support PDF manual display, see also option
1090+
[gameListVariants](CONFIGINI.md#gamelistvariants).
10661091

10671092
Default value: false
10681093
Allowed in sections: `[main]`, `[<PLATFORM>]`

docs/FRONTENDS.md

Lines changed: 111 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,116 @@ file will be preserved: For these on top is the `folderlink` element is preserve
106106

107107
This is modeled after EmualtionStation as it uses it with slight differences.
108108

109+
### Batocera
110+
111+
Over time the fork of EmulationStation in Batocera has diverted stark from the
112+
initial EmulationStation. Thus, the gamelist format is somewhat different, but
113+
the textual scraping elements are still the same. Most notably Batocera
114+
EmulationStation stores a lot of additional information in the gamelist, and the
115+
set of information may differ for each game.
116+
Skyscraper aims to cover the most frequent used elements for scraping, currently
117+
fanart, manuals and videos. See the [scraping
118+
modules](SCRAPINGMODULES.md#capabilities-of-scrapers) for support of these
119+
mediafiles.
120+
121+
This is the complete set of scraping binary data supported by Skyscraper:
122+
123+
| Batocera Gamelist XML-Element | Skyscraper support |
124+
| :---------------------------- | :----------------: |
125+
| boxart ||
126+
| fanart ||
127+
| image (in game Screenshot) ||
128+
| manual ||
129+
| marquee ||
130+
| video ||
131+
| wheel ||
132+
133+
ROMs are expected to be in the input folder `/userdata/roms/<PLATFORM>` for
134+
every `<PLATFORM>` you scrape.
135+
136+
- Default game list location: `/userdata/roms/<PLATFORM>`
137+
- Default game list filename: `gamelist.xml`
138+
- Default media file location: `/userdata/roms/<PLATFORM>/{images,videos,manuals}`
139+
140+
#### Metadata preservation
141+
142+
These extra elements are preserved.
143+
144+
| Batocera Gamelist XML-Element | When present in Gamelist |
145+
| :---------------------------- | :-----------------------: |
146+
| `bezel` | Preserved |
147+
| `boxback` | Preserved |
148+
| `cartridge` | Preserved |
149+
| `magazine` | Preserved |
150+
| `map` | Preserved |
151+
| `mix` | Preserved |
152+
| `music` | Preserved |
153+
| `thumbnail` | Preserved |
154+
| `titleshot` | Preserved |
155+
156+
Also all other non scrapable elements are preserved (Batocera EmulationStation
157+
adds those on occasion) like: `cheevosHash`, `cheevosId`, `scrap`, ...
158+
159+
#### Usage of Skyscraper for Batocera
160+
161+
It is possible to compile Skyscraper on Batocera supported systems but you will
162+
need the build-toolchain (at least GCC, make and Qt). Additionally, the
163+
configuration files must be installed in a defined location (see the `PREFIX`
164+
option in the top-level `README.md`, if you are keen to compile Skyscraper on
165+
Batocera).
166+
167+
A more convienient way is to use Skyscraper from you Desktop system: Below you
168+
can find a step-by-step guide for Linux systems, macOS should be similar.
169+
Windows desktop users can use SMB shares and can adapt the following steps.
170+
171+
1. Mount the root folder of Batocera in your Desktop system. Let the mountpoint
172+
be `/home/mylogin/bato_sshfs` in this example:
173+
```bash
174+
mount -t sshfs root@<batocera-IP-address>:/ /home/mylogin/bato_sshfs
175+
```
176+
2. Change to the platform folder (in this case `snes`) you want to scrape:
177+
```bash
178+
cd /home/mylogin/bato_sshfs/userdata/roms/snes
179+
```
180+
3. Then run on your Desktop system to scrape data from screenscraper and put it
181+
into the Skyscraper cache on your Desktop system:
182+
```bash
183+
Skyscraper -s screenscraper -p snes --flags fanart,manuals,videos -i "$(pwd)"
184+
-g "$(pwd)" -o "$(pwd)"
185+
```
186+
You can also set the values for [input-](CONFIGINI.md#inputfolder) (`-i`),
187+
[gamelist-](CONFIGINI.md#gamelistfolder) (`-g`) und
188+
[media-folder](CONFIGINI.md#mediafolder) (`-o`) permanently in the Skyscraper
189+
config file.
190+
4. Afterwards run the gamelist creation and media file deployment from
191+
cache:
192+
```bash
193+
Skyscraper -f batocera -p snes --flags videos -i "$(pwd)" -g "$(pwd)" -o
194+
"$(pwd)"
195+
```
196+
5. Do a SSH login to your Batocera system and restart the EmulationStation
197+
```bash
198+
batocera-es-swissknife --restart && emulationstation-standalone
199+
```
200+
Leave the SSH shell open to reload EmulationStation with ++ctrl+c++ for
201+
subsequent gamelist reloads. You can also restart the whole system, however
202+
it takes longer.
203+
6. Navigate to the system/platform you just scraped to review the scraping
204+
result.
205+
206+
!!! tip "New to Skyscraper?"
207+
208+
For starters I suggest to enable (set `true`) these settings:
209+
[`unattended`](CONFIGINI.md#unattend),
210+
[`unattendedSktip`](CONFIGINI.md#unattendSkip) and most importantly
211+
[`gameListBackup`](CONFIGINI.md#gamelistbackup). If you have precious media
212+
files which you may want to keep make also a manual backup of the media folders
213+
of. Also you will have to add your credentials for Screenscraper for example in
214+
the [config file of Skyscraper](CONFIGINI.md#usercreds).
215+
216+
For general advise on SSH usage see the [Batocera
217+
documentation](https://wiki.batocera.org/security).
218+
109219
### Attract-Mode
110220

111221
- Default game list location: `/home/<USER>/.attract/romlists`
@@ -140,4 +250,4 @@ You need to add the individual platform rom directories to Pegasus (if they are
140250

141251
#### Metadata preservation
142252

143-
Skyscraper will preserve any metadata key-value pairs added to the header and / or individual game list entries.
253+
Skyscraper will preserve any metadata key-value pairs added to the header and / or individual game list entries.

docs/IMPORT.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ The following describes how to import your own custom textual, artwork and / or
1010

1111
Be sure to also check the [`--cache edit` option](CLIHELP.md#-cache-editnewtype).
1212

13-
### Images, Videos and Game Manuals
13+
### Images, Videos, Fanart and Game Manuals
1414

1515
To import videos or images into the resource cache, use the following procedure:
1616

1717
- Name your image or video file with the _exact_ base name of the rom you wish to connect it to. Example: `Bubble Bobble.nes` will import images with a filename of `Bubble Bobble.jpg` or `Bubble Bobble.png` or other well-known image formats. As long as the base name is an _exact_ match. Same goes for video files. I recommend only making use of well-known video formats since Skyscraper imports them directly without conversion (unless you [convert them](CONFIGINI.md#videoconvertcommand)), so they need to be supported directly by the frontend you plan to use.
1818
- Game manuals are expected to use PDF format and have the extension `.pdf`. The base name must match the ROM file, thus the game manual of the example is `Bubble Bobble.pdf`.
19-
- Place all of your images, videos or game manuals in the `/home/<USER>/.skyscraper/import/<PLATFORM>/screenshots`, `covers`, `wheels`, `marquees`, `videos` or `manuals` folders.
19+
- Place all of your images, fanart, videos or game manuals in the `/home/<USER>/.skyscraper/import/<PLATFORM>/screenshots`, `covers`, `wheels`, `marquees`, `fanarts`, `videos` or `manuals` folders.
2020
- Now run Skyscraper with `Skyscraper -p <PLATFORM> -s import`. If you named your files correctly, they will now be imported. Look for the green 'YES' in the output at the rom(s) you've placed files for. This will tell you if it succeeded or not.
2121
- The data is now imported into the resource cache. To make use of it read the section [How to actually use the data?](#how-to-actually-use-the-data) below.
2222

src/abstractfrontend.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class AbstractFrontend : public QObject {
4040
public:
4141
AbstractFrontend();
4242
virtual ~AbstractFrontend();
43-
void setConfig(Settings *config);
43+
virtual void setConfig(Settings *config);
4444
virtual void checkReqs(){};
4545
virtual void assembleList(QString &, QList<GameEntry> &){};
4646
virtual void skipExisting(QList<GameEntry> &, QSharedPointer<Queue>){};
@@ -58,6 +58,7 @@ class AbstractFrontend : public QObject {
5858
virtual QString getTexturesFolder() { return QString(); };
5959
virtual QString getVideosFolder() { return QString(); };
6060
virtual QString getManualsFolder() { return QString(); };
61+
virtual QString getFanartsFolder() { return QString(); };
6162
virtual void sortEntries(QList<GameEntry> &gameEntries);
6263

6364
protected:

src/abstractscraper.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,11 @@ void AbstractScraper::populateGameEntry(GameEntry &game) {
154154
getManual(game);
155155
}
156156
break;
157+
case GameEntry::Elem::FANART:
158+
if (config->fanart) {
159+
getFanart(game);
160+
}
161+
break;
157162
default:;
158163
}
159164
}

0 commit comments

Comments
 (0)