Commits

ont committed 9eb2acf

(f) fixing overwriting of card's info

Comments (0)

Files changed (1)

     def fetch( self ):
         if not self.pict or not self.rule:
             d = pq(url='http://magiccards.info' + self.murl)
+
+            ## parse pict url
             self.pict = d('table:eq(3) img').attr('src')
 
-            ## take in info in form:
-            ## Creaturerior 1+*/1+*, 5GG (7)
-            info = d('table:eq(3) tr:eq(0) > td:eq(1) p:eq(0)').text()
-            info = ' '.join(info.split())
-
-            try:
-                tb, cc = info.split(',')   ## tb - type and battle properties, cc - cost and converted cost
-                t = ' '.join( tb.split()[:-1] )
-                b = tb.split()[-1]
-
-                self.type = t
-                self.power = b.split('/')[0]
-                self.tough = b.split('/')[1]
-            except:
-                tb, cc = info, '0 (0)'
-                self.type = tb
-                self.power = '-'
-                self.tough = '-'
-
-            self.cost = cc
-
             ## take rule text
             rule = d('table:eq(3) tr:eq(0) > td:eq(1) p.ctext').html()
             rule = re.sub("<br.*?>", "\n", rule, flags=re.I)
             self.rule = rule
 
             ## take legacy
-            self.legacy = '; '.join([ t.text for t in d('table:eq(3) tr:eq(0) > td:eq(1) li.legal') ])
-
-            print self.type, self.power, self.tough, self.cost, self.rule, self.legacy
+            #self.legacy = '; '.join([ t.text for t in d('table:eq(3) tr:eq(0) > td:eq(1) li.legal') ])
 
 
 class User(SqliteModel):
     for a in d('table:eq(1) a'):
         cs_name = a.text
 
-        if cs_name == 'Mirage':
+        if cs_name == 'Dragon\'s Maze':
             skip = False
 
         if skip: continue