[Approved] Auto CDDB on CD (1 Viewer)

Scandermore

MP Donator
  • Premium Supporter
  • March 27, 2009
    46
    2
    Home Country
    Spain Spain
    Hello!
    I have experienced many times that when you put a CD, Mediaportal checks CDDB and if it finds two possible sources, you have to manually select one. This is very annoying (for me and for more users, as seen in the forums https://forum.team-mediaportal.com/general-support-51/disable-imdb-scan-cds-56539/#post424466) because sometimes you only want to put a CD, without switching on the TV, and forget about MP.
    Thus, I have made a little patch that makes that, when you have configured to play CD always upon insertion, it selects the first CDDB entry (if it finds more than one)
    Please take a look at it and include it in the next version (if all is correct), because is a very simple change, and I think many people would be pleased (me the first :p, because now, everytime a new version is released, I have to download the source code, modify the file, compile, etc...)

    Here is the patch file generated: (I don't know if it's OK to put it here, sorry if it's not the correct way)

    Code:
    Index: WindowPlugins/GUIMusic/GUIMusicFiles.cs
    ===================================================================
    --- WindowPlugins/GUIMusic/GUIMusicFiles.cs	(revision 22555)
    +++ WindowPlugins/GUIMusic/GUIMusicFiles.cs	(working copy)
    @@ -1811,10 +1811,18 @@
                           }
                           else if (cds.Length > 1)
                           {
    -                        if (_discId == cds[0].DiscId)
    +                        string m_audiocd = "No";
    +                        using (Profile.Settings XmlReader = new Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml")))
                             {
    -                          MusicCD = freedb.GetDiscDetails(cds[_selectedAlbum].Category, cds[_selectedAlbum].DiscId);
    +                            m_audiocd = XmlReader.GetValueAsString("audioplayer", "autoplay", "No");
                             }
    +
    +                        // m_audiocd --> If we have "Autoplay" set to "Yes", we get the first element of the list, to avoid user input.
    +                        if ((_discId == cds[0].DiscId) || (m_audiocd == "Yes"))
    +                        {
    +                          _discId = cds[0].DiscId;
    +                          MusicCD = freedb.GetDiscDetails(cds[0].Category, cds[0].DiscId);
    +                        }
                             else
                             {
                               _discId = cds[0].DiscId;

    :D

    aLeX
     

    infinite.loop

    Retired Team Member
  • Premium Supporter
  • December 26, 2004
    16,154
    4,133
    127.0.0.1
    Home Country
    Austria Austria
    Nice to see that this newly created subforum, and the threadprefixes were put to good use instantly. :D
     

    Users who are viewing this thread

    Top Bottom