-
Notifications
You must be signed in to change notification settings - Fork 7
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
[Discussion] Absolute Unit Refactor #93
Comments
After having spent several days writing code, trying API calls, and reading the OpenSubsonic API docs, I've come to the conclusion that it's going to be very difficult to get cohesive, reliable behavior across servers. This is the result of several things I've already mentioned, but I'm going to sum up those with some additional findings into a hopefully reasonably brief summary. I'm going to call the OpenSubsonic API "OSA" for my sanity; any criticisms I may appear to level at OSA must be tempered with the knowledge that they're trying to reverse-engineer around an API that comes with a host of problems.
The crux of the issue is that the documentation is ambiguous about the distinction between filesystem and metadata structure, and server implementations vary on how they interpret this. Subsonic originally assumed a directory structure of
In reality, users could put individual song files under the music folder, and create whatever hierarchy they wanted. When browsed through the metadata APIs -- which the documentation specifies is built from tag data -- then the filesysetm structure is irrelevant. This is a valid structure:
Some of these examples may be contrived and seem silly, but some seem (to me) entirely reasonable. If I have a Beetles anthology, the last folder would seem utterly sane. There are artists who release songs only as singles and not under albums, in which case the third subfolder makes sense. However, the view you see when you use different API calls -- file system vs metadata -- can be different and worse, can vary between servers. Mistagged songs might not be reachable at all through the metadata API calls, and wild directory structures can present lies to the use if browsed through the filesystem calls. So, the question I've been struggling with is: how do we reconcile and present a sane representation of the user's database, using the OSA, that works across servers and doesn't misplace songs? Which view do we choose as being the canonical view? Do we even try to? I'd dearly love ideas about this. I'm particularly concerned about mis- or incompletely-tagged songs. If a song is missing the "ARTIST", it won't show up in the metadata view since the top-level data structure there is "artists". I think gonic puts these songs under a meta "[UNKNOWN ARTIST]", and maybe Navidrome does, too. Theoretically, with the search function, users should still be able to get at these items. I'm least interested in trying to work around the file system view, because it isn't very consistent within the API, c.f. points 1 and 2 above. If I can confirm that untagged music files are somehow reachable through the metadata-oriented API calls, I'd like to completely ignore the music directory API calls in stmps and provide a browsing experience where the user can either browse hierarchically via metadata rooted at Artist, or use the Search tab. That's essentially where my I've spent several hours trying to build another browser using only Really happy to get some feedback and ideas on this. As an aside, I pop out of this filesystem-browser branch to pick off bugs and odd behaviors where Navidrome and Gonic don't behave the same, and those continue to get pushed to the |
Not entirely true. Its basically useless in most cases and isn't an object that can be fetched in any sense, but it is accepted by getArtists, getAlbumList, and getIndexes. MusicFolders do not correspond to subdirectories and its only purpose to restrict browsing to a single root folder if you configure the server to use multiple. To confuse things even more, there's this thread. Apparently getIndexes returns an "artist" object and is not supposed to represent actual artists in terms of metadata. Which corroborates with navidrome:
The object is an
At the song level, using the parent as the album should work since that's basically the same compromise gonic makes for subsonic compatability. This is a gonic thing specifically, so not entirely correct to use it for metadata:
I'd probably just pretend metadata doesn't even exist in the filesystem-viewer. Its more accurate to say that an |
The branch xxxserxxx contains a massive refactoring aimed to address a number of fundamental design issues in stmp (inherited by stmps). I intend this issue to be a discussion thread about it.
[..]
until the Entity column looked like the Artists column.subsonic
library were named with the conventionSubsonicXXXX
; this is considered poor Go form, where type and method names are not supposed to repeat the code structure.SubsonicResponse
pointer, which could be any one of several subtypes depending on the data from which it was unmarshalled. In Go, this sort of situation is hard to solve and requires either much code and data duplication or type-unsafeness. It is not solvable with generics (most problems generics are designed to address are not addressable with Go generics). Regardless, the library exacerbated this by having all methods, regardless of subtype, returnSubsonicResponse
structs, leaving type checking to the caller. This was error-prone.Thus, the xxxserxxx branch. The very first commit addressed issues 1-3:
Subsonic
prefixes from types; the unnecessarily repetitivesubsonic.SubsonicArtist
becamesubsonic.Artist
.GetArtist()
returns anArtist
;GetAlbum()
returns anAlbum
.BrowserPage
now operates entirely on the metadata methods, eschewing where possible the Directory and Index functions. This enforces consistency across the application. Almost all of the rest of the pages and code already used the metadata functions, so the biggest impact was onBrowserPage
.Following commits are of four sorts:
i
#90 (code provided by @mahmed2000; I just created the branch and submitted the PR)Sort
calls.At the point of commit 3359cc5, changes fall into the first two categories. My next activities on this branch are the following -- the first two items are my first priority; the rest are in no particular order:
/
should work in the Entities column, and also in the playlists, search, and genre search pagesI want a way to make managing these merges easier. @spezifisch is often busy for periods of time, and I have spurts of productivity, and it's easy for me to pile up several non-trivial PRs that become overwhelming and hard to merge. I've been using jujutsu on my desktop, and it really does massively improve over git's notoriously terrible merging, and is nearly as easy as Mercurial to work with... but that doesn't address the fundamental procedural issue. My solution, at the moment, is to keep my own "main" -- that's this xxxserxxx branch. I still do not want to hard-fork stmps, so I'm open to suggestions.
BTW, I'd like to try to recruit @mahmed2000, who obviously has a better handle on tview than myself and has already been immensely helpful; having another contributor would be fantastic, and from what I've seen, they'd bring a lot of value.
There's a lot of discussion that includes history and observations in #85.
The text was updated successfully, but these errors were encountered: