Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Library Management

Notices

Reply
 
Thread Tools Search this Thread
Old 06-01-2020, 03:41 AM   #1
tamarissa
Connoisseur
tamarissa began at the beginning.
 
Posts: 56
Karma: 10
Join Date: Aug 2018
Device: Kobo Aura H2O
Get System File Date

I'm looking for a way to make a column that pulls the system file modified date for each type of file associated with a book.

I found this piece of code on this thread

Code:
{:'re(list_item(formats_modtimes('yyyy-MM-dd'), 0, ','), '^.*?:', '')'}
Quote:
This template
  • gets the list of formats and their modification times formatted using the 'iso' date format that includes both the date and the time. (formats_modtimes)
  • selects the first (the most recently modified) format (list_item)
  • Strips off the format name (re)
that is definitely on the right track for what I'm looking for, but not quite what I'm after & I sure can't take it farther.

Is there a way to modify this code to search for only 'epub' or only 'azw' files? I tried editing the part of the equation with the asterisk, but my attempts at trying to figure it out in the template tester only managed to get it to show me the file type modified in the results.

I'm intending to make a separate column for each of those book types.
tamarissa is offline   Reply With Quote
Old 06-01-2020, 04:42 AM   #2
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,340
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Use
Code:
{:'select(formats_modtimes('yyyy-MM-dd'), 'EPUB')'}
changing the format type as needed. Format names are upper case.

Note that getting the modtime requires going to the file system, which can be slow. Having multiple columns isn't more of a problem because the modtimes will be cached when the first column is evaluated
chaley is offline   Reply With Quote
Advert
Old 06-01-2020, 09:49 PM   #3
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,905
Karma: 47303824
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
@tamarissa: You got a response fro @chaley, but, I'd looked at it a bit in that time and had a different response, and a question, so...

That template you have is only looking at the first format returned in the list. I think the following is closer to what you want:

Code:
{:'list_re(formats_modtimes('yyyy-MM-dd'), ',', '^(EPUB|AZW).*', '')'}
That gives results like:
Code:
EPUB:2018-09-02, AZW3:2018-07-22
EPUB:2016-01-14
What you do after that depends on what you want. If you just want the ePub date, the @chaley's answer is the best one. But, do you just want the first of these? Or the oldest? Or do you want the EPUB date if both formats exist? The date from the first format added?

The real question is: What are you trying to achieve? The file modification date will change as you do things. If you do a conversion, edit the book or use Embed metadata to update the metadata, then the file modification will change. Because of that, I don't know what use this actually is in the day-to-day book management.
davidfor is offline   Reply With Quote
Old 06-01-2020, 10:12 PM   #4
tamarissa
Connoisseur
tamarissa began at the beginning.
 
Posts: 56
Karma: 10
Join Date: Aug 2018
Device: Kobo Aura H2O
@chaley

That worked up to a point... It definitely visually put the right date dates for the files I cross-checked. But I don't think it puts the date in the column as an actual date. When I tried to search based on dates, I couldn't get any results. I tried to get dates before, dates after, specific dates, and yesterday (I added a new epub yesterday, so there should definitely be a result for that) and couldn't get any results.

I used:
  • "Column built from other columns, behaves like tags" column type.
  • Your exact code, which definitely displays the correct results
  • Search expression (as an example): #epub_last_modified:_yesterday, after trying what I mentioned above and thinking maybe somehow my search expressions were wrong and this had to work. I even tried adding in a quote mark (") before and after the criteria, since that seems to be required for some things, but that didn't work either. I even double-checked the _yesterday with date:_yesterday, and that worked perfectly

Is there something that can make the result a searchable date, or am I missing something (blindingly obvious most likely) in my search?


@davidfor

As you could likely figure out from my comments above, I'm looking to be able to have a searchable (filterable?) list of dates for when the actual files are last modified. I didn't think that was likely doable from one column, which was why I had them separated into 2 columns. Is it possible to have the results produced from your suggestion give me searchable dates? Most specifically in your scenario, I would be looking for it to show me any books of any type returned that haven't been updated since a specific date.
tamarissa is offline   Reply With Quote
Old 06-01-2020, 11:41 PM   #5
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,905
Karma: 47303824
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
@tamarissa: Neither mine or @chaley's solutions were complete. Both were just getting the date for a format in the easiest way we could. They needed more work based on what you were trying to do. And, the issue you seemed to be having was getting the modified date for the format. I think we both thought the next step was obvious.

In any case, the following will produce just the date:

Code:
{:'list_item(list_item(list_re(formats_modtimes('yyyy-MM-dd'), ',', '^(EPUB|AZW).*', ''),0,','),1,':')'}
And in the definition of the column, you need to set the value of the option "Sort/search column by" to "Date". With this, I can do a search on the column as a date.

But, I'm not sure of what the point is. What are you planning to do with this date? Sure, you can search on it or sort by it, but, what will that achieve? About the only thing I can see to use it for is to look for all books where the format is older than calibres modified date and then do an Embed metadata on them. That will update the formats that calibre can do this for, but, I don't see the point in doing this. If you export the book, either via save-to-disk or send-to-device, the metadata is updated in the copy produced. Unless you are doing something else with the book in the library, I don't see the point of doing this. Asking what you are doing is partly curiosity. But, there might be a better way to do what you want to do. Or possibly no way to do it all.

Also, I can't quickly see how to get the oldest date of the formats. My code above just takes the first in the list. I think that is the format first added to the book, but, it I'm not sure. And if it is, then it might have have been modified so that doesn't have the oldest modified date. Or have been modified for a reason different to what you are trying to track, but, still needs those changes.
davidfor is offline   Reply With Quote
Advert
Old 06-02-2020, 05:30 AM   #6
tamarissa
Connoisseur
tamarissa began at the beginning.
 
Posts: 56
Karma: 10
Join Date: Aug 2018
Device: Kobo Aura H2O
I see... I thought it was just that easy based on the other default date columns in Calibre. And I figured that stating I had to find a code showed I knew nothing about creating a code myself. Sorry. I can sometimes get them adapted to what I want if their super simple, but generally probably less than 50/50 odds.

I knew the searching by date thing was going to be something super simple I just couldn't see, thanks for that

I'm using this information so that I can see when I last updated the metadata to the file. I understand why, but it still drives me nuts that the actual book metadata can only be manually updated. My type-A personality likes to have that information embedded in the book itself as a fail-safe, but I don't need to update every single book every time; this way I can just update the books that have had any metadata updated (read status, series correction, etc.) since it was added to Calibre (if the modification date is greater than the file modification date, the book needs updating).

Okay, I think for my purposes and skill level that having separate columns will work just fine for me, now that I know how to make it searchable by date.

Thanks for your help!

Last edited by tamarissa; 06-02-2020 at 05:33 AM.
tamarissa is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Sort by system file creation date Alaa Calibre 3 02-22-2019 01:41 PM
Searching by date does not consider System Locale when using ambiguous dates tempura Library Management 2 04-12-2014 06:31 AM
How to show/sort system date of a (epub) file PalingB Library Management 11 05-12-2012 11:46 AM
Pocket Pro System Date Yanikou Astak EZReader 4 09-17-2009 12:57 PM
how to clean more disk space in root file system to upgrade system chinaet iRex 1 12-18-2006 03:54 PM


All times are GMT -4. The time now is 03:43 AM.


MobileRead.com is a privately owned, operated and funded community.