Mercurial > minori
comparison src/track/media.cc @ 258:862d0d8619f6
*: HUUUGE changes
animia has been renamed to animone, so instead of thinking of a
health condition, you think of a beautiful flower :)
I've also edited some of the code for animone, but I have no idea
if it even works or not because I don't have a mac or windows
machine lying around. whoops!
... anyway, all of the changes divergent from Anisthesia are now
licensed under BSD. it's possible that I could even rewrite most
of the code to where I don't even have to keep the MIT license,
but that's thinking too far into the future
I've been slacking off on implementing the anime seasons page,
mostly out of laziness. I think I'd have to create another db file
specifically for the seasons
anyway, this code is being pushed *primarily* because the hard drive
it's on is failing! yay :)
author | Paper <paper@paper.us.eu.org> |
---|---|
date | Mon, 01 Apr 2024 02:43:44 -0400 |
parents | 4d461ef7d424 |
children | ff0b2052b234 |
comparison
equal
deleted
inserted
replaced
257:699a20c57dc8 | 258:862d0d8619f6 |
---|---|
1 #include "track/media.h" | 1 #include "track/media.h" |
2 #include "core/filesystem.h" | 2 #include "core/filesystem.h" |
3 #include "core/session.h" | |
3 #include "core/strings.h" | 4 #include "core/strings.h" |
4 #include "core/session.h" | |
5 | 5 |
6 #include <QFile> | 6 #include <QFile> |
7 #include <QTextStream> | 7 #include <QTextStream> |
8 | 8 |
9 #include <filesystem> | |
9 #include <string> | 10 #include <string> |
10 #include <unordered_map> | 11 #include <unordered_map> |
11 #include <vector> | 12 #include <vector> |
12 #include <filesystem> | |
13 | 13 |
14 #include <iostream> | 14 #include <iostream> |
15 | 15 |
16 #include "animia.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<animia::Result>& results) { | 21 static bool GetCurrentlyPlayingResults(std::vector<animone::Result>& results) { |
22 std::vector<animia::Player> players; | 22 std::vector<animone::Player> players; |
23 | 23 |
24 players.reserve(session.config.recognition.players.size()); | 24 players.reserve(session.config.recognition.players.size()); |
25 for (const auto& [enabled, player] : session.config.recognition.players) | 25 for (const auto& [enabled, player] : session.config.recognition.players) |
26 if (enabled && player.type == animia::PlayerType::Default) | 26 if (enabled && player.type == animone::PlayerType::Default) |
27 players.push_back(player); | 27 players.push_back(player); |
28 | 28 |
29 if (!animia::GetResults(players, results)) | 29 if (!animone::GetResults(players, results)) { |
30 std::cout << "FAIL!" << std::endl; | |
30 return false; | 31 return false; |
32 } | |
31 | 33 |
32 return true; | 34 return true; |
33 } | 35 } |
34 | 36 |
35 /* meh */ | 37 /* meh */ |
36 bool GetCurrentlyPlaying(std::vector<std::string>& vec) { | 38 bool GetCurrentlyPlaying(std::vector<std::string>& vec) { |
37 std::vector<animia::Result> results; | 39 std::vector<animone::Result> results; |
38 | 40 |
39 if (!GetCurrentlyPlayingResults(results)) | 41 if (!GetCurrentlyPlayingResults(results)) |
40 return false; | 42 return false; |
41 | 43 |
42 bool success = false; | 44 bool success = false; |
43 | 45 |
44 for (const auto& result : results) { | 46 for (const auto& result : results) { |
45 for (const auto& media : result.media) { | 47 for (const auto& media : result.media) { |
46 for (const auto& info : media.information) { | 48 for (const auto& info : media.information) { |
49 std::cout << info.value << std::endl; | |
50 | |
47 switch (info.type) { | 51 switch (info.type) { |
48 case animia::MediaInfoType::File: | 52 case animone::MediaInfoType::File: |
49 vec.push_back(std::filesystem::path(info.value).filename().u8string()); | 53 vec.push_back(std::filesystem::path(info.value).filename().u8string()); |
50 success |= true; | 54 success |= true; |
51 break; | 55 break; |
52 case animia::MediaInfoType::Title: | 56 case animone::MediaInfoType::Title: |
53 vec.push_back(info.value); | 57 vec.push_back(info.value); |
54 success |= true; | 58 success |= true; |
55 break; | 59 break; |
56 default: | 60 default: break; |
57 break; | |
58 } | 61 } |
59 } | 62 } |
60 } | 63 } |
61 } | 64 } |
62 | 65 |