Parse SDK2 video URL's

This commit is contained in:
Natsumi
2021-04-23 13:55:52 +12:00
parent 8eb1321ca7
commit 3c7531afff
4 changed files with 50 additions and 2 deletions

View File

@@ -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

View File

@@ -5784,7 +5784,8 @@ speechSynthesis.getVoices();
tableData = {
created_at: gameLog.dt,
type: 'VideoPlay',
data: gameLog.videoURL
data: gameLog.videoURL,
displayName: gameLog.displayName
};
break;

View File

@@ -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)")

View File

@@ -38,6 +38,7 @@ function parseRawGameLog(dt, type, args) {
case 'video-play':
gameLog.videoURL = args[0];
gameLog.displayName = args[1];
break;
default: