Alexco500 / sidplay5

Sidplay for macOS
GNU General Public License v2.0
49 stars 5 forks source link

Search and intelligent playlists always yield no results #26

Open gr8bit opened 9 months ago

gr8bit commented 9 months ago

I have the simplest, yet strangest problem with Sidplay: searching does not work. Whenever I enter something in the search bar and whatever field I select (using the zoom glass icon), the list is always empty.

On a side note, all the song lengths in my collection are 0:00. Maybe that points to a specific error?

What I tried:

I use version 5.1.0 (74) on a MacBook Pro M1 Max.

Alexco500 commented 9 months ago

Strange. Can you please open a Terminal and check what mdimport -L | grep SID shows?

As for the length of 0:00. That sounds like Sidplay can't parse the songlength db files. Inside your collection folder there should be a folder DOCUMENTS and inside that a Songlengths.md5 (that's the new db format) and/or a Songlengths.txt (old db format) file. Can you please check if these are available?

gr8bit commented 9 months ago

Hi @Alexco500, it lists:

% mdimport -L | grep SID
"/Applications/SIDPLAY.app/Contents/Library/Spotlight/SIDMusic.mdimporter"

which is the App's correct location. I also followed Apple's instuctions on how to rebuild a folder's spotlight index for the C64music folder, but after many (~12) minutes of indexing

Bildschirmfoto 2023-11-19 um 18 33 21

the search still does not work.

Bildschirmfoto 2023-11-19 um 18 37 37
Alexco500 commented 9 months ago

Looks like macOS is still indexing. Question is why and if that is related to Sidplay. Can you please remove sidplay (zip it and move to trash, empty trash). And rebuild the index for your entire system? If that completes, unzip Sidplay again, and see how far indexing goes then.

gr8bit commented 9 months ago

I waited for the indexing to finish, sorry for not mentioning that. I'm letting it reindex the whole system now.

Edit: reindex complete, no change in behavior. :(

Alexco500 commented 9 months ago

Reindex with or without Sidplay installed? Is Spotlight working at all? What happens if you enter mdfind -name Commando.sid It should show some sid files below your C64Music folder.

If Sidplay's plugin is working correctly, this should also show some sid files: mdfind "kMDItemAuthors == '*Hubbard*'"

gr8bit commented 5 months ago

Sorry for the late reply, but the problem persists even with the latest version. I reindexed with Sidplay installed.

% mdfind -name Commando.sid
2024-03-19 22:07:55.765 mdfind[89588:6703772] [UserQueryParser] Loading keywords and predicates for locale "de_DE"
2024-03-19 22:07:55.765 mdfind[89588:6703772] [UserQueryParser] Loading keywords and predicates for locale "de"
/Users/luke/Music/C64music/MUSICIANS/B/Blues_Muz/Gallefoss_Glenn/Commando.sid
/Users/luke/Music/C64music/MUSICIANS/P/Patfield_Kent/Bionic_Commando.sid
/Users/luke/Music/C64music/MUSICIANS/P/Patfield_Kent/Commando.sid
/Users/luke/Music/C64music/MUSICIANS/B/Benedens_Oliver/Little_Commando.sid
/Users/luke/Music/C64music/MUSICIANS/C/Cadaver/Commando.sid
/Users/luke/Music/C64music/MUSICIANS/F/Follin_Tim/Bionic_Commando.sid
/Users/luke/Music/C64music/MUSICIANS/G/Gilmore_Adam/Ninja_Commando.sid
/Users/luke/Music/C64music/MUSICIANS/H/Hubbard_Rob/Commando.sid
/Users/luke/Music/C64music/MUSICIANS/I/Isildur/Commando.sid
/Users/luke/Music/C64music/MUSICIANS/T/Tankard_Paul/Suburban_Commando.sid
/Users/luke/Music/C64music/MUSICIANS/X/Xiny6581/Mojo_Commando.sid

BUT:

% mdfind "kMDItemAuthors == '*Hubbard*'"
%

...no results. Does that give you any hint?

gr8bit commented 5 months ago

@Alexco500 does the plugin need some access rights I have to give it manually?

Alexco500 commented 5 months ago

Hi, and sorry for late reply. At least this test here https://github.com/Alexco500/sidplay5/issues/26#issuecomment-2008142619 shows that Spotlight is working. So, we have

Strange. I have currently no clue, why the Sidplay plugin does not work.

gr8bit commented 5 months ago

As an additional piece of information: it works fine on my MBP i9 (same OS version, same SIDplay version but x86 CPU).

I reindexed the C64Music folder just like I did on my M1 and after a while it worked as expected:

% mdfind "kMDItemAuthors == '*Hubbard*'"
/Users/luke/Music/C64music/MUSICIANS/H/Hubbard_Rob/Lakers_vs_Celtics.sid
/Users/luke/Music/C64music/MUSICIANS/H/Hubbard_Rob/Mr_Meaner.sid
/Users/luke/Music/C64music/MUSICIANS/H/Hubbard_Rob/Off_the_Cuff.sid
/Users/luke/Music/C64music/MUSICIANS/H/Hubbard_Rob/Pacific_Coast.sid
/Users/luke/Music/C64music/MUSICIANS/H/Hubbard_Rob/Pygmies_Revenge.sid
/Users/luke/Music/C64music/MUSICIANS/H/Hubbard_Rob/Radio_ACE.sid
/Users/luke/Music/C64music/MUSICIANS/H/Hubbard_Rob/Rikky.sid
/Users/luke/Music/C64music/MUSICIANS/H/Hubbard_Rob/Rock_Tells_the_Tale.sid
/Users/luke/Music/C64music/MUSICIANS/H/Hubbard_Rob/Sun_Never_Shines.sid
/Users/luke/Music/C64music/MUSICIANS/H/Hubbard_Rob/Task_Force.sid
/Users/luke/Music/C64music/MUSICIANS/H/Hubbard_Rob/Formula_1_Simulator.sid
/Users/luke/Music/C64music/MUSICIANS/H/Hubbard_Rob/Master_of_Magic.sid
/Users/luke/Music/C64music/MUSICIANS/H/Hubbard_Rob/Hunter_Patrol.sid
/Users/luke/Music/C64music/MUSICIANS/H/Hubbard_Rob/Last_V8.sid
/Users/luke/Music/C64music/MUSICIANS/H/Hubbard_Rob/Chicken_Song.sid
/Users/luke/Music/C64music/MUSICIANS/H/Hubbard_Rob/Delta.sid
...

So I'm assuming it might have to do something with the architecture...? Is there a spotlight log I could look into for errors?

Alexco500 commented 4 months ago

No, I don't think so. My development Mac is a MacBook Pro M1, and here it simply works. BTW: do you still have the "song length 0" issue? On both Macs or only on the M1?

gr8bit commented 4 months ago

The song lengths are fine now, that was probably related to an old/corrupted HVSC...

gr8bit commented 4 months ago

I'm not into Mac development - is this the plugin responsible for adding spotlight info for SIDs?

% cd /Applications/SIDPLAY.app/Contents/Library/Spotlight/SIDMusic.mdimporter
% find .                                                                     
.
./Contents
./Contents/_CodeSignature
./Contents/_CodeSignature/CodeResources
./Contents/MacOS
./Contents/MacOS/SIDMusic
./Contents/Resources
./Contents/Resources/en.lproj
./Contents/Resources/en.lproj/InfoPlist.strings
./Contents/Resources/en.lproj/schema.strings
./Contents/Resources/schema.xml
./Contents/Resources/version.plist
./Contents/Info.plist
%
Alexco500 commented 4 months ago

yes, exactly

gr8bit commented 4 months ago

Is there any way to test it directly, execute something or similar? Though SIDMusic is flagged executable, it is not directly it seems. Or does the "missing" de-locale (which I'd need) not fallback to en? Just brainstorming :(

Edit: look at that! I tried debugging the importer as described by Apple and look what it said:

% /usr/bin/mdimport -d3 -t ~/Music/C64music/MUSICIANS/S/Schneider_Markus/Magic_Disk_64_1990_03.sid
Imported '/Users/luke/Music/C64music/MUSICIANS/S/Schneider_Markus/Magic_Disk_64_1990_03.sid' of type 'com.yoyofr.modizer.sid' with no plugIn.
26 attributes returned
{
    ":MD:DeviceId" = 16777230;
    ":MD:kMDItemPath" = "/Users/luke/Music/C64music/MUSICIANS/S/Schneider_Markus/Magic_Disk_64_1990_03.sid";
    "_kMDItemContentChangeDate" = "2013-06-27 19:41:30 +0000";
    "_kMDItemCreationDate" = "2013-06-27 19:41:30 +0000";
    "_kMDItemCreatorCode" = 0;
    "_kMDItemDisplayNameWithExtensions" =     {
        "" = "Magic_Disk_64_1990_03.sid";
    };
    "_kMDItemFileName" = "Magic_Disk_64_1990_03.sid";
    "_kMDItemFinderFlags" = 0;
    "_kMDItemFinderLabel" = 0;
    "_kMDItemFromImporter" = 1;
    "_kMDItemIsExtensionHidden" = 0;
    "_kMDItemIsFromImporter" = 1;
    "_kMDItemOwnerGroupID" = 20;
    "_kMDItemOwnerUserID" = 501;
    "_kMDItemTypeCode" = 0;
    "com_apple_metadata_modtime" = 394054890;
    kMDItemContentCreationDate = "2013-06-27 19:41:30 +0000";
    kMDItemContentModificationDate = "2013-06-27 19:41:30 +0000";
    kMDItemContentType = "com.yoyofr.modizer.sid";
    kMDItemContentTypeTree =     (
        "com.yoyofr.modizer.sid",
        "public.data",
        "public.item"
    );
    kMDItemDateAdded = "2023-11-15 22:40:25 +0000";
    kMDItemDisplayName =     {
        "" = "Magic_Disk_64_1990_03.sid";
    };
    kMDItemDocumentIdentifier = 0;
    kMDItemKind =     {
        "" = "SID File";
        Base = "SID File";
        en = "SID File";
        fr = "SID File";
    };
    kMDItemLogicalSize = 2622;
    kMDItemPhysicalSize = 4096;
}
Alexco500 commented 4 months ago

Ah, awesome! This is how it should look like:

/usr/bin/mdimport -d3 -t ~/Music/C64music/MUSICIANS/S/Schneider_Markus/Magic_Disk_64_1990_03.sid Imported '/Users/alexc/Music/C64Music/MUSICIANS/S/Schneider_Markus/Magic_Disk_64_1990_03.sid' of type 'org.sidmusic.sidtune' with plugIn /Users/alexc/Library/Developer/Xcode/Archives/2023-08-29/SIDPLAY 29.08.23, 12.35.xcarchive/Submissions/9C748CFB-CE6D-4352-8618-644555769A1B/SIDPLAY.app/Contents/Library/Spotlight/SIDMusic.mdimporter. 32 attributes returned { ":MD:DeviceId" = 16777234; ":MD:kMDItemPath" = "/Users/alexc/Music/C64Music/MUSICIANS/S/Schneider_Markus/Magic_Disk_64_1990_03.sid"; "_kMDItemContentChangeDate" = "2013-06-27 19:41:30 +0000"; "_kMDItemCreationDate" = "2013-06-27 19:41:30 +0000"; "_kMDItemCreatorCode" = 0; "_kMDItemDisplayNameWithExtensions" = { "" = "Magic_Disk_64_1990_03.sid"; }; "_kMDItemFileName" = "Magic_Disk_64_1990_03.sid"; "_kMDItemFinderFlags" = 0; "_kMDItemFinderLabel" = 0; "_kMDItemFromImporter" = 1; "_kMDItemIsExtensionHidden" = 0; "_kMDItemIsFromImporter" = 1; "_kMDItemOwnerGroupID" = 20; "_kMDItemOwnerUserID" = 501; "_kMDItemTypeCode" = 0; "com_apple_metadata_modtime" = 394054890; kMDItemAuthors = ( "Markus Schneider" ); kMDItemComposer = "Markus Schneider"; kMDItemContentCreationDate = "2013-06-27 19:41:30 +0000"; kMDItemContentModificationDate = "2013-06-27 19:41:30 +0000"; kMDItemContentType = "org.sidmusic.sidtune"; kMDItemContentTypeTree = ( "org.sidmusic.sidtune", "public.data", "public.item", "public.message" ); kMDItemDateAdded = "2023-07-22 10:13:38 +0000"; kMDItemDisplayName = { "" = "Magic_Disk_64_1990_03.sid"; }; kMDItemDocumentIdentifier = 0; kMDItemKind = { "" = "PSID music file"; Base = "PSID music file"; en = "PSID music file"; }; kMDItemLogicalSize = 2622; kMDItemPhysicalSize = 4096; kMDItemTitle = "Magic Disk 64 (1990/03)"; "org_sidmusic_DefaultSubtune" = 1; "org_sidmusic_Released" = "1990 Magic Disk 64/CP Verlag"; "org_sidmusic_SubtuneCount" = 1; }

So it seems that another tool has already registered itself for sid files and that interferes somehow with Sidplay. Do you have Modizer (or something similar) installed? The key is com.yoyofr.modizer.sid.

gr8bit commented 4 months ago

Yes, I had Modizer installed (iPad App) for playing all sorts of mod-files. Removed it, checked mdimport debug:

    kMDItemContentType = "pl.rabidus.retrodebugger.sid";
    kMDItemContentTypeTree =     (
        "pl.rabidus.retrodebugger.sid",
        "public.data",
        "public.item"
    );

😝 Now it's Retro Debugger's turn it seems. I will remove it but next in line will probably be Vice.

Alexco500 commented 4 months ago

That's really interesting to see what kind of tools you have installed to handle SIDs ;-). But I think I need to find a way how the plugin works with other apps registering for the same file type...

gr8bit commented 4 months ago

Removed Retro Debugger, too, rebooted (! no change in mdimport output before reboot), and when I started mdimport to test the file again

mdimport -d3 -t ~/Music/C64music/MUSICIANS/S/Schneider_Markus/Magic_Disk_64_1990_09.sid

it returned the correct type!

It is now:

    kMDItemContentType = "org.sidmusic.sidtune";
    kMDItemContentTypeTree =     (
        "org.sidmusic.sidtune",
        "public.data",
        "public.item",
        "public.message"
    );

I still had to force reindexing the C64Music folder by adding it to the Spotlight exclusions in the settings, then removing that entry again, but I already got the first search results! Woohoo! Thanks a ton for your support, Alex!

I will now try to install Retro Debugger and Modizer again.

Alexco500 commented 4 months ago

I have to thank you for being so persistent to find the root cause of this. Please post the results here after you installed Retro Debugger and Modizer and rebooted.

gr8bit commented 4 months ago

Unfortunately, after installing Modizer and Retro Debugger and rebooting (!), the SID type is now back to

    kMDItemContentType = "pl.rabidus.retrodebugger.sid";
    kMDItemContentTypeTree =     (
        "pl.rabidus.retrodebugger.sid",
        "public.data",
        "public.item"
    );

😢 Now deleting Retro Debugger and rebooting (mdimport -d3 -t still shows its content type...).

Edit: after reboot, the Content Type is back to SIDplay, even with the Modizer app installed. What's interesting though, is that none of the "alternative" content types supplied an actual plugin, just the type. 🤷‍♂️

Alexco500 commented 4 months ago

I guess it's because they don't declare it in the correct way via UTI. I will install that Retro Debugger thing and try to come up with a solution.

Alexco500 commented 4 months ago

Can you please try the following: Install SIDPlay, then install Retro Debugger. On my system, all .sid files in the C64Music folder are now assigned to Retro Debugger with the icon. Quick Look and open with SIDPlay don't work. Now change the default app via Finder (file info window) back to SIDPlay for all .sid, everything works again, as if Retro Debugger is not installed. Is that the same for you?