diff --git a/client/src/app/pages/dashboard/import/ImportPage.tsx b/client/src/app/pages/dashboard/import/ImportPage.tsx index 110bfce44..a7a70e5cb 100644 --- a/client/src/app/pages/dashboard/import/ImportPage.tsx +++ b/client/src/app/pages/dashboard/import/ImportPage.tsx @@ -244,10 +244,11 @@ function ImportInfoDisplayer({ game }: { game: Game }) { } else if (game === "wacca") { Content.unshift( ); } else if (game === "museca") { @@ -454,6 +455,10 @@ function ImportTypeInfoCard({ key="PLI .csv" /> ); + case "file/mypagescraper-records-csv": + case "file/mypagescraper-player-csv": + // We only expect people to use these import types once ever, so don't recommend them. + return <>; default: // For some reason, the webpack tschecker thinks // that the above switch isn't exhaustive. However, it is. diff --git a/client/src/app/pages/dashboard/import/WACCAMyPageScraperPage.tsx b/client/src/app/pages/dashboard/import/WACCAMyPageScraperPage.tsx new file mode 100644 index 000000000..05582eace --- /dev/null +++ b/client/src/app/pages/dashboard/import/WACCAMyPageScraperPage.tsx @@ -0,0 +1,101 @@ +import ImportFileInfo from "components/imports/ImportFileInfo"; +import useSetSubheader from "components/layout/header/useSetSubheader"; +import Divider from "components/util/Divider"; +import ExternalLink from "components/util/ExternalLink"; +import React from "react"; + +function RecordsParseFunction(data: string) { + if ( + !data.startsWith( + "music_id,music_title,music_artist,music_genre,music_levels,music_play_counts,music_scores,music_achieves\n" + ) + ) { + throw new Error( + "The first line of the CSV doesn't have the right headers. Are you sure this is the records.csv file?" + ); + } + + return { + // not sure why we need this since we're expected to throw if it's invalid? + valid: true, + info: { + // Note: Most other file import types provide a number of scores. It + // doesn't make senes for this import type since we always expect + // all the songs to be present - the only indicator for an unplayed + // song/chart is that the score is 0, so to provide this would would + // need to basically parse the whole file anyway. + }, + }; +} + +function PlayerParseFunction(data: string) { + if ( + !data.startsWith( + "player_name,player_level,player_rate,player_stage,player_play_count,player_play_count_versus,player_play_count_coop,player_total_rp_earned,player_total_rp_spent\n" + ) + ) { + throw new Error( + "The first line of the CSV doesn't have the right headers. Are you sure this is the player.csv file?" + ); + } + + return { + valid: true, + info: {}, + }; +} +export default function WACCASiteImportPage() { + useSetSubheader(["Import Scores", "WaccaMyPageScraperImporter"]); + + return ( +
+

What Is WaccaMyPageScraper?

+
+ + WaccaMyPageScraper + {" "} + is a scraper for the official WACCA MyPage service site. Since the site is offline + as of September 1, 2022, this is only useful if you have used the scraper before + then. +
+

What can I import?

+
+ Based on the data saved from the scraper, your PBs and{" "} + maximum Stage Up rank can be imported. WaccaMyPageScraper doesn't record any + recent plays, so if you have played a chart multiple times, only the PB will be + imported. +
+

How does it work?

+
+ Within the WaccaMyPageScraper directory there is a "data" directory, which contains + two files we care about: +
    +
  • + records/records.csv contains all your personal bests. +
  • +
  • + player/player.csv contains your player info, including your Stage Up + rank. +
  • +
+ Both of these can be imported below in the corresponding sections. +
+ +

Import PBs

+ + +

Import Stage Up

+ +
+ ); +} diff --git a/client/src/app/pages/dashboard/import/WACCASiteImportPage.tsx b/client/src/app/pages/dashboard/import/WACCASiteImportPage.tsx deleted file mode 100644 index 3ee8c8091..000000000 --- a/client/src/app/pages/dashboard/import/WACCASiteImportPage.tsx +++ /dev/null @@ -1,26 +0,0 @@ -import useSetSubheader from "components/layout/header/useSetSubheader"; -import Divider from "components/util/Divider"; -import ExternalLink from "components/util/ExternalLink"; -import { TachiConfig } from "lib/config"; -import React from "react"; - -export default function WACCASiteImportPage() { - useSetSubheader(["Import Scores", "WACCA Site Importer"]); - - return ( -
-

What is the WACCA site importer?

-
- The WACCA Site Importer is a script that will scrape your profile on the WACCA - website and import it to {TachiConfig.name}. -
- -

Setup Instructions

- Instructions are available on{" "} - - the GitHub repository - - . -
- ); -} diff --git a/client/src/app/routes/ImportRoutes.tsx b/client/src/app/routes/ImportRoutes.tsx index cfe1dee1d..44eda4872 100644 --- a/client/src/app/routes/ImportRoutes.tsx +++ b/client/src/app/routes/ImportRoutes.tsx @@ -15,7 +15,7 @@ import SilentHookPage from "app/pages/dashboard/import/SilentHookPage"; import SSSXMLPage from "app/pages/dashboard/import/SSSXMLPage"; import USCDBPage from "app/pages/dashboard/import/USCDBPage"; import USCIRPage from "app/pages/dashboard/import/USCIRPage"; -import WACCASiteImportPage from "app/pages/dashboard/import/WACCASiteImportPage"; +import WACCAMyPageScraperPage from "app/pages/dashboard/import/WACCAMyPageScraperPage"; import KAIIntegrationPage from "components/imports/KAIIntegrationPage"; import Divider from "components/util/Divider"; import { UserContext } from "context/UserContext"; @@ -183,8 +183,8 @@ export default function ImportRoutes() { - - + + )} diff --git a/server/src/server/router/api/v1/users/_userID/router.ts b/server/src/server/router/api/v1/users/_userID/router.ts index a3722fa93..25f9f230c 100644 --- a/server/src/server/router/api/v1/users/_userID/router.ts +++ b/server/src/server/router/api/v1/users/_userID/router.ts @@ -395,6 +395,9 @@ router.get("/recent-imports", async (req, res) => { userID: user.id, timeFinished: { $gt: Date.now() - ONE_MONTH }, userIntent: true, + importType: { + $nin: ["file/mypagescraper-records-csv", "file/mypagescraper-player-csv"], + }, }, }, {