mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-05-07 06:56:04 +02:00
Update PyPyDance parsing
This commit is contained in:
+41
-35
@@ -7586,12 +7586,11 @@ speechSynthesis.getVoices();
|
|||||||
await database.initTables();
|
await database.initTables();
|
||||||
await this.resetGameLog();
|
await this.resetGameLog();
|
||||||
var location = '';
|
var location = '';
|
||||||
var pushToTable = false;
|
|
||||||
for (var gameLog of await gameLogService.getAll()) {
|
for (var gameLog of await gameLogService.getAll()) {
|
||||||
if (gameLog.type === 'location') {
|
if (gameLog.type === 'location') {
|
||||||
location = gameLog.location;
|
location = gameLog.location;
|
||||||
}
|
}
|
||||||
this.addGameLogEntry(gameLog, location, pushToTable);
|
this.addGameLogEntry(gameLog, location);
|
||||||
}
|
}
|
||||||
this.getGameLogTable();
|
this.getGameLogTable();
|
||||||
};
|
};
|
||||||
@@ -7610,12 +7609,11 @@ speechSynthesis.getVoices();
|
|||||||
setTimeout(resolve, 10000);
|
setTimeout(resolve, 10000);
|
||||||
});
|
});
|
||||||
var location = '';
|
var location = '';
|
||||||
var pushToTable = true;
|
|
||||||
for (var gameLog of await gameLogService.getAll()) {
|
for (var gameLog of await gameLogService.getAll()) {
|
||||||
if (gameLog.type === 'location') {
|
if (gameLog.type === 'location') {
|
||||||
location = gameLog.location;
|
location = gameLog.location;
|
||||||
}
|
}
|
||||||
this.addGameLogEntry(gameLog, location, pushToTable);
|
this.addGameLogEntry(gameLog, location);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -7626,14 +7624,13 @@ speechSynthesis.getVoices();
|
|||||||
rawLogs[2],
|
rawLogs[2],
|
||||||
rawLogs.slice(3)
|
rawLogs.slice(3)
|
||||||
);
|
);
|
||||||
var pushToTable = true;
|
this.addGameLogEntry(gameLog, this.lastLocation.location);
|
||||||
this.addGameLogEntry(gameLog, this.lastLocation.location, pushToTable);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
$app.data.lastLocationDestination = '';
|
$app.data.lastLocationDestination = '';
|
||||||
$app.data.lastLocationDestinationTime = 0;
|
$app.data.lastLocationDestinationTime = 0;
|
||||||
|
|
||||||
$app.methods.addGameLogEntry = function (gameLog, location, pushToTable) {
|
$app.methods.addGameLogEntry = function (gameLog, location) {
|
||||||
var userId = '';
|
var userId = '';
|
||||||
if (gameLog.userDisplayName) {
|
if (gameLog.userDisplayName) {
|
||||||
for (var ref of API.cachedUsers.values()) {
|
for (var ref of API.cachedUsers.values()) {
|
||||||
@@ -7747,7 +7744,7 @@ speechSynthesis.getVoices();
|
|||||||
database.addGamelogPortalSpawnToDatabase(entry);
|
database.addGamelogPortalSpawnToDatabase(entry);
|
||||||
break;
|
break;
|
||||||
case 'video-play':
|
case 'video-play':
|
||||||
this.addGameLogVideo(gameLog, location, userId, pushToTable);
|
this.addGameLogVideo(gameLog, location, userId);
|
||||||
return;
|
return;
|
||||||
case 'api-request':
|
case 'api-request':
|
||||||
var bias = Date.parse(gameLog.dt) + 60 * 1000;
|
var bias = Date.parse(gameLog.dt) + 60 * 1000;
|
||||||
@@ -7775,7 +7772,7 @@ speechSynthesis.getVoices();
|
|||||||
// VideoPlay(PyPyDance) "https://jd.pypy.moe/api/v1/videos/jr1NX4Jo8GE.mp4",0.1001,239.606,"0905 : [J-POP] 【まなこ】金曜日のおはよう 踊ってみた (vernities)"
|
// VideoPlay(PyPyDance) "https://jd.pypy.moe/api/v1/videos/jr1NX4Jo8GE.mp4",0.1001,239.606,"0905 : [J-POP] 【まなこ】金曜日のおはよう 踊ってみた (vernities)"
|
||||||
var type = gameLog.data.substr(0, gameLog.data.indexOf(' '));
|
var type = gameLog.data.substr(0, gameLog.data.indexOf(' '));
|
||||||
if (type === 'VideoPlay(PyPyDance)') {
|
if (type === 'VideoPlay(PyPyDance)') {
|
||||||
this.addGameLogPyPyDance(gameLog, location, pushToTable);
|
this.addGameLogPyPyDance(gameLog, location);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
case 'notification':
|
case 'notification':
|
||||||
@@ -7794,18 +7791,13 @@ speechSynthesis.getVoices();
|
|||||||
database.addGamelogEventToDatabase(entry);
|
database.addGamelogEventToDatabase(entry);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (pushToTable && entry) {
|
if (entry) {
|
||||||
this.queueGameLogNoty(entry);
|
this.queueGameLogNoty(entry);
|
||||||
this.addGameLog(entry);
|
this.addGameLog(entry);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
$app.methods.addGameLogVideo = async function (
|
$app.methods.addGameLogVideo = async function (gameLog, location, userId) {
|
||||||
gameLog,
|
|
||||||
location,
|
|
||||||
userId,
|
|
||||||
pushToTable
|
|
||||||
) {
|
|
||||||
var videoUrl = gameLog.videoUrl;
|
var videoUrl = gameLog.videoUrl;
|
||||||
var youtubeVideoId = '';
|
var youtubeVideoId = '';
|
||||||
var videoId = '';
|
var videoId = '';
|
||||||
@@ -7860,20 +7852,11 @@ speechSynthesis.getVoices();
|
|||||||
userId,
|
userId,
|
||||||
videoPos
|
videoPos
|
||||||
};
|
};
|
||||||
if (pushToTable) {
|
|
||||||
this.setNowPlaying(entry);
|
this.setNowPlaying(entry);
|
||||||
this.queueGameLogNoty(entry);
|
|
||||||
this.addGameLog(entry);
|
|
||||||
}
|
|
||||||
database.addGamelogVideoPlayToDatabase(entry);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
$app.methods.addGameLogPyPyDance = function (
|
$app.methods.addGameLogPyPyDance = function (gameLog, location) {
|
||||||
gameLog,
|
|
||||||
location,
|
|
||||||
pushToTable
|
|
||||||
) {
|
|
||||||
var data =
|
var data =
|
||||||
/VideoPlay\(PyPyDance\) "(.+?)",([\d.]+),([\d.]+),"(.+?)\s*(?:)?"/g.exec(
|
/VideoPlay\(PyPyDance\) "(.+?)",([\d.]+),([\d.]+),"(.+?)\s*(?:)?"/g.exec(
|
||||||
gameLog.data
|
gameLog.data
|
||||||
@@ -7905,6 +7888,16 @@ speechSynthesis.getVoices();
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (videoUrl === this.nowPlaying.url) {
|
||||||
|
var entry = {
|
||||||
|
created_at: gameLog.dt,
|
||||||
|
videoUrl,
|
||||||
|
videoLength,
|
||||||
|
videoPos
|
||||||
|
};
|
||||||
|
this.setNowPlaying(entry);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (videoId === 'YouTube') {
|
if (videoId === 'YouTube') {
|
||||||
var entry = {
|
var entry = {
|
||||||
dt: gameLog.dt,
|
dt: gameLog.dt,
|
||||||
@@ -7913,7 +7906,7 @@ speechSynthesis.getVoices();
|
|||||||
videoPos,
|
videoPos,
|
||||||
videoId
|
videoId
|
||||||
};
|
};
|
||||||
this.addGameLogVideo(entry, location, userId, pushToTable);
|
this.addGameLogVideo(entry, location, userId);
|
||||||
} else {
|
} else {
|
||||||
var entry = {
|
var entry = {
|
||||||
created_at: gameLog.dt,
|
created_at: gameLog.dt,
|
||||||
@@ -7927,12 +7920,7 @@ speechSynthesis.getVoices();
|
|||||||
userId,
|
userId,
|
||||||
videoPos
|
videoPos
|
||||||
};
|
};
|
||||||
if (pushToTable) {
|
|
||||||
this.setNowPlaying(entry);
|
this.setNowPlaying(entry);
|
||||||
this.queueGameLogNoty(entry);
|
|
||||||
this.addGameLog(entry);
|
|
||||||
}
|
|
||||||
database.addGamelogVideoPlayToDatabase(entry);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -7989,6 +7977,11 @@ speechSynthesis.getVoices();
|
|||||||
};
|
};
|
||||||
|
|
||||||
$app.methods.setNowPlaying = function (ctx) {
|
$app.methods.setNowPlaying = function (ctx) {
|
||||||
|
if (this.nowPlaying.url !== ctx.videoUrl) {
|
||||||
|
this.queueGameLogNoty(ctx);
|
||||||
|
this.addGameLog(ctx);
|
||||||
|
database.addGamelogVideoPlayToDatabase(ctx);
|
||||||
|
|
||||||
var displayName = '';
|
var displayName = '';
|
||||||
if (ctx.displayName) {
|
if (ctx.displayName) {
|
||||||
displayName = ` (${ctx.displayName})`;
|
displayName = ` (${ctx.displayName})`;
|
||||||
@@ -8003,7 +7996,18 @@ speechSynthesis.getVoices();
|
|||||||
percentage: 0,
|
percentage: 0,
|
||||||
remainingText: ''
|
remainingText: ''
|
||||||
};
|
};
|
||||||
if (!this.nowPlaying.playing) {
|
} else {
|
||||||
|
this.nowPlaying = {
|
||||||
|
...this.nowPlaying,
|
||||||
|
length: ctx.videoLength,
|
||||||
|
startTime: Date.parse(ctx.created_at) / 1000 - ctx.videoPos,
|
||||||
|
elapsed: 0,
|
||||||
|
percentage: 0,
|
||||||
|
remainingText: ''
|
||||||
|
};
|
||||||
|
}
|
||||||
|
this.updateVrNowPlaying();
|
||||||
|
if (!this.nowPlaying.playing && ctx.videoLength > 0) {
|
||||||
this.nowPlaying.playing = true;
|
this.nowPlaying.playing = true;
|
||||||
this.updateNowPlaying();
|
this.updateNowPlaying();
|
||||||
}
|
}
|
||||||
@@ -8011,7 +8015,7 @@ speechSynthesis.getVoices();
|
|||||||
|
|
||||||
$app.methods.updateNowPlaying = function () {
|
$app.methods.updateNowPlaying = function () {
|
||||||
var np = this.nowPlaying;
|
var np = this.nowPlaying;
|
||||||
if (!np.url) {
|
if (!this.nowPlaying.playing) {
|
||||||
this.nowPlaying.playing = false;
|
this.nowPlaying.playing = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -8201,8 +8205,10 @@ speechSynthesis.getVoices();
|
|||||||
appId = '846232616054030376';
|
appId = '846232616054030376';
|
||||||
bigIcon = 'vr_dancing';
|
bigIcon = 'vr_dancing';
|
||||||
}
|
}
|
||||||
if (this.nowPlaying.playing) {
|
if (this.nowPlaying.name) {
|
||||||
L.worldName = this.nowPlaying.name;
|
L.worldName = this.nowPlaying.name;
|
||||||
|
}
|
||||||
|
if (this.nowPlaying.playing) {
|
||||||
Discord.SetTimestamps(
|
Discord.SetTimestamps(
|
||||||
Date.now(),
|
Date.now(),
|
||||||
(this.nowPlaying.startTime + this.nowPlaying.length) * 1000
|
(this.nowPlaying.startTime + this.nowPlaying.length) * 1000
|
||||||
|
|||||||
Reference in New Issue
Block a user