Polochon-street / bliss-rs

A song analysis library for making playlists
https://lelele.io/bliss.html
GNU General Public License v3.0
79 stars 3 forks source link

Error handling for tags: Null and encoding #54

Closed toofar closed 3 months ago

toofar commented 1 year ago

I've reprocessed my library with the new blissify version and am now running into a couple of issues around tags when trying to generate a playlist.

  1. Null tag values

I have some music files without tags, and even some that have valid flags that don't end up in the database. Those are causing panics where the DB rows are being serialized into Song instances: https://github.com/Polochon-street/bliss-rs/blob/8391095/src/library.rs#L1045

The error is Invalid column type Null at index: 2, name: title.. Some files just don't have tags which you can probably reproduce easily enough. There is one interesting example I saw which is a flac file with valid Id3 tags and an empty vorbis comment block. Weird but it works fine with MPD! Here it is (temp upload again): https://litter.catbox.moe/5k2sck.flac

Most of the files it is erroring on just don't have tags though. I could add tags easy enough but these files are working with all my other tooling. I'm using blissify to play around with the feature analysis features and I feel like that could conceivably work without good tags.

  1. invalid utf-8 sequence

There are a few files where rusqlite is claiming tags have invalid utf-8 sequences when it tries to convert them to String (same piece of code as above). I'm not sure what's going on here, Id3 tags can contain non-utf8 text (I think only 2.4 added a Unicode type?) but these values where added to the DB by blissify fine and they look fine in log messages and other tools. Here's an example (it's the title tag I think): https://litter.catbox.moe/87dlzk.mp3

Polochon-street commented 1 year ago

hi,

Again, thanks for reporting. It should definitely not behave like that. I cannot reproduce though - I've downloaded https://litter.catbox.moe/5k2sck.flac and plugged it into blissify, ran the update, and I can create playlists with it just fine.

I've set up a small test case on the branch fix-tag-bug to get it tested, would it be possible for you to check it out (https://github.com/Polochon-street/bliss-rs/pull/55/files) and to plug it a faulty song, to see if you can reproduce it? It would be easier with a minimum test case like this, then we can make sure there's no regression.

As a side-note, I'd be really interested if you had some insight after playing around with feature analysis, it's always nice to see things for a different perspective :)

toofar commented 1 year ago

I'm still looking into this. Been a bit busy with other stuff. I can't reproduce with that test case either, will poke around. Maybe something to do with $LANG or something.

Polochon-street commented 1 year ago

hi @toofar! Did you manage to reproduce? I have a bit more time right now, and it would be nice to investigate this :)

toofar commented 1 year ago

Hmm, I'll try to remember. I haven't made time to work on my ideas around this stuff in a while (I'm still using the last version that worked for me though!). I don't think I managed to reproduce it with that test case, or a few variations. So probably something to do with my setup (eg I'm accessing my library over NFS, ...). I didn't manage to pin it down though.

Polochon-street commented 1 year ago

alright - I just merged https://github.com/Polochon-street/bliss-rs/commit/97f563dd6e00a0d1e044a8a4e3e12a8a5768b1d7 that solves some issues where blissify would just stop making a playlist if files were deleted from the MPD database but not from the blissify one, so I guess it would be nice for you to have that in :smile:

Tell me if you can find anything when you have time, I'd be happy to help :)

Polochon-street commented 5 months ago

hi @toofar! Do you have any news on this? :)

toofar commented 5 months ago

No, I'm sorry! I still use blissify every day so I wish I could put some time into it. A project I'm involved with picked up a bunch and it's taking all my open source time.

I'm still using an old version, my bliss-rs checkout is from October 2022 (08aba11e39594b). So it doesn't look like I tried your update. I'll try to pencil in some time this or next weekend to try the latest commits and see if it works for me or if I can figure out what is going wrong.

As a side-note, I'd be really interested if you had some insight after playing around with feature analysis, it's always nice to see things for a different perspective :)

Ah, I haven't thought about that stuff for some time. My current wishes for improvement are around the playlist UX. I want to have like a waypoint[^1] playlist where I can generate a playlist from a song, when it finishes generate a new one based off one of the songs in the first playlist that I pick, and so on. Without any duplicates across any of them. The goal would be that I have a wandering roughly curated playlist that I can keep going throughout the day. I guess it would be pretty similar to the current interactive-playlist command but I think that is only one song at a time and doesn't have anything to prevent getting in loops (although I actually haven't played around with this at all). Currently I have a script around mpc and blissify that'll save the current playlist, run blissify, remove any songs in the new playlist that were also in the old one. Generally I make playlists of 10 or 30 songs depending on how safe the song I'm picking is and how much attention I think I'll be able to spare over the next hour or so.

Another thing I've wanted to try is to get it to focus on the specific aspect of a song I want to pick out to influence a playlist. You could maybe do this by weighting the features of a song but I think a UI to do that would be pretty technical (show the features, explain what they mean, have sliders, show the impact). Another way might be for the user to provide a set of songs to start a playlist, eg songs that they subjectively think are similar or have a similar them, and then average (or combine in some other way) the feature values of those starting songs to create the starting point for looking for similar songs. Hopefully that would emphasize their most common aspects and de-emphasize any aspects that made individual ones of those songs stand out but that you weren't interested in.

I have been saving all the playlists I've been generating so I can go back over them and rank them as "this looks like something I would put together" or "what is this crap?". And maybe get some insights from that. But dunno if I'll ever get to it.

Well, I'll stop rambling now.

[^1]: "waypoint" is terminology from Music IP Mixer (or "Music Magic Mixer" as I remember it) where a playlist eventually interpolates between two or more songs. I miss this program a lot! Although it's been a long time since I used it.There is some notes on the playlist types here https://web.archive.org/web/20160207050921/http://musicip.wikia.com/wiki/Help_-_Advanced#WaypointMix and some notes on a few other tweaks here https://web.archive.org/web/20160709173650/http://musicip.wikia.com/wiki/Help_-_Basics#Tips_and_Tricks

Polochon-street commented 5 months ago

Thanks for your complete answer, it's very useful to gauge which direction the project should take :)

I'm still using an old version, my bliss-rs checkout is from October 2022 (https://github.com/Polochon-street/bliss-rs/commit/08aba11e39594b7b2fd0a365eead7e23b9d2219a). So it doesn't look like I tried your update. I'll try to pencil in some time this or next weekend to try the latest commits and see if it works for me or if I can figure out what is going wrong.

No worries, just tell me later if you find anything so I can close this issue / investigate further.

Feature-wise, summing it up would be:

There is another big feature I've been thinking about, which is tuning the feature weights according to user input. The user would have a survey of 10-20 rounds (or more, if they want a better tuning), where they would pick the closest 2 songs between 3 songs. From that, you would learn a distance metric that's user-specific. I already have the python code for that survey thing, but I'd need to reimplement it in Rust / find a way to make it work.

Let's see!

toofar commented 5 months ago

There is another big feature I've been thinking about, which is tuning the feature weights according to user input. The user would have a survey of 10-20 rounds (or more, if they want a better tuning), where they would pick the closest 2 songs between 3 songs. From that, you would learn a distance metric that's user-specific.

Ah, cool! I can see it now. It's like one of those personality tests where you get presented with a bunch of scenarios and pick answers and then at the end it tells you that you are kawaii future bass!

toofar commented 3 months ago

72 and https://github.com/Polochon-street/blissify-rs/pull/53 inspired me to get my setup updated. So I've updated my server so it can run a newer rust, rebuilt blissify from the latest commit, reprocessed my whole library and tested generating playlists. Everything works fine, from my original report it looks like the errors were while generating playlists, and since that always loads everything from the DB if it works once then that issue of un-processable stuff in the DB must not be an issue.

Not sure what I did to cause it in the first place but it's gone now :see_no_evil:. Sorry for the delay! I was hesitant to change anything because it takes a fair few hours to re-process everything and I had a bunch of hacked up changes on a branch that I didn't want to take the time to rebase, but new features and a long weekend with plenty of chocolate got me through it :)