Commit graph

174 commits

Author SHA1 Message Date
902fcd4447 Create own parsing function
I have dreamt of this for a long time. It is a minor optimization to be honest, but I previously had to choose between ugly code (what I had just prior to this) or looping through the data twice (slow). This parses the data and puts it into my intermediary type directly, along with relevant information about whetehr or not the scrobble is valid, and then I only need to loop over it once with "nice enough" code. There is still more I can do. My ultimate goal is to remove the looping entirely, and verify the data as it's being parsed, queuing up much smaller jobs that handle the individual entities (albums, artistsongs, etc.) as they come, rather than collecting it all and running it at once. I can get over the problem of needing to wit for all the LastFM responses that way as well. Furthermore, the data checking in the function expects a rather rigid structure that I'm not certain I can guarantee, but I'm pretty sure it'll stay that way. In any case, it may behoove me to make it more dynamic at some point. In any case, I am very excited about this change, and I hope I can continue improving upon it.
2025-07-07 17:13:48 -04:00
8af6341f95 Switch to defined constant when converting between s/ms/ns 2025-07-07 17:07:14 -04:00
c95ac51e05 Prevent upload from crashing if 500 is received from LastFM 2025-07-07 17:03:08 -04:00
6fe885132a Do not use peak
I only tested it on small datasets, and it wasn't so bad, but with my whole LastFM dataset, it is very bad
2025-07-07 16:40:56 -04:00
0dec52af01 Type rank 2025-07-07 16:09:30 -04:00
851aec3a97 I learned about std.math.maxInt 2025-07-07 12:14:27 -04:00
15e72ea326 Revert entity name in url redirect in all cases and create disambiguation pages for all entities
Useless for artists right now
2025-07-03 12:23:57 -04:00
7b1fc6dd71 Include track name in disambiguation 2025-07-03 00:09:31 -04:00
da9934ae1e Create disambiguation for songs
This was way easier than I expected, but I am rather unhappy with some things now. In particular, the GET page is pretty gross. I think there are some things I can do, but I'm not 100% confident. Maybe I'll bring some things up to bob once I have a better picture, but I really want to try to clean up my code
2025-07-02 23:27:39 -04:00
12722f282d Revert forced redirect after id in url and begin disambiguation page
At first, this was a nightmare. Now, I think I have a good idea about how to do disambiguation pages
2025-07-02 23:05:57 -04:00
b0727e77e1 Addd peak query and tie detection for rank
Also begins friends query for songs
2025-07-02 19:37:28 -04:00
f9718f3a37 Make loadQuery comptime
Will eventually do this for all views
2025-07-02 16:11:37 -04:00
9fa90ff129 Add check if there is a tie in scrobble count 2025-07-02 16:10:55 -04:00
5739f89e0d Write "friends" query
Will tell you which songs you listen to the most on the days you listen to some specified song
2025-06-28 00:19:48 -04:00
29041044e7 Remove unnecessary null checks 2025-06-27 00:31:47 -04:00
0b7efc3420 Begin album reviews
Album reviews would ideally allow you to rate tracks at the same time, so we'll have to work on that next. Also, disambiguation pages are becoming more and more necessary (Little Talks in inaccessible atm) Preferably, we start working on the `INDEX` for `/ratings` as well, and maybe use a unified language for these things (is it review, rating, rating_text, score,...?)
2025-06-24 00:05:25 -04:00
9f27fad235 Add section on SongGroups
They don't exist yet, but I was trying to decide in my head if there was a meaningful difference between emrging two songs, and a SongGroup, and I decided they are indeed different, but really only in a small way
2025-06-23 17:02:08 -04:00
6f6aaecb8f Create rating interface on songs view
If no ratings are present, provide a textbox to make a rating. If a rating is present, show the rating. Eventually, there will be a button that allows an additional rating to be made, and the ability to delete ratings
2025-06-23 16:50:13 -04:00
996022fe5f Make rating data optional
Use HTML to enfore at least one of the two fields has a value, but I don't want to require both
2025-06-23 16:47:46 -04:00
b7e625dd98 Start ratings
This is actually fantastic, I'm really happy with how this has worked so far. My only concern for the future is how posting reviews from the `/ratings` path might work, since it's currently designed around posting reviews from the song page itself, but I think some HTMX and/or JS wil alleviate any problems I run into
2025-06-23 10:18:17 -04:00
f292368947 Song name in url string 2025-06-23 10:15:17 -04:00
93da50652a Remove unnecessary else 2025-06-23 10:14:25 -04:00
77a9c24dab Create ratings tables 2025-06-22 14:37:10 -04:00
9c90c683c6 Temporary fix to keep using LLVM 2025-06-22 14:36:59 -04:00
2d7d2835fd Proof of concept artist name in url string
Some of my favorite code in the project. Just need a disambiguation page, and we're in business here
2025-06-18 02:11:30 -04:00
0b07947b8a Create urlDecode function for redirects 2025-06-18 02:10:51 -04:00
36873053bc Make new scrobble processing function
This uses the zmpl data as a hash map to check if we've already checked the db for some song/album/artist/etc. and now only checks once per entity/assoc. table entry to speed things up. Previously, for each scrobble, we checked if its metadata appeared in the respective table, regardless of whether or not we've scrobbled that albumsong before. So, a song like Starless had to be checked (at the time of writing) ~180 times, but is now only checked once. Similarly, Wilco was checked ~3000+ times, as Hurry Up, We're Dreaming was cheked ~700 times.

The only problem now is the way it was implemented. Obviously, copying and pasting those huge chunks of code isn't very nice looking. ATM, I don't really care, and I'm more happy about the overall speed increase, as well as the readability increase of the job. However, I don't want to leave it like that. The way I see it, I have two options: either create a funcion which does this, or I can do something even better, which is create a jsonParse function, which, if my thought process works, would remove the need for an intermediary source type, meaning we no longer need to switch on that type, which means we can just have one for loop that does everything, which would mean we just need to have that code in one place.

Also not entirely happy with the code concerning all the conversions to i64s and []const u8s, but I think I have to.
2025-06-11 20:08:13 -04:00
df8f01525e Merge remote-tracking branch 'refs/remotes/origin/rawsql' into rawsql 2025-06-11 09:28:14 -04:00
2f420bc5ce Testing with groups and htmx 2025-06-11 09:26:12 -04:00
6a1c822420 Add entities_by_name query
Will probably be used for disambiguation pages (among other things, but disambiguation pages are coming up soon)
2025-06-11 09:25:40 -04:00
a8a4ed27c4 Make process_scrobbles vars more readable, and change hashing 2025-06-11 09:22:38 -04:00
1e4a271b8d Update README 2025-06-11 09:22:06 -04:00
85552f39c1 Add Artistsongs table
Whether or not a song is covered, there was an original artist who originally performed the song. The only issue is that an Artistsongs table will almost be the exact same as the Albumsongsartists table, since most songs aren't covered. So, it may be better not to populate that table by default, and then if two albumsongs with different artists share the same song, then fill the Artistsongs table.
2025-06-09 21:45:41 -04:00
162341fb5f Convert ids to i64
The birthday paradox is a real problem with the size of our datasets. i64 is the largest numerical value we can use, and there's a 0.1% chance of collision with ~2,000,000 values, so I feel pretty comfortable with this
2025-06-09 21:41:52 -04:00
c8f2ef57c8 Add some tyling to songs view
This can (will) be easily replicated for the other views, I just first tested it on songs. I think this looks much nicer, and I'll probably roll with a layout similar to this for the other views, with some minor adjustments for each particular view.
2025-06-06 15:55:20 -04:00
3ef17fcd46 Split entity_items and appears query into more granular queries
We can be a bit more specific about the information we get this way
2025-06-06 14:28:15 -04:00
adcaff34ea Fix dumb appears query for albums 2025-06-02 00:13:27 -04:00
566edf1818 Include artist(s) name in album GET view
This also makes the entity_info struct very similar to the UnifiedResult struct, so we'll probably see a merge at some point. Would be nice if we used the fields from the entity_info result more commonly.
2025-05-31 15:48:30 -04:00
906ba6d2e5 Update header partial and remoev table partial
Long overdue
2025-05-31 14:47:52 -04:00
3777b818e3 Create view for groups
One of the largest components that makes zuletzt unique - implementing groups the way MusicBrainz has (release groups in particular). I thought for a while that I would just connect songs via a shared ID, but for remixes and such, I don't think they should be so tightly coupled. This also gives the user freedom for how they want to do the grouping (a remix can be included in the group if they choose to, or it may not). This will allow someone to see a combined scrobble number for an album with, for example, a regular release, a deluxe release, and an anniversary release, in addition to the individual releases. This will complicate SQL queries rather significantly I imagine, and I'm not sure what the interface for creating/deleting groups will be (although it will likely be easier when I have full use of TS), but it's a necessity for the project.
2025-05-31 14:45:45 -04:00
a314fd447d Fix LastFM API scrobble parsing when song is currently playing 2025-05-31 14:31:15 -04:00
c57bf18627 Update queries
Adds datestreak query, provides the number of songs/albums when relevant, and provides timescale with all years, regardless of the number of plays (defaults to 0)
2025-05-31 13:39:03 -04:00
d81681e698 Move scrobble rank from firstlast partial to view.
Eventually moving this to its own partial (probably)
2025-05-31 13:37:34 -04:00
62590fee37 Made queries.zig look significantly nicer
There's a little bit of weird stuff happening, but holy cannoli, that's so much easier to maintain and parse
2025-05-29 19:39:51 -04:00
d638fa66c5 Create GET function for a song view 2025-05-29 15:33:10 -04:00
3ff973e193 Use queries.zig in scrobbles view 2025-05-26 11:15:51 -04:00
f59eec79a8 Removed inline else from upload.zig
If I can figure out a way to get an array of a union instead of a union of arrays, we're in business to make this even better, but this is fine right now. The inline else was just a dumb way to keep the for on the outside
2025-05-26 11:15:19 -04:00
aab61631a3 Directly append complete_scrobble in upload.zig
Thanks bob :)
2025-05-25 16:16:18 -04:00
7f3778e82f Move SQL logic to separate function
Idk if this makes any sense, and I don't really like the code atm, but the view .zig files lookk nicer?
2025-05-24 13:59:28 -04:00
09f542e26e Add timescale partial
Bad name, idk what else to call it
2025-05-24 13:58:31 -04:00