add multiple files to the library
This commit is contained in:
parent
f284cec7cc
commit
616e791f74
1 changed files with 19 additions and 5 deletions
|
@ -12,6 +12,8 @@ Item {
|
||||||
|
|
||||||
property string selectedLibrary: "songs"
|
property string selectedLibrary: "songs"
|
||||||
property bool overlay: false
|
property bool overlay: false
|
||||||
|
property var videoexts: ["mp4", "webm", "mkv", "avi", "MP4", "WEBM", "MKV"]
|
||||||
|
property var imgexts: ["jpg", "png", "gif", "jpeg", "JPG", "PNG"]
|
||||||
|
|
||||||
Kirigami.Theme.colorSet: Kirigami.Theme.View
|
Kirigami.Theme.colorSet: Kirigami.Theme.View
|
||||||
|
|
||||||
|
@ -805,8 +807,7 @@ Item {
|
||||||
print(drop.urls);
|
print(drop.urls);
|
||||||
/* thumbnailer.loadFile(drop.urls[0]); */
|
/* thumbnailer.loadFile(drop.urls[0]); */
|
||||||
if (drop.urls.length > 1){
|
if (drop.urls.length > 1){
|
||||||
print("dropping a real file!!")
|
addFiles(drop.urls);
|
||||||
addVideo(drop.urls[0]);
|
|
||||||
} else if (drop.urls.length === 1)
|
} else if (drop.urls.length === 1)
|
||||||
addFile(drop.urls[0]);
|
addFile(drop.urls[0]);
|
||||||
else if (drop.urls.length === 0)
|
else if (drop.urls.length === 0)
|
||||||
|
@ -854,9 +855,7 @@ Item {
|
||||||
return valid;
|
return valid;
|
||||||
}
|
}
|
||||||
|
|
||||||
function addFile(file, library) {
|
function addFile(file) {
|
||||||
const videoexts = ["mp4", "webm", "mkv", "avi", "MP4", "WEBM", "MKV"];
|
|
||||||
const imgexts = ["jpg", "png", "gif", "jpeg", "JPG", "PNG"]
|
|
||||||
let extension = file.split('.').pop();
|
let extension = file.split('.').pop();
|
||||||
if (videoexts.includes(extension))
|
if (videoexts.includes(extension))
|
||||||
{
|
{
|
||||||
|
@ -875,6 +874,21 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function addFiles(files) {
|
||||||
|
for (let i = 0; i < files.length; i++) {
|
||||||
|
let file = files[i];
|
||||||
|
let ext = file.split('.').pop()
|
||||||
|
if (videoexts.includes(ext))
|
||||||
|
{
|
||||||
|
addVideo(file);
|
||||||
|
}
|
||||||
|
if (imgexts.includes(ext))
|
||||||
|
{
|
||||||
|
addImg(file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue