Register Guidelines E-Books Search Today's Posts Mark Forums Read

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

Notices

Reply
 
Thread Tools Search this Thread
Old 09-18-2016, 06:50 AM   #1
Terisa de morgan
Grand Sorcerer
Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.
 
Terisa de morgan's Avatar
 
Posts: 6,403
Karma: 12408443
Join Date: Jun 2009
Location: Madrid, Spain
Device: Kobo Clara/Aura One/Forma,XiaoMI 5, iPad, Huawei MediaPad, YotaPhone 2
[FileType Plugin] GetFileName

This plugin allows you to store the name of your imported file in a custom column.

Special Notes:
  • Requires calibre 2.49.1 or later
  • It only stores the name when a new book is added to the library, not when a file is added to an existing book.
  • No menu or toolbar entry. Customization is accessed through Preferences -> Plugin
  • The last one version will try to migrate the configuration, as it's now based on file and not on the database.

Installation Notes:
  1. Install from Preferences -> Get New Plugins, or download the attached zip file and install the plugin manually
  2. Restart Calibre
  3. Configure the plugins from Preferences -> Plugins

Configuration Notes:
  • The plugin uses up to four custom columns, these should be created via Preferences -> Add your own custom columns before configuring the plugin.
    • The column type of three of them must be capable of storing text and the other one of storing dates. The drop down selectors will only offer columns of the proper type - i.e. no numbers, Yes/no, etc.
    • A custom column name must be specified in the File Name variable.
    • The File Extension and File Folder variables are optional, i.e. they can be left empty.
  • Configure the plugin for each library where you want to store the originating file name.
    • Leave it unconfigured if you don't want to use on a specific library (eg News Clippings).
    • The configuration, including column names, can be different for each library.
    • The column name can be different across libraries
  • If the File Extension column name is not specified, then the full file name (base name.extension) is stored in the File Name column.
    Otherwise, the base name is stored in the File Name column, and the extension is stored in the File Extension column.
  • If "Include folder" is checked, and File Folder column name is not specified, then the complete file name including the folder path is stored in the File Name column, with or without extension, depends on File Extension setting.
    Otherwise, the folder path is stored in the File Folder column, and the file name is stored in the File Name column, with or without extension, depends on File Extension setting.

Version History:
Spoiler:

Version 0.1.1 - 18 Nov 2020
Error reported by halloleo importing pdf
Version 0.2.0 - 11 Jul 2022
Migration to QT6 (Thanks davidfor)
Fixed bug getting date
Version 0.1.0 - 25 Sep 2020
Ported to python 3
Version 0.0.12 - 12 Dec 2018
Configuration included in json file instead of database.
Version 0.0.12 - 26 Feb 2017
Some books without file name when added in big batch.
Configuration problems.
Version 0.0.11 - 14 Feb 2017
All the file types are supported now.
Version 0.0.10 - 30 Jan 2017
It does not allow to configure non treated options.
Version 0.0.9 - 26 Jan 2017
Corrected (hopefully) bug when file path is not stored.
Included Spanish translation.
Version 0.0.8 - 25 Jan 2017
Date of last modification of the file is stored
Corrected (hopefully) bug when Kindle books with extensions distinct of ".azw" are not stored.
Version 0.0.7 - 26 Dec 2016
Original file directory is stored
Corrected (hopefully) bug when dots are included in file name
Version 0.0.6 - 13 Nov 2016
File name is not stored in Copy to Library
Version 0.0.5 - 04 Oct 2016
File path can be stored.
Version 0.0.4 - 25 Sep 2016
Name and extension can fulfill different columns
Version 0.0.3 - 20 Sep 2016
Name not fulfilled when adding an empty book
Version 0.0.2 - 19 Sep 2016
Comments column accepted as valid destination
Version 0.0.1 - 18 Sep 2016
Initial release
Attached Files
File Type: zip GetFileName.zip (22.6 KB, 43461 views)

Last edited by Terisa de morgan; 07-11-2022 at 05:37 AM. Reason: Release 0.0.13 added
Terisa de morgan is offline   Reply With Quote
Old 09-21-2016, 01:44 PM   #2
fidvo
Addict
fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.
 
Posts: 301
Karma: 1599870
Join Date: Jun 2012
Device: none
This is going to be very useful. Thanks!!

If you'll indulge me for a moment, there are a couple of features that I would love to see added to this plugin.

1. An option to split the file name and extension into two columns.

As it is, this allows you to see the original format of the book when it was first imported, which is great. Several people have asked for that feature. Splitting the extension into its own field would make it easier to identify these original formats in the tag browser. Also, I use a custom Title ID field in my Save to Disk template. If I could populate this field without the extension, it would work perfectly. Yes, I could run a search and replace on the books to remove the extension, but that's one more step I have to perform.

2. Save the file path in another column.

Ideally it would convert the path separators "/" or "\" into periods. That way, it could populate a hierarchical field and you could use the tag browser to browse the folder structure.

Even better would be to include a field in the plugin setup for a "relative path" prefix. If the file path begins with this prefix, it removes it before populating the column. e.g. if the relative path is "C:\In\Ebooks\" and the book comes from "C:\In\Ebooks\Science_Fiction\Verne_Jules\" then it would populate the File Path field with "Science_Fiction.Verne_Jules".

If you decide not to add these, I'll probably dust off my old Python books and see if I can add the features to my own copy of the plugin, but I would love to see them implemented in the official version.

Thanks again!
fidvo is offline   Reply With Quote
Advert
Old 09-21-2016, 04:37 PM   #3
Terisa de morgan
Grand Sorcerer
Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.
 
Terisa de morgan's Avatar
 
Posts: 6,403
Karma: 12408443
Join Date: Jun 2009
Location: Madrid, Spain
Device: Kobo Clara/Aura One/Forma,XiaoMI 5, iPad, Huawei MediaPad, YotaPhone 2
Glad it can be useful! About your request:

* The extension extract would be feasible, and you can define the column for it (and you split the name) or not (and it's like now).

* The path suggestion I don't think so, as some plugins can change the directory.

I'll be back in a couple (or three days) with the first change.
Terisa de morgan is offline   Reply With Quote
Old 09-21-2016, 05:21 PM   #4
fidvo
Addict
fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.
 
Posts: 301
Karma: 1599870
Join Date: Jun 2012
Device: none
Great news!

I'm not sure what you mean by plugins changing the directory. I was talking about the path to the original file. Are you saying plugins change this?

e.g. if the original file is:

C:\In\Ebooks\Science_Fiction\Verne_Jules\80days.ep ub then you would end up with the following custom fields filled (assuming you configured it to use those fields)

#titleid: 80days
#original_format: epub
#original_path: C:.In.Ebooks.Science_Fiction.Verne_Jules

Anyway, splitting the file name and extension will save me a lot of time when adding books to my libraries. Thanks again!
fidvo is offline   Reply With Quote
Old 09-21-2016, 05:27 PM   #5
Terisa de morgan
Grand Sorcerer
Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.
 
Terisa de morgan's Avatar
 
Posts: 6,403
Karma: 12408443
Join Date: Jun 2009
Location: Madrid, Spain
Device: Kobo Clara/Aura One/Forma,XiaoMI 5, iPad, Huawei MediaPad, YotaPhone 2
Quote:
Originally Posted by fidvo View Post
Great news!

I'm not sure what you mean by plugins changing the directory. I was talking about the path to the original file. Are you saying plugins change this?
In some cases, I've been told yes... think about DeDRM, for example
Terisa de morgan is offline   Reply With Quote
Advert
Old 09-21-2016, 07:10 PM   #6
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: 21,064
Karma: 27620706
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by Terisa de morgan View Post
In some cases, I've been told yes... think about DeDRM, for example
I suspect DeDRM creates a DRM free version of the file somewhere, maybe in the 'temporary' folder, and that file is the one that gets added to the library. I can't test because I don't have any DRM protected books - nor the plugin.

Autoadd works OK

BR
BetterRed is offline   Reply With Quote
Old 09-21-2016, 07:14 PM   #7
fidvo
Addict
fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.
 
Posts: 301
Karma: 1599870
Join Date: Jun 2012
Device: none
Quote:
Originally Posted by Terisa de morgan View Post
In some cases, I've been told yes... think about DeDRM, for example
I still must be missing something. I don't use DeDRM myself, but doesn't it just modify the book? Where it came from is irrelevant.

I just figured that to add a book to the library, at some point Calibre has to know the path to that book in order to load the file into memory for adding to the database.

Of course, that path may not be accessible to plugins. And maybe other plugins do interfere with it. If you tell me it's not possible or there are too many complications, I'll believe you. I'm still looking forward to the changes you're making. And like I said, I might see if I can modify my own copy of the plugin to add the feature. Or at least get a better understanding of why it won't work.

fidvo is offline   Reply With Quote
Old 09-21-2016, 07:41 PM   #8
fidvo
Addict
fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.
 
Posts: 301
Karma: 1599870
Join Date: Jun 2012
Device: none
Okay, I did some research and I think I understand what you meant by plugins changing the path.

If I understand correctly, because your plugin is a kind of post-processing for books being added to the library, it doesn't have access to the original file path. By the time your plugin is triggered, the file might have been altered and either been saved to a temporary location or exists only in memory. So when you try to read the path to the file, the result is this new location or just a pointer to the memory stream.

Oh well. I guess it won't work. But at least I got most of what I want, so I'm happy!
fidvo is offline   Reply With Quote
Old 09-25-2016, 07:58 AM   #9
Terisa de morgan
Grand Sorcerer
Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.
 
Terisa de morgan's Avatar
 
Posts: 6,403
Karma: 12408443
Join Date: Jun 2009
Location: Madrid, Spain
Device: Kobo Clara/Aura One/Forma,XiaoMI 5, iPad, Huawei MediaPad, YotaPhone 2
Quote:
Originally Posted by BetterRed View Post
I suspect DeDRM creates a DRM free version of the file somewhere, maybe in the 'temporary' folder, and that file is the one that gets added to the library. I can't test because I don't have any DRM protected books - nor the plugin.
You're right. I've got both things and, when I was tested the changes, I made a mistake and the directory appeared there... not the original one, so no change of getting the initial directory.

BTW, glad it works with autoadd, because I haven't tested it (I don't use that feature).

New release added, with extension configuration.
Terisa de morgan is offline   Reply With Quote
Old 09-27-2016, 01:30 PM   #10
fidvo
Addict
fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.fidvo ought to be getting tired of karma fortunes by now.
 
Posts: 301
Karma: 1599870
Join Date: Jun 2012
Device: none
I just installed the new version, and it works great!

I took a look at the source code the other day, and I might make a custom version for myself with some more file types in it because I want to use it for my non-book libraries (I use Calibre in lots of ways it wasn't meant for), but I'm quite happy with the plugin.

fidvo is offline   Reply With Quote
Old 09-27-2016, 01:56 PM   #11
Terisa de morgan
Grand Sorcerer
Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.
 
Terisa de morgan's Avatar
 
Posts: 6,403
Karma: 12408443
Join Date: Jun 2009
Location: Madrid, Spain
Device: Kobo Clara/Aura One/Forma,XiaoMI 5, iPad, Huawei MediaPad, YotaPhone 2
Glad it's useful! And go ahead with the modifications, I do it myself a lot of times for taylor-making a plugin.
Terisa de morgan is offline   Reply With Quote
Old 09-27-2016, 06:16 PM   #12
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: 21,064
Karma: 27620706
Join Date: Mar 2012
Location: Sydney Australia
Device: none
@Terisa de morgan - I think the plugin should be file type agnostic - I can add just about any file type by dropping it into the book list, or via a shortcut to calibre.exe in my Window Send To folder. I use the latter for ~95% of things I add, and ~30% of things I add are not ebook formats.

I'd also like to see an option to save the full path, in my case it gives me a clue as to the source. At the moment I copy the path into the clipboard before I execute the 'Send To calibre', and paste it into #file in the book list.

BR
BetterRed is offline   Reply With Quote
Old 09-28-2016, 01:13 AM   #13
Terisa de morgan
Grand Sorcerer
Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.
 
Terisa de morgan's Avatar
 
Posts: 6,403
Karma: 12408443
Join Date: Jun 2009
Location: Madrid, Spain
Device: Kobo Clara/Aura One/Forma,XiaoMI 5, iPad, Huawei MediaPad, YotaPhone 2
@BetterRed - The plugin is agnostic, gets the file extension but knows nothing about type (if you see epub es because the extension is ".epub", as you would see prc instead of mobi/azw).

The plugin doesn't know the original path but the previous path, which is a temp directory if you use DeDrm plugin, for example. If, knowing that, you still want the path option, I can add it in the same way I've added the extension field.
Terisa de morgan is offline   Reply With Quote
Old 09-28-2016, 01:55 AM   #14
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: 21,064
Karma: 27620706
Join Date: Mar 2012
Location: Sydney Australia
Device: none
@Terisa de Morgan - I think I added an MP3 to a library where I hadn't configured the file name column

Another Under The Counter transaction

I'd be happy with radio buttons - File Name Only, or Full Path - but whatever is easiest for you, including nothing, will do

BR
BetterRed is offline   Reply With Quote
Old 09-28-2016, 03:59 AM   #15
Terisa de morgan
Grand Sorcerer
Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.
 
Terisa de morgan's Avatar
 
Posts: 6,403
Karma: 12408443
Join Date: Jun 2009
Location: Madrid, Spain
Device: Kobo Clara/Aura One/Forma,XiaoMI 5, iPad, Huawei MediaPad, YotaPhone 2
Quote:
Originally Posted by BetterRed View Post
@Terisa de Morgan - I think I added an MP3 to a library where I hadn't configured the file name column

Another Under The Counter transaction
Glad to know I've messed nothing

Quote:
Originally Posted by BetterRed View Post
I'd be happy with radio buttons - File Name Only, or Full Path - but whatever is easiest for you, including nothing, will do

BR
I've never used radio buttons, I good way to learn to use them Anyway, would you want the path in another field or inside the filename field?
Terisa de morgan is offline   Reply With Quote
Reply

Tags
calibredb, calibredb metadata import, plugin

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[FileType Plugin] YVES Bible Plugin ClashTheBunny Plugins 27 01-16-2023 02:25 AM
How to sort quickly books by filetype? construsol Calibre 7 05-24-2014 07:20 PM
Calibre associated with every filetype?! sej7278 Calibre 14 08-09-2011 11:36 AM
Zip Filetype Plugin? rsingley Plugins 7 02-11-2011 06:11 PM
How to register a filetype? plisken iRex 2 09-28-2009 08:16 AM


All times are GMT -4. The time now is 09:40 PM.


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