Beispiel #1
0
 def Execute(self, msg):
     version_list = Dl_Bukkit.get_cb_versions(msg.channel)
     simple_ver = []
     for item in version_list:
         simple_ver.append(
             FolderApi.convert_ver_to_float(item[0], rough=True))
     matches = list(set(simple_ver).intersection(set(msg.PVI)))
     msg.cb_version = FolderApi.expand_float_to_ver(max(matches))
     for item in version_list:
         if not item[0].find(msg.cb_version) == -1:
             version = item
             module_logger.debug('Found version match: %s' % version[0])
             break
         else:
             module_logger.debug('Version mismatch: %s - %s' %
                                 (item[0], msg.cb_version))
     match = FolderApi.check_for_existing('jars/',
                                          version[0].replace('.', ''),
                                          version[1]['checksum_md5'])
     if match:
         msg.craftbukkit = package.Craftbukkit(
             str(version[0]), match, str(version[1]['checksum_md5']),
             str(version[1]['url']))
         module_logger.debug('File match found: %s - NOT DOWNLOADING' %
                             match)
         msg.download = False
     else:
         msg.craftbukkit = package.Craftbukkit(
             str(version[0]), None, str(version[1]['checksum_md5']),
             str(version[1]['url']))
         module_logger.debug('File match FAILED - DOWNLOADING')
         msg.download = True
     delattr(msg, 'PVI')
     return msg
Beispiel #2
0
 def Execute(self, msg):
     module_logger.debug('Executing Plugin Vesion Index Process Filter')
     module_logger.debug('Creating version lists for comparison')
     lists = []
     for plugin, index in msg.PVI.iteritems():
         vers = []
         for item in index:
             vers.extend(item[1])
         lists.append(vers)
     module_logger.debug('Comparing lists')
     x = lists.pop()
     matches = set(x)
     for item in lists:
         matches = matches.intersection(item)
     matches = list(matches)
     module_logger.debug('Converting to float representation')
     versions = []
     for version in matches:
         versions.append(FolderApi.convert_ver_to_float(version,
                                                        rough=True))
     #version = max(versions)
     #version = FolderApi.expand_float_to_ver(version)
     #module_logger.debug('Found Version: %s'%version)
     msg.pkg_version = msg.cb_version
     #msg.cb_version = version
     #print versions
     msg.PVI = versions
     return msg
Beispiel #3
0
	def Execute(self, msg):
		version_list = Dl_Bukkit.get_cb_versions(msg.channel)
		simple_ver = []
		for item in version_list:
			simple_ver.append(FolderApi.convert_ver_to_float(item[0],rough = True))
		matches = list(set(simple_ver).intersection(set(msg.PVI)))
		msg.cb_version = FolderApi.expand_float_to_ver(max(matches))
		for item in version_list:
			if not item[0].find(msg.cb_version) == -1:
				version = item
				module_logger.debug('Found version match: %s'%version[0])
				break
			else:
				module_logger.debug('Version mismatch: %s - %s'%(item[0], msg.cb_version))
		match = FolderApi.check_for_existing('jars/', version[0].replace('.',''), version[1]['checksum_md5'])
		if match:
			msg.craftbukkit = package.Craftbukkit(str(version[0]), match, str(version[1]['checksum_md5']), str(version[1]['url']))
			module_logger.debug('File match found: %s - NOT DOWNLOADING'%match)
			msg.download = False
		else:
			msg.craftbukkit = package.Craftbukkit(str(version[0]), None, str(version[1]['checksum_md5']), str(version[1]['url']))
			module_logger.debug('File match FAILED - DOWNLOADING')
			msg.download = True
		delattr(msg,'PVI')
		return msg
Beispiel #4
0
	def Execute(self, msg):
		module_logger.debug('Executing Plugin Vesion Index Process Filter')
		module_logger.debug('Creating version lists for comparison')
		lists = []
		for plugin, index in msg.PVI.iteritems():
			vers = []
			for item in index:
				vers.extend(item[1])
			lists.append(vers)
		module_logger.debug('Comparing lists')
		x = lists.pop()
		matches = set(x)
		for item in lists:
			matches = matches.intersection(item)
		matches = list(matches)
		module_logger.debug('Converting to float representation')
		versions = []
		for version in matches:
			versions.append(FolderApi.convert_ver_to_float(version, rough=True))
		#version = max(versions)
		#version = FolderApi.expand_float_to_ver(version)
		#module_logger.debug('Found Version: %s'%version)
		msg.pkg_version = msg.cb_version
		#msg.cb_version = version	
		#print versions
		msg.PVI = versions
		return msg
Beispiel #5
0
	def Execute(self, msg):
		module_logger.debug('Downloading Plugins')
		for plugin in msg.plugins:
			file = plugin+str(FolderApi.convert_ver_to_float(msg.craftbukkit.version, whole=True))
			deets = Dev_Bukkit.find_compat(plugin, msg.cb_version)
			module_logger.debug('Checking for Existing: %s'%plugin)
			existing = FolderApi.check_for_existing('jars/', file, deets[1])
			module_logger.debug('Check Returned: %s' %str(existing))
			if not existing == False:
				module_logger.debug('Match Found: %s'%existing)
				msg.plugins[plugin] = package.Plugin(existing, plugin, deets[1])
			else:
				module_logger.debug('Downloading: %s'%plugin)
				filename = 'jars/%s.jar'%(file)
				FolderApi.dl_file(deets[0], filename, self.callback)
				if FolderApi.check_md5(filename, deets[1]):
					msg.plugins[plugin] = package.Plugin(filename, plugin, deets[1])
					module_logger.debug('Finished downloading %s'%plugin)
		return msg
			
Beispiel #6
0
 def Execute(self, msg):
     module_logger.debug('Downloading Plugins')
     for plugin in msg.plugins:
         file = plugin + str(
             FolderApi.convert_ver_to_float(msg.craftbukkit.version,
                                            whole=True))
         deets = Dev_Bukkit.find_compat(plugin, msg.cb_version)
         module_logger.debug('Checking for Existing: %s' % plugin)
         existing = FolderApi.check_for_existing('jars/', file, deets[1])
         module_logger.debug('Check Returned: %s' % str(existing))
         if not existing == False:
             module_logger.debug('Match Found: %s' % existing)
             msg.plugins[plugin] = package.Plugin(existing, plugin,
                                                  deets[1])
         else:
             module_logger.debug('Downloading: %s' % plugin)
             filename = 'jars/%s.jar' % (file)
             FolderApi.dl_file(deets[0], filename, self.callback)
             if FolderApi.check_md5(filename, deets[1]):
                 msg.plugins[plugin] = package.Plugin(
                     filename, plugin, deets[1])
                 module_logger.debug('Finished downloading %s' % plugin)
     return msg