diff --git a/LogWatcher.cs b/LogWatcher.cs index 7ff0af0d..1eb8dc75 100644 --- a/LogWatcher.cs +++ b/LogWatcher.cs @@ -19,6 +19,7 @@ namespace VRCX public long Length; public long Position; public string RecentWorldName; + public string LastVideoURL; public bool ShaderKeywordsLimitReached = false; } @@ -203,7 +204,8 @@ namespace VRCX } if (ParseLogNotification(fileInfo, logContext, line, 34) == true || - ParseLogShaderKeywordsLimit(fileInfo, logContext, line, 34) == true) + ParseLogShaderKeywordsLimit(fileInfo, logContext, line, 34) == true || + ParseLogSDK2VideoPlay(fileInfo, logContext, line, 34) == true) { continue; } @@ -466,6 +468,12 @@ namespace VRCX var data = line.Substring(78); data = data.Remove(data.Length - 1); + if (logContext.LastVideoURL == data) + { + return false; + } + logContext.LastVideoURL = data; + AppendLog(new[] { fileInfo.Name, @@ -477,6 +485,42 @@ namespace VRCX return true; } + private bool ParseLogSDK2VideoPlay(FileInfo fileInfo, LogContext logContext, string line, int offset) + { + // 2021.04.23 13:12:25 Log - User Natsumi-sama added URL https://www.youtube.com/watch?v=dQw4w9WgXcQ + + if (string.Compare(line, offset, "User ", 0, 5, StringComparison.Ordinal) != 0) + { + return false; + } + + var pos = line.LastIndexOf(" added URL "); + if (pos < 0) + { + return false; + } + + var displayName = line.Substring(offset + 5, pos - (offset + 5)); + var data = line.Substring(pos + 11); + + if (logContext.LastVideoURL == data) + { + return false; + } + logContext.LastVideoURL = data; + + AppendLog(new[] + { + fileInfo.Name, + ConvertLogTimeToISO8601(line), + "video-play", + data, + displayName + }); + + 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 63e3b096..783ae312 100644 --- a/html/src/app.js +++ b/html/src/app.js @@ -5784,7 +5784,8 @@ speechSynthesis.getVoices(); tableData = { created_at: gameLog.dt, type: 'VideoPlay', - data: gameLog.videoURL + data: gameLog.videoURL, + displayName: gameLog.displayName }; break; diff --git a/html/src/index.pug b/html/src/index.pug index 50f429f8..247ff378 100644 --- a/html/src/index.pug +++ b/html/src/index.pug @@ -188,6 +188,8 @@ html 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-if="scope.row.displayName") + span.x-link(@click="lookupUser(scope.row.displayName)") ({{ scope.row.displayName }}) template(v-else-if="scope.row.type === 'Notification'") span.x-link(v-else v-text="scope.row.data" @click="lookupUser(scope.row.data)") diff --git a/html/src/service/gamelog.js b/html/src/service/gamelog.js index 07f8f669..7fe29fe2 100644 --- a/html/src/service/gamelog.js +++ b/html/src/service/gamelog.js @@ -38,6 +38,7 @@ function parseRawGameLog(dt, type, args) { case 'video-play': gameLog.videoURL = args[0]; + gameLog.displayName = args[1]; break; default: