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

Set per issue title #1642

Closed
wants to merge 1 commit into from
Closed

Set per issue title #1642

wants to merge 1 commit into from

Conversation

felagund
Copy link
Contributor

This modifies the title of the downloaded e-book for the economist with the date. It is useful for telling appart different issues in calibre, in the filesystem (the filename is taken from the titile) and it also makes life easier for some e-readers, like this:
https://www.mobileread.com/forums/showthread.php?t=346484

I am sure, python-wise, this can be more elegant but this seems to work. The title of the downloaded magazine is then "The Economist from 2022-05-14" or something like that.

@kovidgoyal
Copy link
Owner

Download in EPUB not MOBI and the dates will be added to the title
automatically, in the format specified by datefmt in the recipe. For
MOBI they are deliberately removed since that is optimal for usage on
Kindles.

@kovidgoyal kovidgoyal closed this May 14, 2022
@felagund
Copy link
Contributor Author

That does not seem to me to be the case at all. See screenshot. I am talking about the title of the whole ebook, not individual articles. Right now, if I download Economist issues every week in calibre and keep them there, they canno be distinguished by title (one needs to open the cover and see the date on it). The date metadata refers (as far as I can see) to the date of the download, not the date of the issue, which would also be confusing for telling them appart.
Screenshot_20220514_234759

@kovidgoyal
Copy link
Owner

Again you need to change the download format to EPUB and the output
profile to non-Kindle.

@felagund
Copy link
Contributor Author

Indeed. By the way, it has nothing to do with EPUB as a download format - Calibre will happily add date to EPUB too.

However, it adds the date of download (May 15), not the day when it was issued (May 14). This would be especially confusing if one was using the support for downloading old issues on lines 20 and 247-249.

I noticed there is a function publication_date() (undocumented here: https://manual.calibre-ebook.com/news_recipe.html ) but when I tried to modify that, it only changes <dc:date>2020-01-02T00:00:00+00:00</dc:date> in content.opf in the resulting EPUB file.

Would not some sort of API for setting the date used in the title with non-kindle-output be useful?

Another thing is that non-kindle output is putting text like this:

This article was downloaded by calibre from https://www.economist.com/the-world-this-week/2022/05/14/politics
| [Section menu](clbr://internal.invalid/feed_0/index.html#article_0) | [Main menu](clbr://internal.invalid/index_u1.html#feed_0) |

in the ebook, which I do not want. The last time I checked, the only way around it to use a kindle output format, no?

If there was a way to either turn on "date in title" for Kindle or turn off the text for non-Kindle output, I would be happy with the current functionality.

@kovidgoyal
Copy link
Owner

kovidgoyal commented May 15, 2022 via email

@felagund
Copy link
Contributor Author

felagund commented May 15, 2022

Set timefmt in the recipe in parse_index.

I do not need to format it. I would like (and I think that should be the default anyway) the date in the title set for the date of the issue of the magazine (that is what my PR did). It would be useful especially when downloading older issues.

Would you accept a patch that would modify create_opf

def create_opf(self, feeds, dir=None):
to use publication_date if set byt the recipe? If publication_date is not set, it default to now in both cases anyway?

No, there isnt. You are free to run from source with a patch.

Would you accept a patch that would make the navbar optional via a setting?

@kovidgoyal
Copy link
Owner

kovidgoyal commented May 16, 2022 via email

@felagund
Copy link
Contributor Author

Would you accept a patch that would modify create_opf (

def create_opf(self, feeds, dir=None):
) to use publication_date if set byt the recipe? If publication_date is not set, it default to now in both cases anyway?
Sure.

#1661

felagund added a commit to felagund/calibre that referenced this pull request Jun 17, 2022
As discussed here: kovidgoyal#1642 (comment), this makes the title in a recipe use the date when a given publication was issued (if set by a recipe) instead of current time. As a proof of concept, this is implemented for the Economist recipe.
felagund added a commit to felagund/calibre that referenced this pull request Jun 17, 2022
As discussed here: kovidgoyal#1642 (comment), this makes the title in a recipe use the date when a given publication was issued (if set by a recipe) instead of current time.
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

Successfully merging this pull request may close these issues.

2 participants