Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Conversion

Notices

Reply
 
Thread Tools Search this Thread
Old 01-03-2017, 07:42 AM   #1
riff
Junior Member
riff began at the beginning.
 
riff's Avatar
 
Posts: 6
Karma: 10
Join Date: Jan 2017
Device: none
ebook-files not recognized after conversion by calibr-server

I run a calibre-server on my Debian-7-NAS.
Database+ebooks are stored in /media/xxx/calibre. I use EPUB as prefered format, but want to provide MOBI as well. So i converted all EPUBs with command-line to MOBI, set permissions correct (same as the epub, 750), restarted server-instance, but the server does not offer the MOBI in Web-GUI.

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"
done
Why do the MOBI show not up?

I think I have to add the file-format to DB with
Code:
calibredb add_format --dont-replace id ebook_file
but for this I need to get the ID of each Ebook-File which I want to add to the DB, so that I can use it in my Batch-Script.
Do I need to specify the location of DB separately?

Last edited by riff; 01-03-2017 at 07:59 AM.
riff is offline   Reply With Quote
Old 01-03-2017, 08:04 AM   #2
mbovenka
Wizard
mbovenka ought to be getting tired of karma fortunes by now.mbovenka ought to be getting tired of karma fortunes by now.mbovenka ought to be getting tired of karma fortunes by now.mbovenka ought to be getting tired of karma fortunes by now.mbovenka ought to be getting tired of karma fortunes by now.mbovenka ought to be getting tired of karma fortunes by now.mbovenka ought to be getting tired of karma fortunes by now.mbovenka ought to be getting tired of karma fortunes by now.mbovenka ought to be getting tired of karma fortunes by now.mbovenka ought to be getting tired of karma fortunes by now.mbovenka ought to be getting tired of karma fortunes by now.
 
Posts: 2,079
Karma: 14079267
Join Date: Oct 2007
Location: Almere, The Netherlands
Device: Kobo Sage
Quote:
Originally Posted by riff View Post
Why do the MOBI show not up?
Because you mucked about under Calibre's skirts. Ebook-convert does just that: it converts an ebook file from one ebook format to another. It does not update Calibre's database (metadata.db)

i.e. Calibre has no idea the MOBI files exist, even though they are physically there.

If you run 'Check database' and have it compare the database with the files on disk, it will show the MOBI files as extra files. I'm not sure you then get the option to 'adopt' them, as it were; I don't think so, actually. You do get the option to delete them, that I know.

If you want to do this, do the conversion from the GUI.

edit: Or start messing about with the other command line tools, as you yourself suggest :-)

Last edited by mbovenka; 01-03-2017 at 08:06 AM.
mbovenka is offline   Reply With Quote
Advert
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
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
GnuTLS: received alert [112]: The server name sent was not recognized exachillus Calibre 4 03-26-2014 08:29 AM
Calibr: options d'affichage (paramétrer) icare2 Software 3 02-11-2014 10:10 PM
Would this work for Calibr Server? Synergi Library Management 12 10-07-2013 07:48 PM
calibre-server: Doesn't server up newly added files kaistian Calibre 5 03-17-2013 11:54 AM
ebook-convert not recognized as a command p3aul Calibre 11 10-11-2009 03:19 PM


All times are GMT -4. The time now is 03:36 PM.


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