changed some console.logs

This commit is contained in:
booploops 2022-04-29 17:31:17 -07:00
parent 73cb9c497a
commit 818df11f68
3 changed files with 49 additions and 45 deletions

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) {
@ -1752,12 +1758,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 +1795,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 +1819,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 +1852,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 +1882,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 +2137,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 +2189,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 +2205,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 +2256,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 +2270,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 +2280,7 @@ const app = new Vue({
})
})
} else {
console.log("Download next", downloaded.next)
console.debug("Download next", downloaded.next)
}
}
}
@ -2291,7 +2297,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 +2305,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 +2363,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 +2491,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 +2519,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 +2720,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 +2730,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 +2765,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 +3151,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 +3776,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 +3785,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