03-20-2011, 11:13 PM | #1 |
Member
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 |
03-21-2011, 04:28 AM | #2 | |
Wizard
Posts: 1,759
Karma: 30063305
Join Date: Dec 2006
Location: Singapore
Device: Boyue
|
Quote:
|
|
Advert | |
|
03-21-2011, 04:34 AM | #3 |
Wizard
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.
|
03-21-2011, 10:48 AM | #4 |
Member
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 |
03-21-2011, 11:01 AM | #5 |
Member
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 |
Advert | |
|
03-21-2011, 11:09 AM | #6 |
Wizard
Posts: 3,130
Karma: 91256
Join Date: Feb 2008
Location: Germany
Device: Cybook Gen3
|
Do a search like
Code:
authors:"series name" |
03-21-2011, 01:22 PM | #7 |
Member
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 |
03-21-2011, 01:59 PM | #8 | |
Wizard
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
|
Quote:
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. |
|
03-21-2011, 06:03 PM | #9 |
Member
Posts: 21
Karma: 10
Join Date: Mar 2011
Device: Kindle
|
Thanks, I"ll check that out
|
03-21-2011, 06:13 PM | #10 |
Wizard
Posts: 3,130
Karma: 91256
Join Date: Feb 2008
Location: Germany
Device: Cybook Gen3
|
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.
|
03-21-2011, 06:25 PM | #11 |
Junior Member
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 .... |
03-21-2011, 06:55 PM | #12 |
Junior Member
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 |
03-21-2011, 07:08 PM | #13 |
Junior Member
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 |
03-21-2011, 11:42 PM | #14 |
Member
Posts: 21
Karma: 10
Join Date: Mar 2011
Device: Kindle
|
Wow, Thank you - I will have to experiment with this,,
|
|
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 |