Download external resources

Bug #1652960 reported by typhoon71 on 2016-12-28
This bug affects 1 person
Affects Status Importance Assigned to Milestone

Bug Description

If I understand it right, in the Calibre Editor, under "Tools", "External Links", the menu entry the "Download external resources" should download the resources into the current ebook.

So I tried with an epub that contains a plain link to imgur, but while the correct image is shown in the "Reports" windows, I can't save it.

If I right click on the image there's a menu but the entries don't do anything.
If I click in the list, I get an error windows, which has this text:

calibre, version 2.75.1
ERROR: Unhandled exception: <b>AttributeError</b>:'FilesView' object has no attribute 'current_location'

calibre 2.75.1 [64bit] embedded-python: True is64bit: True
Windows-7-6.1.7601-SP1 Windows ('64bit', 'WindowsPE')
('Windows', '7', '6.1.7601')
Python 2.7.9
Windows: ('7', '6.1.7601', 'SP1', 'Multiprocessor Free')
Successfully initialized third party plugins: EpubMerge (2, 1, 0)
Traceback (most recent call last):
  File "site-packages\calibre\gui2\tweak_book\", line 190, in show_context_menu
AttributeError: 'FilesView' object has no attribute 'current_location'

I attached a sample epub that has the problem, just clicking around in the report window gives the error; the original epub had more images, and sometime this issue would close the editor completely.

What's happening?

OS is Windows7 sp1 64bit, calibre is 2.75.1 64bit.

typhoon71 (typhoon71) wrote :

Saple epub

Download external resources does not follow links, it downloads
resources, which in this case means <img> tags, stylesheets, scripts,
etc. So change your tag from <a href=...> to <img src=...> and then use
download external resources.

 status invalid

Changed in calibre:
status: New → Invalid
typhoon71 (typhoon71) wrote :

OK, changing the <a href=...> tags to <img src=...> when appropriate does indeed fix the issue: now the pictures are downloaded and saved in the right places, while the link is edited. Perfect.

So the reason I got the error above (and silent crashes) was the "wrong" operation on a non supported tag?

Kovid Goyal (kovid) wrote :

I am confused. Your test book shows no images in the Images section of
the report -- which is to be expected since it has no images. It does
show your link in the links section of the report, and right clicking on
the link does cause an unhandled exception (which is now fixed) but no crashes.

typhoon71 (typhoon71) wrote :

Yes, TEST.epub is supposed to have no image (or content) inside, just a link to a imgur picture.
I crafted it keeping only what gave the issue, so there's nothing exept that imgur link.

The "original story"; the epub is grabbed from a webpage with webtoepub (a browser addon), and it has content and pictures too, excluding when they are in the form of that link in TEST.epub.

That kind of plain links is like that in the original web page(s) too, so when the addon parses them it doesn't know what to do and leaves them like the one in TEST.epub.

I was using the "Download external resources" to try to those images automatically; now I know I have to change the tag before doing so. Many thanks for fixing the unhandled exception too.

I did ask the addon developer about parsing those kind of links, but for now it's not top priority since they're hard to "separate" from standard links.

Kovid Goyal (kovid) wrote :

Just FYI, you dont need to use an addon for this. You can just use the
browser's native Save as webpage, complete function and then add the
resulting HTML file to calibre and convert that to EPUB.

This will not download img links either, for that you should write a recipe
in calibre and use the news download system.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Bug attachments