aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-06-27 20:08:29 +0000
committerJustin Clarke Casey2008-06-27 20:08:29 +0000
commit810d3da2b9e90ca52bfaf9b03233fcda6181ec8e (patch)
tree9adfbafbc9c3396f1b6dfd532761ef8c6be9c0d7
parentmove along, nothing to see here. just a couple of lazy variables. (diff)
downloadopensim-SC-810d3da2b9e90ca52bfaf9b03233fcda6181ec8e.zip
opensim-SC-810d3da2b9e90ca52bfaf9b03233fcda6181ec8e.tar.gz
opensim-SC-810d3da2b9e90ca52bfaf9b03233fcda6181ec8e.tar.bz2
opensim-SC-810d3da2b9e90ca52bfaf9b03233fcda6181ec8e.tar.xz
* Experiment with not bothering with a seperate assets metadata file - extract necessary minimum metadata from asset filenames
* Make all file extensions single - double extensions look ugly and probably aren't good for Windows
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Environment/Modules/World/Archiver/ArchiveConstants.cs48
-rw-r--r--OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs51
-rw-r--r--OpenSim/Region/Environment/Modules/World/Archiver/AssetsArchiver.cs2
3 files changed, 69 insertions, 32 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveConstants.cs b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveConstants.cs
index 843dd0c..0766c95 100644
--- a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveConstants.cs
+++ b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveConstants.cs
@@ -59,50 +59,50 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
59 static ArchiveConstants() 59 static ArchiveConstants()
60 { 60 {
61 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Animation] = ".bvh"; 61 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Animation] = ".bvh";
62 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Bodypart] = ".bpt.txt"; 62 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Bodypart] = ".bpt";
63 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.CallingCard] = ".ccd.txt"; 63 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.CallingCard] = ".ccd";
64 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Clothing] = ".clo.txt"; 64 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Clothing] = ".clo";
65 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Folder] = ".fld.txt"; // Not sure if we'll ever see this 65 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Folder] = ".fld"; // Not sure if we'll ever see this
66 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Gesture] = ".gst.txt"; 66 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Gesture] = ".gst";
67 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.ImageJPEG] = ".jpg"; 67 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.ImageJPEG] = ".jpg";
68 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.ImageTGA] = ".img.tga"; 68 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.ImageTGA] = ".imgtga";
69 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.LostAndFoundFolder] = ".lff.txt"; // Not sure if we'll ever see this 69 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.LostAndFoundFolder] = ".lfd"; // Not sure if we'll ever see this
70 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.LSLBytecode] = ".lso"; 70 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.LSLBytecode] = ".lso";
71 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.LSLText] = ".lsl"; 71 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.LSLText] = ".lsl";
72 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Notecard] = ".ncd.txt"; 72 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Notecard] = ".ncd";
73 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Object] = ".obj.xml"; 73 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Object] = ".oob";
74 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.RootFolder] = ".rof.txt"; // Not sure if we'll ever see this 74 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.RootFolder] = ".rfd"; // Not sure if we'll ever see this
75 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Script] = ".spt"; // Not sure if we'll ever see this 75 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Script] = ".spt"; // Not sure if we'll ever see this
76 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Simstate] = ".sst"; // Not sure if we'll ever see this 76 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Simstate] = ".sst"; // Not sure if we'll ever see this
77 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.SnapshotFolder] = ".ssf.txt"; // Not sure if we'll ever see this 77 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.SnapshotFolder] = ".sfd"; // Not sure if we'll ever see this
78 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Sound] = ".ogg"; 78 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Sound] = ".ogg";
79 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.SoundWAV] = ".wav"; 79 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.SoundWAV] = ".wav";
80 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Texture] = ".jp2"; 80 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Texture] = ".jp2";
81 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.TextureTGA] = ".tga"; 81 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.TextureTGA] = ".tga";
82 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.TrashFolder] = ".trf.txt"; // Not sure if we'll ever see this 82 ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.TrashFolder] = ".tfd"; // Not sure if we'll ever see this
83 83
84 EXTENSION_TO_ASSET_TYPE[".bvh"] = (sbyte)AssetType.Animation; 84 EXTENSION_TO_ASSET_TYPE[".bvh"] = (sbyte)AssetType.Animation;
85 EXTENSION_TO_ASSET_TYPE[".bpt.txt"] = (sbyte)AssetType.Bodypart; 85 EXTENSION_TO_ASSET_TYPE[".bpt"] = (sbyte)AssetType.Bodypart;
86 EXTENSION_TO_ASSET_TYPE[".ccd.txt"] = (sbyte)AssetType.CallingCard; 86 EXTENSION_TO_ASSET_TYPE[".ccd"] = (sbyte)AssetType.CallingCard;
87 EXTENSION_TO_ASSET_TYPE[".clo.txt"] = (sbyte)AssetType.Clothing; 87 EXTENSION_TO_ASSET_TYPE[".clo"] = (sbyte)AssetType.Clothing;
88 EXTENSION_TO_ASSET_TYPE[".fld.txt"] = (sbyte)AssetType.Folder; 88 EXTENSION_TO_ASSET_TYPE[".fld"] = (sbyte)AssetType.Folder;
89 EXTENSION_TO_ASSET_TYPE[".gst.txt"] = (sbyte)AssetType.Gesture; 89 EXTENSION_TO_ASSET_TYPE[".gst"] = (sbyte)AssetType.Gesture;
90 EXTENSION_TO_ASSET_TYPE[".jpg"] = (sbyte)AssetType.ImageJPEG; 90 EXTENSION_TO_ASSET_TYPE[".jpg"] = (sbyte)AssetType.ImageJPEG;
91 EXTENSION_TO_ASSET_TYPE[".img.tga"] = (sbyte)AssetType.ImageTGA; 91 EXTENSION_TO_ASSET_TYPE[".imgtga"] = (sbyte)AssetType.ImageTGA;
92 EXTENSION_TO_ASSET_TYPE[".lff.txt"] = (sbyte)AssetType.LostAndFoundFolder; 92 EXTENSION_TO_ASSET_TYPE[".lfd"] = (sbyte)AssetType.LostAndFoundFolder;
93 EXTENSION_TO_ASSET_TYPE[".lso"] = (sbyte)AssetType.LSLBytecode; 93 EXTENSION_TO_ASSET_TYPE[".lso"] = (sbyte)AssetType.LSLBytecode;
94 EXTENSION_TO_ASSET_TYPE[".lsl"] = (sbyte)AssetType.LSLText; 94 EXTENSION_TO_ASSET_TYPE[".lsl"] = (sbyte)AssetType.LSLText;
95 EXTENSION_TO_ASSET_TYPE[".ncd.txt"] = (sbyte)AssetType.Notecard; 95 EXTENSION_TO_ASSET_TYPE[".ncd"] = (sbyte)AssetType.Notecard;
96 EXTENSION_TO_ASSET_TYPE[".obj.xml"] = (sbyte)AssetType.Object; 96 EXTENSION_TO_ASSET_TYPE[".oob"] = (sbyte)AssetType.Object;
97 EXTENSION_TO_ASSET_TYPE[".rof.txt"] = (sbyte)AssetType.RootFolder; 97 EXTENSION_TO_ASSET_TYPE[".rfd"] = (sbyte)AssetType.RootFolder;
98 EXTENSION_TO_ASSET_TYPE[".spt"] = (sbyte)AssetType.Script; 98 EXTENSION_TO_ASSET_TYPE[".spt"] = (sbyte)AssetType.Script;
99 EXTENSION_TO_ASSET_TYPE[".sst"] = (sbyte)AssetType.Simstate; 99 EXTENSION_TO_ASSET_TYPE[".sst"] = (sbyte)AssetType.Simstate;
100 EXTENSION_TO_ASSET_TYPE[".ssf.txt"] = (sbyte)AssetType.SnapshotFolder; 100 EXTENSION_TO_ASSET_TYPE[".sfd"] = (sbyte)AssetType.SnapshotFolder;
101 EXTENSION_TO_ASSET_TYPE[".ogg"] = (sbyte)AssetType.Sound; 101 EXTENSION_TO_ASSET_TYPE[".ogg"] = (sbyte)AssetType.Sound;
102 EXTENSION_TO_ASSET_TYPE[".wav"] = (sbyte)AssetType.SoundWAV; 102 EXTENSION_TO_ASSET_TYPE[".wav"] = (sbyte)AssetType.SoundWAV;
103 EXTENSION_TO_ASSET_TYPE[".jp2"] = (sbyte)AssetType.Texture; 103 EXTENSION_TO_ASSET_TYPE[".jp2"] = (sbyte)AssetType.Texture;
104 EXTENSION_TO_ASSET_TYPE[".tga"] = (sbyte)AssetType.TextureTGA; 104 EXTENSION_TO_ASSET_TYPE[".tga"] = (sbyte)AssetType.TextureTGA;
105 EXTENSION_TO_ASSET_TYPE[".trf.txt"] = (sbyte)AssetType.TrashFolder; 105 EXTENSION_TO_ASSET_TYPE[".tfd"] = (sbyte)AssetType.TrashFolder;
106 } 106 }
107 } 107 }
108} 108}
diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs
index 8d882ea..8f73c2c 100644
--- a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs
+++ b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs
@@ -61,7 +61,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
61 protected void DearchiveRegion() 61 protected void DearchiveRegion()
62 { 62 {
63 TarArchiveReader archive = new TarArchiveReader(m_loadPath); 63 TarArchiveReader archive = new TarArchiveReader(m_loadPath);
64 AssetsDearchiver dearchiver = new AssetsDearchiver(m_scene.AssetCache); 64 //AssetsDearchiver dearchiver = new AssetsDearchiver(m_scene.AssetCache);
65 65
66 List<string> serialisedSceneObjects = new List<string>(); 66 List<string> serialisedSceneObjects = new List<string>();
67 string filePath = "ERROR"; 67 string filePath = "ERROR";
@@ -76,14 +76,14 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
76 { 76 {
77 serialisedSceneObjects.Add(m_asciiEncoding.GetString(data)); 77 serialisedSceneObjects.Add(m_asciiEncoding.GetString(data));
78 } 78 }
79 else if (filePath.Equals(ArchiveConstants.ASSETS_METADATA_PATH)) 79// else if (filePath.Equals(ArchiveConstants.ASSETS_METADATA_PATH))
80 { 80// {
81 string xml = m_asciiEncoding.GetString(data); 81// string xml = m_asciiEncoding.GetString(data);
82 dearchiver.AddAssetMetadata(xml); 82// dearchiver.AddAssetMetadata(xml);
83 } 83// }
84 else if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH)) 84 else if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH))
85 { 85 {
86 dearchiver.AddAssetData(filePath, data); 86 ResolveAssetData(filePath, data);
87 } 87 }
88 } 88 }
89 89
@@ -103,5 +103,42 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
103 103
104 m_log.InfoFormat("[ARCHIVER]: Successfully loaded archive"); 104 m_log.InfoFormat("[ARCHIVER]: Successfully loaded archive");
105 } 105 }
106
107 /// <summary>
108 /// Resolve a new piece of asset data against stored metadata
109 /// </summary>
110 /// <param name="assetFilename"></param>
111 /// <param name="data"></param>
112 /// <returns>true if asset was successfully loaded, false otherwise</returns>
113 protected bool ResolveAssetData(string assetPath, byte[] data)
114 {
115 // Right now we're nastily obtaining the lluuid from the filename
116 string filename = assetPath.Remove(0, ArchiveConstants.ASSETS_PATH.Length);
117 string extension = filename.Substring(filename.LastIndexOf("."));
118 string uuid = filename.Remove(filename.Length - extension.Length);
119
120 if (ArchiveConstants.EXTENSION_TO_ASSET_TYPE.ContainsKey(extension))
121 {
122 sbyte assetType = ArchiveConstants.EXTENSION_TO_ASSET_TYPE[extension];
123
124 m_log.DebugFormat("[ARCHIVER]: Importing asset {0}", filename);
125
126 AssetBase asset = new AssetBase(new LLUUID(uuid), String.Empty);
127 asset.Type = assetType;
128 asset.Data = data;
129
130 m_scene.AssetCache.AddAsset(asset);
131
132 return true;
133 }
134 else
135 {
136 m_log.ErrorFormat(
137 "[DEARCHIVER]: Tried to dearchive data with path {0} with an unknown type extension {1}",
138 assetPath, extension);
139
140 return false;
141 }
142 }
106 } 143 }
107} 144}
diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/AssetsArchiver.cs b/OpenSim/Region/Environment/Modules/World/Archiver/AssetsArchiver.cs
index 4922362..ed07c9f 100644
--- a/OpenSim/Region/Environment/Modules/World/Archiver/AssetsArchiver.cs
+++ b/OpenSim/Region/Environment/Modules/World/Archiver/AssetsArchiver.cs
@@ -58,7 +58,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
58 /// <param name="archive"></param> 58 /// <param name="archive"></param>
59 public void Archive(TarArchiveWriter archive) 59 public void Archive(TarArchiveWriter archive)
60 { 60 {
61 WriteMetadata(archive); 61 //WriteMetadata(archive);
62 WriteData(archive); 62 WriteData(archive);
63 } 63 }
64 64