I know the answer to this one!
Quote:
Originally Posted by eschwartz
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
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
|