Search code examples
c#media-player

How to update Windows Media Player Album Art programatically in C#


I am writing an application to help with recording Vinyl albums to digital format, for use in Windows Media Player and Media Centre.

I have the recording and track splitting part done, including saving the track information with taglib.

I now need to add album art in a way that can be picked up by Media Player.

I notice Media Player saves the album art in 2 hidden/system files in the album folder, which include a GUID in the file name.

Is there some way I could work out the correct file name to use, and save my album art to the file? Or is there an interface to the Media Player library, so I can tell it what the album art is?


Solution

  • Windows Media Player (and every other player which displays album covers) uses tags to retrieve the pictures. The pictures are embedded within the music files in tags. The hidden images are just cache for the thumbnails to be displayed in the player. Also, other info like Title, Album, Year, etc. are done using the same process.

    The format of the tags differ with different formats.

    For MP3 files, it is called ID3.

    A suitable library would be TagLibSharp. You can get it here. It supports a wide range of formats besides MP3.

    Example of modifying the album art can be found here.

    Other examples can also be found here.

    And the most basic example can be found here.