Commits

Gaurav Toshniwal committed df88243 Merge

fow https

  • Participants
  • Parent commits 19abb81, 99b0e83

Comments (0)

Files changed (3)

 <?xml version="1.0" ?>
 <MchDtl AwTm="New Zealand" AwTmId="5" Evt="New Zealand in West Indies, 2 Test Series, 2012" HmTm="West Indies" HmTmId="9" LsUpDt="7/30/2012" LsUpTm="1:56:56 AM" MchId="92854" Vnu="Sir Vivian Richards Stadium, Antigua">
-  <CrtInns>
+  <CrtInns AltdOvs="46" BtTm="West Indies" BtTmId="9" BwTm="New Zealand" BwTmId="5" Trg="102">
     <Det Ovs="19.3" RR="5.23" Tot="102" Wkts="1"/>
     <Bats>
       <Bat Bls="49" BtId="1201" Rn="64">
 
 matchdetail = soup.findAll('Matchdetail')
 
-current_inning_key = {
+current_inning_prefix = {
 	'First' : 'FI',
 	'Second': 'SI',
 	'Third' : 'TI',
 	'Fourth': 'FOI',
 }
-batsmen = soup.findAll(current_inning_key[matchdetail[0]['currentinning']]+'Batsman',Howout='not out')
+current_inning_key = {
+	'First' : 'FirstInnings',
+	'Second': 'SecondInnings',
+	'Third' : 'ThirdInnings',
+	'Fourth': 'FourthInnings',
+}
+
+batsmen = soup.findAll(current_inning_prefix[matchdetail[0]['currentinning']]+'Batsman',Howout='not out')
 soup.findAll(Bowling="Yes")
 
 #create xml document structure
 for key in Matchdetail_attrs:
 	Matchdetail.setAttribute(Matchdetail_attrs[key],matchdetail[0][key])
 
+currentinning = soup.findAll(current_inning_key[matchdetail[0]['currentinning']])
 Currentinnings = doc.createElement("CrtInns")
 Matchdetail.appendChild(Currentinnings)
+for key in Currentinnings_attrs:
+	Currentinnings.setAttribute(Currentinnings_attrs[key],currentinning[0][key])
 
 foiequation = soup.findAll('FOIEquation')
 FOIEquation = doc.createElement("Det")
 Currentinnings.appendChild(Currentbowlers)
 Currentbowlers.appendChild(doc.createTextNode(''))
 
-f=open('score.xml','r+')
+try:
+	f=open('score.xml','r+')
+except:
+	f=open('score.xml','w')
 f.write(doc.toprettyxml(indent="  "))
 f.close()
-print doc.toprettyxml(indent="  ")
+#print doc.toprettyxml(indent="  ")
 ));
 $facebook->setFileUploadSupport(true);
 $image = base64_to_jpeg( $your_base64_string, 'tmp.png' );
-$args = array('message' => 'Some message','access_token' => $facebook->getAccessToken(),'image' => '@' . realpath( $image ));
 //$args = array('message' => 'Some message','access_token' => $facebook->getAccessToken());
+$args = array('message' => 'Some message','access_token' => $facebook->getAccessToken(),'image' => '@' . realpath( $image );
+);
 echo $args['access_token'];
 echo realpath($image);
-$args['image'] = '@' . realpath( $image );
 $data = $facebook->api('/me/photos', 'post', $args);
 unlink($image);
 ?>