diff --git a/src/assets/js/plex/PlexTv.js b/src/assets/js/plex/PlexTv.js index 4c9e88d8..ef6d506f 100644 --- a/src/assets/js/plex/PlexTv.js +++ b/src/assets/js/plex/PlexTv.js @@ -271,26 +271,29 @@ module.exports = function () { let playables = [] let j = 0 - let validServers = 0 - for (let i in blockedServers){ - if (blockedServers[i].enabled){ - validServers++ - } - } + let validServers = this.servers.length if (blockedServers){ - this.servers.forEach((server) => { - if (!blockedServers[server.clientIdentifier]){ - validServers++ + for (let i = 0; i < blockedServers.length; i++ ){ + if (this.getServerById(blockedServers[i])){ + validServers-- } - }) + } } if (validServers == 0){ return callback(false) } for (let i = 0; i < this.servers.length; i++) { var server = this.servers[i] - if (blockedServers[server.clientIdentifier] && !blockedServers[server.clientIdentifier].enabled){ - console.log('Server: ' + server.name + ' is blocked - not searching') + let blocked = false + if (blockedServers){ + for (let i = 0; i < blockedServers.length; i++ ){ + if (blockedServers[i] == server.clientIdentifier){ + console.log('Server: ' + server.name + ' is blocked - not searching') + blocked = true + } + } + } + if (blocked){ continue } server.search(hostData.rawTitle, function (results, _server) { diff --git a/src/components/application/plexsettings.vue b/src/components/application/plexsettings.vue index 2f59d7ae..43417458 100644 --- a/src/components/application/plexsettings.vue +++ b/src/components/application/plexsettings.vue @@ -1,10 +1,22 @@ @@ -14,57 +26,15 @@ name: 'plexsettings', data () { return { + blockedServers: this.$store.getters.getSettingBLOCKEDSERVERS || [] } }, - mounted() { - this.$nextTick(function() { - console.log('hey') - this.checked = this.getlocalServersList() - }) - }, methods: { - updateServer(id,servername,value){ - let storedSettings = this.$store.getters.getSettingBLOCKEDSERVERS || {} - if (storedSettings[id]){ - // Server already exists in settings - storedSettings[id].enabled = value - } else { - storedSettings[id] = { - enabled: value, - name: servername, - id: id, - source: 'setting' - } - } - this.$store.commit('setSettingBLOCKEDSERVERS', storedSettings) - }, - getlocalServersList () { - let servers = [] - if (this.$store.getters.getSettingBLOCKEDSERVERS) { - for (let i in this.$store.getters.getSettingBLOCKEDSERVERS){ - servers.push(this.$store.getters.getSettingBLOCKEDSERVERS[i]) - } - } - console.log(this.$store.state.plex) - this.$store.state.plex.servers.forEach((server) => { - if (this.$store.getters.getSettingBLOCKEDSERVERS && this.$store.getters.getSettingBLOCKEDSERVERS[server.clientIdentifier]){ - return - } - servers.push({ - name: server.name, - id: server.clientIdentifier, - enabled: true, - source: 'api' - }) - }) - return servers - } }, + watch: { - plex: () => { - console.log('Change') - setTimeout(() => { - },25) + blockedServers: function() { + this.$store.commit('setSettingBLOCKEDSERVERS', this.blockedServers) } }, computed: { @@ -74,47 +44,34 @@ context: function () { return this.$store }, - logo: function () { - return 'static/plexlogo.png' - }, - checked: { - get () { - let servers = [] - if (this.$store.getters.getSettingBLOCKEDSERVERS) { - for (let i in this.$store.getters.getSettingBLOCKEDSERVERS){ - servers.push(this.$store.getters.getSettingBLOCKEDSERVERS[i]) - } - } - this.$store.state.plex.servers.forEach((server) => { - if (this.$store.getters.getSettingBLOCKEDSERVERS && this.$store.getters.getSettingBLOCKEDSERVERS[server.clientIdentifier]){ - return - } + localServersList: function() { + let servers = [] + if (!this.plex || !this.plex.servers){ + return servers + } + this.plex.servers.forEach((server) => { + if (this.$store.getters.getSettingBLOCKEDSERVERS && this.$store.getters.getSettingBLOCKEDSERVERS[server.clientIdentifier]){ servers.push({ name: server.name, id: server.clientIdentifier, - enabled: true, - source: 'api' }) - }) - return servers - }, - set (newsettings) { - console.log(newsettings) - let storedSettings = this.$store.getters.getSettingBLOCKEDSERVERS || {} - if (storedSettings[id]){ - // Server already exists in settings - storedSettings[id].enabled = value - } else { - storedSettings[id] = { - enabled: value, - name: servername, - id: id, - source: 'setting' - } + return } - //this.$store.commit('setSettingBLOCKEDSERVERS', storedSettings) - } + servers.push({ + name: server.name, + id: server.clientIdentifier, + }) + }) + return servers + + + }, + logo: function () { + return 'static/plexlogo.png' }, }, + mounted: function () { + // Create event listeners + } } - + \ No newline at end of file diff --git a/src/components/application/ptplayer.vue b/src/components/application/ptplayer.vue index d5461e57..47e0c6eb 100644 --- a/src/components/application/ptplayer.vue +++ b/src/components/application/ptplayer.vue @@ -14,55 +14,72 @@ :initialOffset="offset" :createdAt="playerCreatedAt" > - -

Playback Settings

-
- - -
-
- - -
-
- - -
-
- - -
-
-
- Stop playback - -
-
+ + + + Playback Settings + + + + + + + + + + + + Close + + -
-
- Stop playback - -
-
+ + + Playback Settings + + + Stop playback + + @@ -196,7 +213,8 @@ transcodeSessionMetadata: {}, // Browser - browser: this.getBrowser() + browser: this.getBrowser(), + dialog: false } }, watch: { diff --git a/src/store.js b/src/store.js index ad0d4cfb..20bfdf10 100644 --- a/src/store.js +++ b/src/store.js @@ -633,12 +633,15 @@ const plexTogether = { state.decisionBlocked = true let blockedServers = rootState.BLOCKEDSERVERS - let validServers = 0 - for (let i in blockedServers){ - if (blockedServers[i].enabled){ - validServers++ + let validServers = rootState.plex.servers.length + if (blockedServers){ + for (let i = 0; i < blockedServers.length; i++ ){ + if (rootState.plex.getServerById(blockedServers[i])){ + validServers-- + } } } + sendNotification('Searching ' + validServers + ' Plex Servers for "' + hostTimeline.rawTitle + '"') rootState.plex.playContentAutomatically(rootState.chosenClient, hostTimeline, blockedServers, function (result) { console.log('Auto play result: ' + result)