Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 03-20-2011, 11:13 PM   #1
collin8579
Member
collin8579 began at the beginning.
 
Posts: 21
Karma: 10
Join Date: Mar 2011
Device: Kindle
Oops - Accidently copied author to Series - Help Question

So,, I was bulk editing and doing fine moving series over from Authors

Author - Series - Series index
Moving Series and index to their fields respectivly

Copied over fine,, in my last step I removed the chaff from Author and then tagged the automatically set author sort,,
I was in my search/replace and clicked on my main one (for this process) to look at something,, then went over and auto set author sort, hit apply,,
I didn't realize, to my own sadness,, it would run the search and replace that was in the other tab,,

So, I overwrote the series with the author on 1500 books,, great
Now, I am under the impression there is no way to undo what I just did,, so the first step to me fixing it is removing the authors from the series so I can just put series in later,,

Sooo after all of that,, is there a way to search through for values that are the same in author and series?
I've edited a LOT of books today so I can't just sort by edit date and remove series,,

Appreciate the help,, and that's one mistake I won't make again - Sigh
collin8579 is offline   Reply With Quote
Old 03-21-2011, 04:28 AM   #2
Dopedangel
Wizard
Dopedangel ought to be getting tired of karma fortunes by now.Dopedangel ought to be getting tired of karma fortunes by now.Dopedangel ought to be getting tired of karma fortunes by now.Dopedangel ought to be getting tired of karma fortunes by now.Dopedangel ought to be getting tired of karma fortunes by now.Dopedangel ought to be getting tired of karma fortunes by now.Dopedangel ought to be getting tired of karma fortunes by now.Dopedangel ought to be getting tired of karma fortunes by now.Dopedangel ought to be getting tired of karma fortunes by now.Dopedangel ought to be getting tired of karma fortunes by now.Dopedangel ought to be getting tired of karma fortunes by now.
 
Dopedangel's Avatar
 
Posts: 1,759
Karma: 30063305
Join Date: Dec 2006
Location: Singapore
Device: Boyue
Quote:
Originally Posted by collin8579 View Post
So,, I was bulk editing and doing fine moving series over from Authors

Author - Series - Series index
Moving Series and index to their fields respectivly

Copied over fine,, in my last step I removed the chaff from Author and then tagged the automatically set author sort,,
I was in my search/replace and clicked on my main one (for this process) to look at something,, then went over and auto set author sort, hit apply,,
I didn't realize, to my own sadness,, it would run the search and replace that was in the other tab,,

So, I overwrote the series with the author on 1500 books,, great
Now, I am under the impression there is no way to undo what I just did,, so the first step to me fixing it is removing the authors from the series so I can just put series in later,,

Sooo after all of that,, is there a way to search through for values that are the same in author and series?
I've edited a LOT of books today so I can't just sort by edit date and remove series,,

Appreciate the help,, and that's one mistake I won't make again - Sigh
You can use populate metadata from file to get author names if you have files that have the metadata. As long as you have formats that have metadata inside and you have used calibre to generate them. Even if you have not used calibre most ebook format should have the metadata.
Dopedangel is offline   Reply With Quote
Advert
Old 03-21-2011, 04:34 AM   #3
Manichean
Wizard
Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.
 
Manichean's Avatar
 
Posts: 3,130
Karma: 91256
Join Date: Feb 2008
Location: Germany
Device: Cybook Gen3
I think your best bet at this stage, if you have no backup of your metadata.db file, would be to do a metadata lookup of the damaged books. That could give you some information back.
Manichean is offline   Reply With Quote
Old 03-21-2011, 10:48 AM   #4
collin8579
Member
collin8579 began at the beginning.
 
Posts: 21
Karma: 10
Join Date: Mar 2011
Device: Kindle
That sounds like a good idea, its discriminating those files within the 50k sorting database that is giving me fits,, (yes I took on too much at once),

I thought I might be able to search in the series field,, something like "IF series = authors" but I can't figure out how
collin8579 is offline   Reply With Quote
Old 03-21-2011, 11:01 AM   #5
collin8579
Member
collin8579 began at the beginning.
 
Posts: 21
Karma: 10
Join Date: Mar 2011
Device: Kindle
Ok I did some playing, and when I went in to individual edit I was able to revert them to original broken metadata,, which is better than I was expecting,, however 2 things

One: I Still can't find out how to bulk revert them to original?
Two: Still can't find them all in one place without some sort of Author=series search
collin8579 is offline   Reply With Quote
Advert
Old 03-21-2011, 11:09 AM   #6
Manichean
Wizard
Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.
 
Manichean's Avatar
 
Posts: 3,130
Karma: 91256
Join Date: Feb 2008
Location: Germany
Device: Cybook Gen3
Do a search like
Code:
authors:"series name"
Manichean is offline   Reply With Quote
Old 03-21-2011, 01:22 PM   #7
collin8579
Member
collin8579 began at the beginning.
 
Posts: 21
Karma: 10
Join Date: Mar 2011
Device: Kindle
I understand that syntax,
however I quite literally meant "author" = "series"
meaning I need them both to be the same to fulfill the criteria,, but not specifically know the name of either up front
So when it does this search it finds
Author Jk Rowling Series JK Rowling
but not Author Jk Rowling Series Harry Potter

Hopefully that clears that question up a little
thanks
collin8579 is offline   Reply With Quote
Old 03-21-2011, 01:59 PM   #8
Starson17
Wizard
Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.
 
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
Quote:
Originally Posted by collin8579 View Post
I need them both to be the same to fulfill the criteria,, but not specifically know the name of either up front
You can't do it. Not that way. It's the same question as finding duplicates (A long thread in the development area) or more recently finding language matches:

You have the same choices as in this thread:

https://www.mobileread.com/forums/sho...d.php?t=125614

Although you can't do it in the search bar, you can create a composite column that compares other columns and produces 'yes' or 'no' as appropriate. Consider chaley's posts about the 'strcmp' function. You can do SQL searches as another option. Searches on duplicate finding will turn up SQL related code.
Starson17 is offline   Reply With Quote
Old 03-21-2011, 06:03 PM   #9
collin8579
Member
collin8579 began at the beginning.
 
Posts: 21
Karma: 10
Join Date: Mar 2011
Device: Kindle
Thanks, I"ll check that out
collin8579 is offline   Reply With Quote
Old 03-21-2011, 06:13 PM   #10
Manichean
Wizard
Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.
 
Manichean's Avatar
 
Posts: 3,130
Karma: 91256
Join Date: Feb 2008
Location: Germany
Device: Cybook Gen3
Quote:
Originally Posted by collin8579 View Post
I understand that syntax,
however I quite literally meant "author" = "series"
meaning I need them both to be the same to fulfill the criteria,, but not specifically know the name of either up front
I know what you meant. But I assume you know which series got borked, so if you search for the series in the author field, you get the messed-up books by series. This obviously doesn't find all of them at once, but I figured this would be better than having to manually search them.
Manichean is offline   Reply With Quote
Old 03-21-2011, 06:25 PM   #11
reading
Junior Member
reading began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Mar 2011
Device: Kindle
If doing this in windows ...

calibredb.exe list --separator , -w 255 -f title,series >tmp.txt
FOR /F "usebackq tokens=1-3 delims=," %a in ("tmp.txt") do if "%b"=="%c" echo %a

The first command should create a comma seperated file with all of your books in it, the format will be "ID,title,series", if you want different fields add them to the -f switch

the second commands reads each line from the text file, seperates each of the comma seperated values into variable %a through %c, in this example we check to see if title (%b) and series (%c) are the same and if so echo the calibre ID which can be used in other calibredb commands.

Note if you add more fields, you need to increase the number of tokens in the second command

like so ..

calibredb.exe list --separator , -w 255 -f authors,title,series >tmp.txt
FOR /F "usebackq tokens=1-4 delims=," %a in ("tmp.txt") do if "%c"=="%d" echo %a,%b,%c

In this case we add authors, and display the ID, title and author on the books that have the problem.

in theory, you can figure out the calibre directory for each file from this

say your calibre database is in C:\Calibre then

calibredb.exe list --separator , -w 255 -f authors,title,series >tmp.txt
FOR /F "usebackq tokens=1-4 delims=," %a in ("tmp.txt") do if "%c"=="%d" echo "C:\Calibre\%b\%c (%a)\metadata.opf"

Should give you a list of all the metadata files you need to go edit ....
reading is offline   Reply With Quote
Old 03-21-2011, 06:55 PM   #12
reading
Junior Member
reading began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Mar 2011
Device: Kindle
The following vbs file

'=========================
strFileName = Wscript.Arguments(0)
strItem = Wscript.Arguments(1)
StrSeries="<meta content=""" & strItem & """ name=""calibre:series""/>"

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile(strFileName, 1)
strText = objFile.ReadAll
objFile.Close

Replace(strText,StrSeries,"")
Set objFile = objFSO.CreateTextFile(strFilename, True)
objFile.Write strText
objFile.Close
'=========================

Should delete the series tag from the OPF file
save the text between the '============ in a file say editopf.vbs

then

cscript editopf.vbs <opffile> "<title>"

would remove the line <meta content="title" name="calibre:series"/> from the opf file

then
calibredb set_metadata ID <opffile>

would update the database

rolling it up

creeat the vbs file above
create a file fix.cmd

REM === FIX.CMD ===
set opf="C:\Calibre\%~2\%~3 (%~1)\metadata.opf"
cscript /nologo editopf.vbs %opf% "%~3"
start "DB" /WAIT cmd /c "C:\program files\calibre2\calibredb.exe" set_metadata %~1 %opf%
REM === END OF FIX.CMD ====

use FIX.CMD ID "Author" "Title"
to fix a single book

then get the list of all your books into tmp.txt with

calibredb.exe list --separator , -w 255 -f authors,title,series >tmp.txt

Now run fix.cmd for each match

FOR /F "usebackq tokens=1-4 delims=," %a in ("tmp.txt") do if "%c"=="%d" call fix.cmd %~a "%~b" "%~c"


Obviously you would want to test it a bit first .... maybe with one book in tmp.txt
reading is offline   Reply With Quote
Old 03-21-2011, 07:08 PM   #13
reading
Junior Member
reading began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Mar 2011
Device: Kindle
BTW, for some bizare reason running calibre at the command prompt prevents CMD files from running, so you may need to open a new cmd prompt before you start using the fix.cmd file.

The following line in fix.cmd starts calibredb in a separate cmd process so it doesn't mess up the running of fix.cmd itself.

start "DB" /WAIT cmd /c "C:\program files\calibre2\calibredb.exe" set_metadata %~1 %opf%

if you think that the calibredb command is not working right, you will need to change the /c to /k, this will leave the new cmd window open when calibredb is done so you can see any error message it displayed
reading is offline   Reply With Quote
Old 03-21-2011, 11:42 PM   #14
collin8579
Member
collin8579 began at the beginning.
 
Posts: 21
Karma: 10
Join Date: Mar 2011
Device: Kindle
Wow, Thank you - I will have to experiment with this,,
collin8579 is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Old Thread] Sorting folders by author/series/title goodreader16 Library Management 15 05-06-2011 01:18 AM
Get to Know-an Author with Noahan Author Interview series! NoahMGillman Self-Promotions by Authors and Publishers 22 12-19-2010 09:45 PM
Accidently Deleted my Calibre Library! Dang it! willmize Calibre 13 10-10-2010 05:03 AM
Calibre doesnt remember (Title.Author,Series,Metadata) changes?! Rafaelo4 Calibre 9 08-19-2010 07:23 AM
Author, Series, Series #, Books diokdin Calibre 19 05-14-2010 05:36 AM


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


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