-
-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ce0c244
commit b618e0a
Showing
21 changed files
with
138 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Non-SRM Shortcut Parser | ||
|
||
This parser imports non SRM steam shortcuts into SRM so their artowrk can be managed. It does not add shortcuts, and as such is an `Artwork Only` parser. This parser requires the `User Accounts` field to be set. | ||
|
||
## User accounts (required) | ||
|
||
Used to limit configuration to specific user accounts. In order to set user accounts, the following syntax must be used: | ||
``` | ||
${...} | ||
``` | ||
You **must** use the username you use to **log in** into Steam **if** [use account credentials](#what-does-use-account-credentials-do) is enabled: | ||
|
||
![Account example](../../../assets/images/user-account-example.png) {.fitImage .center} | ||
|
||
For example, this is how you specify account for "Banana" and "Apple": | ||
|
||
``` | ||
${Banana}${Apple} | ||
``` | ||
|
||
You can also limit accounts by specifying their ids directly. For example: | ||
|
||
``` | ||
${56489124}${21987424} | ||
``` | ||
Would limit the search to `steam/userdata/56489124` and `steam/userdata/21987424`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { ParserInfo, GenericParser, ParsedData, VDF_ListData } from '../../models'; | ||
import { APP } from '../../variables'; | ||
import * as path from 'path'; | ||
import * as steam from '../helpers/steam' | ||
const shortcutsParser = require('steam-shortcut-editor'); | ||
|
||
import * as fs from 'fs'; | ||
|
||
export class NonSRMShortcutsParser implements GenericParser { | ||
|
||
private get lang() { | ||
return APP.lang.nonSRMShortcutsParser; | ||
} | ||
getParserInfo(): ParserInfo { | ||
return { | ||
title: 'Non-SRM Shortcuts', | ||
info: this.lang.docs__md.self.join(''), | ||
inputs: {} | ||
}; | ||
} | ||
|
||
execute(directories: string[], inputs: { [key: string]: any }, cache?: { [key: string]: any }) { | ||
return new Promise<ParsedData>(async (resolve, reject)=>{ | ||
if(!directories || directories.length==0){ | ||
return reject(this.lang.errors.noSteamAccounts); | ||
} | ||
try { | ||
const parsedData: ParsedData = { success: [], failed: [] } | ||
for(let userdir of directories) { | ||
const shortcutsPath = path.join(userdir,'config','shortcuts.vdf') | ||
const addedItemsPath = path.join(userdir,'config','addedItemsV2.json') | ||
const addedItems = fs.existsSync(addedItemsPath) ? JSON.parse(fs.readFileSync(addedItemsPath,'utf8')) : {}; | ||
const addedAppIds = Object.keys(addedItems.addedApps).filter(appId=>!addedItems.addedApps[appId].artworkOnly) | ||
if(fs.existsSync(shortcutsPath)) { | ||
const {shortcuts} = shortcutsParser.parseBuffer(fs.readFileSync(shortcutsPath)); | ||
const mappedApps = shortcuts.filter((shortcut: any) => { | ||
return !addedAppIds.includes(steam.appifyShortcutId(shortcut.appid)) | ||
}).map((shortcut: any) => { return { | ||
extractedTitle: shortcut.appname, | ||
extractedAppId: steam.shortenAppId(steam.appifyShortcutId(shortcut.appid)) | ||
}}) | ||
parsedData.success=[...parsedData.success, ...mappedApps] | ||
} | ||
} | ||
resolve(parsedData) | ||
} catch(e) { | ||
reject(this.lang.errors.fatalError__i.interpolate({error: e})) | ||
} | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters