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
|