示例#1
0
        public void Process(NodeAlbum aNode)
        {
            musicAlbum metadata = new musicAlbum();

            SetContainerMetadata(metadata, aNode);

            LibraryItem albumArtItem = null;

            foreach (NodeItem item in aNode.ItemList)
            {
                LibraryItem libItem = item.LibraryItem;
                if (libItem.AlbumArtId != null)
                {
                    albumArtItem = libItem;
                    break;
                }
            }

            if (albumArtItem != null)
            {
                string filename = iLibrary.GetAlbumArtFilenameNoExt(albumArtItem.AlbumArtId) + albumArtItem.AlbumArtExt;
                try
                {
                    string albumArtUri = iSupport.VirtualFileSystem.Uri(filename);
                    metadata.AlbumArtUri.Add(albumArtUri);
                }
                catch (HttpServerException) { }
            }

            iMetadata = metadata;
        }
示例#2
0
        public void Process(NodeAlbum aNode)
        {
            try
            {
                // find the ID of the track containing the album art
                string albumArtId  = null;
                string albumArtExt = null;

                foreach (NodeItem item in aNode.ItemList)
                {
                    LibraryItem libItem = item.LibraryItem;

                    // obtain the 3 digits for the folder hierarchy where the artwork file
                    // for this track will reside
                    uint[] d = iLibrary.GetAlbumArtFilenameDigits(libItem.PersistentId);
                    if (d == null)
                    {
                        continue;
                    }

                    List <string> l = iFileDict[d[0]][d[1]][d[2]];

                    // check if the artwork file exists for this track
                    string filename = iLibrary.GetAlbumArtFilenameNoExt(libItem.PersistentId);
                    if (l.IndexOf(filename + ".itc") != -1)
                    {
                        albumArtId  = libItem.PersistentId;
                        albumArtExt = ".itc";
                        break;
                    }
                    else if (l.IndexOf(filename + ".itc2") != -1)
                    {
                        albumArtId  = libItem.PersistentId;
                        albumArtExt = ".itc2";
                        break;
                    }
                }

                // now set the album art ID for each track
                if (albumArtId != null)
                {
                    foreach (NodeItem item in aNode.ItemList)
                    {
                        LibraryItem libItem = item.LibraryItem;
                        libItem.AlbumArtId  = albumArtId;
                        libItem.AlbumArtExt = albumArtExt;
                    }
                }
            }
            catch (Exception e)
            {
                UserLog.WriteLine(DateTime.Now + ": iTunes plugin: error scanning album art - skipping album: " + aNode.Name + ", " + e.Message);
            }
        }