Import categories from appstream into tags
This commit is contained in:
parent
c329a5a428
commit
d6f387bcc4
|
@ -57,7 +57,6 @@ tags = { x.name : x for x in Tag.query.all() }
|
|||
admin_user = User.query.filter_by(username="appstream").first()
|
||||
|
||||
|
||||
'''
|
||||
for ss in PackageScreenshot.query.all():
|
||||
if ss.package.cover_image == ss:
|
||||
ss.package.cover_image = None
|
||||
|
@ -68,7 +67,6 @@ for ss in PackageScreenshot.query.all():
|
|||
for game in Package.query.all():
|
||||
session.delete(game)
|
||||
session.commit()
|
||||
'''
|
||||
|
||||
if not admin_user:
|
||||
admin_user = User("appstream")
|
||||
|
@ -96,13 +94,18 @@ for app in apps:
|
|||
licenses[row.name] = row
|
||||
session.add(row)
|
||||
session.commit()
|
||||
for category in app.get_categories():
|
||||
if category.lower() not in tags:
|
||||
row = Tag(category)
|
||||
tags[row.name] = row
|
||||
print("adding tag: ", row.name)
|
||||
session.add(row)
|
||||
game1.tags.append(tags[category.lower()])
|
||||
game1.license = licenses[license]
|
||||
#game1.license = licenses[app.get_project_license()]
|
||||
game1.media_license = licenses["MIT"]
|
||||
game1.author = admin_user
|
||||
game1.tags.append(tags["pvp"])
|
||||
game1.tags.append(tags["survival"])
|
||||
game1.tags.append(tags["multiplayer"])
|
||||
|
||||
|
||||
for url,t in urls:
|
||||
if t == "bugtracker":
|
||||
game1.issueTracker = url
|
||||
|
@ -110,7 +113,7 @@ for app in apps:
|
|||
game1.repo = url
|
||||
|
||||
game1.forums = 12835
|
||||
game1.short_desc = app.get_comment()
|
||||
game1.short_desc = "" or app.get_comment()
|
||||
game1.desc = app.get_description()
|
||||
session.add(game1)
|
||||
|
||||
|
|
Loading…
Reference in New Issue