Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0efec7f4db | ||
|
|
db2cdd6737 |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1 +1,2 @@
|
||||
_repo_xml_generator.py
|
||||
_repo_xml_generator.py
|
||||
plugin.video.blackhatconf.zip
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<addon id="service.lowerthird" name="LowerThird" version="0.1.1" provider-name="Double T">
|
||||
<addon id="service.lowerthird" name="LowerThird" version="0.1.2" provider-name="Double T">
|
||||
<requires>
|
||||
<import addon="xbmc.python" version="2.1.0"/>
|
||||
<import addon="script.module.pil" version="1.1.7"/>
|
||||
|
||||
@@ -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
|
||||
|
||||
BIN
service.lowerthird/fonts/sans_serif.ttf
Normal file
BIN
service.lowerthird/fonts/sans_serif.ttf
Normal file
Binary file not shown.
BIN
service.lowerthird/sample_in.jpg
Normal file
BIN
service.lowerthird/sample_in.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 188 KiB |
BIN
service.lowerthird/service.lowerthird.zip
Normal file
BIN
service.lowerthird/service.lowerthird.zip
Normal file
Binary file not shown.
@@ -15,8 +15,73 @@ 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...
|
||||
# ============================================================
|
||||
|
||||
class RealTimeNotifications
|
||||
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>, <font-size>)
|
||||
# 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-file>, <font-size>)
|
||||
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')
|
||||
|
||||
def DisplayLowerThird(displaytime, position):
|
||||
global myWidget
|
||||
global intYOffset
|
||||
global __addon__
|
||||
|
||||
__addon__ = xbmcaddon.Addon(id='service.lowerthird')
|
||||
|
||||
ActWin = xbmcgui.getCurrentWindowId()
|
||||
myWidget = OverlayText(ActWin)
|
||||
myWidget.show()
|
||||
|
||||
if position == 'top':
|
||||
myWidget.imageBottom.setImage("")
|
||||
myWidget.imageCenter.setImage("")
|
||||
myWidget.imageTop.setImage("sample-out.jpg")
|
||||
elif position == 'bottom':
|
||||
myWidget.imageBottom.setImage("sample-out.jpg")
|
||||
myWidget.imageCenter.setImage("")
|
||||
myWidget.imageTop.setImage("")
|
||||
else:
|
||||
myWidget.imageBottom.setImage("")
|
||||
myWidget.imageCenter.setImage("sample-out.jpg")
|
||||
myWidget.imageTop.setImage("")
|
||||
|
||||
image = Image.open(open("sample-out.jpg", 'rb'))
|
||||
width, height = image.size
|
||||
myWidget.scaleimage(width, height, intYOffset)
|
||||
|
||||
xbmc.log('BANNERS >> STANDALONE INITIALIZING OVERLAY')
|
||||
|
||||
xbmc.sleep(displaytime)
|
||||
|
||||
try:
|
||||
myWidget._close()
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
myWidget = None
|
||||
|
||||
|
||||
|
||||
|
||||
# ============================================================
|
||||
# Define Overlay Class
|
||||
# ============================================================
|
||||
@@ -174,18 +239,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:
|
||||
|
||||
Reference in New Issue
Block a user