View Single Post
Old 01-31-2014, 12:21 PM   #29
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)
I know the answer to this one!

Quote:
Originally Posted by eschwartz View Post
And Kovid fixed that. See here: Official calibre PPA? where we discussed updating via a script using that check.

This thread also has a nice elegant way of checking if there is an update available -- Kovid helped us thrash it out.

Here it is:

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
Quote:
Originally Posted by Geremia View Post
Wow, thanks for that, but I get this error:
Code:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "<string>", line 356, in main
  File "<string>", line 192, in prints
TypeError: encode() argument 1 must be string, not None
eschwartz is offline   Reply With Quote