Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
James Campbell committed Aug 1, 2019
1 parent 5c2f01e commit b3062a9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
2 changes: 1 addition & 1 deletion folders2json/folders2json.py
@@ -1,6 +1,6 @@
from .functions import GetFullPathFiles, GetDevices, GenerateJson, prep

__version__ = "1.1.1"
__version__ = "1.1.2"


def main():
Expand Down
24 changes: 11 additions & 13 deletions folders2json/functions.py
Expand Up @@ -59,19 +59,17 @@ def GenerateJson(deviceiddict, win, fullpathfiles):
for item in value:
absfullfinal.append(f"file:/{item}")
finaldict["urls"] = absfullfinal
partsofpath = Path(fullpathfiles[0]).parts
if len(partsofpath) > 3:
finaldict["metadata"] = {
"objective": partsofpath[0],
"batch": partsofpath[1],
"device": key
}
else:
finaldict["metadata"] = {
"objective": Path(fullpathfiles[1]).parts[0],
"batch": Path(fullpathfiles[1]).parts[1],
"device": key
}
for pathitem in fullpathfiles:
partsofpath = Path(pathitem).parts
if len(partsofpath) > 3 and key in partsofpath:
finaldict["metadata"] = {
"objective": partsofpath[0],
"batch": partsofpath[1],
"device": key
}
break
else:
continue
finaldict["params"] = {}
if os.path.exists(f"{key}.json"):
os.remove(f"{key}.json")
Expand Down

0 comments on commit b3062a9

Please sign in to comment.