View Single Post
Old 02-19-2014, 02:49 PM   #27
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,421
Karma: 85400180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
Quote:
Originally Posted by Gregg Bell View Post
Thanks eschwartz. So with the apropos thing, so you get all those commands. So then what? Do you choose one if you wish? And then if you decide to do that, how do you choose it?
apropos is just a way of informing you about commands, so if you want to use one, say "apropos calibre" told you that "ebook-convert" is "part of calibre" you then go ahead and type "ebook-convert".

And then you get
Code:
Usage: ebook-convert input_file output_file [options]

Convert an ebook from one format to another.

input_file is the input and output_file is the output. Both must be specified as the first two arguments to the command.

The output ebook format is guessed from the file extension of output_file. output_file can also be of the special format .EXT where EXT is the output file extension. In this case, the name of the output file is derived from the name of the input file. Note that the filenames must not start with a hyphen. Finally, if output_file has no extension, then it is treated as a directory and an "open ebook" (OEB) consisting of HTML files is written to that directory. These files are the files that would normally have been passed to the output plugin.

After specifying the input and output file you can customize the conversion by specifying various options. The available options depend on the input and output file types. To get help on them specify the input and output file and then use the -h option.

For full documentation of the conversion system see
http://manual.calibre-ebook.com/conversion.html

Whenever you pass arguments to ebook-convert that have spaces in them, enclose the arguments in quotation marks.

Options:
  --version       show program's version number and exit

  -h, --help      show this help message and exit

  --list-recipes  List builtin recipe names. You can create an ebook from a
                  builtin recipe like this: ebook-convert "Recipe Name.recipe"
                  output.epub


Created by Kovid Goyal <kovid@kovidgoyal.net>
Which tells you how to use it. Many commands, if they need to be used on something, will show you the help message when the file that must be acted upon wasn't specified.

Quote:
And yeah, I'd be interested in the automatic updating of Calibre.

This is how you update calibre -- by reinstalling.

Do you uninstall first? And does this apply to all Linux updating of software?

Thanks.
Most linux software gets updated through the Software Center -- or rather, the Update Manager which is connected to the Software Center. (But both of them come as one in the command line. "apt-get" followed by "install program-name" to either install something new or update it, or followed by "upgrade" to update everything.)

calibre is different -- since it gets weekly updates, you can't rely on the version in the software center, which doesn't get updated after the Ubuntu version gets released. Ubuntu updates programs only if they're really important ones, like the browser, or if they have security fixes, or a volunteer does it.

So Kovid Goyal bundles everything needed to run calibre in one zipped folder, and the command
Code:
sudo python -c "import sys; py3 = sys.version_info[0] > 2; u = __import__('urllib.request' if py3 else 'urllib', fromlist=1); exec(u.urlopen('http://status.calibre-ebook.com/linux_installer').read()); main(install_dir='/opt')"
unzips it to the default (or specified) location, then makes shortcuts in the application menu. Re-running this will overwrite the previous folder, in effect this leaves calibre upgraded without having to *actually* uninstall.




Okay, updating automatically. Go to the software center and install the program "gnome-schedule". This is the GUI interface for linux's equivalent to the Task Scheduler. Your computer will already have the command-line version, "crontab", installed. You can use that too, just run "crontab -e", but you will have to edit a text file within the terminal. So use gnome-schedule for now.

Run the following command in the terminal (It must be run as the root user, or you cannot create a task as the root user):
Code:
gksu gnome-schedule
Then create a task (one guide is here: http://www.maketecheasier.com/easy-w...sks-in-ubuntu/) that will run
Code:
sudo python -c "import sys; py3 = sys.version_info[0] > 2; u = __import__('urllib.request' if py3 else 'urllib', fromlist=1); exec(u.urlopen('http://status.calibre-ebook.com/linux_installer').read()); main(install_dir='/opt')"
every week on Friday, at say, 6 in the morning, so you will presumably be asleep when it updates. (we don't want to upgrade while we try to run it. )


For bonus points, you can use the commands listed at this thread HERE (again) which will first check to see if calibre was updated, then shutdown calibre if it's currently running.

Store this as calibre-upgrade.sh;
Code:
#!/bin/bash

calibre-debug -c "import urllib as u; from calibre.constants import numeric_version; raise SystemExit(int(numeric_version  < (tuple(map(int, u.urlopen('http://calibre-ebook.com/downloads/latest_version').read().split('.'))))))"

UP_TO_DATE=$?

if [ $UP_TO_DATE = 0 ]; then
        echo "Calibre is up-to-date"
else
        killall calibre calibre-server
        sudo python -c "import sys; py3 = sys.version_info[0] > 2; u = __import__('urllib.request' if py3 else 'urllib', fromlist=1); exec(u.urlopen('http://status.calibre-ebook.com/linux_installer').read()); main(install_dir='/opt')"
fi
and then run that file in the task scheduler.
eschwartz is offline