SubmarinerApp / Submariner

A Subsonic client for macOS
https://submarinerapp.com
BSD 3-Clause "New" or "Revised" License
123 stars 3 forks source link

Playlist does not sync, and weird UI behavior #146

Closed dxlr8r closed 11 months ago

dxlr8r commented 11 months ago

Even when I right click on the server and choose "Reload Server", playlist name, content and order remains the same even if one or more of those are changed on the server.

Also when right clicking on the metadata bar(?), Downloaded appears many times:

Screenshot 2023-07-24 at 20 37 25
NattyNarwhal commented 11 months ago

Looks like I forgot the bit that commits the playlists to the server in GH-116.

I also do see the duplicated item in the header right-click menu, though both correspond to the same ID. What version of macOS are you on?

Screenshot 2023-07-24 at 4 14 00 PM
dxlr8r commented 11 months ago

Apple M1, Ventura 13.1. It used to be 2x here as well, but have increased, no idea why :P

NattyNarwhal commented 11 months ago

I have an overhaul of the server playlist code pushed to Git which should fix your issue. Next is figuring out what's up with table columns.

Columns: (
    "<NSTableColumn: 0x6000035c9ea0> identifier: AutomaticTableColumnIdentifier.0 width: 25 hidden: NO",
    "<NSTableColumn: 0x6000035c9f10> identifier: AutomaticTableColumnIdentifier.1 width: 150 hidden: NO",
    "<NSTableColumn: 0x6000035c9f80> identifier: AutomaticTableColumnIdentifier.2 width: 60 hidden: NO",
    "<NSTableColumn: 0x6000035c9ff0> identifier: AutomaticTableColumnIdentifier.3 width: 100 hidden: NO",
    "<NSTableColumn: 0x6000035ca060> identifier: AutomaticTableColumnIdentifier.4 width: 100 hidden: NO",
    "<NSTableColumn: 0x6000035cbcd0> identifier: AutomaticTableColumnIdentifier.5 width: 100 hidden: NO",
    "<NSTableColumn: 0x6000035cbd40> identifier: online width: 16 hidden: NO",
    "<NSTableColumn: 0x6000035cbd40> identifier: online width: 16 hidden: NO",
    "<NSTableColumn: 0x6000035cbe20> identifier: rating width: 421.5 hidden: NO",
    "<NSTableColumn: 0x6000035cbd40> identifier: online width: 16 hidden: NO",
    "<NSTableColumn: 0x6000035cbdb0> identifier: online width: 10 hidden: NO"
)

This is eliciting a 🤨 right now...

NattyNarwhal commented 11 months ago

As a workaround, try:

% defaults delete fr.read-write.Submariner "NSTableView Columns v3 PlaylistTable"
% defaults delete fr.read-write.Submariner "NSTableView Sort Ordering v2 PlaylistTable"
% defaults delete fr.read-write.Submariner "NSTableView Sort Ordering v2 PlaylistTable"

This resets the table back to its default state. I think it's my table header code not doing something right. The good news is in macOS 14, hiding table headers in a drop-down is now a system-wide API, so we can just drop this code in 14.

NattyNarwhal commented 11 months ago

Technical notes on trying to figure this out follow:

The more I look at this, the more I think it's an AppKit bug, or something in the playlist table nib is fouled up and confusing it, since it's the only one that's broken (Could be both!). I've disconnected the code that does the menu setup, and found the playlist table header still gets mangled. Every time you restart the app, it grows:

calvin@anika Submariner % defaults read fr.read-write.Submariner "NSTableView Columns v3 PlaylistTable"  
{length = 1607, bytes = 0x62706c69 73743030 d4010203 04050607 ... 00000000 00000453 }
calvin@anika Submariner % defaults read fr.read-write.Submariner "NSTableView Columns v3 PlaylistTable"
{length = 1662, bytes = 0x62706c69 73743030 d4010203 04050607 ... 00000000 00000474 }
calvin@anika Submariner % defaults read fr.read-write.Submariner "NSTableView Columns v3 PlaylistTable"
{length = 2033, bytes = 0x62706c69 73743030 d4000100 02000300 ... 00000000 000005d1 }

It seems to peak at 2171 bytes. I'm not sure what changes structurally. The initial one NSTableView is likely messed up anyways, so it probably doesn't matter too much. Converting the binary plists to XML and diffing them isn't too enlightening as I don't have NSKeyedArchiver committed to memory.

What I do find interesting is the NSTableView Columns v3 (with the autosave name after) is new-ish. I haven't seen anything about NSTableView autosave data schema changes.... or anything about autosave internals, for that matter. It seems hidden columns are persisted in both v2 and v3, though I don't know what the difference there is. (I did find a hidden defaults key in AppKit called NSTableViewCanUseColumnsAutoSaveNameV3 - that forces V2, which is also broken).