static void ReadFileImage(iTunesAlbum folder, iTunesSong song) { if (folder.HasImage) return; string uncFilePath = GetUncFileName(song.Path); string folderPath = ResolveImage(uncFilePath, "folder", false); if (System.IO.File.Exists(folderPath)) folder.PrimaryImagePath = folderPath; string backPath = ResolveImage(uncFilePath, "backdrop", true); if (System.IO.File.Exists(backPath)) folder.BackdropImagePath = backPath; backPath = ResolveImage(Directory.GetParent(Path.GetDirectoryName(uncFilePath)).FullName, "backdrop", false); if (System.IO.File.Exists(backPath)) { if (folder.Parent != null) folder.Parent.BackdropImagePath = backPath; } }
private static iTunesSong BuildSong(iTunesArtist childArtistFolder, iTunesAlbum childAlbumFolder, Dictionary<string, string> data) { iTunesSong newSong = new iTunesSong(); newSong.SongName = data["Name"]; newSong.Name = data["Name"]; newSong.Path = GetUncFileName(data["Location"]); newSong.Id = newSong.Path.GetMD5(); childAlbumFolder.Songs.Add(newSong); childAlbumFolder.Parent = childArtistFolder; return newSong; }