Mercurial > minori
comparison src/track/media.cpp @ 80:825506f0e221
[UNFINISHED]: stuff
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Fri, 13 Oct 2023 13:15:19 -0400 |
parents | 1ce00c1c8ddc |
children |
comparison
equal
deleted
inserted
replaced
79:c489dd4434af | 80:825506f0e221 |
---|---|
3 #include "anitomy/anitomy.h" | 3 #include "anitomy/anitomy.h" |
4 #include "core/filesystem.h" | 4 #include "core/filesystem.h" |
5 #include "core/strings.h" | 5 #include "core/strings.h" |
6 #include <string> | 6 #include <string> |
7 #include <vector> | 7 #include <vector> |
8 #include <unordered_map> | |
8 #include <QDebug> | 9 #include <QDebug> |
9 | 10 |
10 namespace Track { | 11 namespace Track { |
11 namespace Media { | 12 namespace Media { |
12 | 13 |
25 } | 26 } |
26 } | 27 } |
27 return Filesystem::Path(); | 28 return Filesystem::Path(); |
28 } | 29 } |
29 | 30 |
30 std::string GetFileTitle(Filesystem::Path path) { | 31 std::unordered_map<std::string, std::string> GetMapFromElements(const anitomy::Elements& elements) { |
32 /* there are way more than this in anitomy, but we only need basic information | |
33 I also just prefer using maps than using the ".get()" stuff which is why I'm doing this */ | |
34 std::unordered_map<std::string, std::string> ret; | |
35 | |
36 ret["title"] = Strings::ToUtf8String(elements.get(anitomy::kElementAnimeTitle)); | |
37 ret["filename"] = Strings::ToUtf8String(elements.get(anitomy::kElementFileName)); | |
38 ret["language"] = Strings::ToUtf8String(elements.get(anitomy::kElementLanguage)); | |
39 ret["group"] = Strings::ToUtf8String(elements.get(anitomy::kElementReleaseGroup)); | |
40 ret["episode"] = Strings::ToUtf8String(elements.get(anitomy::kElementEpisodeNumber)); | |
41 | |
42 return ret; | |
43 } | |
44 | |
45 std::unordered_map<std::string, std::string> GetFileElements(Filesystem::Path path) { | |
31 anitomy::Anitomy anitomy; | 46 anitomy::Anitomy anitomy; |
32 anitomy.Parse(Strings::ToWstring(path.Basename())); | 47 anitomy.Parse(Strings::ToWstring(path.Basename())); |
33 | 48 |
34 const auto& elements = anitomy.elements(); | 49 return GetMapFromElements(anitomy.elements()); |
35 | |
36 return Strings::ToUtf8String(elements.get(anitomy::kElementAnimeTitle)); | |
37 } | 50 } |
38 | 51 |
39 } // namespace Media | 52 } // namespace Media |
40 } // namespace Track | 53 } // namespace Track |