开发者

Auto-scrobble video titles

I want to automate the service myshows.ru. Riht now, people must manually input information about movies they watched.

I want to write a program in c++, that gets the ti开发者_StackOverflow中文版tles of movies in video players and scrobbles them to their account on the service.

What libraries I can use for this work?


Use plain Winapi functions paired with some regex library. What you have to do is to enumerate windows in your system (get their HWND - handles), then take their captions and store them in std::strings. The next step would be checking if your caption matches some regex (this could be boost::regex or boost::xpressive, for example) - so you would have to maintain a regex database for every possible multimedia player caption.

There is a more complicated approach that is harder to code, but which is more efficient. The number of players that are widely used isn't very big, therefore you can enumerate processes in your system using Winapi call and take only players (like mpc.exe or winamp.exe). Then you can easily retrieve the active application window (from it's process handle) and only then invoke your regex search. This is actually much better, because you would only have to store process name - caption regex values in your database.

After that (when you've parsed out the name of currently opened file), it's all up to you - I mean storing it at the server, etc, etc.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜