comparison src/track/media.cc @ 230:2f5a9247e501

torrents: implement download button erg
author Paper <paper@paper.us.eu.org>
date Sat, 13 Jan 2024 09:42:02 -0500
parents 649786bae914
children 69f4768a820c
comparison
equal deleted inserted replaced
229:adc20fa321c1 230:2f5a9247e501
8 8
9 #include <string> 9 #include <string>
10 #include <unordered_map> 10 #include <unordered_map>
11 #include <vector> 11 #include <vector>
12 #include <filesystem> 12 #include <filesystem>
13
14 #include <iostream>
13 15
14 #include "animia.h" 16 #include "animia.h"
15 17
16 namespace Track { 18 namespace Track {
17 namespace Media { 19 namespace Media {
42 for (const auto& result : results) { 44 for (const auto& result : results) {
43 for (const auto& media : result.media) { 45 for (const auto& media : result.media) {
44 for (const auto& info : media.information) { 46 for (const auto& info : media.information) {
45 switch (info.type) { 47 switch (info.type) {
46 case animia::MediaInfoType::File: 48 case animia::MediaInfoType::File:
49 vec.push_back(std::filesystem::path(info.value).filename().u8string());
50 success |= true;
51 break;
47 case animia::MediaInfoType::Title: 52 case animia::MediaInfoType::Title:
48 vec.push_back(std::filesystem::path(info.value).filename().string()); 53 vec.push_back(info.value);
49 success |= true; 54 success |= true;
55 break;
50 default: 56 default:
51 break; 57 break;
52 } 58 }
53 } 59 }
54 } 60 }