Add title property for EventMediaLoader

This commit is contained in:
miruka 2020-03-09 11:08:07 -04:00
parent 2a2b3df845
commit bd7b45cc7a
2 changed files with 9 additions and 2 deletions

View File

@ -28,6 +28,9 @@ HLoader {
property string downloadedPath: ""
readonly property string title:
singleMediaInfo.media_title || utils.urlFileName(mediaUrl)
readonly property var imageExtensions: [
"bmp", "gif", "jpg", "jpeg", "png", "pbm", "pgm", "ppm", "xbm", "xpm",
"tiff", "webp", "svg",

View File

@ -298,9 +298,13 @@ QtObject {
}
function urlFileName(url) {
return url.toString().split("/").slice(-1)[0].split("?")[0]
}
function urlExtension(url) {
return url.toString().split("/").slice(-1)[0].split("?")[0].split(".")
.slice(-1)[0].toLowerCase()
return urlFileName(url).split(".").slice(-1)[0]
}