-
Notifications
You must be signed in to change notification settings - Fork 696
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
Wrong order of chapters #279
Comments
I can confirm that it's not only this book, it happens to other books I've tested. Indeed the chapters are not in chronological order. There is a problem with the creation of the <spine toc="ncx">
<itemref idref="titlepage"/>
<itemref idref="titl"/>
<itemref idref="Copyright"/>
<itemref idref="Dedication"/>
<itemref idref="btoc"/>
<itemref idref="toc"/>
<itemref idref="Preface"/>
<itemref idref="Acknowledgments"/>
<itemref idref="Book"/>
<itemref idref="Author"/>
<itemref idref="05"/> <!-- Chapter 5 is placed in the wrong order -->
<itemref idref="Cover"/>
<itemref idref="p1"/>
<itemref idref="01"/>
<itemref idref="02"/>
<itemref idref="p2"/>
<itemref idref="03"/>
<itemref idref="04"/>
<itemref idref="06"/>
<itemref idref="07"/>
<itemref idref="08"/>
<itemref idref="09"/>
<itemref idref="10"/>
<itemref idref="p3"/>
<itemref idref="11"/>
<itemref idref="12"/>
<itemref idref="13"/>
<itemref idref="14"/>
<itemref idref="15"/>
<itemref idref="16"/>
<itemref idref="resources"/> <!-- Resources is placed in the wrong order -->
<itemref idref="17"/>
<itemref idref="18"/>
<itemref idref="A"/>
<itemref idref="B"/>
<itemref idref="C"/>
<itemref idref="D"/>
<itemref idref="Index"/>
<itemref idref="Figures"/>
<itemref idref="Tables"/>
<itemref idref="Listings"/>
</spine> It's either the python script parsing the wrong order and appending or there is some sort of re-arrangement causing the issue. My Environment:I'm running the latest commit (e016ad3) as of this post.
|
I can confirm that this happens quite a lot for me too, in fact basically every book i download. One book that you can test is The generated
|
I'm sure someone with better understanding of python and the code base can explain this better than I can, but the problem looks like it's related to line #567 in safaribooks.py. ProblemWhen taking a closer look at the original code causing the problem: result.extend([c for c in response["results"] if "cover" in c["filename"] or "cover" in c["title"]]) The code above will append an item to the "result" list if the dictionary variable contains the word "cover" inside of "filename" or "title" key's value. I'm certain if you look at the chapters or sections that are incorrectly ordered, it will contain the word "cover" in the title or filename, so the problem here is that we can't use Workaround?result.extend([c for c in response["results"] if "cover" == c["title"].lower() or "cover.xhtml" == c["filename"].lower() or "titlepage.xhtml" == c["filename"].lower()]) I've change the That sorted out the wrong order of chapters, but now there's an issue with the books mentioned above where the cover image from |
The order of chapters is messed up.
<..>
Is it an issue with this specific title "Marko Lukša. “Kubernetes in Action.” only?
I tried to run the following command twice with the same outcome both times:
python3 safaribooks.py --cred "xxx:yyy" --kindle 9781617293726
The text was updated successfully, but these errors were encountered: