def addComicFromMetadata(self, md ):
        #logging.debug(u"Adding {0} {1}\r".format(self.add_count, md.path))
        #sys.stdout.flush()
    
        self.add_count += 1
        
        comic = Comic()
        # store full path, and filename and folder separately, for search efficiency,
        # at the cost of redundant storage
        comic.folder, comic.file = os.path.split(md.path)
        comic.path = md.path

        comic.page_count = md.page_count
        comic.mod_ts = md.mod_ts
        comic.hash = md.hash
        comic.filesize = md.filesize
        
        if not md.isEmpty:
            if md.series is not None:
                comic.series   = unicode(md.series)
            if md.issue is not None:
                comic.issue = unicode(md.issue)
                comic.issue_num = IssueString(unicode(comic.issue)).asFloat()   
     
            if md.year is not None:
                try:
                    day = 1   
                    month = 1 
                    if md.month is not None:
                        month = int(md.month)
                    if md.day is not None:
                        day = int(md.day)
                    year = int(md.year)
                    comic.date = datetime(year,month,day)
                except:
                    pass
                
            comic.year = md.year
            comic.month = md.month
            comic.day = md.day
            
            if md.volume is not None:
                comic.volume = int(md.volume)
            if md.publisher is not None:
                comic.publisher = unicode(md.publisher)
            if md.title is not None:
                comic.title = unicode(md.title)
            if md.comments is not None:
                comic.comments = unicode(md.comments)
            if md.imprint is not None:
                comic.imprint = unicode(md.imprint)
            if md.webLink is not None:
                comic.weblink = unicode(md.webLink)
                    

        self.session.add(comic)
        
        if md.characters is not None:
            for c in list(set(md.characters.split(","))):
                character = self.fetchObjByName( self.character_dict, c.strip())
                comic.characters_raw.append(character)
                #comic.characters_raw.append(self.character_objs[0])
                
        if md.teams is not None:
            for t in list(set(md.teams.split(","))):
                team = self.fetchObjByName( self.team_dict, t.strip())
                comic.teams_raw.append(team)
        if md.locations is not None:
            for l in list(set(md.locations.split(","))):
                location = self.fetchObjByName( self.location_dict, l.strip())
                comic.locations_raw.append(location)            
        if md.storyArc is not None:
            for sa in list(set(md.storyArc.split(","))):
                storyarc = self.fetchObjByName( self.storyarc_dict,  sa.strip())                     
                comic.storyarcs_raw.append(storyarc)
                pass
        if md.genre is not None:
            for g in list(set(md.genre.split(","))):
                genre = self.fetchObjByName( self.genre_dict,  g.strip())                     
                comic.genres_raw.append(genre)
                pass            
        if md.tags is not None:
            for gt in list(set(md.tags)):
                generictag = self.fetchObjByName( self.generictag_dict,  gt.strip())                     
                comic.generictags_raw.append(generictag)
                pass
        
        if md.credits is not None:
            for credit in md.credits:
                role = self.fetchObjByName( self.role_dict,  credit['role'].lower().strip())                     
                person = self.fetchObjByName( self.person_dict,  credit['person'].strip())                       
                comic.credits_raw.append(Credit(person, role))
                #comic.credits_raw.append(Credit(self.person_objs[0], self.role_objs[0]))
                pass
dataset/ETHPy150Open beville/ComicStreamer/comicstreamerlib/monitor.py/Monitor.addComicFromMetadata/original