Coder Social home page Coder Social logo

bgg_collection2pdf's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

bgg_collection2pdf's Issues

'NoneType' object has no attribute 'text'

$ python generate_pdf.py 
WARNING:root:UserName:  was not valid
Enter your BGG UserName: rkonigsberg
INFO:root:UserName: rkonigsberg is valid
INFO:root:starting
WARNING:root:Reading collection from bgg
Traceback (most recent call last):
  File "generate_pdf.py", line 377, in <module>
    items = read_collection(config)
  File "generate_pdf.py", line 273, in read_collection
    collection_response = bgg_getter('collection',params, config)
  File "generate_pdf.py", line 97, in bgg_getter
    logging.info("Sleeping " + str(config.sleep_time) + " Seconds: " + (error.find('message').text if error != None else str(status)))
AttributeError: 'NoneType' object has no attribute 'text'
$

Import Library Failing

davidmcdougal@Davids-MacBook-Air bgg_collection2pdf-main % python3 generate_pdf.py --username davidmcdougal
Traceback (most recent call last):
File "/Users/davidmcdougal/Downloads/bgg_collection2pdf-main/generate_pdf.py", line 3, in
import requests
ModuleNotFoundError: No module named 'requests'
davidmcdougal@Davids-MacBook-Air bgg_collection2pdf-main %

Greenshot 2022-10-10 14 48 31

CSS has a slight misalignment

image

My assumption is this is related to combining percentages and pixels. I've avoided learning the CSS box grammar, but this might be a good time to do it. :D

The script errors out if game_info.image is None

My entry for "Funkoverse Strategy Game: Space Jam A New Legacy 100" returns nothing back for the image URL. The script then errors out with:

Traceback (most recent call last):
  File "./generate_pdf.py", line 463, in <module>
    download_image(config, game_info)
  File "./generate_pdf.py", line 227, in download_image
    res = requests.get(game_info.image, stream = True)
  File "/usr/lib/python3.6/site-packages/requests/api.py", line 70, in get
    return request('get', url, params=params, **kwargs)
  File "/usr/lib/python3.6/site-packages/requests/api.py", line 56, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/lib/python3.6/site-packages/requests/sessions.py", line 474, in request
    prep = self.prepare_request(req)
  File "/usr/lib/python3.6/site-packages/requests/sessions.py", line 407, in prepare_request
    hooks=merge_hooks(request.hooks, self.hooks),
  File "/usr/lib/python3.6/site-packages/requests/models.py", line 302, in prepare
    self.prepare_url(url, params)
  File "/usr/lib/python3.6/site-packages/requests/models.py", line 382, in prepare_url
    raise MissingSchema(error)
requests.exceptions.MissingSchema: Invalid URL 'None': No schema supplied. Perhaps you meant http://None?

I got around the error with a simple None check in download_image, though the resulting output still reference a non-existent image:

            #Download the image to the local cache.
            if (game_info.image is None):
                logging.warning(game_info.name + " has no image url")
            else:
                res = requests.get(game_info.image, stream = True)
                if res.status_code == 200:
                    logging.info("Writing: " + collection_info.game_name + " boxart to " + os.path.join(config.images_path, game_info.obj_id + ".jpg"))
                    with open(os.path.join(config.images_path, game_info.obj_id + ".jpg"), 'wb') as f:
                        shutil.copyfileobj(res.raw, f)

Perhaps adding a "no image" placeholder jpg and referencing that in the output in this case?

"/usr/lib/python3.9/xml/etree/ElementTree.py", line 1348 throws exception with Python 3.9

There may be something that can be done to patch this issue in the script. However, it seems to be occurring in ElementTree.py

I'm unable to reproduce the issue with Python 3.10.2

WARNING:root:UserName: was not valid
Enter your BGG UserName: packrat84
INFO:root:UserName: packrat84 is valid
INFO:root:starting
WARNING:root:Reading ./collection.xml
Traceback (most recent call last):
File "/mnt/c/users/frankk/OneDrive/Boredgames/BGG/bgg_collection2pdf/generate_pdf.py", line 391, in <module>
thisgameitems = ElementTree.fromstring(file.read())
File "/usr/lib/python3.9/xml/etree/ElementTree.py", line 1348, in XML
return parser.close()
xml.etree.ElementTree.ParseError: no element found: line 1, column 0

Title displayed is not title used for alphabetizing

It looks like the main entry name from BGG is going into the titles of the entries on the page, but the alphabetical order instead follows the (invisible) version name. You can see this pretty early in my collection (fiddly_bits) with Werewolf (version: Are You a Werewolf?), Miscellaneous Game Collection (version: 56 Games), and two versions of the Decktet (Decktet and Double Decktet) which have become separated.

It may or may not be an issue for you that my two versions of the Decktet are being displayed as separate entries as well. Usually BGG doesn't double the entries like this when listing games with multiple versions, but you still may want to.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.