various updates and changes, move admin widgets into different seperate dialogs
This commit is contained in:
@@ -12,7 +12,6 @@ def csv_to_list(path: str) -> list[str]:
|
||||
reader = csv.reader(csvfile, delimiter=";", quotechar="|")
|
||||
ret = []
|
||||
for row in reader:
|
||||
print(row)
|
||||
ret.append(row[0].replace('"', ""))
|
||||
return ret
|
||||
|
||||
@@ -20,4 +19,4 @@ def csv_to_list(path: str) -> list[str]:
|
||||
if __name__ == "__main__":
|
||||
text = csv_to_list("C:/Users/aky547/Desktop/semap/71.csv")
|
||||
# remove linebreaks
|
||||
print(text)
|
||||
# print(text)
|
||||
|
||||
@@ -21,7 +21,7 @@ class ApparatData:
|
||||
|
||||
def get_prof_details(self) -> dict:
|
||||
return {
|
||||
"prof_title": self.prof_title,
|
||||
"title": self.prof_title,
|
||||
"profname": self.profname,
|
||||
"prof_mail": self.prof_mail,
|
||||
"prof_tel": self.prof_tel,
|
||||
@@ -62,7 +62,7 @@ class BookData:
|
||||
else:
|
||||
pattern = r"(\w+)='([^']*)'"
|
||||
data_dict = dict(re.findall(pattern, data))
|
||||
print(data_dict)
|
||||
# print(data_dict)
|
||||
for key, value in data_dict.items():
|
||||
setattr(self, key, value)
|
||||
return self
|
||||
|
||||
@@ -35,26 +35,31 @@ class BookGrabber(QThread):
|
||||
self.logger.log_info(f"Working on {len(self.data)} entries")
|
||||
self.tstate = (self.app_id, self.prof_id, self.mode, self.data)
|
||||
self.logger.log_debug("State: " + str(self.tstate))
|
||||
print(self.tstate)
|
||||
# print(self.tstate)
|
||||
|
||||
def run(self):
|
||||
self.db = Database()
|
||||
item = 0
|
||||
iterdata = self.data
|
||||
print(iterdata)
|
||||
# print(iterdata)
|
||||
if self.prof_id is None:
|
||||
self.prof_id = self.db.getProfNameByApparat(self.app_id)
|
||||
for entry in iterdata:
|
||||
print(entry)
|
||||
# print(entry)
|
||||
signature = str(entry)
|
||||
self.logger.log_info("Processing entry: " + signature)
|
||||
|
||||
webdata = WebRequest(self.appnr).get_ppn(entry).get_data()
|
||||
if webdata == "error":
|
||||
continue
|
||||
|
||||
bd = BibTextTransformer(self.mode).get_data(webdata).return_data()
|
||||
bd.signature = entry
|
||||
transformer = (
|
||||
BibTextTransformer("RDS").get_data(webdata).return_data("rds_data")
|
||||
)
|
||||
if bd is None:
|
||||
continue
|
||||
# confirm lock is acquired
|
||||
self.db.addBookToDatabase(bd, self.app_id, self.prof_id)
|
||||
# get latest book id
|
||||
@@ -62,13 +67,13 @@ class BookGrabber(QThread):
|
||||
self.logger.log_info("Added book to database")
|
||||
state = 0
|
||||
for result in transformer.RDS_DATA:
|
||||
print(result.RDS_LOCATION)
|
||||
# print(result.RDS_LOCATION)
|
||||
if str(self.app_id) in result.RDS_LOCATION:
|
||||
state = 1
|
||||
break
|
||||
|
||||
self.logger.log_info(f"State of {signature}: {state}")
|
||||
print("updating availability of " + str(self.book_id) + " to " + str(state))
|
||||
# print("updating availability of " + str(self.book_id) + " to " + str(state))
|
||||
try:
|
||||
self.db.setAvailability(self.book_id, state)
|
||||
except sqlite3.OperationalError as e:
|
||||
@@ -100,7 +105,7 @@ class BookGrabber(QThread):
|
||||
# self.mode = mode
|
||||
# self.book_id = None
|
||||
# self.state = (self.app_id, self.prof_id, self.mode, self.data)
|
||||
# print(self.state)
|
||||
# # print(self.state)
|
||||
# self.logger.log_info("state: " + str(self.state))
|
||||
# # time.sleep(2)
|
||||
|
||||
@@ -116,9 +121,9 @@ class BookGrabber(QThread):
|
||||
# self.db = Database()
|
||||
# item = 0
|
||||
# iterdata = self.data
|
||||
# print(iterdata)
|
||||
# # print(iterdata)
|
||||
# for entry in iterdata:
|
||||
# print(entry)
|
||||
# # print(entry)
|
||||
# signature = str(entry)
|
||||
# self.logger.log_info("Processing entry: " + signature)
|
||||
|
||||
@@ -135,7 +140,7 @@ class BookGrabber(QThread):
|
||||
# self.book_id = self.db.getLastBookId()
|
||||
# self.logger.log_info("Added book to database")
|
||||
# state = 0
|
||||
# print(len(rds.items))
|
||||
# # print(len(rds.items))
|
||||
# for rds_item in rds.items:
|
||||
# sign = rds_item.superlocation
|
||||
# loc = rds_item.location
|
||||
@@ -146,7 +151,7 @@ class BookGrabber(QThread):
|
||||
# break
|
||||
|
||||
# self.logger.log_info(f"State of {signature}: {state}")
|
||||
# print(
|
||||
# # print(
|
||||
# "updating availability of "
|
||||
# + str(self.book_id)
|
||||
# + " to "
|
||||
|
||||
@@ -23,8 +23,8 @@ class AutoAdder(QThread):
|
||||
self.app_id = app_id
|
||||
self.prof_id = prof_id
|
||||
|
||||
print("Launched AutoAdder")
|
||||
print(self.data, self.app_id, self.prof_id)
|
||||
# print("Launched AutoAdder")
|
||||
# print(self.data, self.app_id, self.prof_id)
|
||||
|
||||
def run(self):
|
||||
self.db = Database()
|
||||
@@ -41,11 +41,11 @@ class AutoAdder(QThread):
|
||||
# qsleep
|
||||
item += 1
|
||||
self.progress.emit(item)
|
||||
print(item, len(self.data))
|
||||
# print(item, len(self.data))
|
||||
time.sleep(1)
|
||||
|
||||
except Exception as e:
|
||||
print(e)
|
||||
# print(e)
|
||||
self.logger.log_exception(
|
||||
f"The query failed with message {e} for signature {entry}"
|
||||
)
|
||||
|
||||
@@ -52,7 +52,7 @@ class AvailChecker(QThread):
|
||||
for item in rds.items:
|
||||
sign = item.superlocation
|
||||
loc = item.location
|
||||
# print(item.location)
|
||||
# # print(item.location)
|
||||
if self.appnumber in sign or self.appnumber in loc:
|
||||
state = 1
|
||||
break
|
||||
@@ -61,7 +61,7 @@ class AvailChecker(QThread):
|
||||
book_id = book["id"]
|
||||
break
|
||||
self.logger.log_info(f"State of {link}: " + str(state))
|
||||
print("Updating availability of " + str(book_id) + " to " + str(state))
|
||||
# print("Updating availability of " + str(book_id) + " to " + str(state))
|
||||
self.db.setAvailability(book_id, state)
|
||||
count += 1
|
||||
self.updateProgress.emit(count, len(self.links))
|
||||
|
||||
@@ -184,7 +184,7 @@ class ZoteroController:
|
||||
book = bib.return_data()
|
||||
return book
|
||||
|
||||
# print(zot.item_template("bookSection"))
|
||||
# # print(zot.item_template("bookSection"))
|
||||
def createBook(self, isbn):
|
||||
book = self.__get_data(isbn)
|
||||
|
||||
@@ -207,7 +207,7 @@ class ZoteroController:
|
||||
def createItem(self, item):
|
||||
resp = self.zot.create_items([item])
|
||||
if "successful" in resp.keys():
|
||||
print(resp["successful"]["0"]["key"])
|
||||
# print(resp["successful"]["0"]["key"])
|
||||
return resp["successful"]["0"]["key"]
|
||||
else:
|
||||
return None
|
||||
@@ -217,7 +217,7 @@ class ZoteroController:
|
||||
for item in items:
|
||||
if item["key"] == key:
|
||||
self.zot.delete_item(item)
|
||||
print(item)
|
||||
# print(item)
|
||||
break
|
||||
|
||||
def createHGSection(self, book: Book, data: dict):
|
||||
@@ -238,7 +238,7 @@ class ZoteroController:
|
||||
]
|
||||
chapter.creators += authors
|
||||
|
||||
print(chapter.to_dict())
|
||||
# print(chapter.to_dict())
|
||||
return self.createItem(chapter.to_dict())
|
||||
pass
|
||||
|
||||
@@ -254,7 +254,7 @@ class ZoteroController:
|
||||
# chapter.creators
|
||||
|
||||
def createJournalArticle(self, journal, article):
|
||||
print(type(article))
|
||||
# print(type(article))
|
||||
journalarticle = JournalArticle()
|
||||
journalarticle.assign(journal)
|
||||
journalarticle.itemType = "journalArticle"
|
||||
@@ -270,7 +270,7 @@ class ZoteroController:
|
||||
journalarticle.issue = article["issue"]
|
||||
journalarticle.url = article["isbn"]
|
||||
|
||||
print(journalarticle.to_dict())
|
||||
# print(journalarticle.to_dict())
|
||||
|
||||
return self.createItem(journalarticle.to_dict())
|
||||
|
||||
@@ -316,16 +316,16 @@ if __name__ == "__main__":
|
||||
# if isinstance(publishers, str):
|
||||
# publishers = [publishers]
|
||||
# for publisher in publishers:
|
||||
# print(publisher)
|
||||
# # print(publisher)
|
||||
# creator = Creator().from_string(publisher)
|
||||
# creator.creatorType = "editor"
|
||||
# authors.append(creator.__dict__)
|
||||
|
||||
# chapter.creators = authors
|
||||
# chapter.publisher = book.publisher
|
||||
# print(chapter.to_dict())
|
||||
# # print(chapter.to_dict())
|
||||
# createBookSection(chapter.to_dict())
|
||||
# get_citation("9ZXH8DDE")
|
||||
# # print()
|
||||
# print(get_books())
|
||||
# print(zot.item_creator_types("bookSection"))
|
||||
# # # print()
|
||||
# # print(get_books())
|
||||
# # print(zot.item_creator_types("bookSection"))
|
||||
|
||||
Reference in New Issue
Block a user