2
import gtk, gobject, time, urllib
3
from xl import common, xlmisc
4
import xl.plugins as plugins
6
PLUGIN_NAME = "Update Notifier"
7
PLUGIN_AUTHORS = ['Adam Olsen <arolsen' + chr(32+32) + 'gmail' + '.com>']
8
PLUGIN_VERSION = "0.3.1"
9
PLUGIN_DESCRIPTION = r"""Notifies the user of Exaile and plugin updates"""
11
PLUGIN_ENABLED = False
16
def found_updates(found):
17
message = "The following plugins have new versions available for install."
18
message += " You can install them from the plugin manager.\n\n"
20
for (name, version) in found:
21
message += "%s\t%s\n" % (name, version)
23
common.info(APP.window, message)
26
def start_thread(exaile):
28
version = map(int, APP.get_version().replace('svn', '').split('.'))
29
check_version = map(int,
30
urllib.urlopen('http://exaile.org/current_version.txt').read().split('.'))
32
if version < check_version:
33
gobject.idle_add(common.info, APP.window, "Exaile version %s is "
34
"available. Grab it from http://www.exaile.org today!" %
35
'.'.join([str(i) for i in check_version]))
38
pmanager = APP.pmanager
39
avail_url = 'http://www.exaile.org/files/plugins/%s/plugin_info.txt' % \
40
APP.get_plugin_location()
42
h = urllib.urlopen(avail_url)
51
(file, name, version, author, description) = line.split('\t')
53
for plugin in pmanager.plugins:
54
if plugin.PLUGIN_NAME == name:
55
installed_ver = map(int, plugin.PLUGIN_VERSION.split('.'))
56
available_ver = map(int, version.split('.'))
58
if installed_ver < available_ver:
59
found.append((name, version))
62
gobject.idle_add(found_updates, found)
66
Connect to the PluginEvents
69
SIGNAL_ID = APP.playlist_manager.connect('last-playlist-loaded', start_thread)
76
gobject.source_remove(SIGNAL_ID)