Merge branch 'ciderapp:develop' into develop

This commit is contained in:
Gabriel Davila 2022-04-29 22:48:34 -03:00 committed by GitHub
commit cd9f245d21
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 362 additions and 349 deletions

View file

@ -16,6 +16,7 @@
height: var(--chromeHeight1);
&.chrome-bottom {
-webkit-app-region: no-drag;
height : var(--chromeHeight2);
box-shadow: 0px -1px 0px rgba(0, 0, 0, 0.25);
z-index : 1;
@ -30,6 +31,7 @@
.app-playback-controls .actions {
align-self: center;
}
-webkit-app-region: no-drag;
.playback-button.play,
.playback-button.pause {
@ -120,8 +122,9 @@
width : 30%;
justify-content: flex-start;
align-items : flex-start;
-webkit-app-region: no-drag!important;
.playback-controls {
-webkit-app-region: no-drag!important;
.artwork {
width : var(--chromeHeight2);
height : var(--chromeHeight2);

View file

@ -234,7 +234,7 @@ const app = new Vue({
watch: {
cfg: {
handler: function (val, oldVal) {
console.log(`cfg changed from ${oldVal} to ${val}`);
console.debug(`cfg changed from ${oldVal} to ${val}`);
ipcRenderer.send("setStore", val);
},
deep: true
@ -254,6 +254,12 @@ const app = new Vue({
app.resetState()
}
},
mounted() {
window.addEventListener("hashchange", function (event) {
let currentPath = window.location.hash.slice(1);
console.debug("hashchange", currentPath);
}, false)
},
methods: {
setTimeout(func, time) {
return setTimeout(func, time);
@ -268,10 +274,10 @@ const app = new Vue({
if (httpRequest.readyState === 4) {
if (httpRequest.status === 200) {
let response = JSON.parse(httpRequest.responseText);
console.log(response);
console.debug(response);
self.copyToClipboard(response.pageUrl)
} else {
console.log('There was a problem with the request.');
console.warn('There was a problem with the request.');
notyf.error(app.getLz('term.requestError'))
}
}
@ -940,7 +946,7 @@ const app = new Vue({
})
},
async setTheme(theme = "", onlyPrefs = false) {
console.log(theme)
console.debug(theme)
if (this.cfg.visual.theme == "") {
this.cfg.visual.theme = "default.less"
}
@ -1121,15 +1127,15 @@ const app = new Vue({
const cachedTrackMapping = await CiderCache.getCache("library-playlists-tracks")
if (cachedPlaylist) {
console.log("using cached playlists")
console.debug("using cached playlists")
this.playlists.listing = cachedPlaylist
self.sortPlaylists()
} else {
console.log("playlist has no cache")
console.debug("playlist has no cache")
}
if (cachedTrackMapping) {
console.log("using cached track mapping")
console.debug("using cached track mapping")
this.playlists.trackMapping = cachedTrackMapping
}
if (localOnly) {
@ -1140,7 +1146,7 @@ const app = new Vue({
this.library.backgroundNotification.show = true
async function deepScan(parent = "p.playlistsroot") {
console.log(`scanning ${parent}`)
console.debug(`scanning ${parent}`)
const playlistData = await app.mk.api.v3.music(`/v1/me/library/playlist-folders/${parent}/children/`)
await asyncForEach(playlistData.data.data, async (playlist) => {
playlist.parent = parent
@ -1259,7 +1265,7 @@ const app = new Vue({
// this.darwinShare(str)
// } else {
notyf.success(app.getLz('term.share.success'))
navigator.clipboard.writeText(str).then(r => console.log("Copied to clipboard."))
navigator.clipboard.writeText(str).then(r => console.debug("Copied to clipboard."))
// }
},
newPlaylist(name = app.getLz('term.newPlaylist'), tracks = []) {
@ -1282,7 +1288,7 @@ const app = new Vue({
}
}).then(res => {
res = res.data.data[0]
console.log(res)
console.debug(res)
self.appRoute(`playlist_` + res.id);
self.showingPlaylist = [];
self.getPlaylistFromID(app.page.substring(9), true)
@ -1317,7 +1323,7 @@ const app = new Vue({
},
async showCollection(response, title, type, requestBody = {}) {
let self = this
console.log(response)
console.debug(response)
this.collectionList.requestBody = {}
this.collectionList.response = response
this.collectionList.title = title
@ -1327,7 +1333,7 @@ const app = new Vue({
},
async showArtistView(artist, title, view) {
let response = (await app.mk.api.v3.music(`/v1/catalog/${app.mk.storefrontId}/artists/${artist}/view/${view}?l=${this.mklang}`, {}, { includeResponseMeta: !0 })).data
console.log(response)
console.debug(response)
await this.showCollection(response, title, "artists")
},
async showRecordLabelView(label, title, view) {
@ -1367,7 +1373,7 @@ const app = new Vue({
includeResponseMeta: !0
})
console.log('searchres', response)
console.debug('searchres', response)
let responseFormat = {
data: response.data.results[group].data,
next: response.data.results[group].next,
@ -1421,13 +1427,13 @@ const app = new Vue({
app.mk.api.v3.music(`/v1/me/library/playlists/${id}`, params).then(res => {
self.getPlaylistContinuous(res, transient)
}).catch((e) => {
console.log(e);
console.debug(e);
try {
app.mk.api.v3.music(`/v1/catalog/${app.mk.storefrontId}/playlists/${id}`, params).then(res => {
self.getPlaylistContinuous(res, transient)
})
} catch (err) {
console.log(err)
console.debug(err)
}
})
@ -1444,7 +1450,7 @@ const app = new Vue({
"art[url]": "f",
l: this.mklang
}, { includeResponseMeta: !0 })
console.log(artistData.data.data[0])
console.debug(artistData.data.data[0])
this.artistPage.data = artistData.data.data[0]
this.page = "artist-page"
},
@ -1479,12 +1485,12 @@ const app = new Vue({
"meta": {}
}
if (response.next) {
console.log("has next")
console.debug("has next")
returnData.data.concat(response.data)
returnData.meta = response.meta
return await this.getRecursive(await response.next())
} else {
console.log("no next")
console.debug("no next")
returnData.data.concat(response.data)
return returnData
}
@ -1624,7 +1630,7 @@ const app = new Vue({
window.location.hash = `${kind}/${id}`
document.querySelector("#app-content").scrollTop = 0
} else if (kind == "editorial-elements") {
console.log(item)
console.debug(item)
if (item.relationships?.contents?.data != null && item.relationships?.contents?.data.length > 0) {
this.routeView(item.relationships.contents.data[0])
} else if (item.attributes?.link?.url != null) {
@ -1665,28 +1671,16 @@ const app = new Vue({
params["meta[albums:tracks]"] = 'popularity'
params["fields[albums]"] = "artistName,artistUrl,artwork,contentRating,editorialArtwork,editorialNotes,editorialVideo,name,playParams,releaseDate,url,copyright"
}
// if (this.cfg.advanced.experiments.includes('inline-playlists')) {
if (false) {
let showModal = kind.toString().includes("album") || kind.toString().includes("playlist")
if (app.page.includes("playlist") || app.page.includes("album")) {
showModal = false
}
if (showModal) {
app.modals.showPlaylist = true
app.chrome.contentAreaScrolling = false
} else {
if(kind.includes("playlist") || kind.includes("album")){
app.page = (kind) + "_" + (id);
window.location.hash = `${kind}/${id}${isLibrary ? "/" + isLibrary : ''}`
}
} else {
app.page = (kind) + "_" + (id);
window.location.hash = `${kind}/${id}${isLibrary ? "/" + isLibrary : ''}`
}
app.getTypeFromID((kind), (id), (isLibrary), params);
// document.querySelector("#app-content").scrollTop = 0
}else{
app.page = (kind)
window.location.hash = `${kind}/${id}${isLibrary ? "/" + isLibrary : ''}`
}
// app.getTypeFromID((kind), (id), (isLibrary), params);
} else {
app.playMediaItemById((id), (kind), (isLibrary), item.attributes.url ?? '')
}
@ -1752,12 +1746,12 @@ const app = new Vue({
try {
if (artistQuery.artists.data.length > 0) {
artistId = artistQuery.artists.data[0].id;
console.log(artistId)
console.debug(artistId)
}
} catch (e) {
}
}
console.log(artistId);
console.debug(artistId);
if (artistId != "")
self.appRoute(`artist/${artistId}`)
break;
@ -1789,7 +1783,7 @@ const app = new Vue({
})).data.results;
if (albumQuery.albums.data.length > 0) {
albumId = albumQuery.albums.data[0].id;
console.log(albumId)
console.debug(albumId)
}
} catch (e) {
}
@ -1813,7 +1807,7 @@ const app = new Vue({
})).data.results;
if (labelQuery["record-labels"].data.length > 0) {
labelId = labelQuery["record-labels"].data[0].id;
console.log(labelId)
console.debug(labelId)
}
} catch (e) {
}
@ -1846,7 +1840,7 @@ const app = new Vue({
}
},
followingArtist(id) {
console.log(`check for ${id}`)
console.debug(`check for ${id}`)
return this.cfg.home.followedArtists.includes(id)
},
playMediaItem(item) {
@ -1876,7 +1870,7 @@ const app = new Vue({
try {
a = await this.mkapi(kind.toString(), isLibrary, id.toString(), params, params2);
} catch (e) {
console.log(e);
console.debug(e);
try {
a = await this.mkapi(kind.toString(), !isLibrary, id.toString(), params, params2);
} catch (err) {
@ -2131,7 +2125,7 @@ const app = new Vue({
return await this.mk.api.v3.music(`/v1/catalog/${app.mk.storefrontId}/${truemethod}/${term.toString()}`, params, params2)
}
} catch (e) {
console.log(e)
console.debug(e)
return await this.mkapi(method, library, term, params, params2, attempts + 1)
}
},
@ -2183,7 +2177,7 @@ const app = new Vue({
l: app.mklang,
},
onProgress: (data) => {
console.log(`${data.total}/${data.response.data.meta.total}`)
console.debug(`${data.total}/${data.response.data.meta.total}`)
self.library.backgroundNotification.show = true
self.library.backgroundNotification.message = app.getLz('notification.updatingLibrarySongs')
self.library.backgroundNotification.total = data.response.data.meta.total
@ -2199,7 +2193,7 @@ const app = new Vue({
self.library.backgroundNotification.show = false
self.searchLibrarySongs()
CiderCache.putCache(cacheId, library)
console.log("Done!")
console.debug("Done!")
return
},
@ -2250,7 +2244,7 @@ const app = new Vue({
app.mk.api.v3.music(`/v1/me/library/albums/`, params).then((response) => {
processChunk(response.data)
}).catch((error) => {
console.log('safe loading');
console.debug('safe loading');
app.mk.api.v3.music(`/v1/me/library/albums/`, safeparams).then((response) => {
processChunk(response.data)
}).catch((error) => {
@ -2264,7 +2258,7 @@ const app = new Vue({
app.mk.api.v3.music(downloaded.next, params).then((response) => {
processChunk(response.data)
}).catch((error) => {
console.log('safe loading');
console.debug('safe loading');
app.mk.api.v3.music(downloaded.next, safeparams).then((response) => {
processChunk(response.data)
}).catch((error) => {
@ -2274,7 +2268,7 @@ const app = new Vue({
})
})
} else {
console.log("Download next", downloaded.next)
console.debug("Download next", downloaded.next)
}
}
}
@ -2291,7 +2285,7 @@ const app = new Vue({
return
}
if (typeof downloaded.next == "undefined") {
console.log("downloaded.next is undefined")
console.debug("downloaded.next is undefined")
self.library.albums.listing = library
self.library.albums.downloadState = 2
self.library.backgroundNotification.show = false
@ -2299,7 +2293,7 @@ const app = new Vue({
self.searchLibraryAlbums(index)
}
if (downloaded.meta.total > library.length || typeof downloaded.meta.next != "undefined") {
console.log(`downloading next chunk - ${library.length
console.debug(`downloading next chunk - ${library.length
} albums so far`)
downloadChunk()
} else {
@ -2357,7 +2351,7 @@ const app = new Vue({
app.mk.api.v3.music(`/v1/me/library/artists/`, params).then((response) => {
processChunk(response.data)
}).catch((error) => {
console.log('safe loading');
console.debug('safe loading');
app.mk.api.v3.music(`/v1/me/library/artists/`, safeparams).then((response) => {
processChunk(response.data)
}).catch((error) => {
@ -2485,7 +2479,7 @@ const app = new Vue({
reload: !0
})).data;
this.listennow.timestamp = Date.now()
console.log(this.listennow)
console.debug(this.listennow)
} catch (e) {
console.log(e)
this.getListenNow(attempt + 1)
@ -2513,7 +2507,7 @@ const app = new Vue({
});
this.browsepage = browse.data.data[0];
this.browsepage.timestamp = Date.now()
console.log(this.browsepage)
console.debug(this.browsepage)
} catch (e) {
console.log(e)
this.getBrowsePage(attempt + 1)
@ -2714,7 +2708,7 @@ const app = new Vue({
if (status2 == 200) {
let token = jsonResponse["message"]["body"]["user_token"] ?? '';
if (token != "" && token != "UpgradeOnlyUpgradeOnlyUpgradeOnlyUpgradeOnly") {
console.log('200 token', mode);
console.debug('200 token', mode);
// token good
app.mxmtoken = token;
@ -2724,7 +2718,7 @@ const app = new Vue({
getMXMTrans(songid, lang, app.mxmtoken);
}
} else {
console.log('fake 200 token');
console.debug('fake 200 token');
getToken(mode, track, artist, songid, lang, time)
}
} else {
@ -2759,7 +2753,7 @@ const app = new Vue({
req.onload = function () {
try {
let jsonResponse = JSON.parse(this.responseText);
console.log(jsonResponse);
console.debug(jsonResponse);
let status1 = jsonResponse["message"]["header"]["status_code"];
if (status1 == 200) {
@ -3145,7 +3139,7 @@ const app = new Vue({
},
playMediaItemById(id, kind, isLibrary, raurl = "") {
let truekind = (!kind.endsWith("s")) ? (kind + "s") : kind;
console.log(id, truekind, isLibrary)
console.debug(id, truekind, isLibrary)
try {
if (truekind.includes("artist")) {
app.mk.setStationQueue({ artist: 'a-' + id }).then(() => {
@ -3770,7 +3764,7 @@ const app = new Vue({
volumeUp() {
if ((app.mk.volume + app.cfg.audio.volumeStep) > app.cfg.audio.maxVolume) {
app.mk.volume = app.cfg.audio.maxVolume;
console.log('setting max volume')
console.debug('setting max volume')
} else {
console.log('volume up')
app.mk.volume = ((app.mk.volume * 100) + (app.cfg.audio.volumeStep * 100)) / 100
@ -3779,7 +3773,7 @@ const app = new Vue({
volumeDown() {
if ((app.mk.volume - app.cfg.audio.volumeStep) < 0) {
app.mk.volume = 0;
console.log('setting volume to 0')
console.debug('setting volume to 0')
} else {
console.log('volume down')
app.mk.volume = ((app.mk.volume * 100) - (app.cfg.audio.volumeStep * 100)) / 100

View file

@ -40,7 +40,7 @@
this.itemPages = app.arrayToChunk(this.items, 4);
try{
this.simplifiedParent = JSON.stringify(this.items.map ( function(x){return x.attributes.playParams}));
console.log("simplifiedParent: " + this.simplifiedParent);
console.debug("simplifiedParent: " + this.simplifiedParent);
}
catch (e){}

View file

@ -54,7 +54,6 @@
}
},
mounted() {
console.log("MOUNTED")
if (this.event) {
this.position = [this.event.clientX, this.event.clientY];
}
@ -81,7 +80,6 @@
},
getStyle() {
let style = {}
console.debug(this.$refs.menubody)
this.size = [this.$refs.menubody.offsetWidth, this.$refs.menubody.offsetHeight];
if (this.event) {
style["position"] = "absolute";

View file

@ -1,6 +1,6 @@
<script type="text/x-template" id="cider-settings">
<div class="content-inner settings-page">
<b-tabs pills fill content-class="mt-3">
<b-tabs pills fill content-class="mt-3" v-model="tabIndex">
<b-tab :title="$root.getLz('settings.header.general')" active>
<div class="md-option-container">
<!-- General Settings -->
@ -1522,10 +1522,28 @@
data: function () {
return {
app: this.$root,
themes: ipcRenderer.sendSync("get-themes")
themes: ipcRenderer.sendSync("get-themes"),
tabIndex: 0,
canChangeHash: false
}
}, watch: {
tabIndex: function (val) {
if (this.canChangeHash) {
window.location.hash = `#settings/${val}`
}
}
},
mounted: function () {
this.$nextTick(function () {
if (window.location.hash.split("/").length > 1) {
this.tabIndex = parseInt(window.location.hash.split("/")[1])
console.debug("tabIndex", this.tabIndex)
this.canChangeHash = true
}else{
this.canChangeHash = true
}
})
if (app.cfg.lastfm.enabled) {
const element = document.getElementById('lfmConnect');
if (element) {