Worked on the out of date method a bit. All the checking logic is in place. But it adds a new record instead of updating the existing record.
This commit is contained in:
20
main.py
20
main.py
@@ -170,13 +170,15 @@ def upgrade():
|
|||||||
|
|
||||||
@app.route('/ood/', methods=['GET'])
|
@app.route('/ood/', methods=['GET'])
|
||||||
def ood():
|
def ood():
|
||||||
|
|
||||||
|
added = []
|
||||||
|
|
||||||
url = []
|
url = []
|
||||||
base = []
|
base = []
|
||||||
name = []
|
name = []
|
||||||
y = 0
|
y = 0
|
||||||
z = 0
|
z = 0
|
||||||
|
|
||||||
mangaName = manga.query().all()
|
|
||||||
|
|
||||||
with open(PATH + "/tach.json", "r") as tf:
|
with open(PATH + "/tach.json", "r") as tf:
|
||||||
# with open("tach.json", "r") as tf:
|
# with open("tach.json", "r") as tf:
|
||||||
@@ -190,6 +192,22 @@ def ood():
|
|||||||
base.append(data["mangas"][y]["manga"][2])
|
base.append(data["mangas"][y]["manga"][2])
|
||||||
y = y + 1
|
y = y + 1
|
||||||
|
|
||||||
|
for each in name:
|
||||||
|
# print('start')
|
||||||
|
if manga.query.filter_by(name=name[z]).first():
|
||||||
|
result = manga.query.filter_by(name=name[z]).first()
|
||||||
|
if result.url != url[z]:
|
||||||
|
new_manga={}
|
||||||
|
# print('----' + name[z])
|
||||||
|
# print(url[z])
|
||||||
|
# print(result.url)
|
||||||
|
query = manga(name=name[z], url=url[z], url_flag=str(base[z]), view_format=0, unknown_value=0)
|
||||||
|
new_manga['title'] = name[z]
|
||||||
|
added.append(new_manga)
|
||||||
|
db.session.add(query)
|
||||||
|
z = z + 1
|
||||||
|
db.session.commit()
|
||||||
|
return jsonify(updated=added)
|
||||||
|
|
||||||
@app.route('/test/', methods=['GET'])
|
@app.route('/test/', methods=['GET'])
|
||||||
def test():
|
def test():
|
||||||
|
|||||||
Reference in New Issue
Block a user