diff --git a/resources/cider-ui-tests/index.js b/resources/cider-ui-tests/index.js index ca49c82a..98ccc52d 100644 --- a/resources/cider-ui-tests/index.js +++ b/resources/cider-ui-tests/index.js @@ -79,9 +79,14 @@ const app = new Vue({ showingPlaylist: [], artistPage: { data: {}, - topSongsExpanded: false }, library: { + downloadNotification: { + show: false, + message: "", + total: 0, + progress: 0 + }, songs: { sortingOptions: { "albumName": "Album", @@ -289,17 +294,28 @@ const app = new Vue({ } return hash; }, - getArtistPalette(artist) { - if (artist["attributes"]["artwork"]) { - return { - "background": "#" + artist["attributes"]["artwork"]["bgColor"], - "color": "#" + artist["attributes"]["artwork"]["textColor1"], + playAnimatedArtwork(url) { + if (Hls.isSupported()) { + var video = document.querySelector(`[vid="${app.hashCode(url)}"] > video`) + console.log('supported'); + var hls = new Hls(); + // bind them together + if (video) { + hls.attachMedia(video); + hls.on(Hls.Events.MEDIA_ATTACHED, function () { + console.log('video and hls.js are now bound together !'); + hls.loadSource(url); + hls.on(Hls.Events.MANIFEST_PARSED, function (event, data) { + video.play(); + return ""; + }); + }); + } else { + console.log("hso"); + return ""; } } else { - return { - "background": "#000000", - "color": "#ffffff", - } + return ""; } }, routeView(item) { @@ -432,7 +448,24 @@ const app = new Vue({ sortSongs() } else { this.library.songs.displayListing = this.library.songs.listing.filter(item => { - if (item.attributes.name.toLowerCase().includes(this.library.songs.search.toLowerCase())) { + let itemName = item.attributes.name.toLowerCase() + let searchTerm = this.library.songs.search.toLowerCase() + let artistName = "" + let albumName = "" + if (item.attributes.artistName != null) { + artistName = item.attributes.artistName.toLowerCase() + } + if (item.attributes.albumName != null) { + albumName = item.attributes.albumName.toLowerCase() + } + + // remove any non-alphanumeric characters and spaces from search term and item name + searchTerm = searchTerm.replace(/[^a-z0-9 ]/gi, "") + itemName = itemName.replace(/[^a-z0-9 ]/gi, "") + artistName = artistName.replace(/[^a-z0-9 ]/gi, "") + albumName = albumName.replace(/[^a-z0-9 ]/gi, "") + + if (itemName.includes(searchTerm) || artistName.includes(searchTerm) || albumName.includes(searchTerm)) { return item } }) @@ -497,7 +530,24 @@ const app = new Vue({ sortAlbums() } else { this.library.albums.displayListing = this.library.albums.listing.filter(item => { - if (item.attributes.name.toLowerCase().includes(this.library.albums.search.toLowerCase())) { + let itemName = item.attributes.name.toLowerCase() + let searchTerm = this.library.albums.search.toLowerCase() + let artistName = "" + let albumName = "" + if (item.attributes.artistName != null) { + artistName = item.attributes.artistName.toLowerCase() + } + if (item.attributes.albumName != null) { + albumName = item.attributes.albumName.toLowerCase() + } + + // remove any non-alphanumeric characters and spaces from search term and item name + searchTerm = searchTerm.replace(/[^a-z0-9 ]/gi, "") + itemName = itemName.replace(/[^a-z0-9 ]/gi, "") + artistName = artistName.replace(/[^a-z0-9 ]/gi, "") + albumName = albumName.replace(/[^a-z0-9 ]/gi, "") + + if (itemName.includes(searchTerm) || artistName.includes(searchTerm) || albumName.includes(searchTerm)) { return item } }) @@ -542,7 +592,10 @@ const app = new Vue({ let self = this let library = [] let downloaded = null; - if ((this.library.songs.downloadState == 2 || this.library.songs.downloadState == 1) && !force) { + if ((this.library.songs.downloadState == 2) && !force) { + return + } + if(this.library.songs.downloadState == 1) { return } if (localStorage.getItem("librarySongs") != null) { @@ -553,6 +606,8 @@ const app = new Vue({ return } this.library.songs.downloadState = 1 + this.library.downloadNotification.show = true + this.library.downloadNotification.message = "Updating library songs..." function downloadChunk() { self.library.songs.downloadState = 1 @@ -570,8 +625,11 @@ const app = new Vue({ function processChunk(response) { downloaded = response library = library.concat(downloaded.data) - self.library.songs.meta.total = downloaded.meta.total - self.library.songs.meta.progress = library.length + self.library.downloadNotification.show = true + self.library.downloadNotification.message = "Updating library songs..." + self.library.downloadNotification.total = downloaded.meta.total + self.library.downloadNotification.progress = library.length + if (downloaded.meta.total == 0) { self.library.songs.downloadState = 3 return @@ -580,6 +638,7 @@ const app = new Vue({ console.log("downloaded.next is undefined") self.library.songs.listing = library self.library.songs.downloadState = 2 + self.library.downloadNotification.show = false self.searchLibrarySongs() localStorage.setItem("librarySongs", JSON.stringify(library)) } @@ -589,6 +648,7 @@ const app = new Vue({ } else { self.library.songs.listing = library self.library.songs.downloadState = 2 + self.library.downloadNotification.show = false self.searchLibrarySongs() localStorage.setItem("librarySongs", JSON.stringify(library)) console.log(library) @@ -613,10 +673,11 @@ const app = new Vue({ return } this.library.albums.downloadState = 1 - this.library.songs.downloadState = 1 + this.library.downloadNotification.show = true + this.library.downloadNotification.message = "Updating library albums..." function downloadChunk() { - self.library.songs.downloadState = 1 + self.library.albums.downloadState = 1 if (downloaded == null) { app.mk.api.library.albums("", {limit: 100}, {includeResponseMeta: !0}).then((response) => { processChunk(response) @@ -631,10 +692,11 @@ const app = new Vue({ function processChunk(response) { downloaded = response library = library.concat(downloaded.data) - self.library.songs.meta.total = downloaded.meta.total - self.library.songs.meta.progress = library.length + self.library.downloadNotification.show = true + self.library.downloadNotification.message = "Updating library albums..." + self.library.downloadNotification.total = downloaded.meta.total + self.library.downloadNotification.progress = library.length if (downloaded.meta.total == 0) { - self.library.songs.downloadState = 3 self.library.albums.downloadState = 3 return } @@ -642,7 +704,7 @@ const app = new Vue({ console.log("downloaded.next is undefined") self.library.albums.listing = library self.library.albums.downloadState = 2 - self.library.songs.downloadState = 2 + self.library.downloadNotification.show = false localStorage.setItem("libraryAlbums", JSON.stringify(library)) self.searchLibraryAlbums() } @@ -653,7 +715,7 @@ const app = new Vue({ } else { self.library.albums.listing = library self.library.albums.downloadState = 2 - self.library.songs.downloadState = 2 + self.library.downloadNotification.show = false localStorage.setItem("libraryAlbums", JSON.stringify(library)) self.searchLibraryAlbums() console.log(library) @@ -751,6 +813,12 @@ const app = new Vue({ }) } }, + addToLibrary(id) { + let self = this + this.mk.addToLibrary(id).then((data)=>{ + self.getLibrarySongsFull(true) + }) + }, loadMXM() { let attempt = 0; const track = encodeURIComponent((this.mk.nowPlayingItem != null) ? this.mk.nowPlayingItem.title ?? '' : ''); @@ -1364,4 +1432,3 @@ var checkIfScrollIsStatic = setInterval(() => { } }, 50); - diff --git a/resources/cider-ui-tests/style.css b/resources/cider-ui-tests/style.css index 10ee4bd4..a394fba4 100644 --- a/resources/cider-ui-tests/style.css +++ b/resources/cider-ui-tests/style.css @@ -1358,6 +1358,28 @@ input[type=range].web-slider::-webkit-slider-runnable-track { /* Cider */ +.reload-btn { + background: rgb(86 86 86 / 52%); + border-radius: 100%; + width: 32px; + height: 32px; + border: 0px; + appearance: none; + display: flex; + justify-content: center; + align-items: center; +} + +.reload-btn:hover { + background: rgb(86 86 86 / 80%); + cursor: pointer; +} + +.reload-btn>svg { + height: 50%; + color: #eee; +} + .wr-btn { font-family: inherit; appearance: none; @@ -1448,6 +1470,34 @@ input[type=range].web-slider::-webkit-slider-runnable-track { text-transform: uppercase; } +.playlist-display .playlist-info .playlist-desc-expanded { + box-sizing: border-box; + font-size: 14px; + position: relative; +} + +.playlist-display .playlist-info .playlist-desc-expanded .more-btn { + appearance: none; + position: absolute; + right: 0; + bottom: 0; + padding: 0 5px; + font-size: 14px; + color: var(--keyColor); + background-color: transparent; + border: 0px; + cursor: pointer; + width: 100%; + height: 100%; + overflow: hidden; + display: flex; + justify-content: flex-end; + align-items: flex-end; + font-weight: 600; + font-family: inherit; + text-transform: uppercase; +} + .playlist-time { font-size: 0.9em; margin: 6px; diff --git a/resources/cider-ui-tests/views/components/mediaitem-list-item.ejs b/resources/cider-ui-tests/views/components/mediaitem-list-item.ejs index d1acf5d4..38b2d09e 100644 --- a/resources/cider-ui-tests/views/components/mediaitem-list-item.ejs +++ b/resources/cider-ui-tests/views/components/mediaitem-list-item.ejs @@ -1,12 +1,10 @@ + \ No newline at end of file diff --git a/resources/cider-ui-tests/views/pages/cider-playlist.ejs b/resources/cider-ui-tests/views/pages/cider-playlist.ejs index dad06225..8ac26e0e 100644 --- a/resources/cider-ui-tests/views/pages/cider-playlist.ejs +++ b/resources/cider-ui-tests/views/pages/cider-playlist.ejs @@ -2,39 +2,61 @@