Пример #1
0
                print "%s not a valid type %s" % (filename, mimetype)
                continue


            # Get comic info

            (key, original_date) = match_object.group(1,2)

            published_date = dirpath.split('/')[-1]

            vintage = (published_date != original_date)

            if vintage and not key.endswith('-vintage'):
                key = '%s-vintage' % key

            comic_exists = get_comic(key, published_date, original_date)

            if comic_exists:
                print "%s already exists in database." % (filename,)
                continue
                
            series = get_comic_series(key)

            try:
                o = Comic(series.id, original_date, published_date, filename)
                db.session.add(o)
                counter = counter + 1
                if not counter % increment:
                    db.session.commit()
                print "Added %s" % filename
            except:
Пример #2
0
def comic(key=None, published_date=None, original_date=None):
    comic = get_comic(key, published_date, original_date)
    image_url = comic.image_url
    mimetype = magic.from_file(image_url, mime=True)
    return send_file(image_url, mimetype=mimetype)
Пример #3
0
def comic(key=None, published_date=None, original_date=None):
    comic = get_comic(key, published_date, original_date)
    image_url = comic.image_url
    mimetype = magic.from_file(image_url, mime=True)
    return send_file(image_url, mimetype=mimetype)