Skip to content

Commit

Permalink
Fixed missing logo error #14
Browse files Browse the repository at this point in the history
  • Loading branch information
OwenCochell committed Nov 25, 2022
1 parent 9f3eb59 commit de6f65f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
21 changes: 14 additions & 7 deletions cursepy/handlers/metacf.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
from cursepy.classes.search import SearchParam, url_convert
from cursepy.errors import HandlerNotSupported

# TODO: Remove this

import pprint

class BaseMetaCFHandler(URLHandler):
"""
Expand Down Expand Up @@ -309,20 +312,24 @@ def format(data: dict) -> base.CurseAddon:
for auth in data['authors']
]

# Create the logo attachment:

logoa = data['logo']

logo = base.CurseAttachment(logoa['title'], logoa['id'], logoa['thumbnailUrl'] if 'thumbnailUrl' in logoa.keys() else logoa['thumbnailurl'], logoa['url'], True, data['id'], logoa['description'])

# Create other attachments, named screenshots by CF:

attach = [
base.CurseAttachment(att['title'], att['id'], att['thumbnailUrl'], att['url'], False, data['id'], att['description'])
for att in data['screenshots']
]

attach.insert(0, logo)
# Create the logo attachment:

logoa = data['logo']

if logoa is not None:

logo = base.CurseAttachment(logoa['title'], logoa['id'], logoa['thumbnailUrl'] if 'thumbnailUrl' in logoa.keys() else logoa['thumbnailurl'], logoa['url'], True, data['id'], logoa['description'])

# Append the logo to the attachments

attach.insert(0, logo)

# Create catagories:

Expand Down
1 change: 1 addition & 0 deletions docs/source/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Features Added
Bug Fixes
---------

* Fixed a bug where cursepy fails if the addon does not have a logo
* Fixed a syntax error while getting the file a dependency is apart of

2.1.0
Expand Down

0 comments on commit de6f65f

Please sign in to comment.