MediaMonkey not updating lyrics when rescanning files

Get answers about the current version of MediaMonkey 5

Moderator: Gurus

Chris4man
Posts: 2
Joined: Fri May 08, 2009 8:30 am

MediaMonkey not updating lyrics when rescanning files

Post by Chris4man »

I use MediaMonkey to manage my music library, but have only recently updated to the paid version so quite a bit of my music is missing lyrics.

I use my own program to play my music, this program also searches for missing lyrics and adds them to the file when it finds them. When this happens I update the MediaMonkey.ini file so that MediaMonkey rescans those files the next time it starts up. This all works fine with the missing lyrics appearing in MediaMonkey.

To make sure the lyrics are as clean as possible I do some processing on the lyrics to remove lines like "[Chorus]" and correct a few common spelling mistakes. This works fine in my program and the corrected lyrics are displayed. I also update the MediaMonkey.ini file to get MediaMonkey to rescan these files too.

However, when I start MediaMonkey even though I can see it's scanning the files it doesn't appear to update the lyrics it displays over the album art or when you selected the lyrics tab on the properties dialog for that track.

How can I force MediaMonkey to rescan files and update it's database where it already has the lyrics but they've changed in the file?

I'm running version 5.0.3.2627. MediaMonkey Gold (Lifetime)
Last edited by Chris4man on Tue Oct 18, 2022 7:58 am, edited 1 time in total.
Lowlander
Posts: 56586
Joined: Sat Sep 06, 2003 5:53 pm
Location: MediaMonkey 5

Re: MediaMonkey not updating lyrics when rescanning files

Post by Lowlander »

How do you modify the mediamonkey.ini file?

When you edit the files to fix things in the Lyrics is the Date Modified of the file changed? Which Build (Help > About) of MediaMonkey are you using?
Chris4man
Posts: 2
Joined: Fri May 08, 2009 8:30 am

Re: MediaMonkey not updating lyrics when rescanning files

Post by Chris4man »

I'm running version 5.0.3.2627. MediaMonkey Gold (Lifetime)

This is the code I've got for editing the .ini file. As I said, I can see MM (re)scanning the files when I next open it and the folder(s) I've added are in the list when I go to File -> Add/Rescan files to the library...

Code: Select all

        private void SetFolderToRescan(string folder)
        {
            if (!string.IsNullOrWhiteSpace(Properties.Settings.Default.MediaMonkeyIni))
            {
                string filePath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
                string mediaMonkeyIni = Path.Combine(filePath, Properties.Settings.Default.MediaMonkeyIni);
                if (File.Exists(mediaMonkeyIni))
                {
                    string input = File.ReadAllText(mediaMonkeyIni, Encoding.Unicode);

                    var parser = new IniDataParser();
                    IniData model = parser.Parse(input);

                    SectionData autoScan = model.Sections.FirstOrDefault(s => s.SectionName == "AutoScan");
                    if (autoScan == null)
                    {
                        autoScan = new SectionData("AutoScan");
                        model.Sections.Add(autoScan);
                        KeyData autoRemoveDeadLinks = new KeyData("autoRemoveDeadLinks")
                        {
                            Value = 0.ToString()
                        };
                        _ = autoScan.Keys.AddKey(autoRemoveDeadLinks);
                        KeyData autoRemoveAttributes = new KeyData("autoRemoveAttributes")
                        {
                            Value = 1.ToString()
                        };
                        _ = autoScan.Keys.AddKey(autoRemoveAttributes);
                        KeyData folderCount = new KeyData("FolderCount")
                        {
                            Value = 0.ToString()
                        };
                        _ = autoScan.Keys.AddKey(folderCount);
                    }

                    if (!autoScan.Keys.Any(f => f.Value.Equals(folder, StringComparison.CurrentCultureIgnoreCase)))
                    {
                        KeyData folderCount = autoScan.Keys.First(f => f.KeyName == "FolderCount");
                        if (int.TryParse(folderCount.Value, out int count))
                        {
                            count++;
                            folderCount.Value = count.ToString();
                            KeyData path = autoScan.Keys.FirstOrDefault(f => f.KeyName == $"Path{count}");
                            if (path == null)
                            {
                                path = new KeyData($"Path{count}");
                                _ = autoScan.Keys.AddKey(path);
                            }
                            path.Value = folder;
                            KeyData subFolders = autoScan.Keys.FirstOrDefault(f => f.KeyName == $"Subfolders{count}");
                            if (subFolders == null)
                            {
                                subFolders = new KeyData($"Subfolders{count}");
                                _ = autoScan.Keys.AddKey(subFolders);
                            }
                            subFolders.Value = "0";
                            KeyData scanOnStart = autoScan.Keys.FirstOrDefault(f => f.KeyName == $"ScanOnStart{count}");
                            if (scanOnStart == null)
                            {
                                scanOnStart = new KeyData($"ScanOnStart{count}");
                                _ = autoScan.Keys.AddKey(scanOnStart);
                            }
                            scanOnStart.Value = "1";
                            KeyData constantMonitoring = autoScan.Keys.FirstOrDefault(f => f.KeyName == $"ConstantMonitoring{count}");
                            if (constantMonitoring == null)
                            {
                                constantMonitoring = new KeyData($"ConstantMonitoring{count}");
                                _ = autoScan.Keys.AddKey(constantMonitoring);
                            }
                            constantMonitoring.Value = "0";

                            string output = "\r\n" + model.ToString().Replace(" = ", "=") + "\r\n";
                            File.WriteAllText(mediaMonkeyIni, output, Encoding.Unicode);

                            LyricsAdded = true;
                        }
                    }
                }
            }
        }
I'll have to wait until I get a track that needs edits before I can check whether the time stamp of the file is updated correctly. I assume it is as I have a process that does a backup of modified files and that's working as expected.
Post Reply