An open API service indexing awesome lists of open source software.

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

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).