mylar3 / mylar3

The python3 version of the automated Comic Book downloader (cbr/cbz) for use with various download clients.
GNU General Public License v3.0
1.08k stars 119 forks source link

Attempting to add series without any issues aren't handled gracefully #1208

Open baodrate opened 2 years ago

baodrate commented 2 years ago

Describe the bug Adding a series without any issues is not handled gracefully. They are treated as "added" but the series information isn't fully loaded and no error message is presented (series cover and title are placeholders, and series info page says "Comic information is currently being loaded" indefinitely)

Is it absolutely necessary to have issues before populating the series information? Currently, adding a series without any issues (e.g. at time of writing: Robyn Hood: Hearts of Darkness) causes an unhandled exception that prevents the series from fully adding.

If it is required by the implementation that the series have issues, this ticket can be closed (although I think in that case the 'Add this comic' link should be disabled or a more clear error message should be displayed to the user).

Environment (please complete the following information):

Additional information Example traceback:

13-May-2022 18:05:01 - INFO    :: mylar.addbyid.1247 : CP Server Thread-3 : Attempting to add Robyn Hood: Hearts of Darkness
13-May-2022 18:05:01 - INFO    :: mylar.addbyid.1290 : CP Server Thread-3 : [SHIZZLE-WHIZZLE] Now queueing to add Robyn Hood: Hearts of Darkness [142929]
13-May-2022 18:05:01 - INFO    :: mylar.importer_thread.1863 : CP Server Thread-3 : [MASS-ADD] MASS_ADD thread not started. Started & submitting.
13-May-2022 18:05:04 - INFO    :: mylar.addvialist.63 : mass-add : [MASS-ADD][1/1] Now adding Robyn Hood: Hearts of Darkness [142929]
13-May-2022 18:05:06 - ERROR   :: mylar.excepthook.315 : mass-add : Uncaught exception: Traceback (most recent call last):
  File "/app/mylar/logger.py", line 337, in new_run
    old_run(*args, **kwargs)
  File "/usr/lib/python3.9/threading.py", line 910, in run
    self._target(*self._args, **self._kwargs)
  File "/app/mylar/importer.py", line 69, in addvialist
    addComictoDB(item['comicid'])
  File "/app/mylar/importer.py", line 142, in addComictoDB
    comic = cv.getComic(comicid, 'comic', series=True)
  File "/app/mylar/cv.py", line 174, in getComic
    return GetComicInfo(comicid, dom, series=series)
  File "/app/mylar/cv.py", line 369, in GetComicInfo
    comic['FirstIssueID'] = dom.getElementsByTagName('id')[0].firstChild.wholeText
IndexError: list index out of range
evilhero commented 2 years ago

When you add a series to mylar, it's with the intention of being able to download issues from that series. Without issues, there's no point to adding the series as mylar can't do anything with just that info alone.

As far as being able to disable the button, while I like the idea, it might result in additional api calls to CV in order to determine if there are issues present, which would have to be done prior to displaying the search results page, which would mean longer load times for the results, which can take abit already as it is.

Throwing a better error message is also possible, especially since the results page has been redone - that wasn't added at the time as when it was created, CV wasn't being dumb and allowing people to blindly create series with no issues attached (which is the reason people use CV).

This won't get an immediate fix, as I'm AWOL for an undetermined amount of time, but it can definitely be looked into thereafter.

baodrate commented 2 years ago

When you add a series to mylar, it's with the intention of being able to download issues from that series. Without issues, there's no point to adding the series as mylar can't do anything with just that info alone.

I just assumed that it would add an empty series that would eventually update whenever new issues were committed. It would be useful for my personal organizing purposes to have a directory/page associated with the series even if issues have yet to be added. That said, series having at least one issue is a completely fair assumption and I wouldn't fault you for enforcing it.

As far as being able to disable the button, while I like the idea, it might result in additional api calls to CV in order to determine if there are issues present

I agree that would be quite undesirable

This won't get an immediate fix, as I'm AWOL for an undetermined amount of time

I had not realized, sorry. In the meantime I will see if I can dig into the code and figure out a (hopefully elegant) fix