Add duration and resolution to files

This commit is contained in:
Nicolas Werner 2022-03-21 00:48:27 +01:00
parent d3471a1097
commit fd83858715
No known key found for this signature in database
GPG key ID: C8D75E610773F2D9
12 changed files with 230 additions and 9 deletions

View file

@ -169,6 +169,20 @@ struct EventThumbnailUrl
}
};
struct EventDuration
{
template<class Content>
using thumbnail_url_t = decltype(Content::info.duration);
template<class T>
uint64_t operator()(const mtx::events::Event<T> &e)
{
if constexpr (is_detected<thumbnail_url_t, T>::value) {
return e.content.info.duration;
}
return 0;
}
};
struct EventBlurhash
{
template<class Content>
@ -420,6 +434,11 @@ mtx::accessors::thumbnail_url(const mtx::events::collections::TimelineEvents &ev
{
return std::visit(EventThumbnailUrl{}, event);
}
uint64_t
mtx::accessors::duration(const mtx::events::collections::TimelineEvents &event)
{
return std::visit(EventDuration{}, event);
}
std::string
mtx::accessors::blurhash(const mtx::events::collections::TimelineEvents &event)
{