mirror of
https://github.com/KevinMidboe/knowit_julekalender-2017.git
synced 2025-10-29 09:40:18 +00:00
Because we had a / char in there it was doing something funky. Now we show completed by 1 of 24.
This commit is contained in:
5
badge.py
5
badge.py
@@ -13,7 +13,6 @@ def get_xml_test_results():
|
|||||||
return [failures, total]
|
return [failures, total]
|
||||||
|
|
||||||
def buildURL(subject, value, color):
|
def buildURL(subject, value, color):
|
||||||
print('https://img.shields.io/badge/{}-{}-{}.svg'.format(subject, value, color))
|
|
||||||
return 'https://img.shields.io/badge/{}-{}-{}.svg'.format(subject, value, color)
|
return 'https://img.shields.io/badge/{}-{}-{}.svg'.format(subject, value, color)
|
||||||
|
|
||||||
def getPicture(path):
|
def getPicture(path):
|
||||||
@@ -24,6 +23,8 @@ def downloadImage(image_url):
|
|||||||
session = requests.Session()
|
session = requests.Session()
|
||||||
session.headers = {"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.109 Safari/537.36"}
|
session.headers = {"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.109 Safari/537.36"}
|
||||||
localFilename = image_url.split('/')[-1].split("?")[0].split('-')[0].lower() + '.svg'
|
localFilename = image_url.split('/')[-1].split("?")[0].split('-')[0].lower() + '.svg'
|
||||||
|
print(localFilename)
|
||||||
|
exit(0)
|
||||||
|
|
||||||
r = session.get(image_url, stream=True, verify=False)
|
r = session.get(image_url, stream=True, verify=False)
|
||||||
with open(localFilename, 'wb') as f:
|
with open(localFilename, 'wb') as f:
|
||||||
@@ -55,7 +56,7 @@ def uploadToDropbox(path):
|
|||||||
def main():
|
def main():
|
||||||
failures, total = get_xml_test_results()
|
failures, total = get_xml_test_results()
|
||||||
progress = "{0:.1f}".format((total-failures)/total * 100)
|
progress = "{0:.1f}".format((total-failures)/total * 100)
|
||||||
completed = str(total-failures) + '/' + str(total)
|
completed = str(total-failures) + '_of_' + str(total)
|
||||||
color = getColor(progress)
|
color = getColor(progress)
|
||||||
|
|
||||||
image1 = downloadImage(buildURL('Progress', progress + '%25', color))
|
image1 = downloadImage(buildURL('Progress', progress + '%25', color))
|
||||||
|
|||||||
Reference in New Issue
Block a user