Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Plugins

Notices

Reply
 
Thread Tools Search this Thread
Old 09-13-2022, 05:13 AM   #571
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: 11,741
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by jpkar View Post
Hello everyone,
I use caliber to manage videos!
Now I would like to import the metadata from the videos into "Custom Columns" to be created accordingly with "Import List".
In a first step, I tried to create and import a separate column for the length of the video.
The metadata from the videos are available to me as a csv file.
Example:
"Name","Author","Length"
"Example title","TestAuthor","00:14:16"

Here is the actual question: How must the "Own Column": "length" of the video be formatted so that the Import works?

When trying to import I get the error message:

Column "
The following rows have invalid type for column #länge:
row (1) => 00:14:16

Vielen Dank
Calibre doesn't support duration as a column type. Using integer is the best solution. The input should be formatted as the number of seconds. For example,
00:14:16 ==> 14 minutes + 16 seconds ==> 856 seconds
You can use a column built from other columns to display the number of seconds however you wish. For example, this template displays the number of seconds (I used a constant instead of the correct column lookup name) as hh:mm:ss
Code:
program:
	number_of_seconds = 856;
	hours = floor(number_of_seconds/3600);
	minutes = floor((number_of_seconds - (hours * 3600))/60);
	seconds = mod(number_of_seconds, 60);
	format_number(hours, '02d') & ':' & format_number(minutes, '02d') & ':' & format_number(seconds, '02d')
Note that you couldn't edit the value shown in the column built from other columns. You must edit the number_of_seconds column
chaley is offline   Reply With Quote
Old 09-13-2022, 07:17 AM   #572
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 20,567
Karma: 26954694
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by chaley View Post
Calibre doesn't support duration as a column type.
FWIW: I have duration column in my Media library, which is a Date, viz:

Click image for larger version

Name:	Screenshot 2022-09-13 210116.jpg
Views:	414
Size:	40.6 KB
ID:	196487

My media items are short news video and audio clips. I key the data into the booklist - not sure if/how that could work with IL.

BR
BetterRed is offline   Reply With Quote
Old 09-13-2022, 07:32 AM   #573
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: 11,741
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by BetterRed View Post
FWIW: I have duration column in my Media library, which is a Date, viz:

Attachment 196487

My media items are short news video and audio clips. I key the data into the booklist - not sure if/how that could work with IL.

BR
I thought of that then rejected it as too complicated because it is actually a date column, not a duration. It isn't clear to me how it will work over time, for example for sorting, and whether arithmetic would work. I am sure that one must guarantee that the date portion is always the same date and that the timezone never changes. Possibly 01-01-0101Tmm:dd:ssZ would do.

That said, I am glad it works for you.
chaley is offline   Reply With Quote
Old 09-13-2022, 08:49 AM   #574
capink
Wizard
capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.
 
Posts: 1,090
Karma: 1948136
Join Date: Aug 2015
Device: Kindle
if @jpkar does not need to use arithmetic for his duration column, he can proceed with the same format (hh:mm:ss) he currently has and it will work well for sorting. He just needs to change the target column datatype to text to avoid the validation error.
capink is offline   Reply With Quote
Old 09-13-2022, 09:25 AM   #575
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 20,567
Karma: 26954694
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by chaley View Post
I thought of that then rejected it as too complicated because it is actually a date column, not a duration. It isn't clear to me how it will work over time, for example for sorting, and whether arithmetic would work. I am sure that one must guarantee that the date portion is always the same date and that the timezone never changes. Possibly 01-01-0101Tmm:dd:ssZ would do.

That said, I am glad it works for you.
I've never wanted to sort on it, much less do arithmetic. If I wanted to do something like that I'd create a csv and use Excel. I also use the column as a hook on which to hang an icon.

But wait, I just did a sort on my duration column - perfect.

Click image for larger version

Name:	Screenshot 2022-09-13 231624.jpg
Views:	370
Size:	25.2 KB
ID:	196491

And then I remembered the sort_dates_using_visible_fields tweak takes care of it. Perhaps there should be a companion tweak zero_non_visible_fields_in_dates.

BR
BetterRed is offline   Reply With Quote
Old 09-14-2022, 04:18 AM   #576
jpkar
Junior Member
jpkar began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Jan 2021
Location: Deutschland
Device: PocketBook
Quote:
Originally Posted by chaley View Post
Calibre doesn't support duration as a column type. Using integer is the best solution. The input should be formatted as the number of seconds. For example,
00:14:16 ==> 14 minutes + 16 seconds ==> 856 seconds
You can use a column built from other columns to display the number of seconds however you wish. For example, this template displays the number of seconds (I used a constant instead of the correct column lookup name) as hh:mm:ss
Code:
program:
	number_of_seconds = 856;
	hours = floor(number_of_seconds/3600);
	minutes = floor((number_of_seconds - (hours * 3600))/60);
	seconds = mod(number_of_seconds, 60);
	format_number(hours, '02d') & ':' & format_number(minutes, '02d') & ':' & format_number(seconds, '02d')
Note that you couldn't edit the value shown in the column built from other columns. You must edit the number_of_seconds column
Danke für deinen Vorschlag, habe Ihn wie folgt übernommen!
2 neue Spalten angelegt:
1. Spalte = aus anderen Spalten aufgebaute Spalte = #länge
2. Spalte = Ganzzahlen = #sekunden

Wie gelingt mir der Verweis auf die selbst definierte Spalte:"#sekunden"?

Vielen Dank
Attached Thumbnails
Click image for larger version

Name:	5.JPG
Views:	82
Size:	17.8 KB
ID:	196506   Click image for larger version

Name:	4.JPG
Views:	94
Size:	120.5 KB
ID:	196507  
jpkar is offline   Reply With Quote
Old 09-14-2022, 04:29 AM   #577
jpkar
Junior Member
jpkar began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Jan 2021
Location: Deutschland
Device: PocketBook
Code:
program:
	number_of_seconds = 856;
	hours = floor(number_of_seconds/3600);
	minutes = floor((number_of_seconds - (hours * 3600))/60);
	seconds = mod(number_of_seconds, 60);
	format_number(hours, '02d') & ':' & format_number(minutes, '02d') & ':' & format_number(seconds, '02d')
Danke für den Tipp
Wie gelingt mir ein Verweis auf die Spalte "#sekunden"? siehe Bilder
Attached Thumbnails
Click image for larger version

Name:	5.JPG
Views:	81
Size:	17.8 KB
ID:	196508   Click image for larger version

Name:	4.JPG
Views:	84
Size:	120.5 KB
ID:	196509  
jpkar is offline   Reply With Quote
Old 09-14-2022, 05:44 AM   #578
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: 11,741
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by jpkar View Post
Code:
program:
	number_of_seconds = 856;
	hours = floor(number_of_seconds/3600);
	minutes = floor((number_of_seconds - (hours * 3600))/60);
	seconds = mod(number_of_seconds, 60);
	format_number(hours, '02d') & ':' & format_number(minutes, '02d') & ':' & format_number(seconds, '02d')
Danke für den Tipp
Wie gelingt mir ein Verweis auf die Spalte "#sekunden"? siehe Bilder
Try this:
Code:
	number_of_seconds = $#sekunden;
# Alternate 1: number_of_seconds = field('#sekunden');
# Alternate 2: number_of_seconds = raw_field('#sekunden', '');

# Add this line if you want empty duration to display as empty instead of 00:00:00
	if ! number_of_seconds then return '' fi;
chaley is offline   Reply With Quote
Old 09-14-2022, 06:08 AM   #579
jpkar
Junior Member
jpkar began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Jan 2021
Location: Deutschland
Device: PocketBook
Thumbs up Das war die Lösung - Danke

[CODE] number_of_seconds = $#sekunden;

Vielen Dank,
Das war die Lösung
jpkar is offline   Reply With Quote
Old 10-16-2022, 03:10 PM   #580
kiwidude
Calibre Plugins Developer
kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.
 
Posts: 4,636
Karma: 2162064
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
Import List v1.9.0 Released

Release Notes:
https://github.com/kiwidude68/calibr...rt_list-v1.9.0
kiwidude is offline   Reply With Quote
Old 05-30-2023, 12:00 PM   #581
Tharos
Connoisseur
Tharos began at the beginning.
 
Posts: 55
Karma: 10
Join Date: Jul 2010
Device: Kindle Oasis 2, Moon+ Reader pro
I am not sure if it is a bug in the extension or if I am doing something wrong. I want to import a list of books via a .csv (utf-8). The book titles are structured as follows:
Book v1
book v2
Book v3

In "Books in list:" they are also displayed like this.

However, in "Matches in library" it says:
Book V1
Book V2
Book V3
The small v becomes a big V. These are then of course also imported in this way.
Tharos is offline   Reply With Quote
Old 07-14-2023, 07:50 PM   #582
Rellwood
Library Breeder (She/Her)
Rellwood ought to be getting tired of karma fortunes by now.Rellwood ought to be getting tired of karma fortunes by now.Rellwood ought to be getting tired of karma fortunes by now.Rellwood ought to be getting tired of karma fortunes by now.Rellwood ought to be getting tired of karma fortunes by now.Rellwood ought to be getting tired of karma fortunes by now.Rellwood ought to be getting tired of karma fortunes by now.Rellwood ought to be getting tired of karma fortunes by now.Rellwood ought to be getting tired of karma fortunes by now.Rellwood ought to be getting tired of karma fortunes by now.Rellwood ought to be getting tired of karma fortunes by now.
 
Rellwood's Avatar
 
Posts: 1,156
Karma: 1900479
Join Date: Apr 2015
Location: Fullerton, California
Device: Kobo Aura HD (1) PW3 (4) PW3 2019 new edition (1)
Hi!
I am trying to import my GR library list, it has pages and number of ratings. The columns are {0:,d} intengers.

I am getting the following error:
calibre, version 6.19.1
ERROR: Failed:

Traceback (most recent call last):
File "calibre_plugins.import_list.page_persist", line 42, in to_int
ValueError: could not convert string to float: '202,520'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "calibre_plugins.import_list.page_persist", line 150, in do_it
File "calibre_plugins.import_list.page_persist", line 459, in pd_callback
File "calibre_plugins.import_list.page_persist", line 316, in _apply_metadata_updates
File "calibre_plugins.import_list.page_persist", line 369, in _update_mi_for_book
File "calibre_plugins.import_list.page_persist", line 405, in _update_mi_custom_column
File "calibre_plugins.import_list.page_persist", line 44, in to_int
ValueError

Can someone help?
Rellwood is offline   Reply With Quote
Old 07-14-2023, 09:06 PM   #583
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 29,800
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
First of all: update calibre. 6.23 is the latest and that fixed some issues
theducks is online now   Reply With Quote
Old 07-14-2023, 09:24 PM   #584
capink
Wizard
capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.
 
Posts: 1,090
Karma: 1948136
Join Date: Aug 2015
Device: Kindle
Quote:
Originally Posted by Rellwood View Post
Hi!
I am trying to import my GR library list, it has pages and number of ratings. The columns are {0:,d} intengers.

I am getting the following error:
calibre, version 6.19.1
ERROR: Failed:

Traceback (most recent call last):
File "calibre_plugins.import_list.page_persist", line 42, in to_int
ValueError: could not convert string to float: '202,520'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "calibre_plugins.import_list.page_persist", line 150, in do_it
File "calibre_plugins.import_list.page_persist", line 459, in pd_callback
File "calibre_plugins.import_list.page_persist", line 316, in _apply_metadata_updates
File "calibre_plugins.import_list.page_persist", line 369, in _update_mi_for_book
File "calibre_plugins.import_list.page_persist", line 405, in _update_mi_custom_column
File "calibre_plugins.import_list.page_persist", line 44, in to_int
ValueError

Can someone help?
Python functions to convert strings to numerals (int and float) do not handle numbers with commas. Until kiwidude responds to this and decides whether he wants to make the to_int() function capable of removing these automatically, you should remove the commas yourself from your csv column using a program like excel.
capink is offline   Reply With Quote
Old 07-22-2023, 09:16 PM   #585
Rellwood
Library Breeder (She/Her)
Rellwood ought to be getting tired of karma fortunes by now.Rellwood ought to be getting tired of karma fortunes by now.Rellwood ought to be getting tired of karma fortunes by now.Rellwood ought to be getting tired of karma fortunes by now.Rellwood ought to be getting tired of karma fortunes by now.Rellwood ought to be getting tired of karma fortunes by now.Rellwood ought to be getting tired of karma fortunes by now.Rellwood ought to be getting tired of karma fortunes by now.Rellwood ought to be getting tired of karma fortunes by now.Rellwood ought to be getting tired of karma fortunes by now.Rellwood ought to be getting tired of karma fortunes by now.
 
Rellwood's Avatar
 
Posts: 1,156
Karma: 1900479
Join Date: Apr 2015
Location: Fullerton, California
Device: Kobo Aura HD (1) PW3 (4) PW3 2019 new edition (1)
Quote:
Originally Posted by capink View Post
Python functions to convert strings to numerals (int and float) do not handle numbers with commas. Until kiwidude responds to this and decides whether he wants to make the to_int() function capable of removing these automatically, you should remove the commas yourself from your csv column using a program like excel.
Sweet, no problems. Does this mean that Calibre will automatically add the comas though?
Rellwood is offline   Reply With Quote
Reply

Tags
column types


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[GUI Plugin] Reading List kiwidude Plugins 1316 Yesterday 12:52 PM
[GUI Plugin] Manage Sony x50 Reader Book List kpw Plugins 170 10-02-2014 08:23 PM
Import List plugin idea thread kiwidude Development 45 08-13-2012 06:05 AM
[GUI Plugin] WebOS Kindle-Import CranstD Plugins 0 01-24-2012 03:36 PM
[GUI Plugin] Plugin Updater **Deprecated** kiwidude Plugins 159 06-19-2011 12:27 PM


All times are GMT -4. The time now is 09:31 AM.


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