-
Notifications
You must be signed in to change notification settings - Fork 1
/
EmailTemplate.py
35 lines (28 loc) · 1.15 KB
/
EmailTemplate.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
import sys
class EmailTemplate:
def __init__(self):
self.repository = sys.modules["__main__"].repository
def createEmailFromTemplate(self, updates):
print "\n"
subject = self.getEmailSubject(updates)
print subject
for update in updates:
print ""
self.repository.getBranchUpdateDetails(update)
details = self.getUpdateDetails(update)
print details
def getUpdateDetails(self, update):
details = ""
details += "*addon - " + update["plugin"]["name"] + "\r\n"
details += "*version - " + update["plugin"]["new_" + update["branch"] + "_version"] + "\r\n"
details += "*url - " + update["plugin"]["public"] + "\r\n"
details += "*revision - " + update["revision"]
details += "*branch - " + update["branch"] + "\r\n"
details += "*xbmc version - " + update["branch"] + "\r\n"
return details
def getEmailSubject(self, updates):
plugins = []
for update in updates:
plugins.append(update["plugin"]["name"])
plugins = list(set(plugins))
return "[Git Pull] " + " ".join(plugins)