mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #368
This commit is contained in:
parent
494c50dd96
commit
f9441e3676
36
src/libprs500/gui2/update.py
Normal file
36
src/libprs500/gui2/update.py
Normal file
@ -0,0 +1,36 @@
|
||||
## Copyright (C) 2007 Kovid Goyal kovid@kovidgoyal.net
|
||||
## This program is free software; you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published by
|
||||
## the Free Software Foundation; either version 2 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along
|
||||
## with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
import urllib, re
|
||||
|
||||
from PyQt4.QtCore import QThread, SIGNAL
|
||||
|
||||
from libprs500 import __version__
|
||||
from libprs500.ebooks.BeautifulSoup import BeautifulSoup
|
||||
|
||||
class CheckForUpdates(QThread):
|
||||
|
||||
def run(self):
|
||||
src = urllib.urlopen('http://pypi.python.org/pypi/libprs500').read()
|
||||
soup = BeautifulSoup(src)
|
||||
meta = soup.find('link', rel='meta', title='DOAP')
|
||||
if meta:
|
||||
src = meta['href']
|
||||
match = re.search(r'version=(\S+)', src)
|
||||
if match:
|
||||
version = match.group(1)
|
||||
if version != __version__:
|
||||
self.emit(SIGNAL('update_found(PyQt_PyObject)'), version)
|
||||
|
Loading…
x
Reference in New Issue
Block a user