-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Breaking change: help test the new Spotify folders format #10
Comments
macOS with Python 3.9, 3.10, 3.11, and 3.12 works here and verified folder structure. 👍 |
Seems to be totally broken for me on Windows. With the new update, I'm only getting an error message: "No data found in the Spotify cache. ...". My client, at least, doesn't seem to be using the root level log or lbd file. I'll investigate a bit more hopefully next week. |
👍 @Nitemice If it's using the old format, we could fall back to that. If it helps, what's the folder structure of your On macOS, the structure is:
|
I've looked into it a bit more, and it seems like Spotify no longer uses the custom cache directory for storing the lbd files. It's in the However, even when I run the script without the custom cache path, it fails. I've tried following what exactly it's looking for, but I don't quite understand the pattern it's trying to match in the file. Either the files on Windows are a bit different, or there's something going wrong with the pattern string. Could you provide a bit of clarification on how the pattern string is constructed, if you know? Otherwise, I'm happy to provide some sample files if that would be helpful. |
Thanks, @Nitemice! if I understand you correctly, it sounds like the spotifyfolders --cache CACHE_DIR where you replace CACHE_DIR with the windows_store_path. If that doesn't work, then can you provide any sample files or directory structures you see? That would be most helpful. I'll look into it. — if you want to search for some pattern, look for "rootlist". |
Hey @mikez, The problem now is that the |
@Nitemice Ah, I see. The LevelDB files are there, but something seems to fail—it can't seem to find the key. I can think of 2 ways to debug this:
As an aside: Spotify uses a |
I've stepped through the code and I've managed to get it working. However, I had to make two major (probably breaking) changes. At first, I thought the issue was that the
That's odd and all, but after I made that change, I found that still didn't fix it. Instead now the code wasn't even reaching the files that contained the rootlist key.
But on further review of the code, a simpler fix is to simply remove the I have pushed a branch with those changes for you to have a proper look: Nitemice@63a40c7 |
@Nitemice Nice debugging there! :) Change 1 is very interesting, and I'd like to learn more about this—is this Windows specific, is there something else going on? I wonder if we could get others to give us data here. Change 2 makes it so that every key in every table is traversed. This takes longer. However, it could be a fall-back option, in case no key is found. Here's what I propose in terms of changes (for now):
I'm assuming the |
@Nitemice Digging some more, I've noticed the pattern of the keys here seem to be:
where PREFIX can be something like:
and the spacers are
Does the spacer encode some number, is there some logic behind it? I don't understand. Also, the ordering of the keys becomes more confusing the closer I look at it. |
@Nitemice FYI, pushed a new version based on our current understanding. |
I agree, it'd be good to have more data from others to see if it's the same. If I had to guess, I'd say it's a Windows vs Unix thing, but who knows!
I'll admit I didn't fully understand what a lot of this code was doing, and I probably still don't fully get it. But now that I've more closely examined this loop, and the I think I've found a simpler solution that shouldn't slow down the runtime much if at all. What if we modify the
I think this is a reasonable solution, but if we start finding even more alternatives, we may need to rethink it (maybe in combination with the solution above?).
Like I mentioned, I think the above solution is cleaner and simpler. But it's really up to you.
I spent a large chunk of time over the last few days trying to dump the ldb various ways, but nothing has worked for me on Windows. If you've got a script that you think'll work (and doesn't depend on a dozen extra things), I'd be happy to give it a go.
Yeah, I think
I've also seen the following as spacers:
|
I like simple solutions! :) In this specific case, this seems a bit speculative for me (and prone to false negatives), since we don't quite know yet what that "SPACER" symbol means. (Including its usage in
👍 This is an error. Thank you. I pushed a fix.
I much prefer cleaner and simpler. I see this as a transitory solution until we have clarity on how greenbase.KeyComparator works. Then we can massively clean up the code and only need one attempt.
https://gist.github.com/mikez/dcd8cd65319049e434820c3c9459cc4a No dependencies; except for the folders.py script. Put this into the same directory as that file. As for greenbase.KeyComparator: I haven't understood the ordering. Sometimes it seems alphanumeric; at other times, it seems the SPACER symbol has higher weight than the rest, even the characters before it. |
I don't disagree. You're probably right; this is the best we can do for now, until we have a much better handle on what's going on with the key's structure and sorting. I've run the script you provided (thanks for that!) on the file that contain the 'rootlist' keys, because really, that's the only one we care about. I've attached a anonymised/summarised version of the output. Basically, it looks to be in alphanumeric order, with group separators (in this case space chars) treated as greater than other chars. |
Thank you, @Nitemice, this is very helpful.
Sometimes the data can contain #, ! and such symbols too, but the "len" prefix makes that clear. Greenbase comparator is still unclear. |
Ok, I think I figured out the comparator approximately too now. It's essentially alphanumeric, but ignores the varint {length} sections. Pushed new version. Leaving in slow_search as a backup in case DB gets corrupted. |
@Nitemice Can you confirm that this works on your end? |
Yes, working for me now. Thank you! |
Spotify changed the cache storage tech as of 2023-11-30. The code was substantially rewritten. You're invited to test the new setup and report any issues here.
So far, I've tested it on one macOS machine. More testing is especially needed for Linux and Windows.
If you were able to run this and verify your folder structure, please give a thumbs up here 👍; also, feel free to report the operating system you tested it on.
Installation instructions (unchanged)
curl -L https://git.io/folders > /usr/local/bin/spotifyfolders chmod +x /usr/local/bin/spotifyfolders
Note: If you haven't changed your folder hierarchy recently, it may be stored in a compressed format. In that case, you may receive additional instructions on how to install the "snappy" decompression library. You can circumvent this by making a tiny change to your folder structure (which you can immediately change back again); this will store the folder hierarchy in an uncompressed cache.
(/cc @technomorph, @Nitemice, @inferrinizzard, @chocolateboy, @AlexSWall, @sydoracle, @ShiromMakkad)
The text was updated successfully, but these errors were encountered: