diff --git a/.gitignore b/.gitignore index 1ebb5ea..733ce1d 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -_repo_xml_generator.py \ No newline at end of file +_repo_xml_generator.py +plugin.video.blackhatconf.zip diff --git a/service.lowerthird/addon.xml b/service.lowerthird/addon.xml index 4f3489d..df59d70 100644 --- a/service.lowerthird/addon.xml +++ b/service.lowerthird/addon.xml @@ -1,5 +1,5 @@ - + diff --git a/service.lowerthird/default.py b/service.lowerthird/default.py index 505030e..32b447f 100644 --- a/service.lowerthird/default.py +++ b/service.lowerthird/default.py @@ -13,6 +13,8 @@ import xbmcgui import os.path from random import randint from PIL import Image +from PIL import ImageFont +from PIL import ImageDraw from datetime import datetime as date from threading import Timer from xml.dom import minidom diff --git a/service.lowerthird/fonts/sans_serif.ttf b/service.lowerthird/fonts/sans_serif.ttf new file mode 100644 index 0000000..26e32cc Binary files /dev/null and b/service.lowerthird/fonts/sans_serif.ttf differ diff --git a/service.lowerthird/sample_in.jpg b/service.lowerthird/sample_in.jpg new file mode 100644 index 0000000..eabc4d7 Binary files /dev/null and b/service.lowerthird/sample_in.jpg differ diff --git a/service.lowerthird/service.lowerthird.zip b/service.lowerthird/service.lowerthird.zip new file mode 100644 index 0000000..a0d23c8 Binary files /dev/null and b/service.lowerthird/service.lowerthird.zip differ diff --git a/service.lowerthird/standalone.py b/service.lowerthird/standalone.py index afc3b87..de665e5 100644 --- a/service.lowerthird/standalone.py +++ b/service.lowerthird/standalone.py @@ -15,8 +15,32 @@ import urlparse import os import sys from PIL import Image +from PIL import ImageFont +from PIL import ImageDraw from xml.dom import minidom +# ============================================================ +# Create lowerthird banners from API sent text +# Won't work yet... +# ============================================================ + +def CreateLowerThird + # define the font path as local fonts dir in prj root + fonts_path = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'fonts') + font = ImageFont.truetype(os.path.join(fonts_path, 'sans_serif.ttf'), 24) + # font = ImageFont.truetype(, ) + # font-file should be present in provided path. + font = ImageFont.truetype("sans-serif.ttf", 16) + img = Image.open("sample_in.jpg") + draw = ImageDraw.Draw(img) + # font = ImageFont.truetype(, ) + font = ImageFont.truetype("sans-serif.ttf", 16) + # draw.text((x, y),"Sample Text",(r,g,b)) + draw.text((0, 0),notitxt,(255,255,255),font=font) + img.save('sample-out.jpg') + + + # ============================================================ # Define Overlay Class # ============================================================ @@ -174,18 +198,20 @@ if __name__ == '__main__': try: params = urlparse.parse_qs('&'.join(sys.argv[1:])) - imageloc = params.get('imageloc', None)[0] + notitxt = params.get('notitxt', None)[0] + imageloc = params.get('imageloc', None)[0] displaytime = int(params.get('displaytime', None)[0]) position = params.get('position', None)[0] except Exception: imageloc = None displaytime = None position = None + notitxt = None - if imageloc and displaytime and position: + if imageloc and displaytime and position and notitxt: success = xbmcvfs.exists(imageloc) - if success and displaytime > 1000 and displaytime < 60000 and (position == 'top' or position == 'bottom' or position == 'center'): + if success and displaytime > 1000 and displaytime < 300001 and (position == 'top' or position == 'bottom' or position == 'center'): xbmc.log("BANNERS >> STANDALONE DISPLAY IMAGE: " + str(imageloc) + " >> TIMEOUT: " + str(displaytime) + " >> POSITION: " + str(position)) displayBanner(imageloc, displaytime, position) else: