Tenma-Server / Tenma

Comic book server with in-browser reader
MIT License
251 stars 31 forks source link

Comic import fails due to issue having a non-integer comic number #51

Open bpepple opened 7 years ago

bpepple commented 7 years ago

Attempting to import an issue, and it fails due to sql integrity error. This is a fairly common error due to special issues the big two companies put out (in this case due to the Marvel Monster Unleashed event which has issue number such as '1.MU')

https://comicvine.gamespot.com/champions-1mu/4000-582520/

[2017-10-30 16:36:04,133: ERROR/MainProcess] Task reprocess_issue_task[9f131a0e-b9ee-4a81-beb6-70955d754b9f] raised unexpected: ValueError("invalid literal for int() with base 10: '1.MU'",)
Traceback (most recent call last):
  File "/home/bpepple/Documents/venv/lib/python3.6/site-packages/celery/app/trace.py", line 240, in trace_task
    R = retval = fun(*args, **kwargs)
  File "/home/bpepple/Documents/venv/lib/python3.6/site-packages/celery/app/trace.py", line 438, in __protected_call__
    return self.run(*args, **kwargs)
  File "/home/bpepple/Documents/venv/Tenma/comics/tasks.py", line 13, in reprocess_issue_task
    comicimporter.reprocess_issue(issue_id)
  File "/home/bpepple/Documents/venv/Tenma/comics/utils/comicimporter.py", line 112, in reprocess_issue
    self._process_issue(issue.file, cvid)
  File "/home/bpepple/Documents/venv/Tenma/comics/utils/comicimporter.py", line 403, in _process_issue
    issue = self._update_issue(matching_issue[0].id, response_issue['results']['api_detail_url'], series.id)
  File "/home/bpepple/Documents/venv/Tenma/comics/utils/comicimporter.py", line 935, in _update_issue
    cover=data['image'],
  File "/home/bpepple/Documents/venv/lib/python3.6/site-packages/django/db/models/query.py", line 637, in update
    rows = query.get_compiler(self.db).execute_sql(CURSOR)
  File "/home/bpepple/Documents/venv/lib/python3.6/site-packages/django/db/models/sql/compiler.py", line 1148, in execute_sql
    cursor = super(SQLUpdateCompiler, self).execute_sql(result_type)
  File "/home/bpepple/Documents/venv/lib/python3.6/site-packages/django/db/models/sql/compiler.py", line 824, in execute_sql
    sql, params = self.as_sql()
  File "/home/bpepple/Documents/venv/lib/python3.6/site-packages/django/db/models/sql/compiler.py", line 1112, in as_sql
    val = field.get_db_prep_save(val, connection=self.connection)
  File "/home/bpepple/Documents/venv/lib/python3.6/site-packages/django/db/models/fields/__init__.py", line 755, in get_db_prep_save
    prepared=False)
  File "/home/bpepple/Documents/venv/lib/python3.6/site-packages/django/db/models/fields/__init__.py", line 747, in get_db_prep_value
    value = self.get_prep_value(value)
  File "/home/bpepple/Documents/venv/lib/python3.6/site-packages/django/db/models/fields/__init__.py", line 1832, in get_prep_value
    return int(value)
ValueError: invalid literal for int() with base 10: '1.MU'
hmhrex commented 7 years ago

This looks like a fun one! I’ll take a look at this one soon.