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

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 01-04-2019, 05:32 AM   #1
EmilThelonius
Enthusiast
EmilThelonius knows who John Galt is.EmilThelonius knows who John Galt is.EmilThelonius knows who John Galt is.EmilThelonius knows who John Galt is.EmilThelonius knows who John Galt is.EmilThelonius knows who John Galt is.EmilThelonius knows who John Galt is.EmilThelonius knows who John Galt is.EmilThelonius knows who John Galt is.EmilThelonius knows who John Galt is.EmilThelonius knows who John Galt is.
 
Posts: 37
Karma: 71294
Join Date: May 2016
Device: Sony DPT-RP1 and Pocketbook Touch Lux 2 and Basic
How to sync MacOs Finder Tags with Calibre Tags

Is there a possibility to sync Calibre Tags to MacOs Finder Tags? So that whenever I change the tags in Apples Finder the Calibre Tags get changed too?

EmilThelonius is offline   Reply With Quote
Old 01-04-2019, 07:10 AM   #2
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 34,914
Karma: 12669638
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
no there isn't
kovidgoyal is offline   Reply With Quote
Old 01-04-2019, 01:32 PM   #3
EmilThelonius
Enthusiast
EmilThelonius knows who John Galt is.EmilThelonius knows who John Galt is.EmilThelonius knows who John Galt is.EmilThelonius knows who John Galt is.EmilThelonius knows who John Galt is.EmilThelonius knows who John Galt is.EmilThelonius knows who John Galt is.EmilThelonius knows who John Galt is.EmilThelonius knows who John Galt is.EmilThelonius knows who John Galt is.EmilThelonius knows who John Galt is.
 
Posts: 37
Karma: 71294
Join Date: May 2016
Device: Sony DPT-RP1 and Pocketbook Touch Lux 2 and Basic
And do you know if there is a possibility of scripting adding one to the other? So Is there a possibility to add calibre tags by script within the finder? Could you modify for example the metadata.opf to add tags to calibre?
EmilThelonius is offline   Reply With Quote
Old 01-04-2019, 01:51 PM   #4
BetterRed
null operator
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: 14,391
Karma: 12542140
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by EmilThelonius View Post
And do you know if there is a possibility of scripting adding one to the other? So Is there a possibility to add calibre tags by script within the finder? Could you modify for example the metadata.opf to add tags to calibre?
If you can save the MacOS tags into a CSV file (with title and author) you should be able to read it into the Import List plugin to update book metadata in a calibre library.

To go the other way, you would export the tags into a similar CSV using the Create catalog feature and import it into MacOS, you may need to add the Create catalog feature to a toolbar or menu.

I have no idea how to export the tags from the MacOS file system into a CSV file, not how to import a CSV into the MacOS file system.

BR
BetterRed is online now   Reply With Quote
Old 01-04-2019, 03:41 PM   #5
EmilThelonius
Enthusiast
EmilThelonius knows who John Galt is.EmilThelonius knows who John Galt is.EmilThelonius knows who John Galt is.EmilThelonius knows who John Galt is.EmilThelonius knows who John Galt is.EmilThelonius knows who John Galt is.EmilThelonius knows who John Galt is.EmilThelonius knows who John Galt is.EmilThelonius knows who John Galt is.EmilThelonius knows who John Galt is.EmilThelonius knows who John Galt is.
 
Posts: 37
Karma: 71294
Join Date: May 2016
Device: Sony DPT-RP1 and Pocketbook Touch Lux 2 and Basic
Quote:
Originally Posted by BetterRed View Post
If you can save the MacOS tags into a CSV file (with title and author) you should be able to read it into the Import List plugin to update book metadata in a calibre library.

To go the other way, you would export the tags into a similar CSV using the Create catalog feature and import it into MacOS, you may need to add the Create catalog feature to a toolbar or menu.

I have no idea how to export the tags from the MacOS file system into a CSV file, not how to import a CSV into the MacOS file system.

BR
Nice Idea! Thank You, I will try it!
EmilThelonius is offline   Reply With Quote
Old 01-04-2019, 09:47 PM   #6
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 34,914
Karma: 12669638
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
If you want to script calibre, use calibredb which has an extensive interface to the calibre database, see https://manual.calibre-ebook.com/gen...calibredb.html
kovidgoyal is offline   Reply With Quote
Old 01-07-2019, 08:44 AM   #7
EmilThelonius
Enthusiast
EmilThelonius knows who John Galt is.EmilThelonius knows who John Galt is.EmilThelonius knows who John Galt is.EmilThelonius knows who John Galt is.EmilThelonius knows who John Galt is.EmilThelonius knows who John Galt is.EmilThelonius knows who John Galt is.EmilThelonius knows who John Galt is.EmilThelonius knows who John Galt is.EmilThelonius knows who John Galt is.EmilThelonius knows who John Galt is.
 
Posts: 37
Karma: 71294
Join Date: May 2016
Device: Sony DPT-RP1 and Pocketbook Touch Lux 2 and Basic
Quote:
Originally Posted by kovidgoyal View Post
If you want to script calibre, use calibredb which has an extensive interface to the calibre database, see https://manual.calibre-ebook.com/gen...calibredb.html
Thank You for this! That put me a huge step forward.
Where I am struggling is getting the ID and use the ID with shell script.

If I use that script, it works nicely:

Code:
#!/bin/bash
id=3149
a='-f "tags:Hegel"'
eval calibredb set_metadata "$a" "$id"
But now, to use as variable, I want to extract the id from $1 where $1 is the path to the metadata.opf file. Do you know how I could accomplish that? Is there a way to single out the ID from the metadata.opf and use it as $id within the calibredb command?
EmilThelonius is offline   Reply With Quote
Old 01-07-2019, 03:41 PM   #8
BetterRed
null operator
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: 14,391
Karma: 12542140
Join Date: Mar 2012
Location: Sydney Australia
Device: none
A calibredb list --fields id,authors,title command will provide a list of books in current library showing the book id, authors, and title columns as a comma separated list. Pipe it to a file and edit that to create the script.

BR
BetterRed is online now   Reply With Quote
Old 01-07-2019, 05:05 PM   #9
EmilThelonius
Enthusiast
EmilThelonius knows who John Galt is.EmilThelonius knows who John Galt is.EmilThelonius knows who John Galt is.EmilThelonius knows who John Galt is.EmilThelonius knows who John Galt is.EmilThelonius knows who John Galt is.EmilThelonius knows who John Galt is.EmilThelonius knows who John Galt is.EmilThelonius knows who John Galt is.EmilThelonius knows who John Galt is.EmilThelonius knows who John Galt is.
 
Posts: 37
Karma: 71294
Join Date: May 2016
Device: Sony DPT-RP1 and Pocketbook Touch Lux 2 and Basic
Thank You – I will try that!

For the time being I found another solution: I used the folder containing the file. There the ID is in Brackets. So I can get the ID with the Code:
Code:
i=$(echo "$1" | awk -F'[()]' '{print $2}')
EmilThelonius is offline   Reply With Quote
Old 01-07-2019, 07:32 PM   #10
BetterRed
null operator
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: 14,391
Karma: 12542140
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by EmilThelonius View Post
Thank You – I will try that!

For the time being I found another solution: I used the folder containing the file. There the ID is in Brackets. So I can get the ID with the Code:
Code:
i=$(echo "$1" | awk -F'[()]' '{print $2}')
I started my post with: "You can extract the id from the book folder name...", but then I thought the calibredb list --fields solution might be better.

Now you have two ways to get what you want.

BR
BetterRed is online now   Reply With Quote
Old 01-09-2019, 09:45 AM   #11
EmilThelonius
Enthusiast
EmilThelonius knows who John Galt is.EmilThelonius knows who John Galt is.EmilThelonius knows who John Galt is.EmilThelonius knows who John Galt is.EmilThelonius knows who John Galt is.EmilThelonius knows who John Galt is.EmilThelonius knows who John Galt is.EmilThelonius knows who John Galt is.EmilThelonius knows who John Galt is.EmilThelonius knows who John Galt is.EmilThelonius knows who John Galt is.
 
Posts: 37
Karma: 71294
Join Date: May 2016
Device: Sony DPT-RP1 and Pocketbook Touch Lux 2 and Basic
Adding Tags from Finder to Books in Calibre via Hazel

So now a first solution (for now):
A short Tip for those of you who want to translate the Tags of the Finder (f.e. made by Hazel https://www.noodlesoft.com/forums/vi...hp?f=3&t=10822) to the Calibre library.

Calibre stores its tags (and other metadata) in the metadata.db database file <del>next to the PDF, Epub or Mobi in the same directory</del> in the calibre library. To access the metadata of calibre you need the calibredb command line, the ID of the book, the Tag you want to add and a nice Program which is called Hazel to automate the process (maybe you can do that with a folder-script, but I am not sure).
The ID is within the folder name containing the book file. So the folder is the one which we want to process with Hazel. In Hazel my setup is:



What it does: it tells Hazel to process all folders which have a certain "Full Name" (because we want to include the folders with a "." in the name) that contains a file that has the tag "Hegel". So we want to add the tag with the Book-ID <del>to all of the metadata.opfs within such a folder we want to add the tag "Hegel"</del> to the metadata.db database in the library so that calibre recognizes those tags.
As the ID needed by calibredb to add such a tag is within the name of the folder (in brackets), we can now extract the ID from the $1 (which Hazel gives the shell script: The File Hazel processes) and use it in the shell script:

Code:
#!/bin/bash

#tells $i to be the number in in brackets of the folder name
i=$(echo "$1" | awk -F'[()]' '{print $2}')

#tells $a to be the tag Hegel
a='-f "tags:Hegel"'

eval calibredb set_metadata "$a" "$i"
fi
Make sure that Calibre is closed otherwise the script will deliver an error.
Now: wherever I wrote "Hegel" you can add every tag you want (or multiple) to insert into calibre. You will need a rule in Hazel for every Tag you want to add –*so simply copy your Hazel rule and change the Tags.

If you know of a better way or see any flaws or possible improvements of that Hazel rule, please write me!

Last edited by BetterRed; 01-10-2019 at 03:49 PM. Reason: change metadat.opf to metadata.db - the difference is important because both exist
EmilThelonius is offline   Reply With Quote
Old 01-09-2019, 05:01 PM   #12
BetterRed
null operator
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: 14,391
Karma: 12542140
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by EmilThelonius View Post
<snip> . . .

Calibre stores its tags (and other metadata) in an metadata.opf file next to the PDF, Epub or Mobi in the same directory. To access the metadata of calibre you need the calibredb command line, the ID of the book, the Tag you want to add and . . .

<snip>
Clarification: calibre stores the metadata in the metadata.db sqlite database file that's found in every library folder. The calibredb command reads and writes to that file, as does the calibre GUI.

The metadata.opf files in the book folders, along with any metadata_db_prefs_backup.json file in the library folder, are the means to restore the metadata.db database should it become corrupt.

BR
BetterRed is online now   Reply With Quote
Old 01-10-2019, 03:52 AM   #13
EmilThelonius
Enthusiast
EmilThelonius knows who John Galt is.EmilThelonius knows who John Galt is.EmilThelonius knows who John Galt is.EmilThelonius knows who John Galt is.EmilThelonius knows who John Galt is.EmilThelonius knows who John Galt is.EmilThelonius knows who John Galt is.EmilThelonius knows who John Galt is.EmilThelonius knows who John Galt is.EmilThelonius knows who John Galt is.EmilThelonius knows who John Galt is.
 
Posts: 37
Karma: 71294
Join Date: May 2016
Device: Sony DPT-RP1 and Pocketbook Touch Lux 2 and Basic
Thanks for the calification! I did not know that!
EmilThelonius is offline   Reply With Quote
Old 09-11-2019, 12:53 PM   #14
ldmobi
Member
ldmobi began at the beginning.
 
Posts: 13
Karma: 10
Join Date: Jan 2018
Device: Kindle Oasis 2
I would need the exact opposite: I would like to set my tags in Calibre and mirror them in Mac OS, do you have any advice?
thanks!



Quote:
Originally Posted by EmilThelonius View Post
So now a first solution (for now):
A short Tip for those of you who want to translate the Tags of the Finder (f.e. made by Hazel https://www.noodlesoft.com/forums/vi...hp?f=3&t=10822) to the Calibre library.

Calibre stores its tags (and other metadata) in the metadata.db database file <del>next to the PDF, Epub or Mobi in the same directory</del> in the calibre library. To access the metadata of calibre you need the calibredb command line, the ID of the book, the Tag you want to add and a nice Program which is called Hazel to automate the process (maybe you can do that with a folder-script, but I am not sure).
The ID is within the folder name containing the book file. So the folder is the one which we want to process with Hazel. In Hazel my setup is:



What it does: it tells Hazel to process all folders which have a certain "Full Name" (because we want to include the folders with a "." in the name) that contains a file that has the tag "Hegel". So we want to add the tag with the Book-ID <del>to all of the metadata.opfs within such a folder we want to add the tag "Hegel"</del> to the metadata.db database in the library so that calibre recognizes those tags.
As the ID needed by calibredb to add such a tag is within the name of the folder (in brackets), we can now extract the ID from the $1 (which Hazel gives the shell script: The File Hazel processes) and use it in the shell script:

Code:
#!/bin/bash

#tells $i to be the number in in brackets of the folder name
i=$(echo "$1" | awk -F'[()]' '{print $2}')

#tells $a to be the tag Hegel
a='-f "tags:Hegel"'

eval calibredb set_metadata "$a" "$i"
fi
Make sure that Calibre is closed otherwise the script will deliver an error.
Now: wherever I wrote "Hegel" you can add every tag you want (or multiple) to insert into calibre. You will need a rule in Hazel for every Tag you want to add –*so simply copy your Hazel rule and change the Tags.

If you know of a better way or see any flaws or possible improvements of that Hazel rule, please write me!
ldmobi is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Embedding TAGS specifically on MacOS ghoetker Library Management 1 12-04-2018 04:10 AM
Sync Calibre Prefs between Win 10 and macOS Sierra saluli Library Management 0 06-05-2017 08:33 PM
Calibre Tags & Aldiko Tags Not the Same Themus Calibre 3 03-21-2012 08:23 PM
Amazon Tags - Popular tags vs Unique tags. chrisanthropic Writers' Corner 6 09-19-2011 11:18 PM
Sony Library Sync/Calibre/Tags? JanieB Calibre 10 04-11-2010 12:44 AM


All times are GMT -4. The time now is 08:34 PM.


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