-
Notifications
You must be signed in to change notification settings - Fork 131
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: vdffz.py missing, dropping vdffz does nothing
- Loading branch information
Showing
2 changed files
with
30 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/usr/bin/env python2 | ||
""" | ||
Imports VDFFZ profile and converts it to Profile object. | ||
VDFFZ is just VDF encapsulated in json, so this just gets one value and calls | ||
VDFProfile to decode rest. | ||
""" | ||
from vdf import VDFProfile | ||
from scc.lib.vdf import parse_vdf | ||
|
||
import json, logging | ||
log = logging.getLogger("import.vdffz") | ||
|
||
class VDFFZProfile(VDFProfile): | ||
def load(self, filename): | ||
try: | ||
data = json.loads(open(filename, "r").read()) | ||
except Exception, e: | ||
raise ValueError("Failed to parse JSON") | ||
if 'ConfigData' not in data: | ||
raise ValueError("ConfigData missing in JSON") | ||
self.load_data(parse_vdf(data['ConfigData'].encode('utf-8'))) |
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