Skip to content

Commit a17a9f6

Browse files
committed
empty titles will now be failed + ability to fail files that do not have custom variable
1 parent 731c76e commit a17a9f6

File tree

10 files changed

+39
-7
lines changed

10 files changed

+39
-7
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
# Change Log
22
All notable changes to this project will be documented in this file.
33

4+
## 2.2.6 - 2017-11-09
5+
6+
### Added
7+
8+
* Titles, not found in `customVariables.json` can now be failed (skipped). Useful for MAME and similar emulators.
9+
10+
### Fixed
11+
12+
* Empty titles (with a length of a 0) will now be failed (skipped) by a parser.
13+
414
## 2.2.5 - 2017-11-07
515

616
### Added

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "steam-rom-manager",
3-
"version": "2.2.5",
3+
"version": "2.2.6",
44
"license": "GPL-3.0",
55
"description": "An app for managing ROMs in Steam",
66
"author": {
@@ -23,7 +23,7 @@
2323
"icon": "./src/assets/icons/win.ico"
2424
},
2525
"portable": {
26-
"artifactName": "${productName} ${version} (portable).${ext}"
26+
"artifactName": "${productName}-portable-${version}.${ext}"
2727
},
2828
"linux": {
2929
"category": "Utility",

src/lang/english/langData.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,7 @@ export const EnglishLang: languageContainer = {
305305
skipWithMissingDataDir: 'Skip found accounts with missing data directories',
306306
useCredentials: 'Use account credentials',
307307
tryToMatchTitle: 'Enabled',
308+
skipFileIfVariableWasNotFound: 'Skip file if variable was not found',
308309
caseInsensitiveVariables: 'Case-insensitive variables',
309310
fuzzy_use: 'Use fuzzy matching',
310311
fuzzy_removeCharacters: 'Aggressive matching',

src/lib/file-parser.ts

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,18 @@ export class FileParser {
142142
missingUserAccounts: filteredAccounts.missing,
143143
steamDirectory: configs[i].steamDirectory,
144144
files: [],
145-
failed: []
145+
failed: _.cloneDeep(data[i].failed)
146146
});
147147

148148
for (let j = 0; j < data[i].success.length; j++) {
149149
let fuzzyTitle = data[i].success[j].fuzzyTitle || data[i].success[j].extractedTitle;
150+
151+
// Fail empty titles
152+
if (fuzzyTitle.length === 0) {
153+
parsedConfigs[i].failed.push(data[i].success[j].filePath);
154+
continue;
155+
}
156+
150157
let executableLocation = configs[i].executableLocation ? configs[i].executableLocation : data[i].success[j].filePath;
151158

152159
parsedConfigs[i].files.push({
@@ -189,8 +196,6 @@ export class FileParser {
189196
})) : [];
190197
}
191198

192-
parsedConfigs[i].failed = _.cloneDeep(data[i].failed);
193-
194199
localImagePromises.push(this.resolveFieldGlobs('localImages', configs[i], parsedConfigs[i], vParser).then((data) => {
195200
for (let j = 0; j < data.parsedConfig.files.length; j++) {
196201
data.parsedConfig.files[j].resolvedLocalImages = data.resolvedGlobs[j];
@@ -246,6 +251,13 @@ export class FileParser {
246251
if (found)
247252
break;
248253
}
254+
if (config.titleFromVariable.skipFileIfVariableWasNotFound && !found)
255+
data.success[i].extractedTitle = '';
256+
}
257+
}
258+
else if (config.titleFromVariable.skipFileIfVariableWasNotFound) {
259+
for (let i = 0; i < data.success.length; i++) {
260+
data.success[i].extractedTitle = '';
249261
}
250262
}
251263
}

src/lib/fuzzy-matcher.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,11 @@ export class FuzzyMatcher {
6666
}
6767

6868
private matchFromList(input: string, removeCharacters: boolean, removeBrackets: boolean) {
69+
if (input.length === 0){
70+
return { output: input, matched: false };
71+
}
6972
// Check if title contains ", The..."
70-
if (/,\s*the/i.test(input)) {
73+
else if (/,\s*the/i.test(input)) {
7174
let modifiedInput = input.replace(/(.*?),\s*(.*)/i, '$2 $1');
7275
modifiedInput = this.modifyString(modifiedInput, removeCharacters, removeBrackets);
7376
let matches = this.performMatching(modifiedInput);

src/models/language.model.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,7 @@ export interface languageStruct {
258258
skipWithMissingDataDir: string,
259259
useCredentials: string,
260260
tryToMatchTitle: string,
261+
skipFileIfVariableWasNotFound: string,
261262
caseInsensitiveVariables: string,
262263
fuzzy_use: string,
263264
fuzzy_removeCharacters: string,

src/models/user-configuration.model.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export interface UserConfiguration {
1414
parserInputs: { [inputKey: string]: string },
1515
titleFromVariable: {
1616
limitToGroups: string,
17+
skipFileIfVariableWasNotFound: boolean,
1718
caseInsensitiveVariables: boolean,
1819
tryToMatchTitle: boolean
1920
},

src/renderer/components/parsers.component.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,9 @@ export class ParsersComponent implements AfterViewInit, OnDestroy {
200200
caseInsensitiveVariables: new NestedFormElement.Toggle({
201201
text: this.lang.text.caseInsensitiveVariables
202202
}),
203+
skipFileIfVariableWasNotFound: new NestedFormElement.Toggle({
204+
text: this.lang.text.skipFileIfVariableWasNotFound
205+
}),
203206
tryToMatchTitle: new NestedFormElement.Toggle({
204207
text: this.lang.text.tryToMatchTitle
205208
})

src/renderer/schemas/user-configuration.schema.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export const userConfiguration = {
3636
default: {},
3737
properties: {
3838
limitToGroups: { type: 'string', default: '' },
39+
skipFileIfVariableWasNotFound: { type: 'boolean', default: false },
3940
caseInsensitiveVariables: { type: 'boolean', default: false },
4041
tryToMatchTitle: { type: 'boolean', default: false }
4142
}

0 commit comments

Comments
 (0)