berkinet wrote:jay wrote:I...We're working on several things to help with finding and downloading plugins and getting notification when a new version of a plugin is available. Auto updating isn't in the cards though, at least in the short/medium term, for either Indigo or plugins - it's an extremely non-trivial exercise.
Agreed with auto-updating, and good to hear version checking is being planned. In the meantime, the @gregjsmith's request seemed to be a good idea so I cooked up this snippet of portable code to let a plugin check its version number. I used my own server, but if there is general interest I could host other plugin's versions as well - until Matt and Jay do something official.
Other than entering a value for versionServer, the code should be completely portable. BTW, the "html" file contains one line only, with the version number. No actual html code.
- Code: Select all
from urllib2 import urlopen
import urllib2
import socket
########################################
def versionCheck(self):
self.debugLog(u"versionCheck() called")
sp = re.split('\.', self.pluginId)
myName = sp[2]
myVersion = str(self.pluginVersion)
socket.setdefaulttimeout(3)
versionServer = 'http://yikes.com/plugins/'
theUrl = versionServer + myName + '.html'
socket.setdefaulttimeout(3)
try:
f = urlopen(theUrl)
latestVersion = str(f.read()).rstrip('\n')
if myVersion < latestVersion:
self.errorLog(u"You are running v%s. A newer version, v%s is available." % (myVersion, latestVersion))
else:
indigo.server.log(u"Your plugin version, v" + myVersion + " is current", type=self.pluginDisplayName)
except:
self.errorLog(u"Unable to reach the version server.")
EDIT: I added a timeout and exception handler. BTW, I called this from startup().
Please keep in mind, that I already created and implemented a full solution for version checking...
See
viewtopic.php?f=18&t=7273&p=44355&hilit=plugins.com#p44355Simply add an import line....
import versioncheck
Your plugin ID...
plugin_id = "com.schollnick.indigoplugin.External_IP"
And the actual version check code:
version_found, update_url, plugin_name = versioncheck.VersionCheck ( plugin_id )
self.debugLog ("Version Check Server reports %s is available." % version_found)
if version_found == None:
indigo.server.log ("Update Check failed. Please contact the Author of the Plugin.", isError=True)
elif float(version_found) > float(self.pluginVersion):
indigo.server.log ( "A New Version of %s v.%s is available. You can download the upgrade from %s" % (self.pluginDisplayName, version_found, update_url), type="Upgrade", isError=True )
The web site is all setup.... and online, for use....
http://www.indigo-plugins.com