Changeset 197
- Timestamp:
- 04/28/08 15:56:03
- Files:
-
- obskml/trunk/General/ObsKMLToGeoRSS.pl (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
obskml/trunk/General/ObsKMLToGeoRSS.pl
r196 r197 7 7 use constant MICROSOFT_PLATFORM => 0; 8 8 use constant USE_DEBUG_PRINTS => 1; 9 10 my $strEmail = 'dan@inlet.geol.sc.edu (Dan Ramage)'; 11 #use $strRSSXML = "<?xml version="1.0" encoding="UTF-8"?>\n 9 12 10 13 my %CommandLineOptions; … … 184 187 $strRow = '<channel>'; 185 188 print( $GeoRSSFile $strRow."\n" ); 186 $strRow = "<title>$platform_id latest observations</title>\n<link>$platform_url</link>\n<description>Latest observation data</description>\n"; 187 print( $GeoRSSFile $strRow ); 188 189 $strRow = '<item>'; 190 print( $GeoRSSFile $strRow."\n" ); 191 192 $strRow = "<title>$platform_id Latest observations</title>"; 193 print( $GeoRSSFile $strRow."\n" ); 194 195 #Convert the DB date into RFC822 as per the RSS spec. 189 190 my $strChannelDate; 196 191 my $strRFCDate = $datetime; 197 192 $strRFCDate =~ s/Z//; 193 $strRFCDate =~ s/T/ /; 198 194 if( !MICROSOFT_PLATFORM ) 199 195 { 196 #Convert the DB date into RFC822 as per the RSS spec. 200 197 $strRFCDate = `date --date=\"$strRFCDate\" -R`; 201 } 202 else 203 { 198 #Get the current RFC822 date to use as channel publication date. 199 $strChannelDate = `date -R`; 200 } 201 else 202 { 203 #Convert the DB date into RFC822 as per the RSS spec. 204 204 $strRFCDate = `\\UnixUtils\\usr\\local\\wbin\\date.exe --date=\"$strRFCDate\" -R`; 205 #Get the current RFC822 date to use as channel publication date. 206 $strChannelDate = `\\UnixUtils\\usr\\local\\wbin\\date.exe -R`; 205 207 } 206 208 chomp( $strRFCDate ); 209 chomp( $strChannelDate ); 210 211 $strRow = "<title>$platform_id latest observations</title>\n<description>Latest observation data</description>\n<pubDate>$strChannelDate</pubDate>\n<webMaster>$strEmail</webMaster>\n"; 212 print( $GeoRSSFile $strRow ); 213 214 #We must have a valid link to add the tag. 215 if( length( $platform_url ) > 0 ) 216 { 217 $strRow = "<link>$platform_url</link>\n"; 218 } 219 else 220 { 221 #We MUST have a link for the georss, so if the obsKML file didn't have one, we dummy something up for now. 222 $strRow = "<link>http://$platform_id</link>\n"; 223 } 224 print( $GeoRSSFile $strRow ); 225 226 ####################################################################################################################################### 227 # The <item> children begin here. 228 $strRow = '<item>'; 229 print( $GeoRSSFile $strRow."\n" ); 230 231 $strRow = "<title>$platform_id Latest observations</title>"; 232 print( $GeoRSSFile $strRow."\n" ); 233 207 234 $strRow = "<pubDate>$strRFCDate</pubDate>"; 208 235 print( $GeoRSSFile $strRow."\n" ); 209 236 210 $strRow = "<link>$platform_url</link>"; 237 #We must have a valid link to add the tag. 238 if( length( $platform_url ) > 0 ) 239 { 240 $strRow = "<link>$platform_url</link>\n"; 241 } 242 else 243 { 244 #We MUST have a link for the georss, so if the obsKML file didn't have one, we dummy something up for now. 245 $strRow = "<link>http://$platform_id</link>\n"; 246 } 247 print( $GeoRSSFile $strRow ); 248 249 $strRow = "<author>$strEmail</author>"; 211 250 print( $GeoRSSFile $strRow."\n" ); 212 251 … … 223 262 my $data_url = sprintf("%s",$observation->find('dataURL')); 224 263 #Create the row. we use html table formatting to help present the data in a more readable fashion. 225 $strDesc = $strDesc."<tr><td>$parameter:</td><td>$measurement</td><td>$uom</td><td>Depth: $depth </td></tr>\n"; 264 #$strDesc = $strDesc."<tr><td>$parameter:</td><td>$measurement</td><td>$uom</td><td>Depth</td><td>$depth </td></tr>\n"; 265 $strDesc = $strDesc."<tr><td>$parameter:</td><td>$measurement</td><td>$uom</td></tr>\n"; 226 266 } #obs 227 267 #We use the ![CDATA]] directive to tell teh parser not to mess with the contents so we can take advantage of the HTML table
