Skip to content
This repository has been archived by the owner on Feb 10, 2023. It is now read-only.

Commit

Permalink
Add description to megajson
Browse files Browse the repository at this point in the history
  • Loading branch information
suchmememanyskill committed Aug 10, 2022
1 parent bc6bb7a commit c626285
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,13 +157,15 @@ def toDict(self):
target = self.target
repo = self.repoUrl
manifestVersion = 1
description = None

if self.repo != None:
name = self.repo.name
version = self.repo.version
author = self.repo.author
target = self.repo.target
manifestVersion = self.repo.manifestVersion
description = self.repo.description

if self.megaJsonEntry != None:
def possiblyReturnMegaJsonStuff(attribute : str, original):
Expand All @@ -177,6 +179,7 @@ def possiblyReturnMegaJsonStuff(attribute : str, original):
author = possiblyReturnMegaJsonStuff("author", author)
target = possiblyReturnMegaJsonStuff("target", target)
manifestVersion = possiblyReturnMegaJsonStuff("manifest_version", manifestVersion)
description = possiblyReturnMegaJsonStuff("description", description)

return {
"id": themeId,
Expand All @@ -189,6 +192,7 @@ def possiblyReturnMegaJsonStuff(attribute : str, original):
"target": target,
"source": repo,
"manifest_version": manifestVersion,
"description": description,
}

class Repo:
Expand All @@ -203,6 +207,7 @@ def __init__(self, repoReference : RepoReference):
self.themePath = None
self.repoPath = None
self.manifestVersion = None
self.description = None

def get(self):
tempDir = tempfile.TemporaryDirectory()
Expand Down Expand Up @@ -262,11 +267,12 @@ def upload(self):

def read(self, json : dict):
self.json = json
self.name = json["name"] if "name" in json else None
self.version = json["version"] if "version" in json else "v1.0"
self.author = json["author"] if "author" in json else None # This isn't required by the css loader but should be for the theme store
self.target = json["target"] if "target" in json else self.target # This isn't used by the css loader but used for sorting instead
self.name = str(json["name"]) if "name" in json else None
self.version = str(json["version"]) if "version" in json else "v1.0"
self.author = str(json["author"]) if "author" in json else None # This isn't required by the css loader but should be for the theme store
self.target = str(json["target"]) if "target" in json else self.target # This isn't used by the css loader but used for sorting instead
self.manifestVersion = int(json["manifest_version"]) if "manifest_version" in json else 1
self.description = str(json["description"]) if "description" in json else ""

def verify(self):
if self.json is None:
Expand Down

0 comments on commit c626285

Please sign in to comment.