diff --git a/.eslintrc.js b/.eslintrc.js index e33a8a1f..763c3e7e 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -16,7 +16,7 @@ module.exports = { code: 100, // ignoreComments: true, // ignoreUrls: true, - ignoreStrings: true, + // ignoreStrings: true, ignoreTemplateLiterals: true, }, ], diff --git a/src/components/plex/plexthumb.vue b/src/components/plex/plexthumb.vue index 63420ce2..057badb6 100644 --- a/src/components/plex/plexthumb.vue +++ b/src/components/plex/plexthumb.vue @@ -320,7 +320,7 @@ export default { easing: 'cubic-bezier(.03,.98,.52,.99)', // Easing on enter/exit. glare: false, // if it should have a "glare" effect 'max-glare': 0.15, // the maximum "glare" opacity (1 = 100%, 0.5 = 50%) - 'glare-prerender': false, // false = VanillaTilt creates the glare elements for you, otherwise + 'glare-prerender': false, // false = VanillaTilt creates the glare elements for you }); } }, diff --git a/src/main.js b/src/main.js index cef1aa3a..65f53942 100644 --- a/src/main.js +++ b/src/main.js @@ -29,9 +29,11 @@ router.beforeEach(async (to, from, next) => { } else { next({ name: 'Signin' }); } - } else if (to.matched.some((record) => record.meta.requiresNoAuth) && store.getters['plex/IS_AUTHENTICATED']) { + } else if (to.matched.some((record) => record.meta.requiresNoAuth) + && store.getters['plex/IS_AUTHENTICATED']) { next({ name: 'CreateRoom' }); - } else if (!store.getters['synclounge/IS_IN_ROOM'] && to.matched.some((record) => record.meta.protected)) { + } else if (!store.getters['synclounge/IS_IN_ROOM'] + && to.matched.some((record) => record.meta.protected)) { // this route requires us to be in a room with a client selected // if not, redirect to the needed stage next({ name: 'CreateRoom' }); diff --git a/src/mixins/redirection.js b/src/mixins/redirection.js index 57741880..9207cfc7 100644 --- a/src/mixins/redirection.js +++ b/src/mixins/redirection.js @@ -4,7 +4,8 @@ export default { this.$router.push({ name: 'nowplaying', params: { - machineIdentifier: this.$store.getters['plexclients/GET_ACTIVE_MEDIA_METADATA'].machineIdentifier, + machineIdentifier: this.$store.getters['plexclients/GET_ACTIVE_MEDIA_METADATA'] + .machineIdentifier, ratingKey: this.$store.getters['plexclients/GET_ACTIVE_MEDIA_METADATA'].ratingKey, }, }); diff --git a/src/router/index.js b/src/router/index.js index 5081b82c..4663f932 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -150,7 +150,7 @@ export default new Router({ { path: - '/browse/:machineIdentifier/:sectionId/tv/:grandparentRatingKey/:parentRatingKey/:ratingKey', + '/browse/:machineIdentifier/:sectionId/tv/:grandparentRatingKey/:parentRatingKey/:ratingKey', meta: { requiresAuth: true, protected: true, diff --git a/src/store/modules/plex/actions.js b/src/store/modules/plex/actions.js index e7fdf887..deab18f9 100644 --- a/src/store/modules/plex/actions.js +++ b/src/store/modules/plex/actions.js @@ -126,7 +126,8 @@ export default { const nonRelayConnections = connections.filter((connection) => !connection.relay); // Prefer secure connections first. - const secureConnections = nonRelayConnections.filter((connection) => connection.protocol === 'https'); + const secureConnections = nonRelayConnections.filter((connection) => connection.protocol + === 'https'); try { return dispatch('FIND_WORKING_CONNECTION', { connections: secureConnections, accessToken }); @@ -136,7 +137,8 @@ export default { // If we are using synclounge over https, we can't access connections over http because // most modern web browsers block mixed content - const insecureConnections = nonRelayConnections.filter((connection) => connection.protocol === 'http'); + const insecureConnections = nonRelayConnections.filter((connection) => connection.protocol + === 'http'); try { return dispatch('FIND_WORKING_CONNECTION', { connections: insecureConnections, accessToken }); } catch (e) { diff --git a/src/store/modules/plexclients/actions.js b/src/store/modules/plexclients/actions.js index bb1655a6..19750126 100644 --- a/src/store/modules/plexclients/actions.js +++ b/src/store/modules/plexclients/actions.js @@ -183,7 +183,8 @@ export default { // Store latency to use to adjust time when seeking commit('SET_LATENCY', latency); - const videoTimeline = data.MediaContainer[0].Timeline.find((timeline) => timeline.type === 'video'); + const videoTimeline = data.MediaContainer[0].Timeline.find((timeline) => timeline.type + === 'video'); // Clients seem to respond with strings instead of numbers so need to parse const time = parseInt(videoTimeline.time, 10); @@ -221,7 +222,9 @@ export default { await dispatch('UPDATE_STATE_FROM_ACTIVE_PLAY_QUEUE_SELECTED_ITEM'); - const serverName = rootGetters['plexservers/GET_PLEX_SERVER'](getters.GET_ACTIVE_SERVER_ID).name; + const serverName = rootGetters['plexservers/GET_PLEX_SERVER']( + getters.GET_ACTIVE_SERVER_ID, + ).name; await dispatch('DISPLAY_NOTIFICATION', `Now Playing: ${contentTitleUtils.getCombinedTitle(getters.GET_ACTIVE_MEDIA_METADATA)} from ${serverName}`, { root: true }); @@ -331,7 +334,8 @@ export default { && playerPollData.state === 'paused'; console.debug('SYNC difference', difference); - if (difference > rootGetters['settings/GET_SYNCFLEXIBILITY'] || (bothPaused && difference > 10)) { + if (difference > rootGetters['settings/GET_SYNCFLEXIBILITY'] + || (bothPaused && difference > 10)) { // We need to seek! // Decide what seeking method we want to use @@ -417,7 +421,8 @@ export default { console.debug('SEEK_TO', offset); switch (getters.GET_CHOSEN_CLIENT_ID) { case 'PTPLAYER9PLUS10': { - return dispatch('slplayer/SPEED_OR_NORMAL_SEEK', { cancelSignal, seekToMs: offset }, { root: true }); + return dispatch('slplayer/SPEED_OR_NORMAL_SEEK', { cancelSignal, seekToMs: offset }, + { root: true }); } default: { @@ -491,7 +496,8 @@ export default { }, UPDATE_STATE_FROM_ACTIVE_PLAY_QUEUE_SELECTED_ITEM: async ({ getters, dispatch, commit }) => { - const metadata = await dispatch('FETCH_METADATA_OF_PLAY_QUEUE_ITEM', getters.GET_ACTIVE_PLAY_QUEUE_SELECTED_ITEM); + const metadata = await dispatch('FETCH_METADATA_OF_PLAY_QUEUE_ITEM', + getters.GET_ACTIVE_PLAY_QUEUE_SELECTED_ITEM); if (!getters.GET_ACTIVE_MEDIA_METADATA || metadata.ratingKey !== getters.GET_ACTIVE_MEDIA_METADATA.ratingKey || getters.GET_ACTIVE_SERVER_ID !== metadata.machineIdentifier) { diff --git a/src/store/modules/plexclients/getters.js b/src/store/modules/plexclients/getters.js index 2aee7d65..bd52c088 100644 --- a/src/store/modules/plexclients/getters.js +++ b/src/store/modules/plexclients/getters.js @@ -46,7 +46,8 @@ export default { GET_PREVIOUS_SYNC_TIMELINE_COMMAND_ID: (state) => state.previousSyncTimelineCommandId, // TODO: come back and reallly examine this logic - ALREADY_SYNCED_ON_CURRENT_TIMELINE: (state, getters) => getters.GET_CHOSEN_CLIENT_ID !== 'PTPLAYER9PLUS10' + ALREADY_SYNCED_ON_CURRENT_TIMELINE: (state, getters) => getters.GET_CHOSEN_CLIENT_ID + !== 'PTPLAYER9PLUS10' && ((getters.GET_PLEX_CLIENT_TIMELINE_COMMAND_ID === null && getters.GET_PREVIOUS_SYNC_TIMELINE_COMMAND_ID !== null) && getters.GET_PLEX_CLIENT_TIMELINE_COMMAND_ID diff --git a/src/store/modules/plexservers/actions.js b/src/store/modules/plexservers/actions.js index e743ca6e..102684ba 100644 --- a/src/store/modules/plexservers/actions.js +++ b/src/store/modules/plexservers/actions.js @@ -11,7 +11,9 @@ export default { const libraryKey = sample(libraryKeys); - const librarySize = await dispatch('FETCH_LIBRARY_SIZE', { machineIdentifier, sectionId: libraryKey }); + const librarySize = await dispatch('FETCH_LIBRARY_SIZE', { + machineIdentifier, sectionId: libraryKey, + }); const randomItemIndex = randomInt(librarySize - 1); const contents = await dispatch('FETCH_LIBRARY_CONTENTS', { @@ -119,10 +121,12 @@ export default { }, SEARCH_UNBLOCKED_PLEX_SERVERS: ({ getters, dispatch }, query) => Promise.allSettled( - getters.GET_UNBLOCKED_PLEX_SERVER_IDS.map((machineIdentifier) => dispatch('SEARCH_PLEX_SERVER', { - machineIdentifier, - query, - })), + getters.GET_UNBLOCKED_PLEX_SERVER_IDS.map((machineIdentifier) => dispatch( + 'SEARCH_PLEX_SERVER', { + machineIdentifier, + query, + }, + )), ).then((results) => results.filter((result) => result.status === 'fulfilled') .flatMap((result) => result.value)), @@ -350,15 +354,17 @@ export default { return data.MediaContainer; }, - MARK_WATCHED: ({ dispatch }, { machineIdentifier, ratingKey, signal }) => dispatch('FETCH_PLEX_SERVER', { - machineIdentifier, - path: '/:/scrobble', - params: { - identifier: 'com.plexapp.plugins.library', - key: ratingKey, + MARK_WATCHED: ({ dispatch }, { machineIdentifier, ratingKey, signal }) => dispatch( + 'FETCH_PLEX_SERVER', { + machineIdentifier, + path: '/:/scrobble', + params: { + identifier: 'com.plexapp.plugins.library', + key: ratingKey, + }, + signal, }, - signal, - }), + ), UPDATE_STREAM: ({ dispatch }, { machineIdentifier, id, offset, signal, diff --git a/src/store/modules/slplayer/actions.js b/src/store/modules/slplayer/actions.js index 990a011c..389a9ffe 100644 --- a/src/store/modules/slplayer/actions.js +++ b/src/store/modules/slplayer/actions.js @@ -451,10 +451,12 @@ export default { continuing: 1, }); - await dispatch('plexclients/UPDATE_STATE_FROM_ACTIVE_PLAY_QUEUE_SELECTED_ITEM', null, { root: true }); + await dispatch('plexclients/UPDATE_STATE_FROM_ACTIVE_PLAY_QUEUE_SELECTED_ITEM', null, + { root: true }); // TODO: maybe plex indicates ongoing media index? commit('SET_MEDIA_INDEX', 0); - commit('SET_OFFSET_MS', rootGetters['plexclients/GET_ACTIVE_PLAY_QUEUE_SELECTED_ITEM'].viewOffset || 0); + commit('SET_OFFSET_MS', + rootGetters['plexclients/GET_ACTIVE_PLAY_QUEUE_SELECTED_ITEM'].viewOffset || 0); commit('SET_MASK_PLAYER_STATE', true); await dispatch('synclounge/PROCESS_MEDIA_UPDATE', null, { root: true }); @@ -468,7 +470,8 @@ export default { SKIP_INTRO: ({ commit, rootGetters }) => { console.debug('SKIP_INTRO'); - const introEnd = rootGetters['plexclients/GET_ACTIVE_MEDIA_METADATA_INTRO_MARKER'].endTimeOffset; + const introEnd = rootGetters['plexclients/GET_ACTIVE_MEDIA_METADATA_INTRO_MARKER'] + .endTimeOffset; commit('SET_OFFSET_MS', introEnd); setCurrentTimeMs(introEnd); diff --git a/src/store/modules/slplayer/getters.js b/src/store/modules/slplayer/getters.js index bd3fef7b..ba061d55 100644 --- a/src/store/modules/slplayer/getters.js +++ b/src/store/modules/slplayer/getters.js @@ -8,10 +8,13 @@ const buggyChromeBitrate = 23000; export default { GET_PLEX_DECISION: (state) => state.plexDecision, - IS_IN_BUGGY_CHROME_STATE: (state, getters, rootState, rootGetters) => (rootGetters.GET_BROWSER.name === 'chrome' + IS_IN_BUGGY_CHROME_STATE: (state, getters, rootState, rootGetters) => ( + rootGetters.GET_BROWSER.name === 'chrome' || rootGetters.GET_BROWSER.name === 'edge-chromium') - && (rootGetters['settings/GET_SLPLAYERQUALITY'] == null || rootGetters['settings/GET_SLPLAYERQUALITY'] > buggyChromeBitrate) - && rootGetters['plexclients/GET_ACTIVE_MEDIA_METADATA']?.Media?.[getters.GET_MEDIA_INDEX]?.bitrate > buggyChromeBitrate, + && (rootGetters['settings/GET_SLPLAYERQUALITY'] == null + || rootGetters['settings/GET_SLPLAYERQUALITY'] > buggyChromeBitrate) + && rootGetters['plexclients/GET_ACTIVE_MEDIA_METADATA'] + ?.Media?.[getters.GET_MEDIA_INDEX]?.bitrate > buggyChromeBitrate, // TODO: Remove this hack when this issue is fixed // https://forums.plex.tv/t/plex-skipping-forward-by-a-few-seconds-on-web-player/402112 @@ -19,7 +22,8 @@ export default { ? 'hls' : state.streamingProtocol), - GET_PLEX_SERVER: (state, getters, rootState, rootGetters) => rootGetters['plexservers/GET_PLEX_SERVER'](rootGetters['plexclients/GET_ACTIVE_SERVER_ID']), + GET_PLEX_SERVER: (state, getters, rootState, rootGetters) => rootGetters[ + 'plexservers/GET_PLEX_SERVER'](rootGetters['plexclients/GET_ACTIVE_SERVER_ID']), GET_PLEX_SERVER_ACCESS_TOKEN: (state, getters) => (getters.GET_PLEX_SERVER ? getters.GET_PLEX_SERVER.accessToken @@ -37,9 +41,11 @@ export default { : 'wan' : undefined), - GET_PART_ID: (state, getters, rootState, rootGetters) => (rootGetters['plexclients/GET_ACTIVE_MEDIA_METADATA'] - ? rootGetters['plexclients/GET_ACTIVE_MEDIA_METADATA'].Media[getters.GET_MEDIA_INDEX].Part[0].id - : null), + GET_PART_ID: (state, getters, rootState, rootGetters) => ( + rootGetters['plexclients/GET_ACTIVE_MEDIA_METADATA'] + ? rootGetters['plexclients/GET_ACTIVE_MEDIA_METADATA'] + .Media[getters.GET_MEDIA_INDEX].Part[0].id + : null), GET_SRC_URL: (state, getters) => makeUrl( `${getters.GET_PLEX_SERVER_URL}/video/:/transcode/universal/start.${protocolExtension[getters.GET_STREAMING_PROTOCOL]}`, @@ -54,9 +60,11 @@ export default { GET_TIMELINE_URL: (state, getters) => `${getters.GET_PLEX_SERVER_URL}/:/timeline`, - GET_STREAMS: (state, getters, rootState, rootGetters) => (rootGetters['plexclients/GET_ACTIVE_MEDIA_METADATA'] - ? rootGetters['plexclients/GET_ACTIVE_MEDIA_METADATA'].Media[getters.GET_MEDIA_INDEX].Part[0].Stream - : []), + GET_STREAMS: (state, getters, rootState, rootGetters) => ( + rootGetters['plexclients/GET_ACTIVE_MEDIA_METADATA'] + ? rootGetters['plexclients/GET_ACTIVE_MEDIA_METADATA'] + .Media[getters.GET_MEDIA_INDEX].Part[0].Stream + : []), GET_DECISION_STREAMS: (state, getters) => (getters.GET_PLEX_DECISION ? getters.GET_PLEX_DECISION.MediaContainer.Metadata[0].Media[0].Part[0].Stream @@ -75,13 +83,14 @@ export default { id, displayTitle, }) => ({ id, text: displayTitle })), - GET_MEDIA_LIST: (state, getters, rootState, rootGetters) => (rootGetters['plexclients/GET_ACTIVE_MEDIA_METADATA'] - ? rootGetters['plexclients/GET_ACTIVE_MEDIA_METADATA'].Media.map( - ({ videoResolution, bitrate }, index) => ({ - index, - text: `${Math.round(bitrate / 100) / 10} Mbps, ${videoResolution}p`, - }), - ) : []), + GET_MEDIA_LIST: (state, getters, rootState, rootGetters) => ( + rootGetters['plexclients/GET_ACTIVE_MEDIA_METADATA'] + ? rootGetters['plexclients/GET_ACTIVE_MEDIA_METADATA'].Media.map( + ({ videoResolution, bitrate }, index) => ({ + index, + text: `${Math.round(bitrate / 100) / 10} Mbps, ${videoResolution}p`, + }), + ) : []), GET_QUALITIES: () => qualities, @@ -101,9 +110,11 @@ export default { // TODO: fix this 0 fallback GET_MEDIA_INDEX: (state) => state.mediaIndex, - GET_RELATIVE_THUMB_URL: (state, getters, rootState, rootGetters) => (rootGetters['plexclients/GET_ACTIVE_MEDIA_METADATA'] - ? rootGetters['plexclients/GET_ACTIVE_MEDIA_METADATA'].grandparentThumb || rootGetters['plexclients/GET_ACTIVE_MEDIA_METADATA'].thumb - : null), + GET_RELATIVE_THUMB_URL: (state, getters, rootState, rootGetters) => ( + rootGetters['plexclients/GET_ACTIVE_MEDIA_METADATA'] + ? rootGetters['plexclients/GET_ACTIVE_MEDIA_METADATA'].grandparentThumb + || rootGetters['plexclients/GET_ACTIVE_MEDIA_METADATA'].thumb + : null), GET_THUMB_URL: (state, getters, rootState, rootGetters) => (getters.GET_PLEX_SERVER ? rootGetters['plexservers/GET_MEDIA_IMAGE_URL']({ @@ -118,17 +129,18 @@ export default { GET_PLAYER_STATE: (state) => state.playerState, - GET_TITLE: (state, getters, rootState, rootGetters) => (rootGetters['plexclients/GET_ACTIVE_MEDIA_METADATA'] - ? contenttitleutils.getTitle(rootGetters['plexclients/GET_ACTIVE_MEDIA_METADATA']) - : null), + GET_TITLE: (state, getters, rootState, rootGetters) => ( + rootGetters['plexclients/GET_ACTIVE_MEDIA_METADATA'] + ? contenttitleutils.getTitle(rootGetters['plexclients/GET_ACTIVE_MEDIA_METADATA']) + : null), - GET_SECONDARY_TITLE: (state, getters, rootState, rootGetters) => (rootGetters['plexclients/GET_ACTIVE_MEDIA_METADATA'] - ? contenttitleutils.getSecondaryTitle(rootGetters['plexclients/GET_ACTIVE_MEDIA_METADATA']) - : null), + GET_SECONDARY_TITLE: (state, getters, rootState, rootGetters) => ( + rootGetters['plexclients/GET_ACTIVE_MEDIA_METADATA'] + ? contenttitleutils.getSecondaryTitle(rootGetters['plexclients/GET_ACTIVE_MEDIA_METADATA']) + : null), - GET_PART_PARAMS: (state, getters, rootState, rootGetters) => rootGetters['plex/GET_PLEX_BASE_PARAMS']( - getters.GET_PLEX_SERVER_ACCESS_TOKEN, - ), + GET_PART_PARAMS: (state, getters, rootState, rootGetters) => rootGetters[ + 'plex/GET_PLEX_BASE_PARAMS'](getters.GET_PLEX_SERVER_ACCESS_TOKEN), GET_PLEX_PROFILE_EXTRAS: (state, getters, rootState, rootGetters) => { const base = `append-transcode-target-codec(type=videoProfile&context=streaming&audioCodec=aac&protocol=${getters.GET_STREAMING_PROTOCOL})`; @@ -150,7 +162,10 @@ export default { subtitleSize: 100, audioBoost: 100, location: getters.GET_PLEX_SERVER_LOCATION, - ...rootGetters['settings/GET_SLPLAYERQUALITY'] && { maxVideoBitrate: rootGetters['settings/GET_SLPLAYERQUALITY'] }, // only include if not null + // only include if not null + ...rootGetters['settings/GET_SLPLAYERQUALITY'] && { + maxVideoBitrate: rootGetters['settings/GET_SLPLAYERQUALITY'], + }, addDebugOverlay: 0, // TODO: figure out how to make autoAdjustQuality work diff --git a/src/store/modules/synclounge/actions.js b/src/store/modules/synclounge/actions.js index 79ee43fd..69d43bb5 100644 --- a/src/store/modules/synclounge/actions.js +++ b/src/store/modules/synclounge/actions.js @@ -52,7 +52,8 @@ export default { }, JOIN_ROOM: async ({ getters, rootGetters, dispatch }) => { - const joinPlayerData = await dispatch('plexclients/FETCH_JOIN_PLAYER_DATA', null, { root: true }); + const joinPlayerData = await dispatch('plexclients/FETCH_JOIN_PLAYER_DATA', null, + { root: true }); emit({ eventName: 'join', @@ -191,15 +192,18 @@ export default { .map(async ({ url }) => [ url, { - ...await fetchJson(combineRelativeUrlParts(url, 'health'), null, { signal: controller.signal }), + ...await fetchJson(combineRelativeUrlParts(url, 'health'), null, + { signal: controller.signal }), latency: Date.now() - start, }, ])); clearTimeout(timeout); - const aliveServerHealths = Object.fromEntries(results.filter((result) => result.status === 'fulfilled') - .map(({ value }) => value)); + const aliveServerHealths = Object.fromEntries( + results.filter((result) => result.status === 'fulfilled') + .map(({ value }) => value), + ); commit('SET_SERVERS_HEALTH', aliveServerHealths); }, @@ -241,8 +245,14 @@ export default { registerListener({ eventName: 'slPing', action: 'HANDLE_SLPING' }); registerListener({ eventName: 'playerStateUpdate', action: 'HANDLE_PLAYER_STATE_UPDATE' }); registerListener({ eventName: 'mediaUpdate', action: 'HANDLE_MEDIA_UPDATE' }); - registerListener({ eventName: 'syncFlexibilityUpdate', action: 'HANDLE_SYNC_FLEXIBILITY_UPDATE' }); - registerListener({ eventName: 'setPartyPausingEnabled', action: 'HANDLE_SET_PARTY_PAUSING_ENABLED' }); + registerListener({ + eventName: 'syncFlexibilityUpdate', + action: 'HANDLE_SYNC_FLEXIBILITY_UPDATE', + }); + registerListener({ + eventName: 'setPartyPausingEnabled', + action: 'HANDLE_SET_PARTY_PAUSING_ENABLED', + }); registerListener({ eventName: 'partyPause', action: 'HANDLE_PARTY_PAUSE' }); registerListener({ eventName: 'disconnect', action: 'HANDLE_DISCONNECT' }); registerListener({ eventName: 'connect', action: 'HANDLE_RECONNECT' }); @@ -294,7 +304,8 @@ export default { await dispatch('CANCEL_UPNEXT'); // Check if we need to activate the upnext feature - if (getters.AM_I_HOST && playerState.state !== 'stopped' && !rootGetters.GET_UP_NEXT_POST_PLAY_DATA) { + if (getters.AM_I_HOST && playerState.state !== 'stopped' + && !rootGetters.GET_UP_NEXT_POST_PLAY_DATA) { // If in region and not already scheduled if (await dispatch('CALC_IS_IN_UPNEXT_REGION', playerState)) { if (!getters.GET_UP_NEXT_TRIGGERED) { @@ -313,7 +324,8 @@ export default { PROCESS_PLAYER_STATE_UPDATE: async ({ getters, dispatch, commit }, noSync) => { // TODO: only send message if in room, check in room - const playerState = await dispatch('plexclients/FETCH_TIMELINE_POLL_DATA_CACHE', null, { root: true }); + const playerState = await dispatch('plexclients/FETCH_TIMELINE_POLL_DATA_CACHE', null, + { root: true }); commit('SET_USER_PLAYER_STATE', { ...playerState, @@ -336,7 +348,8 @@ export default { dispatch, getters, commit, rootGetters, }) => { // TODO: only send message if in room, check in room - const playerState = await dispatch('plexclients/FETCH_TIMELINE_POLL_DATA_CACHE', null, { root: true }); + const playerState = await dispatch('plexclients/FETCH_TIMELINE_POLL_DATA_CACHE', null, + { root: true }); if (playerState.state !== 'stopped') { if (rootGetters.GET_UP_NEXT_POST_PLAY_DATA) { @@ -479,7 +492,8 @@ export default { _SYNC_MEDIA_AND_PLAYER_STATE: async ({ getters, dispatch, rootGetters }, cancelSignal) => { console.debug('_SYNC_MEDIA_AND_PLAYER_STATE'); // TODO: potentailly don't do anythign if we have no timeline data yet - const timeline = await dispatch('plexclients/FETCH_TIMELINE_POLL_DATA_CACHE', null, { root: true }); + const timeline = await dispatch('plexclients/FETCH_TIMELINE_POLL_DATA_CACHE', null, + { root: true }); if (rootGetters['plexclients/ALREADY_SYNCED_ON_CURRENT_TIMELINE']) { // TODO: examine if I should throw error or handle it another way @@ -499,7 +513,8 @@ export default { // Logic for deciding whether we should play somethign different if (rootGetters['settings/GET_AUTOPLAY']) { - const bestMatch = await dispatch('plexservers/FIND_BEST_MEDIA_MATCH', getters.GET_HOST_USER.media, { root: true }); + const bestMatch = await dispatch('plexservers/FIND_BEST_MEDIA_MATCH', + getters.GET_HOST_USER.media, { root: true }); if (bestMatch) { if (!rootGetters['plexclients/IS_THIS_MEDIA_PLAYING'](bestMatch)) { // If we aren't playing the best match, play it @@ -540,7 +555,8 @@ export default { // Private version without lock. Please use the locking version unless you know what you are doing _SYNC_PLAYER_STATE: async ({ getters, dispatch }, cancelSignal) => { console.debug('_SYNC_PLAYER_STATE'); - const timeline = await dispatch('plexclients/FETCH_TIMELINE_POLL_DATA_CACHE', null, { root: true }); + const timeline = await dispatch('plexclients/FETCH_TIMELINE_POLL_DATA_CACHE', null, + { root: true }); // TODO: examine if we want this or not if (timeline.state === 'buffering') { diff --git a/src/store/modules/synclounge/eventhandlers.js b/src/store/modules/synclounge/eventhandlers.js index cdf090ef..6027d218 100644 --- a/src/store/modules/synclounge/eventhandlers.js +++ b/src/store/modules/synclounge/eventhandlers.js @@ -51,7 +51,8 @@ export default { HANDLE_DISCONNECT: async ({ dispatch }) => { console.log('disconnect'); - await dispatch('DISPLAY_NOTIFICATION', 'Disconnected from the SyncLounge server', { root: true }); + await dispatch('DISPLAY_NOTIFICATION', + 'Disconnected from the SyncLounge server', { root: true }); }, HANDLE_RECONNECT: async ({ dispatch, commit }) => { diff --git a/src/store/modules/synclounge/getters.js b/src/store/modules/synclounge/getters.js index b8473609..f4ff819e 100644 --- a/src/store/modules/synclounge/getters.js +++ b/src/store/modules/synclounge/getters.js @@ -50,9 +50,10 @@ export default { .reduce((prev, curr) => (curr[1] < prev[1] ? curr : prev))[0] : null), - GET_DISPLAY_USERNAME: (state, getters, rootState, rootGetters) => (rootGetters['settings/GET_HIDEUSERNAME'] - ? rootGetters['settings/GET_ALTUSERNAME'] - : rootGetters['plex/GET_PLEX_USER'].username || rootGetters['plex/GET_PLEX_USER'].title), + GET_DISPLAY_USERNAME: (state, getters, rootState, rootGetters) => ( + rootGetters['settings/GET_HIDEUSERNAME'] + ? rootGetters['settings/GET_ALTUSERNAME'] + : rootGetters['plex/GET_PLEX_USER'].username || rootGetters['plex/GET_PLEX_USER'].title), GET_SERVER: (state) => state.server, diff --git a/src/utils/combineurl.js b/src/utils/combineurl.js index 52013bcc..a96a78a6 100644 --- a/src/utils/combineurl.js +++ b/src/utils/combineurl.js @@ -7,6 +7,7 @@ export const combineUrl = (url, base) => { return new URL(url, fixedBase); }; -export const combineRelativeUrlParts = (base, path) => (!base || base.charAt(base.length - 1) === '/' +export const combineRelativeUrlParts = (base, path) => (!base + || base.charAt(base.length - 1) === '/' ? `${base}${path}` : `${base}/${path}`);