Mercurial > minori
comparison src/track/media.cc @ 369:47c9f8502269
*: clang-format all the things
I've edited the formatting a bit. Now pointer asterisks (and reference
ampersands) are on the variable instead of the type, as well as having
newlines for function braces (but nothing else)
author | Paper <paper@tflc.us> |
---|---|
date | Fri, 25 Jul 2025 10:16:02 -0400 |
parents | 886f66775f31 |
children |
comparison
equal
deleted
inserted
replaced
368:6d37a998cf91 | 369:47c9f8502269 |
---|---|
16 #include "animone.h" | 16 #include "animone.h" |
17 | 17 |
18 namespace Track { | 18 namespace Track { |
19 namespace Media { | 19 namespace Media { |
20 | 20 |
21 static bool GetCurrentlyPlayingResults(std::vector<animone::Result>& results) { | 21 static bool GetCurrentlyPlayingResults(std::vector<animone::Result> &results) |
22 { | |
22 std::vector<animone::Player> players; | 23 std::vector<animone::Player> players; |
23 | 24 |
24 players.reserve(session.config.recognition.players.size()); | 25 players.reserve(session.config.recognition.players.size()); |
25 for (const auto& [enabled, player] : session.config.recognition.players) | 26 for (const auto &[enabled, player] : session.config.recognition.players) |
26 if (enabled && player.type == animone::PlayerType::Default) | 27 if (enabled && player.type == animone::PlayerType::Default) |
27 players.push_back(player); | 28 players.push_back(player); |
28 | 29 |
29 return animone::GetResults(players, results); | 30 return animone::GetResults(players, results); |
30 } | 31 } |
32 /* The results from this function are KIND OF guaranteed to be UTF-8; | 33 /* The results from this function are KIND OF guaranteed to be UTF-8; |
33 * more specifically any files returned are UTF-8 as required by the C++ | 34 * more specifically any files returned are UTF-8 as required by the C++ |
34 * standard. However, window titles are not, and for some obscure X11 | 35 * standard. However, window titles are not, and for some obscure X11 |
35 * window managers, WILL not be in UTF-8. I don't care enough about this | 36 * window managers, WILL not be in UTF-8. I don't care enough about this |
36 * to do anything about it though. */ | 37 * to do anything about it though. */ |
37 bool GetCurrentlyPlaying(std::vector<std::string>& vec) { | 38 bool GetCurrentlyPlaying(std::vector<std::string> &vec) |
39 { | |
38 std::vector<animone::Result> results; | 40 std::vector<animone::Result> results; |
39 | 41 |
40 if (!GetCurrentlyPlayingResults(results)) | 42 if (!GetCurrentlyPlayingResults(results)) |
41 return false; | 43 return false; |
42 | 44 |
43 bool success = false; | 45 bool success = false; |
44 | 46 |
45 for (const auto& result : results) { | 47 for (const auto &result : results) { |
46 for (const auto& media : result.media) { | 48 for (const auto &media : result.media) { |
47 for (const auto& info : media.information) { | 49 for (const auto &info : media.information) { |
48 switch (info.type) { | 50 switch (info.type) { |
49 case animone::MediaInfoType::File: | 51 case animone::MediaInfoType::File: |
50 vec.push_back(std::filesystem::path(info.value).filename().u8string()); | 52 vec.push_back(std::filesystem::path(info.value).filename().u8string()); |
51 success |= true; | 53 success |= true; |
52 break; | 54 break; |
53 case animone::MediaInfoType::Title: | 55 case animone::MediaInfoType::Title: |
54 vec.push_back(info.value); | 56 vec.push_back(info.value); |
55 success |= true; | 57 success |= true; |
56 break; | 58 break; |
57 case animone::MediaInfoType::Tab: | 59 case animone::MediaInfoType::Tab: break; |
58 break; | 60 case animone::MediaInfoType::Url: break; |
59 case animone::MediaInfoType::Url: | |
60 break; | |
61 default: break; | 61 default: break; |
62 } | 62 } |
63 } | 63 } |
64 } | 64 } |
65 } | 65 } |