Traceback (most recent call last):
Python script "38", line 31, in <module>
secArray = elaps.split(':')
AttributeError: 'NoneType' object has no attribute 'split'
- Code: Select all
import re
mpc = eg.WindowMatcher(u'mpc-hc.exe', None, u'MediaPlayerClassicW', None, None, None, True, 0.0, 0)
hWnd = mpc()
if len(hWnd) > 0:
from eg.WinApi import GetWindowText
title = GetWindowText(hWnd[0])
if re.search(".mkv",title,re.I):
title = title.split(".mkv")[0]
elif re.search(".mp4",title,re.I):
title = title.split(".mp4")[0]
elif re.search(".avi",title,re.I):
title = title.split(".avi")[0]
elif re.search(".ogm",title,re.I):
title = title.split(".ogm") [0]
else:
title = title.split(".")[0]
elaps, rem, total = eg.plugins.MediaPlayerClassic.GetTimes()
#print "elaps, rem, total =",elaps, rem, total
x = 1
while x < 4:
if elaps != "00:00:00":
if eg.globals.WindowsState == "Fullscreen": howManyBars = 100
if eg.globals.WindowsState != "Fullscreen": howManyBars = 100
secArray = elaps.split(':')
secArrayTotal = total.split(':')
secondsTotal = int(secArrayTotal[0])*(3600)+int(secArrayTotal[1])*(60)+int(secArrayTotal[2])
secondsElapsed = int(secArray[0])*(3600)+int(secArray[1])*(60)+int(secArray[2])
percent = (1.0*secondsElapsed)/(secondsTotal)*100
percent = int(round(percent))
bars = (percent * howManyBars)/100
#print "percent =",percent
#print "bars =",bars
osd = title + "\n \n" + "[ " + "|" * bars + " " * (howManyBars - bars) + " ]" + "\n" + " "*30 + elaps + " / " + total
if eg.globals.WindowsState <> "Fullscreen":
eg.plugins.EventGhost.ShowOSD(osd, u'0;-40;0;0;0;700;0;0;0;0;3;2;1;49;Arial', (0, 255, 255), (0, 0, 0), 4, (0, 0), 1, 1.0, False)
else:
eg.plugins.EventGhost.ShowOSD(osd, u'0;-40;0;0;0;700;0;0;0;0;3;2;1;49;Arial', (0, 255, 255), (0, 0, 0), 4, (0, 0), 0, 1.0, False)
eg.Wait(0.8)
#print x
x += 1
