Media Player Classic view modes not working

Questions and comments specific to a particular plugin should go here.
Post Reply
molitar
Experienced User
Posts: 190
Joined: Fri Sep 11, 2009 6:44 am

Media Player Classic view modes not working

Post by molitar » Sun Mar 10, 2019 3:56 am

Windows 10 build 1809 and EventGhost 0.5.0 RC6 and view modes will not work. view minimal, normal, and compact none are functional in EventGhost from the plugin actions.

User avatar
topix
Experienced User
Posts: 441
Joined: Sat May 05, 2007 3:43 pm
Location: Germany
Contact:

Re: Media Player Classic view modes not working

Post by topix » Sun Mar 10, 2019 11:06 am

Which version of the plugin are you using? The latest is 2.13.

Which edition (HC or BE) and version of MPC do you have? I've tested it with MPC-BE x64 1.5.2 and MPC-HC x64 1.7.13, both are working.

molitar
Experienced User
Posts: 190
Joined: Fri Sep 11, 2009 6:44 am

Re: Media Player Classic view modes not working

Post by molitar » Sun Mar 10, 2019 6:15 pm

Hello using 1.7.13 and when I try to do the modes maximize or minimal it will not change. If I use the hot key 1, 2, or 3 it works fine but when I use the action in EventGhost nothing happens. I was using 2.12 so I will try that 2.13 as the one that was listed in the repository only showed up to 2.12.

Ok tried 2.13 and it helps a bit now it will maximize but not go into minimal mode. Maybe something wrong with this script for the new EventGhost version.

from eg.WinApi.Dynamic import GetWindowLong, ShowWindow, SW_RESTORE, SW_MAXIMIZE, SW_MINIMIZE
from win32gui import SetWindowPos
from ctypes import windll

# Check that we have a window to try to maximize/restore
# Use Find Window action before this script!
if eg.globals.WindowsState != "Fullscreen":
if len(result) > 0:
# Check if WS_MAXIMIZE bit is set
if(GetWindowLong(result[0], -16) & 0x01000000):
eg.plugins.EventGhost.ShowOSD('Maximized ' + eg.WinApi.GetWindowText(eg.result[0]), None, (255, 255, 255), (0, 0, 0), 0, (0, 0), 0, 3.0, None)
ShowWindow(result[0], SW_RESTORE)
eg.plugins.MediaPlayerClassic.ViewNormal()
#Script Unhide Taskbar
eg.plugins.Taskbar.SetAutohideOff()
print "Modal Status was maximized"
else:
eg.plugins.EventGhost.ShowOSD('Maximized ' + eg.WinApi.GetWindowText(eg.result[0]), None, (255, 255, 255), (0, 0, 0), 0, (0, 0), 0, 3.0, None)
#Script Hide Taskbar
eg.plugins.Taskbar.SetAutohideOn()
ShowWindow(result[0], SW_MAXIMIZE)
eg.plugins.MediaPlayerClassic.ViewMinimal()
print "Modal status was normal"
The part in Red does not seem to be triggering for some reason at all. Also is there a cleaner easier method to check window status then the GetWindowLong method I am using?

Thanks.

BTW is the MPC-BE stilling being developed as I read that MPC-Home Cinema is not and if so where is the site to keep up on it? Home page? Github? Opensource?

User avatar
topix
Experienced User
Posts: 441
Joined: Sat May 05, 2007 3:43 pm
Location: Germany
Contact:

Re: Media Player Classic view modes not working

Post by topix » Sun Mar 10, 2019 7:51 pm

Looks like something with your script is wrong. Where comes the variables eg.globals.WindowsState and result from? Is your script correct indented? (Would have been better to paste it here in a code block)

This edited version worked for me:

Code: Select all

from eg.WinApi.Dynamic import GetWindowLong, ShowWindow, SW_RESTORE, SW_MAXIMIZE, SW_MINIMIZE
from win32gui import SetWindowPos
from ctypes import windll

# Check that we have a window to try to maximize/restore
# Use Find Window action before this script!
#if eg.globals.WindowsState != "Fullscreen":
    #if len(result) > 0:
# Check if WS_MAXIMIZE bit is set
if(GetWindowLong(result[0], -16) & 0x01000000):
    eg.plugins.EventGhost.ShowOSD('Maximized ' + eg.WinApi.GetWindowText(eg.result[0]), None, (255, 255, 255), (0, 0, 0), 0, (0, 0), 0, 3.0, None)
    ShowWindow(result[0], SW_RESTORE)
    eg.plugins.MediaPlayerClassic.ViewNormal()
    #Script Unhide Taskbar
    #eg.plugins.Taskbar.SetAutohideOff()
    print "Modal Status was maximized"
else:
    eg.plugins.EventGhost.ShowOSD('Maximized ' + eg.WinApi.GetWindowText(eg.result[0]), None, (255, 255, 255), (0, 0, 0), 0, (0, 0), 0, 3.0, None)
    #Script Hide Taskbar
    #eg.plugins.Taskbar.SetAutohideOn()
    ShowWindow(result[0], SW_MAXIMIZE)
    eg.plugins.MediaPlayerClassic.ViewMinimal()
    print "Modal status was normal"
The GetWindowLong method is okay for now, but you gave me an idea and i will add some actions to the window plugin in the next version.

MPC-Be seems to have active development: https://sourceforge.net/projects/mpcbe/files/MPC-BE/
while MPC-HC has not lot commits: https://github.com/mpc-hc/mpc-hc

molitar
Experienced User
Posts: 190
Joined: Fri Sep 11, 2009 6:44 am

Re: Media Player Classic view modes not working

Post by molitar » Sun Mar 10, 2019 9:48 pm

Ok thanks that result is from a windows state script that is run first. So it's a global value.

Code: Select all

from win32gui import GetWindowPlacement

#SW_SHOWNORMAL = 1
#SW_SHOWMINIMIZED = 2
#SW_SHOWMAXIMIZED = 3

FindWin = eg.WindowMatcher(None, None, u'MediaPlayerClassicW' , None, None, None, True, 0.0, 0)
hwnd = FindWin()

def GetWindowStatus(hwnd):
    showList  = ("None", "Normal", "Minimized", "Maximized")
    placement = GetWindowPlacement(hwnd)
    #unrem the below line to display the placement values that you need for the if placement[4] line
    print placement
   
    if placement[4] == (-3840, 0, 0, 2160):
        return "Fullscreen"
    else:
        return showList[placement[1]]
    
eg.globals.WindowsState = GetWindowStatus(hwnd[0])

print "Windows State = " + eg.globals.WindowsState

Code: Select all

from eg.WinApi.Dynamic import GetWindowLong, ShowWindow, SW_RESTORE, SW_MAXIMIZE, SW_MINIMIZE
from win32gui import SetWindowPos
from ctypes import windll

# Check that we have a window to try to maximize/restore
# Use Find Window action before this script!
#if eg.globals.WindowsState != "Fullscreen":
    #if len(result) > 0:
# Check if WS_MAXIMIZE bit is set
if(GetWindowLong(result[0], -16) & 0x01000000):
    eg.plugins.EventGhost.ShowOSD('Maximized ' + eg.WinApi.GetWindowText(eg.result[0]), None, (255, 255, 255), (0, 0, 0), 0, (0, 0), 0, 3.0, None)
    ShowWindow(result[0], SW_RESTORE)
    eg.plugins.MediaPlayerClassic.ViewNormal()
    #Script Unhide Taskbar
    eg.plugins.Taskbar.SetAutohideOff()
    print "Modal Status was maximized"
else:
    eg.plugins.EventGhost.ShowOSD('Maximized ' + eg.WinApi.GetWindowText(eg.result[0]), None, (255, 255, 255), (0, 0, 0), 0, (0, 0), 0, 3.0, None)
    #Script Hide Taskbar
    eg.plugins.Taskbar.SetAutohideOn()
    ShowWindow(result[0], SW_MAXIMIZE)
    eg.plugins.MediaPlayerClassic.ViewMinimal()
    print "Modal status was normal"
Toggle works better but I still am not getting MPC to show up in viewminimal so let me try that BE version and see if it's a problem with mpc-hc.

molitar
Experienced User
Posts: 190
Joined: Fri Sep 11, 2009 6:44 am

Re: Media Player Classic view modes not working

Post by molitar » Sun Mar 10, 2019 10:18 pm

Ok I switched my profile to MPC-BE 64bit and it is working perfectly now I just had to move one line up to get a proper restore.

Just had to move the ViewNormal before the SW-RESTORE or it would not restore properly. So what happens now is the taskbar hides itself, the window maximizes, and ViewMinimal is called giving a full screen view on primary monitor. I do this as sometimes I run two displays and I have full screen set to my HDTV or the other more common reason is I am letting company play the PS4 on the HDTV and will watch a video on full screen on the monitor.

eg.plugins.MediaPlayerClassic.ViewNormal()
ShowWindow(result[0], SW_RESTORE)

Code: Select all

from eg.WinApi.Dynamic import GetWindowLong, ShowWindow, SW_RESTORE, SW_MAXIMIZE, SW_MINIMIZE
from win32gui import SetWindowPos
from ctypes import windll

# Check that we have a window to try to maximize/restore
# Use Find Window action before this script!
#if eg.globals.WindowsState != "Fullscreen":
    #if len(result) > 0:
# Check if WS_MAXIMIZE bit is set
if(GetWindowLong(result[0], -16) & 0x01000000):
    eg.plugins.EventGhost.ShowOSD('Maximized ' + eg.WinApi.GetWindowText(eg.result[0]), None, (255, 255, 255), (0, 0, 0), 0, (0, 0), 0, 3.0, None)
    eg.plugins.MediaPlayerClassic.ViewNormal()
    ShowWindow(result[0], SW_RESTORE)
    #Script Unhide Taskbar
    eg.plugins.Taskbar.SetAutohideOff()
    print "Modal Status was maximized"
else:
    eg.plugins.EventGhost.ShowOSD('Maximized ' + eg.WinApi.GetWindowText(eg.result[0]), None, (255, 255, 255), (0, 0, 0), 0, (0, 0), 0, 3.0, None)
    #Script Hide Taskbar
    eg.plugins.Taskbar.SetAutohideOn()
    ShowWindow(result[0], SW_MAXIMIZE)
    eg.plugins.MediaPlayerClassic.ViewMinimal()
    print "Modal status was normal"
Thanks for the help Topix!

molitar
Experienced User
Posts: 190
Joined: Fri Sep 11, 2009 6:44 am

Re: Media Player Classic view modes not working

Post by molitar » Tue Mar 12, 2019 11:34 pm

I found a fatal flaw with MPC-BE whenever I do a jump the video stops playing. I could find no setting to change this fatal flaw as if I missed something and do a jump backward I then have to press play again which is really stupid. Is there some fix for this?

User avatar
topix
Experienced User
Posts: 441
Joined: Sat May 05, 2007 3:43 pm
Location: Germany
Contact:

Re: Media Player Classic view modes not working

Post by topix » Tue Mar 19, 2019 5:24 pm

hmm, strange, it's not happening here on my test machine. :?: I can jump backward (small/medium/large/keyframe/n seconds) and the video continues to play.

molitar
Experienced User
Posts: 190
Joined: Fri Sep 11, 2009 6:44 am

Re: Media Player Classic view modes not working

Post by molitar » Tue Mar 19, 2019 5:39 pm

topix wrote:
Tue Mar 19, 2019 5:24 pm
hmm, strange, it's not happening here on my test machine. :?: I can jump backward (small/medium/large/keyframe/n seconds) and the video continues to play.
What version are you running?

User avatar
topix
Experienced User
Posts: 441
Joined: Sat May 05, 2007 3:43 pm
Location: Germany
Contact:

Re: Media Player Classic view modes not working

Post by topix » Tue Mar 19, 2019 5:51 pm

topix wrote:
Sun Mar 10, 2019 11:06 am
I've tested it with MPC-BE x64 1.5.2 and MPC-HC x64 1.7.13, both are working.

molitar
Experienced User
Posts: 190
Joined: Fri Sep 11, 2009 6:44 am

Re: Media Player Classic view modes not working

Post by molitar » Tue Mar 19, 2019 6:45 pm

topix wrote:
Tue Mar 19, 2019 5:51 pm
topix wrote:
Sun Mar 10, 2019 11:06 am
I've tested it with MPC-BE x64 1.5.2 and MPC-HC x64 1.7.13, both are working.
Ok I was using MPC-BE 1.5.3 and MPC-HC 1.7.9.190. I will try the newer version of MPC-HC and see if that makes any difference.

Post Reply