https://github.com/erengy/anisthesia
Media detection library
https://github.com/erengy/anisthesia
work-in-progress
Last synced: about 1 year ago
JSON representation
Media detection library
- Host: GitHub
- URL: https://github.com/erengy/anisthesia
- Owner: erengy
- License: mit
- Created: 2017-02-06T21:58:39.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2024-07-01T14:27:56.000Z (about 2 years ago)
- Last Synced: 2025-03-22T00:03:32.288Z (over 1 year ago)
- Topics: work-in-progress
- Language: C++
- Homepage:
- Size: 77.1 KB
- Stars: 42
- Watchers: 7
- Forks: 9
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Anisthesia
*Anisthesia* is a media detection library for Windows.
- Detects running media players and web browsers
- Retrieves information about the currently playing video
## Usage
***This is a work in progress. Usage in public applications is not yet recommended.***
```cpp
#include
#include
#include
int main() {
std::vector players;
if (!anisthesia::ParsePlayersFile("data/players.anisthesia", players)) {
return 1;
}
const auto media_proc = [](const anisthesia::MediaInfo&) {
return true; // Accept all media
};
std::vector results;
if (!anisthesia::win::GetResults(players, media_proc, results)) {
return 1;
}
const auto get_type = [](const anisthesia::MediaInfoType& type) {
switch (type) {
case anisthesia::MediaInfoType::File: return "File";
case anisthesia::MediaInfoType::Tab: return "Tab";
case anisthesia::MediaInfoType::Title: return "Title";
case anisthesia::MediaInfoType::Url: return "URL";
default: return "Other";
}
};
for (const auto& result : results) {
std::cout << result.player.name << '\n';
for (const auto& media : result.media) {
for (const auto& information : media.information) {
std::cout << "\t" << get_type(information.type);
std::cout << "\t\"" << information.value << "\"\n";
}
}
}
return 0;
}
```
## License
Licensed under the [MIT License](https://opensource.org/licenses/MIT).