Mercurial > minori
diff 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 |
line wrap: on
line diff
--- a/src/track/media.cpp Thu Oct 12 11:31:39 2023 -0400 +++ b/src/track/media.cpp Fri Oct 13 13:15:19 2023 -0400 @@ -5,6 +5,7 @@ #include "core/strings.h" #include <string> #include <vector> +#include <unordered_map> #include <QDebug> namespace Track { @@ -27,13 +28,25 @@ return Filesystem::Path(); } -std::string GetFileTitle(Filesystem::Path path) { +std::unordered_map<std::string, std::string> GetMapFromElements(const anitomy::Elements& elements) { + /* there are way more than this in anitomy, but we only need basic information + I also just prefer using maps than using the ".get()" stuff which is why I'm doing this */ + std::unordered_map<std::string, std::string> ret; + + ret["title"] = Strings::ToUtf8String(elements.get(anitomy::kElementAnimeTitle)); + ret["filename"] = Strings::ToUtf8String(elements.get(anitomy::kElementFileName)); + ret["language"] = Strings::ToUtf8String(elements.get(anitomy::kElementLanguage)); + ret["group"] = Strings::ToUtf8String(elements.get(anitomy::kElementReleaseGroup)); + ret["episode"] = Strings::ToUtf8String(elements.get(anitomy::kElementEpisodeNumber)); + + return ret; +} + +std::unordered_map<std::string, std::string> GetFileElements(Filesystem::Path path) { anitomy::Anitomy anitomy; anitomy.Parse(Strings::ToWstring(path.Basename())); - const auto& elements = anitomy.elements(); - - return Strings::ToUtf8String(elements.get(anitomy::kElementAnimeTitle)); + return GetMapFromElements(anitomy.elements()); } } // namespace Media