Mercurial > minori
comparison src/track/media.cc @ 153:bd439dd6ffc5
*: make win stuff actually work, rename bsd.cc to xnu.cc
It's been OS X only for ages, and these functions are different between
most BSDs anyway
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Wed, 15 Nov 2023 13:28:18 -0500 |
parents | 8700806c2cc2 |
children | d43d68408d3c |
comparison
equal
deleted
inserted
replaced
152:8700806c2cc2 | 153:bd439dd6ffc5 |
---|---|
39 bool success = false; | 39 bool success = false; |
40 | 40 |
41 for (const auto& result : results) { | 41 for (const auto& result : results) { |
42 for (const auto& media : result.media) { | 42 for (const auto& media : result.media) { |
43 for (const auto& info : media.information) { | 43 for (const auto& info : media.information) { |
44 switch (info.type) { | |
45 case | |
46 } | |
44 std::cout << static_cast<int>(info.type) << ": " << info.value << std::endl; | 47 std::cout << static_cast<int>(info.type) << ": " << info.value << std::endl; |
45 vec.push_back(info.value); | 48 vec.push_back(info.value); |
46 success |= true; | 49 success |= true; |
47 } | 50 } |
48 } | 51 } |
49 } | 52 } |
50 | 53 |
51 return success; | 54 return success; |
52 } | 55 } |
53 | 56 |
54 /* this sucks. use anitomy directly like a real man */ | |
55 std::unordered_map<std::string, std::string> GetMapFromElements(const anitomy::Elements& elements) { | |
56 std::unordered_map<std::string, std::string> ret; | |
57 | |
58 ret["title"] = Strings::ToUtf8String(elements.get(anitomy::kElementAnimeTitle)); | |
59 ret["filename"] = Strings::ToUtf8String(elements.get(anitomy::kElementFileName)); | |
60 ret["language"] = Strings::ToUtf8String(elements.get(anitomy::kElementLanguage)); | |
61 ret["group"] = Strings::ToUtf8String(elements.get(anitomy::kElementReleaseGroup)); | |
62 ret["episode"] = Strings::ToUtf8String(elements.get(anitomy::kElementEpisodeNumber)); | |
63 ret["resolution"] = Strings::ToUtf8String(elements.get(anitomy::kElementVideoResolution)); | |
64 | |
65 return ret; | |
66 } | |
67 | |
68 std::unordered_map<std::string, std::string> GetFileElements(const std::string& basename) { | |
69 anitomy::Anitomy anitomy; | |
70 anitomy.Parse(Strings::ToWstring(basename)); | |
71 | |
72 return GetMapFromElements(anitomy.elements()); | |
73 } | |
74 | |
75 std::unordered_map<std::string, std::string> GetFileElements(const std::filesystem::path& path) { | |
76 anitomy::Anitomy anitomy; | |
77 anitomy.Parse(path.filename().wstring()); | |
78 | |
79 return GetMapFromElements(anitomy.elements()); | |
80 } | |
81 | |
82 } // namespace Media | 57 } // namespace Media |
83 } // namespace Track | 58 } // namespace Track |