Help! MPC_Home time values stopped working

If you have a question or need help, this is the place to be.
Post Reply
molitar
Experienced User
Posts: 168
Joined: Fri Sep 11, 2009 6:44 am

Help! MPC_Home time values stopped working

Post by molitar » Sat Jul 14, 2018 5:28 am

eg.WindowMatcher(u'mpc-hc64.exe', None, u'MediaPlayerClassicW', None, None, None, True, 0.0, 0)

Now all this does it provides values all none. I am getting error
Python Script
Traceback (most recent call last):
Python script "9", line 31, in <module>
secArray = elaps.split(':')
AttributeError: 'NoneType' object has no attribute 'split'

Entire code below:

Python Script
Traceback (most recent call last):
Python script "105", line 26, in <module>
if elaps != "00:00:00":
NameError: name 'elaps' is not defined

Code: Select all

import re

mpc = eg.WindowMatcher(u'mpc-hc64.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]
        

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;-90;0;0;0;700;0;0;0;0;3;2;1;49;Arial', (0, 255, 255), (0, 0, 0), 4, (0, 0), 2, 1.0, False)
        else:
            eg.plugins.EventGhost.ShowOSD(osd, u'0;-060;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)
    eg.Wait(0.8)
    #print x
    x += 1

User avatar
kgschlosser
Site Admin
Posts: 4250
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Help! MPC_Home time values stopped working

Post by kgschlosser » Sat Jul 14, 2018 9:43 pm

no worries. the script you posted is missing pieces. So what I need you to do is it take a screen shot of the window you are trying to grab the title information from (while it is playing something. I need to see the title on the bar and how the text is formatted in order to fix it.
If you like the work I have been doing then feel free to Image

Post Reply