This repository has been archived by the owner on May 30, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nurfedui.py
executable file
·95 lines (72 loc) · 2.11 KB
/
nurfedui.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!/usr/bin/python
'''
Plugin for updating NurfedUI
'''
__author__ = "Patrick Butler <pbutler@killertux.org>"
__version__ = "$Revision: 31 $"
__copyright__ = "Copyright 2005,2006 Patrick Butler"
__license__ = "GPL Version 2"
import wowaddon
import urllib
import urllib2
import re
import os
import shutil
class Plugin(wowaddon.Plugin):
def __init__(self, updater, args):
wowaddon.Plugin.__init__(self, updater, args)
if (id == ""):
raise "Need id"
self.id = 'nurfed'
self.type = "Nurfed UI"
def getinfo(self):
if self.timemutex(60):
return
self.out("Checking mod NurfedUI")
try:
data = urllib.urlopen("http://www.nurfedui.net").read()
version = re.compile("(?is)<font[^>]*>Updated:</font>\s*([^<]+?)\s*</b>").search(data).group(1)
#print version
except IOError:
raise wowaddon.DownloadError
self.name = 'NurfedUI ' + wowaddon.cleanuphtml(version)
self.link = 'http://www.nurfedui.net/download.php?file=nurfedui.zip'
self.newversion = version
self.zipfilename = 'nurfedui.zip'
return self.link, self.newversion, self.zipfilename
def update(self):
zipdir = self.getoption('zipdir')
if self.link == "":
self.getinfo();
#print self.link;
name = self.id+".zip"
self.out("%s (%s)" % (self.link, name))
zipfile = os.path.join(zipdir, self.zipfilename)
link = self.link
link = link.replace(" ", "%20")
self.out("Downloading NurfedUI...")
try:
req = urllib2.Request(self.link)
req.add_header("Referer", "http://www.nurfedui.net")
fpage = urllib2.urlopen(req, 'download=Download')
file = open(zipfile, "wb")
file.write(fpage.read())
file.close()
except IOError, e:
raise DownloadError, e;
self.zipfile = zipfile
self.out("Downloading NurfedUI... done")
return
def postcopy(self):
ifacedir = os.path.join(self.getoption('wowdir'), "Interface")
wowaddon.nopatch(ifacedir, self.outfiles);
def help():
return ""
def argdesc():
return None
help = staticmethod(help)
argdesc = staticmethod(argdesc)
wowaddon.addModType("Nurfed UI", Plugin)
if __name__ == "__main__":
p = Plugin(None, [])
print p.getinfo()