diff --git a/LogWatcher.cs b/LogWatcher.cs index 55db4f15..a46547a9 100644 --- a/LogWatcher.cs +++ b/LogWatcher.cs @@ -193,6 +193,7 @@ namespace VRCX ParseLogLocation(fileInfo, logContext, line, offset) == true || ParseLogPortalSpawn(fileInfo, logContext, line, offset) == true || ParseLogJoinBlocked(fileInfo, logContext, line, offset) == true || + ParseLogVideoPlay(fileInfo, logContext, line, offset) == true || ParseLogVideoError(fileInfo, logContext, line, offset) == true) { continue; @@ -449,6 +450,34 @@ namespace VRCX return true; } + private bool ParseLogVideoPlay(FileInfo fileInfo, LogContext logContext, string line, int offset) + { + // 2021.04.20 13:37:69 Log - [Video Playback] Attempting to resolve URL 'https://www.youtube.com/watch?v=dQw4w9WgXcQ' + + if (string.Compare(line, offset, "Attempting to resolve URL '", 0, 27, StringComparison.Ordinal) != 0) + { + return false; + } + + var pos = line.LastIndexOf("'"); + if (pos < 0) + { + return false; + } + var data = line.Substring(78); + data = data.Remove(data.Length - 1); + + AppendLog(new[] + { + fileInfo.Name, + ConvertLogTimeToISO8601(line), + "video-play", + data + }); + + return true; + } + private bool ParseLogNotification(FileInfo fileInfo, LogContext logContext, string line, int offset) { // 2021.01.03 05:48:58 Log - Received Notification: < Notification from username:pypy, sender user id:usr_4f76a584-9d4b-46f6-8209-8305eb683661 to of type: friendRequest, id: not_3a8f66eb-613c-4351-bee3-9980e6b5652c, created at: 01/14/2021 15:38:40 UTC, details: {{}}, type:friendRequest, m seen:False, message: ""> received at 01/02/2021 16:48:58 UTC diff --git a/html/src/app.js b/html/src/app.js index 38d03a74..bdfcffb4 100644 --- a/html/src/app.js +++ b/html/src/app.js @@ -4371,6 +4371,9 @@ speechSynthesis.getVoices(); case 'Event': this.speak(noty.data); break; + case 'VideoPlay': + this.speak(`Now playing: ${noty.data}`); + break; default: break; } @@ -4448,6 +4451,9 @@ speechSynthesis.getVoices(); case 'Event': AppApi.XSNotification('VRCX', noty.data, timeout, image); break; + case 'VideoPlay': + AppApi.XSNotification('VRCX', `Now playing: ${noty.data}`, timeout, image); + break; default: break; } @@ -4522,7 +4528,10 @@ speechSynthesis.getVoices(); AppApi.DesktopNotification(noty.data, `has spawned a portal`, image); break; case 'Event': - AppApi.DesktopNotification('Event', noty.data, ''); + AppApi.DesktopNotification('Event', noty.data, image); + break; + case 'VideoPlay': + AppApi.DesktopNotification('Now playing', noty.data, image); break; default: break; @@ -5783,7 +5792,6 @@ speechSynthesis.getVoices(); }; break; - case 'event': tableData = { created_at: gameLog.dt, @@ -5792,6 +5800,14 @@ speechSynthesis.getVoices(); }; break; + case 'video-play': + tableData = { + created_at: gameLog.dt, + type: 'VideoPlay', + data: gameLog.videoURL + }; + break; + default: break; } @@ -6957,6 +6973,7 @@ speechSynthesis.getVoices(); sharedFeedFilters.noty.unmute = 'On'; sharedFeedFilters.noty.PortalSpawn = 'Everyone'; sharedFeedFilters.noty.Event = 'On'; + sharedFeedFilters.noty.VideoPlay = 'Off'; sharedFeedFilters.wrist.Location = 'On'; sharedFeedFilters.wrist.OnPlayerJoined = 'Everyone'; sharedFeedFilters.wrist.OnPlayerLeft = 'Everyone'; @@ -6981,6 +6998,7 @@ speechSynthesis.getVoices(); sharedFeedFilters.wrist.unmute = 'On'; sharedFeedFilters.wrist.PortalSpawn = 'Everyone'; sharedFeedFilters.wrist.Event = 'On'; + sharedFeedFilters.wrist.VideoPlay = 'On'; configRepository.setString('sharedFeedFilters', JSON.stringify(sharedFeedFilters)); } diff --git a/html/src/index.pug b/html/src/index.pug index 97f0572c..2037a600 100644 --- a/html/src/index.pug +++ b/html/src/index.pug @@ -167,7 +167,7 @@ html template(#tool) div(style="margin:0 0 10px;display:flex;align-items:center") el-select(v-model="gameLogTable.filters[0].value" multiple clearable collapse-tags style="flex:1" placeholder="Filter") - el-option(v-once v-for="type in ['Location', 'OnPlayerJoined', 'OnPlayerLeft', 'Notification', 'PortalSpawn', 'Event']" :key="type" :label="type" :value="type") + el-option(v-once v-for="type in ['Location', 'OnPlayerJoined', 'OnPlayerLeft', 'Notification', 'PortalSpawn', 'Event', 'VideoPlay']" :key="type" :label="type" :value="type") el-input(v-model="gameLogTable.filters[1].value" placeholder="Search" style="flex:none;width:150px;margin:0 10px") el-button(type="default" @click="resetGameLog()" icon="el-icon-refresh" circle style="flex:none") el-table-column(type="expand") @@ -186,6 +186,8 @@ html location(v-if="scope.row.type === 'Location'" :location="scope.row.data[0]" :hint="scope.row.data[1]") template(v-else-if="scope.row.type === 'Event'") span(v-text="scope.row.data") + template(v-else-if="scope.row.type === 'VideoPlay'") + span.x-link(v-text="scope.row.data" @click="openExternalLink(scope.row.data)") template(v-else-if="scope.row.type === 'Notification'") span.x-link(v-else v-text="scope.row.data" @click="lookupUser(scope.row.data)") @@ -1519,6 +1521,9 @@ html div span.toggle-name Events toggle-switch(:options="toggleSwitchOptionsOn" group="switchNotyGrouprequestEvent" v-model="sharedFeedFilters.noty.Event" class="toggle-switch") + div + span.toggle-name Video Play + toggle-switch(:options="toggleSwitchOptionsOn" group="switchNotyGrouprequestVideoPlay" v-model="sharedFeedFilters.noty.VideoPlay" class="toggle-switch") template(#footer) el-button(type="small" @click="cancelSharedFeedFilters") Cancel el-button(type="primary" size="small" style="margin-left:10px" @click="saveSharedFeedFilters") Save @@ -1598,6 +1603,9 @@ html div span.toggle-name Events toggle-switch(:options="toggleSwitchOptionsOn" group="switchWristGrouprequestEvent" v-model="sharedFeedFilters.wrist.Event" class="toggle-switch") + div + span.toggle-name Video Play + toggle-switch(:options="toggleSwitchOptionsOn" group="switchWristGrouprequestVideoPlay" v-model="sharedFeedFilters.wrist.VideoPlay" class="toggle-switch") template(#footer) el-button(type="small" @click="cancelSharedFeedFilters") Cancel el-button(type="primary" size="small" @click="saveSharedFeedFilters") Save diff --git a/html/src/service/gamelog.js b/html/src/service/gamelog.js index c729d5a0..07f8f669 100644 --- a/html/src/service/gamelog.js +++ b/html/src/service/gamelog.js @@ -36,6 +36,10 @@ function parseRawGameLog(dt, type, args) { gameLog.event = args[0]; break; + case 'video-play': + gameLog.videoURL = args[0]; + break; + default: break; } diff --git a/html/src/vr.js b/html/src/vr.js index 337f7cd2..387add21 100644 --- a/html/src/vr.js +++ b/html/src/vr.js @@ -958,6 +958,9 @@ speechSynthesis.getVoices(); case 'Event': text = noty.data; break; + case 'VideoPlay': + text = `Now playing: ${noty.data}`; + break; default: break; }