Mercurial > minori
annotate src/track/media.cpp @ 79:c489dd4434af
*: what did I do again?
I really forgot what I did here :)
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Thu, 12 Oct 2023 11:31:39 -0400 |
parents | 1ce00c1c8ddc |
children | 825506f0e221 |
rev | line source |
---|---|
64 | 1 #include "track/media.h" |
76 | 2 #include "animia.h" |
3 #include "anitomy/anitomy.h" | |
64 | 4 #include "core/filesystem.h" |
5 #include "core/strings.h" | |
6 #include <string> | |
7 #include <vector> | |
78
1ce00c1c8ddc
dep/animia: update to upstream
Paper <mrpapersonic@gmail.com>
parents:
76
diff
changeset
|
8 #include <QDebug> |
64 | 9 |
10 namespace Track { | |
11 namespace Media { | |
12 | |
13 Filesystem::Path GetCurrentPlaying() { | |
14 /* getting all open files */ | |
15 std::vector<int> pids = Animia::get_all_pids(); | |
16 for (int i : pids) { | |
78
1ce00c1c8ddc
dep/animia: update to upstream
Paper <mrpapersonic@gmail.com>
parents:
76
diff
changeset
|
17 if (Animia::get_process_name(i) == "vlc") { |
64 | 18 std::vector<std::string> files = Animia::filter_system_files(Animia::get_open_files(i)); |
19 for (std::string s : files) { | |
78
1ce00c1c8ddc
dep/animia: update to upstream
Paper <mrpapersonic@gmail.com>
parents:
76
diff
changeset
|
20 qDebug() << Strings::ToQString(s); |
64 | 21 Filesystem::Path p(s); |
78
1ce00c1c8ddc
dep/animia: update to upstream
Paper <mrpapersonic@gmail.com>
parents:
76
diff
changeset
|
22 if (p.Extension() == "mp4") |
64 | 23 return p; |
24 } | |
25 } | |
26 } | |
27 return Filesystem::Path(); | |
28 } | |
29 | |
30 std::string GetFileTitle(Filesystem::Path path) { | |
31 anitomy::Anitomy anitomy; | |
32 anitomy.Parse(Strings::ToWstring(path.Basename())); | |
33 | |
34 const auto& elements = anitomy.elements(); | |
35 | |
36 return Strings::ToUtf8String(elements.get(anitomy::kElementAnimeTitle)); | |
37 } | |
38 | |
39 } // namespace Media | |
40 } // namespace Track |