Update MgrCalibreDB.py, UI.py, and 4 more files...
This commit is contained in:
29
pupildata.py
29
pupildata.py
@@ -1,4 +1,5 @@
|
||||
import json
|
||||
import os
|
||||
|
||||
import UtilPack as util
|
||||
import DataClass as info
|
||||
@@ -21,23 +22,35 @@ JTITLE = "japanese_title"
|
||||
class PupuilInfoFile:
|
||||
m_data = None
|
||||
|
||||
def __init__(self, path):
|
||||
self.path = path
|
||||
def __init__(self, argv):
|
||||
self.argv = argv
|
||||
|
||||
def __enter__(self):
|
||||
self.DBXLSOpen(self.path)
|
||||
self.PupilJSONOpen(self.argv)
|
||||
|
||||
def __exit__(self, ex_type, ex_value, traceback):
|
||||
self.DBXLSClose()
|
||||
pass
|
||||
|
||||
def PupilJSONOpen(self, path):
|
||||
with open(path, 'r') as file:
|
||||
self.m_data = json.load(file)
|
||||
def PupilJSONOpen(self, argv):
|
||||
if True == util.IsEmptyStr(argv):
|
||||
print("PupilData: input Null")
|
||||
return
|
||||
|
||||
if True == os.path.exists(argv):
|
||||
print("pupildata : file")
|
||||
with open(argv, "r", encoding="utf-8") as file:
|
||||
self.m_data = json.load(file)
|
||||
else:
|
||||
print("pupildata : text")
|
||||
self.m_data = json.loads(argv)
|
||||
|
||||
# pupil 의 JSON 을 파싱해서 DataClass 에 데이터를 넣어 반환한다.
|
||||
def GetInfo(self):
|
||||
if None == self.m_data and None != self.argv:
|
||||
self.m_data = self.PupilJSONOpen(self.argv)
|
||||
|
||||
if None == self.m_data:
|
||||
return None
|
||||
return
|
||||
|
||||
title = self.m_data[GALINFO]["title"]
|
||||
url = self.m_data[GALBLOCK]["galleryUrl"]
|
||||
|
||||
Reference in New Issue
Block a user