View Single Post
Old 01-03-2017, 08:16 AM   #3
riff
Junior Member
riff began at the beginning.
 
riff's Avatar
 
Posts: 6
Karma: 10
Join Date: Jan 2017
Device: none
for
Code:
./calibredb check_library
i get
Code:
No library found at None
Code:
./calibredb --library-path /media/xxx/calibre/metadata.db check_library
seems to have wrong synthax

I am not that advanced in using bash and command line. I did connect with GUI to the server (Remote-DB), but is crap converting the ebooks like that, because they will be downloaded, converted and uploaded again. I work a lot far away from home, so my goal was that the server can work on conversion itself. Using GUI from remote just takes sooo long an blocks my laptop meanwhile. On lost VPN-Connection, conversion is stopped with an error.

Edit:
Code:
./calibredb --with-library=/media/xxx/calibre/ check_library
worked, shows that there are new files, but does not add them to DB.

Edit:
I tried
Code:
./calibredb --with-library=/media/xxx/calibre/ add_format book-id /media/xxx/calibre/author/book-title/book-title.mobi
but has wrong synthax.

Edit:
Code:
./calibredb add_format --with-library=/media/xxx/calibre/ book-id /media/xxx/calibre/author/book-title/book-title.mobi
worked, I see my MOBI! Now I have to refit my bash-script.

Edit: Script now looks like this:

Code:
#!/bin/bash
IFS=$'\n'
for file in `find /media/xxx/calibre/ -type f -name "*.epub"`
do
    /opt/calibre/ebook-convert "$file" "${file%epub}mobi" && chown calibre:users "${file%epub}mobi"
    idstring=`dirname "${file%epub}mobi"`
    idstring=${idstring%\)}
    /opt/calibre/calibredb add_format --with-library=/media/xxx/calibre/ ${idstring##*\(} "${file%epub}mobi"
done
Thanks a lot!

Edit 23.02.2017

I added a check for existing MOBI-Files in my script
Code:
#!/bin/bash
    IFS=$'\n'
    for file in `find /media/xxx/calibre/ -type f -name "*.epub"`
    do
     if [ ! -f "${file%epub}mobi" ]
     then
      /opt/calibre/ebook-convert "$file" "${file%epub}mobi" && chown calibre:users "${file%epub}mobi"
      idstring=`dirname "${file%epub}mobi"`
      idstring=${idstring%\)}
      /opt/calibre/calibredb add_format --with-library=/media/xxx/calibre/ ${idstring##*\(} "${file%epub}mobi"
     fi
    done
It works out quite well for a small DB with 100 books, skips the existing if there are any.
When I apply the script to my large DB it works out well in beginning, but messes things up after a while.

When my source EPUB file is for example

"Albert Einstein - My Biography.epub"
a file with name
"Albert Einstein - My Biography.mobi"
should be created and added to the DB.
But somehow in between I get two MOBI Files in one book directory, the
"Albert Einstein - My Biography.mobi"
and another one like
"Einstein, Albert - My Biography (French).mobi"

My DB does not contain any MOBI at the beginning, so I can exclude the fact the "creepy file" existed before. Only a couple books get two MOBIs, I can't tell why. Also I can't figure out where these files come from and have a different name than the script would generate.
This is quite annoying, because it messes up my DB and I have to restore a backup.

How can I figure out what is wrong and how can I solve my problem?

I appreciate your help, thank you in advance.

Last edited by riff; 02-23-2017 at 03:45 AM.
riff is offline   Reply With Quote