summaryrefslogtreecommitdiff
path: root/watrack_mpd/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'watrack_mpd/main.c')
-rwxr-xr-xwatrack_mpd/main.c34
1 files changed, 23 insertions, 11 deletions
diff --git a/watrack_mpd/main.c b/watrack_mpd/main.c
index b7ceb14..a1ce47d 100755
--- a/watrack_mpd/main.c
+++ b/watrack_mpd/main.c
@@ -21,6 +21,7 @@
void Start();
int Parser();
+int Flags = 0;
LPINITPROC Init()
{
@@ -41,6 +42,7 @@ LPCHECKPROC CheckPlayer(HWND wnd, int flags)
return 0;
}
Parser();
+ flags = Flags;
if(Connected)
return (LPCHECKPROC)1;
return 0;
@@ -53,7 +55,7 @@ LPGETSTATUSPROC GetStatus()
return 0;
}
Parser();
- return (LPGETSTATUSPROC)gbState;
+ return (LPGETSTATUSPROC)(gbState);
}
LPNAMEPROC GetFileName(HWND wnd, int flags)
{
@@ -105,6 +107,11 @@ LPINFOPROC GetPlayerInfo(LPSONGINFO info, int flags)
info->genre = SongInfo.genre;
info->album = SongInfo.album;
info->year = SongInfo.year;
+ info->kbps = SongInfo.kbps;
+ info->track = SongInfo.track;
+ info->khz = SongInfo.khz;
+ info->volume = SongInfo.volume;
+ flags = Flags;
/* info->url = SongInfo.url; //??
info->vbr = SongInfo.vbr;
info->volume = SongInfo.volume;
@@ -129,11 +136,11 @@ void RegisterPlayer()
player.DeInit = (LPDEINITPROC)DeInit;
player.GetStatus = (LPGETSTATUSPROC)GetStatus;
player.Command = (LPCOMMANDPROC)SendCommand;
- player.flags = (WAT_OPT_HASURL|WAT_OPT_SINGLEINST);
+ player.flags = (WAT_OPT_HASURL|WAT_OPT_SINGLEINST|WAT_OPT_ONLYONE);
player.GetName = (LPNAMEPROC)GetFileName;
player.GetInfo = (LPINFOPROC)GetPlayerInfo;
// player.Icon = //TODO:implement icon support
- player.Notes = _T("123");
+ player.Notes = _T("mpd is a nice music player for linux whic have not any gui, just daemon.\nuses very small amount of ram, cpu.");
player.URL = "http://www.musicpd.org";
CallService(MS_WAT_PLAYER, (WPARAM)WAT_ACT_REGISTER, (LPARAM)&player);
}
@@ -146,7 +153,7 @@ int Parser()
char tmp[128];
int i;
char *buf;
- static char ver[16];
+ static char ver[16], title[64];
nlpr.cbSize = sizeof(nlpr);
nlpr.dwTimeout = 5;
if(!ghConnection)
@@ -187,7 +194,7 @@ int Parser()
tmp[i] = ptr[i];
tmp[i] = '\0';
strcpy(ver, tmp);
- SongInfo.txtver = (TCHAR*)mir_a2t(tmp);
+ SongInfo.txtver = (TCHAR*)mir_utf8decodeW(tmp);
}
else
SongInfo.txtver = (TCHAR*)mir_a2t(ver);
@@ -198,7 +205,7 @@ int Parser()
tmp[i] = ptr[i];
tmp[i] = '\0';
- SongInfo.mfile = (TCHAR*)mir_a2t(tmp);
+ SongInfo.mfile = (TCHAR*)mir_utf8decodeW(tmp);
}
else
SongInfo.mfile = _T("");
@@ -228,7 +235,12 @@ int Parser()
for(i = 0; ((ptr[i] != '\n') && (ptr[i] != '\0')); i++)
tmp[i] = ptr[i];
tmp[i] = '\0';
- SongInfo.title = (TCHAR*)mir_a2t(tmp);
+ if(!strcmp(title, tmp))
+ Flags |= WAT_EVENT_NEWTRACK;
+ else
+ Flags = 0;
+ strcpy(title, tmp);
+ SongInfo.title = (TCHAR*)mir_utf8decodeW(tmp);
}
else
SongInfo.title = _T("");
@@ -238,7 +250,7 @@ int Parser()
for(i = 0; ((ptr[i] != '\n') && (ptr[i] != '\0')); i++)
tmp[i] = ptr[i];
tmp[i] = '\0';
- SongInfo.artist = (TCHAR*)mir_a2t(tmp);
+ SongInfo.artist = (TCHAR*)mir_utf8decodeW(tmp);
}
else
SongInfo.artist = _T("");
@@ -248,7 +260,7 @@ int Parser()
for(i = 0; ((ptr[i] != '\n') && (ptr[i] != '\0')); i++)
tmp[i] = ptr[i];
tmp[i] = '\0';
- SongInfo.genre = (TCHAR*)mir_a2t(tmp);
+ SongInfo.genre = (TCHAR*)mir_utf8decodeW(tmp);
}
else
SongInfo.genre = _T("");
@@ -258,7 +270,7 @@ int Parser()
for(i = 0; ((ptr[i] != '\n') && (ptr[i] != '\0')); i++)
tmp[i] = ptr[i];
tmp[i] = '\0';
- SongInfo.album = (TCHAR*)mir_a2t(tmp);
+ SongInfo.album = (TCHAR*)mir_utf8decodeW(tmp);
}
else
SongInfo.album = _T("");
@@ -268,7 +280,7 @@ int Parser()
for(i = 0; ((ptr[i] != '\n') && (ptr[i] != '\0')); i++)
tmp[i] = ptr[i];
tmp[i] = '\0';
- SongInfo.year = (TCHAR*)mir_a2t(tmp);
+ SongInfo.year = (TCHAR*)mir_utf8decodeW(tmp);
}
else
SongInfo.year = _T("");