Yooooomi / your_spotify

Self hosted Spotify tracking dashboard
GNU General Public License v3.0
3.09k stars 124 forks source link

Extended history import error #250

Closed XBCreepinJesus closed 1 year ago

XBCreepinJesus commented 1 year ago

Describe the bug (Possibly similar to #248 and #237?)

I've just received my extended history; files are named by year, but another issue thread says that doesn't matter, so that should be fine... I tried importing all at once which gave an error. Then tried importing the two smallest files first, which worked - 9933 songs were imported fine.

Now I'm left with the big ones, about 10MB each. When I start the import, I get the error "The initialization failed, maybe your files are wrongly formatted" at the top (logs below).

Strangely, I get the same error(s) if I upload a file with just the first song and nothing else (in correct JSON format).

Expected behavior

Files to import the same as the others.

Additional context

Running v1.60 docker build from linuxserver.io, MongoDB is v4.4.18 (latest for this platform), and all running through a Traefik reverse proxy. Not sure any of this is an issue as it imported 2 of the files from Spotify with no issue...

Logs Note, there are some odd non-text characters between "path":[0, and "endTime" that I can't paste - I can send the file(s) if needed.

[error]  If you submitted the right files and this error comes up, please open an issue with the following logs at https://github.com/Yooooomi/your_spotify [
 {
  "code": "invalid_type",
  "expected": "string",
  "received": "undefined",
  "path": [
   0,
   "endTime"
  ],
  "message": "Required"
 },
 {
  "code": "invalid_type",
  "expected": "string",
  "received": "undefined",
  "path": [
   0,
   "artistName"
  ],
  "message": "Required"
 },
 {
  "code": "invalid_type",
  "expected": "string",
  "received": "undefined",
  "path": [
   0,
   "trackName"
  ],
  "message": "Required"
 },
 {
  "code": "invalid_type",
  "expected": "number",
  "received": "undefined",
  "path": [
   0,
   "msPlayed"
  ],
  "message": "Required"
 }
]
[error]  TypeError: Cannot read properties of null (reading 'length')
    at PrivacyImporter.<anonymous> (/app/www/server/lib/tools/importers/privacy.js:86:51)
    at Generator.next (<anonymous>)
    at fulfilled (/app/www/server/lib/tools/importers/privacy.js:5:58)
POST /import/privacy 400 82.922 ms - 29

Imported file This is the one-song file I tried as an extract of the larger set; same error. If using the full file, I get a repeat of the error above for each entry.

[
    {
        "ts": "2021-03-23T14:06:33Z",
        "username": "xxx",
        "platform": "Windows 10 (10.0.19042; x64; AppX)",
        "ms_played": 93160,
        "conn_country": "GB",
        "ip_addr_decrypted": "31.53.180.148",
        "user_agent_decrypted": "unknown",
        "master_metadata_track_name": "Make It Wit Chu",
        "master_metadata_album_artist_name": "Queens of the Stone Age",
        "master_metadata_album_album_name": "Era Vulgaris",
        "spotify_track_uri": "spotify:track:4hwQDO9saWsuwGvHp4oE1Z",
        "episode_name": null,
        "episode_show_name": null,
        "spotify_episode_uri": null,
        "reason_start": "fwdbtn",
        "reason_end": "endplay",
        "shuffle": false,
        "skipped": null,
        "offline": false,
        "offline_timestamp": 1616508299684,
        "incognito_mode": false
    }
]

Shared link

Would share but hosted privately.

Yooooomi commented 1 year ago

Ow this is bad. It seems that they changed the format of the files. Maybe you could, if you don't mind, send me those files so I can have a look at yooooomi_ on discord.

XBCreepinJesus commented 1 year ago

Oh right 😬 Yep, I don't mind. I'll add you on Discord and send over the whole zip file I downloaded straight from Spotify. It comes with a readme on the file structure too so that might be helpful. Stand by...

Cheers.

XBCreepinJesus commented 1 year ago

Attempted to send but it says I can't send to this user - assuming it's just a matter of being friends, but letting you know just in case! No rush 👍

Yooooomi commented 1 year ago

I'll work on this asap, didn't find the time lately. Sorry for that

XBCreepinJesus commented 1 year ago

Turns out to be user error - my bad!

For anyone else: keep an eye on the drop-down menu where you select Account Info or Extended Streaming Data - when the page reloads, it reverts back to Account Info and, if you're rushing like I was, you might miss it and try importing to the wrong method 🤦‍♂️

Closing issue.

Supbro112 commented 1 year ago

I checked the drop-down menu as extended streaming history. My history spans from 2016-present so there are a lot of files but i am confused, because none of them are endsong, they are streaming_history, which is account data... but my email says its the files of my extended streaming history. Very confused, but I managed to add one. 2016-2017. I try to add any others and it complains about the "Some file do not being with endsong, import might not work" and one did work, but the rest wont now and says error "An import is already running on this account"... am I allowed only 1 history file on my account?

Edit: So the main issue with the name... is the file name. I guess spotify changed their formatting again to be Steaming_History instead of StreamingHistory, so once I changed that, your_spotify said it should all be good, except still issue of "An import is already running on this account"...