summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGluzskiy Alexandr <sss123next@list.ru>2009-11-23 09:00:49 +0200
committerGluzskiy Alexandr <sss123next@list.ru>2009-11-23 09:00:49 +0200
commitcd38af6ebd9732c7dd28f8a36bec9452f98cb461 (patch)
tree07246c96f601bb3c6626e6dbbdfc128831798af9
parent94590c748dbf760e96e44b62e662c6377d3ed9f3 (diff)
basick player controll support, resume playing currently unsupported
modified: watrack_mpd/init.c modified: watrack_mpd/main.c
-rwxr-xr-xwatrack_mpd/init.c2
-rwxr-xr-xwatrack_mpd/main.c52
2 files changed, 45 insertions, 9 deletions
diff --git a/watrack_mpd/init.c b/watrack_mpd/init.c
index eaefe0a..d7ac310 100755
--- a/watrack_mpd/init.c
+++ b/watrack_mpd/init.c
@@ -30,7 +30,7 @@ extern int WaMpdOptInit(WPARAM wParam,LPARAM lParam);
PLUGININFOEX pluginInfo={
sizeof(PLUGININFOEX),
0,
- PLUGIN_MAKE_VERSION(0,0,0,3),
+ PLUGIN_MAKE_VERSION(0,0,0,4),
"Music Player Daemon support for watrack",
"sss, others..",
"sss123next@list.ru",
diff --git a/watrack_mpd/main.c b/watrack_mpd/main.c
index 1108a4f..a79ff66 100755
--- a/watrack_mpd/main.c
+++ b/watrack_mpd/main.c
@@ -41,9 +41,9 @@ LPCHECKPROC CheckPlayer(HWND wnd, int flags)
return 0;
}
if(Parser())
- return (LPCHECKPROC)-1;
- if(Connected)
- return (LPCHECKPROC)1;
+ return (LPCHECKPROC)WAT_MES_STOPPED;
+ if(Connected)
+ return (LPCHECKPROC)WAT_MES_PLAYING;
return 0;
}
LPGETSTATUSPROC GetStatus()
@@ -120,6 +120,32 @@ LPINFOPROC GetPlayerInfo(LPSONGINFO info, int flags)
}
LPCOMMANDPROC SendCommand(HWND wnd, int command, int value)
{
+ switch (command)
+ {
+ case WAT_CTRL_PREV:
+ Netlib_Send(ghConnection, "previous\n", strlen("previous\n"), 0);
+ break;
+ case WAT_CTRL_PLAY: //add resuming support
+ Netlib_Send(ghConnection, "play\n", strlen("play\n"), 0);
+ break;
+ case WAT_CTRL_PAUSE:
+ Netlib_Send(ghConnection, "pause 1\n", strlen("pause 1\n"), 0);
+ break;
+ case WAT_CTRL_STOP:
+ Netlib_Send(ghConnection, "stop\n", strlen("stop\n"), 0);
+ break;
+ case WAT_CTRL_NEXT:
+ Netlib_Send(ghConnection, "next\n", strlen("next\n"), 0);
+ break;
+ case WAT_CTRL_VOLDN:
+ break;
+ case WAT_CTRL_VOLUP:
+ break;
+ case WAT_CTRL_SEEK:
+ break;
+ default:
+ break;
+ }
return 0;
}
@@ -163,6 +189,16 @@ int Parser()
if(ghConnection)
{
int recvResult;
+/* do
+ {
+ recvResult = CallService(MS_NETLIB_GETMOREPACKETS,(WPARAM)ghPacketReciever, (LPARAM)&nlpr);
+ if(recvResult == SOCKET_ERROR)
+ {
+ ReStart();
+ return 1;
+ }
+ }
+ while(recvResult > 0);*/
if(!Connected)
{
char tmp[128];
@@ -256,7 +292,7 @@ int Parser()
SongInfo.title = (TCHAR*)mir_utf8decodeW(tmp);
}
else
- SongInfo.title = _T("");
+ SongInfo.title = _T("Unknown track");
if(ptr = strstr(buf, "Artist:"))
{
ptr = &ptr[8];
@@ -266,7 +302,7 @@ int Parser()
SongInfo.artist = (TCHAR*)mir_utf8decodeW(tmp);
}
else
- SongInfo.artist = _T("");
+ SongInfo.artist = _T("Unknown artist");
if(ptr = strstr(buf, "Genre:"))
{
ptr = &ptr[7];
@@ -276,7 +312,7 @@ int Parser()
SongInfo.genre = (TCHAR*)mir_utf8decodeW(tmp);
}
else
- SongInfo.genre = _T("");
+ SongInfo.genre = _T("Unknown genre");
if(ptr = strstr(buf, "Album:"))
{
ptr = &ptr[7];
@@ -286,7 +322,7 @@ int Parser()
SongInfo.album = (TCHAR*)mir_utf8decodeW(tmp);
}
else
- SongInfo.album = _T("");
+ SongInfo.album = _T("Unknown album");
if(ptr = strstr(buf, "Date:"))
{
ptr = &ptr[6];
@@ -296,7 +332,7 @@ int Parser()
SongInfo.year = (TCHAR*)mir_utf8decodeW(tmp);
}
else
- SongInfo.year = _T("");
+ SongInfo.year = _T("Unknown year");
if(ptr = strstr(buf, "volume:"))
{
ptr = &ptr[8];