Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exeption: calibre_plugins.fanficfare_plugin.jobs(450): Exception #1105

Closed
dirkschut opened this issue Sep 10, 2024 · 5 comments
Closed

Exeption: calibre_plugins.fanficfare_plugin.jobs(450): Exception #1105

dirkschut opened this issue Sep 10, 2024 · 5 comments

Comments

@dirkschut
Copy link

I was doing an update on my library and had the update mode set to overwrite always. It updated a few stories sucessfully but got an exception on this one, see log below.

FFF: DEBUG: 2024-09-10 12:11:15,827: base_xenforoforum_adapter.py(761): Getting chapter text for: https://www.alternatehistory.com/forum/posts/25260679/ index: 120
FFF: DEBUG: 2024-09-10 12:11:15,827: base_xenforoforum_adapter.py(772): Using reader mode
FFF: DEBUG: 2024-09-10 12:11:15,827: cache_basic.py(116): 
========== MISS (GET) BasicCache
https://www.alternatehistory.com/forum/threads/what-is-dead-may-never-die-theon-si.527602/reader/page-13?threadmark_category=1
FFF: DEBUG: 2024-09-10 12:11:15,827: fetcher_requests.py(114): 
---------- REQ (GET) RequestsFetcher
https://www.alternatehistory.com/forum/threads/what-is-dead-may-never-die-theon-si.527602/reader/page-13?threadmark_category=1
FFF: DEBUG: 2024-09-10 12:11:16,579: fetcher_requests.py(127): response code:200
FFF: DEBUG: 2024-09-10 12:11:16,580: decorators.py(112): fromcache:False
FFF: DEBUG: 2024-09-10 12:11:16,580: decorators.py(123): random sleep(3.00-9.00):5.91
FFF: DEBUG: 2024-09-10 12:11:22,496: requestable.py(55): Encoding:utf8
FFF: DEBUG: 2024-09-10 12:11:22,638: base_xenforoforum_adapter.py(761): Getting chapter text for: https://www.alternatehistory.com/forum/posts/25370717/ index: 121
FFF: DEBUG: 2024-09-10 12:11:22,638: base_xenforoforum_adapter.py(772): Using reader mode
FFF: DEBUG: 2024-09-10 12:11:22,638: base_xenforoforum_adapter.py(792): post found in cache
FFF: INFO: 2024-09-10 12:11:22,693: writer_epub.py(369): Saving EPUB Version 2.0
FFF: INFO: 2024-09-10 12:11:22,710: calibre_plugins.fanficfare_plugin.jobs(450): Exception: {'title': 'ASOIAFWhat is dead may never die', 'author_sort': ['Ironwolf852'], 'author': ['Ironwolf852'], 'comments': '<div class="bbWrapper"><i>Prologue<br/>\n<br/>\nEddard POV</i><br/>\n<br/>\nIt was a week since the finding of the direwolves. My children were overjoyed with their new pets. But the news afterward doesn’t give much joy. Even if it would be nice to meet Robert again after all those years, I knew why he was coming.<br/>\n<br/>\nIt would be hard to say no to him, especially now when he is a king. The news of Jon Arryn’s death was hard to take. There are many things I need to think about. Theon’s behavior was alarming too.<br/>\n<br/>\nAfter finding the direwolves, he became enclosed—demanding training for my master-at-arms to a gruesome decree. He doesn’t talk much anymore, no japes, no nothing. He is training with his sword or bow to the point he needs to be forced to stop. And then he decides to pick up a spear too.<br/>\n<br/>\n“Lord Stark,” Ser Cassel called out for me. “It is good to find you. It is about Theon. He is again practicing with his bow, it’s been hours, and he refuses to stop.”</div>', 'good': False, 'status': 'Error', 'showerror': True, 'calibre_id': 148, 'begin': None, 'end': None, 'comment': 'Invalid placeholder in string: line 1, col 10', 'url': 'https://www.alternatehistory.com/forum/threads/what-is-dead-may-never-die-theon-si.527602/', 'site': 'www.alternatehistory.com', 'series': '', 'added': False, 'pubdate': datetime.datetime(2022, 4, 28, 9, 14, 8, tzinfo=datetime.timezone(datetime.timedelta(seconds=7200), 'CEST')), 'publisher': 'www.alternatehistory.com', 'listorder': 2, 'collision': 'Overwrite Always', 'uniqueurl': 'https://www.alternatehistory.com/forum/threads/what-is-dead-may-never-die-theon-si.527602/[None-None]', 'is_adult': False, 'username': 'NoneGiven', 'password': '', 'icon': 'dialog_error.png', 'epub_for_update': '/var/folders/nb/s8lkm3493_g433r452n44k6h0000gn/C/calibre_7.17.0_tmp_a_1ekf5l/fanficfare_zv1zc_b2/old-148-qjr_6gu5.epub', 'calibre_columns': {}, 'outfile': '/var/folders/nb/s8lkm3493_g433r452n44k6h0000gn/C/calibre_7.17.0_tmp_a_1ekf5l/fanficfare_zv1zc_b2/bgmeta-mydc65v8.epub', 'updatedate': datetime.datetime(2024, 9, 7, 10, 32, 33, tzinfo=datetime.timezone(datetime.timedelta(seconds=7200), 'CEST')), 'timestamp': datetime.datetime(2024, 9, 10, 12, 8, 32, 77442, tzinfo=datetime.timezone(datetime.timedelta(seconds=7200), 'CEST'))}:Invalid placeholder in string: line 1, col 10
Traceback (most recent call last):
  File "calibre_plugins.fanficfare_plugin.jobs", line 318, in do_download_for_worker
    writer.writeStory(outfilename=outfile,
  File "/Users/dirkschut/Library/Preferences/calibre/plugins/FanFicFare.zip/fanficfare/writers/base_writer.py", line 234, in writeStory
    self.writeStoryImpl(outstream)
  File "/Users/dirkschut/Library/Preferences/calibre/plugins/FanFicFare.zip/fanficfare/writers/writer_epub.py", line 613, in writeStoryImpl
    for index, chap in enumerate(self.story.getChapters(fortoc=True)):
                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/dirkschut/Library/Preferences/calibre/plugins/FanFicFare.zip/fanficfare/story.py", line 1481, in getChapters
    chapter['chapter'] = usetempl.substitute(chapter)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "string.py", line 121, in substitute
  File "string.py", line 118, in convert
  File "string.py", line 101, in _invalid
ValueError: Invalid placeholder in string: line 1, col 10
@JimmXinu
Copy link
Owner

There's an error in your chapter title pattern. Which ever of chapter_title_def_pattern, chapter_title_add_pattern, chapter_title_addnew_pattern, or chapter_title_new_pattern is being used.

What's your personal.ini look like?

@dirkschut
Copy link
Author

dirkschut commented Sep 10, 2024

I'm looking for what I did wrong in it right now. Sorry for assuming it was a bug :D

## This is an example of what your personal configuration might look
## like.  Uncomment options by removing the '#' in front of them.

[defaults]
## [defaults] section applies to all formats and sites but may be
## overridden at several levels.  See
## https://github.com/JimmXinu/FanFicFare/wiki/INI-File for more
## details.

## Some sites also require the user to confirm they are adult for
## adult content.  Uncomment by removing '#' in front of is_adult.
#is_adult:true

## Don't like the numbers at the start of chapter titles on some
## sites?  You can use strip_chapter_numbers to strip them off.  Just
## want to make them all look the same?  Strip them off, then add them
## back on with add_chapter_numbers.  Don't like the way it strips
## numbers or adds them back?  See chapter_title_strip_pattern and
## chapter_title_add_pattern in defaults.ini.
#strip_chapter_numbers:true
#add_chapter_numbers:true


[epub]
## Include images from img tags in the body and summary of stories.
## Images will be converted to jpg for size if possible.  Images work
## in epub format only.  To get mobi or other format with images,
## download as epub and use Calibre to convert.
## true by default, uncomment and set false to not include images.
#include_images:true

## If set false, the summary will have all html stripped for safety.
## Both this and include_images must be true to get images in the
## summary.
## true by default, uncomment and set false to not keep summary html.
#keep_summary_html:true

## If set true, and there isn't a specific cover image, the first
## image found in the story will be made the cover image.  If
## keep_summary_html is true, images in the summary will be before any
## in chapters.
## true by default, uncomment and set false to turn off
#make_firstimage_cover:true


## Most common, I expect will be using this to save username/passwords
## for different sites.  Here are a few examples.  See defaults.ini
## for the full list.

[www.twilighted.net]
#username:XXXXXXXX
#password:XXXXXXXX
## default is false
#collect_series: true

[www.fimfiction.net]
#is_adult:true
#fail_on_password:XXXXXXXX

[www.tthfanfic.org]
#is_adult:true
## tth is a little unusual--it doesn't require user/pass, but the site
## keeps track of which chapters you've read and won't send another
## update until it thinks you're up to date.  If you set
## username/password, FFF will login to download.  Then the site
## thinks you're up to date.
#username:XXXXXXXX
#password:XXXXXXXX

[forum.questionablequesting.com]
## see [base_xenforoforum]

## Some sites require login (or login for some rated stories) The
## program can prompt you, or you can save it in config.  In
## commandline version, this should go in your personal.ini, not
## defaults.ini.
username:XXXXXXXX
password:XXXXXXXX

[www.alternatehistory.com]
## see [base_xenforoforum]

## Some sites require login (or login for some rated stories) The
## program can prompt you, or you can save it in config.  In
## commandline version, this should go in your personal.ini, not
## defaults.ini.
username:XXXXXXXX
password:XXXXXXXX

[archiveofourown.org]
## Some sites require login (or login for some rated stories) The
## program can prompt you, or you can save it in config.  In
## commandline version, this should go in your personal.ini, not
## defaults.ini.
username:XXXXXXXX
password:XXXXXXXX


## This section will override anything in the system defaults or other
## sections here.
[overrides]
## default varies by site.  Set true here to force all sites to
## collect series.
#collect_series: true

## If true, when updating an epub that already has old chapters, new
## chapters will be marked in the TOC and chapter header by using
## chapter_title_new_pattern and chapter_title_addnew_pattern to set
## the chapter title.
## If set to latestonly, only new chapters downloaded this time will
## be marked (new) and existing chapters will have any (new) marks
## removed.
##
## mark_new_chapters can be true, false or latestonly
mark_new_chapters:true

## The 'date' value for chapters mentioned above can be formated with
## datethreadmark_format.  Otherwise it will default to
## dateCreated_format
datethreadmark_format:%%Y-%%m-%%d %%H:%%M

## (Plugin Only) - When mark_new_chapters:true, new stories added to
## an existing anthology will have *all* chapters marked (new).  If
## set to latestonly, existing (new) marks will only be removed when
## that particular story within the anthology is updated--either
## because it has new chapter(s) or you are using Update Always.
##
## By default, EpubMerge only creates one TOC entry for a story that
## has only one chapter (not counting titlepage and logpage).  Because
## that TOC entry is the story title, the *chapter* title doesn't
## appear in the anthology TOC.  Setting
## anthology_merge_keepsingletocs:true will keep the full TOC for all
## anthology stories, even when only one chapter.  Helpful to see
## (new) marks in TOC when mark_new_chapters:true
#anthology_merge_keepsingletocs:false

## chapter title patterns use python template substitution.  The
## ${number} is the 'chapter' number and ${title} is the chapter
## title, after applying chapter_title_strip_pattern.  ${index04} is
## chapter number padded with leading zeros (mostly for internal use)
## such as 0001.  ${index} == ${number} for backward compatibility.  A
## few site adapters add additional chapter metadata.

## The basic pattern used when not using add_chapter_numbers or
## mark_new_chapters
chapter_title_def_pattern:${title} $(date)

## Pattern used with add_chapter_numbers, but not mark_new_chapters
chapter_title_add_pattern:${number}. ${title} ${date}

## Pattern used with mark_new_chapters, but not add_chapter_numbers
## (new) is just text and can be changed.
chapter_title_new_pattern:(new) ${title} ${date}

## Pattern used with add_chapter_numbers and mark_new_chapters
## (new) is just text and can be changed.
chapter_title_addnew_pattern:${number}. (new) ${title} ${date}

@dirkschut
Copy link
Author

I think I see what I did wrong. I should have put the chapter title stuff in the xenforo/ao3 section. Testing now.

@JimmXinu
Copy link
Owner

## The basic pattern used when not using add_chapter_numbers or
## mark_new_chapters
chapter_title_def_pattern:${title} $(date)

Change to ${date}.

@dirkschut
Copy link
Author

## The basic pattern used when not using add_chapter_numbers or
## mark_new_chapters
chapter_title_def_pattern:${title} $(date)

Change to ${date}.

thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants