1
# -*- coding: utf-8 -*-
3
# This file is part of emesene.
5
# Emesene is free software; you can redistribute it and/or modify
6
# it under the terms of the GNU General Public License as published by
7
# the Free Software Foundation; either version 2 of the License, or
8
# (at your option) any later version.
10
# emesene is distributed in the hope that it will be useful,
11
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
# GNU General Public License for more details.
15
# You should have received a copy of the GNU General Public License
16
# along with emesene; if not, write to the Free Software
17
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22
user = ctypes.windll.user32
25
from emesenelib import *
27
class MediaPlayerClassic( CurrentSong.CurrentSong ):
30
CurrentSong.CurrentSong.__init__( self )
31
self.mplayerwindow = None
34
self.template = "MPlayerClassic\\0Music\\01\\0{0}\\0%s\\0\\0"
36
def isPlaying( self ):
37
if self.mplayerwindow is not None:
38
st = ctypes.create_unicode_buffer(100)
39
user.GetWindowTextW(self.mplayerwindow, st, 100)
40
return st.value != "Media Player Classic"
44
def isRunning( self ):
45
winampClassName = ctypes.c_wchar_p('MediaPlayerClassicW')
46
self.mplayerwindow = user.FindWindowW(winampClassName, None)
47
return self.mplayerwindow != 0
49
def getCurrentSong( self ):
50
return self.currentSong
53
if not self.isRunning():
57
st = ctypes.create_unicode_buffer(100)
58
user.GetWindowTextW(self.mplayerwindow, st, 100)
59
string = st.value.split(" - Media Player Classic")[0]
60
newCurrentSong = self.template % string
64
if self.currentSong != newCurrentSong:
65
self.currentSong = newCurrentSong
70
def getStatus( self ):
72
check if everything is OK to start the plugin
73
return a tuple whith a boolean and a message
74
if OK -> ( True , 'some message' )
75
else -> ( False , 'error message' )
79
return ( False, 'This plugin only works on windows systems' )