Esempio n. 1
0
        /// <summary>
        /// Get the Album Artwork from Mediaportal folder
        /// </summary>
        /// <param name="mvArtistObject"></param>
        /// <returns></returns>
        private bool getMPAlbumArt(DBAlbumInfo mvAlbumObject)
        {
            logger.Debug("In Method: getMPAlbumArt(DBAlbumInfo mvAlbumObject)");
            bool found = false;

            string artist = string.Empty;
            string album  = mvAlbumObject.Album;

            List <DBTrackInfo> a1 = DBTrackInfo.GetEntriesByAlbum(mvAlbumObject);

            if (a1.Count > 0)
            {
                artist = a1[0].ArtistInfo[0].Artist;
            }

            string thumbFolder = Thumbs.MusicAlbum;
            string cleanTitle  = string.Format("{0}-{1}", MediaPortal.Util.Utils.MakeFileName(artist), MediaPortal.Util.Utils.MakeFileName(album));
            string filename    = thumbFolder + @"\" + cleanTitle + "L.jpg";

            if (File.Exists(filename))
            {
                found &= mvAlbumObject.AddArtFromFile(filename);
            }
            logger.Debug("In Method: getMPAlbumArt(DBAlbumInfo mvAlbumObject) filename: " + filename + " - " + found);
            return(found);
        }
Esempio n. 2
0
        /// <summary>
        /// Get the Album Artwork using the old method
        /// </summary>
        /// <param name="mvAlbumObject"></param>
        /// <returns></returns>
        private bool getOldAlbumArt(DBAlbumInfo mvAlbumObject)
        {
            logger.Debug("In Method getOldAlbumArt(DBAlbumInfo mv)");
            bool found = false;

            string        AlbumArtFolderPath = mvCentralCore.Settings.AlbumArtFolder;
            DirectoryInfo albumartFolder     = new DirectoryInfo(AlbumArtFolderPath);

            string safeName      = mvAlbumObject.Album.Replace(' ', '.').ToValidFilename();
            Regex  oldtrackRegex = new Regex("^{?" + Regex.Escape(safeName) + "}? \\[-?\\d+\\]\\.(jpg|png)");

            foreach (FileInfo currFile in albumartFolder.GetFiles())
            {
                if (oldtrackRegex.IsMatch(currFile.Name))
                {
                    found &= mvAlbumObject.AddArtFromFile(currFile.FullName);
                }
            }
            return(found);
        }