Пример #1
0
    def test_getting_mp4(self):
        payload = {
            'url': 'http://media.giphy.com/media/WSqcqvTxgwfYs/giphy.gif',
            'api_key': '123456'
        }
        response = self.app.post('/convert',
                                 data=json.dumps(payload),
                                 follow_redirects=True)
        self.assertEqual(response.status_code, 200)
        data = json.loads(response.data)
        self.assertRegex(data['mp4'], '\.mp4')
        self.assertRegex(data['ogv'], '\.ogv')
        self.assertRegex(data['webm'], '\.webm')
        self.assertRegex(data['snapshot'], '\.jpg')

        file_to_delete = data['mp4'].split('/')[-1]

        s3Manager = S3Manager(get_config())
        s3Manager.delete(file_to_delete)
Пример #2
0
    def get_s3_path(self):
        config = get_config()

        return "https://%s.s3.amazonaws.com:443/%s/%s" % (
            config.get('BUCKET'), config.get('FOLDER'), get_current_date())
Пример #3
0
 def setUp(self):
     self.s3Manager = S3Manager(get_config())
Пример #4
0
    def delete_all_files_in_s3(self):
        s3Manager = S3Manager(get_config())

        bucket = s3Manager.get_bucket()
        bucketListResultSet = bucket.list()
        bucket.delete_keys([key.name for key in bucketListResultSet])
Пример #5
0
import urllib.parse
import os
import json
import logging
import requests
import sys

from gif2html5.s3_manager import S3Manager
from gif2html5.config_parser import get_config
from gif2html5.video_manager import convert as convert_gif
from gif2html5.celery import make_celery

logging.basicConfig(stream=sys.stdout, level=logging.DEBUG)
logging.getLogger('boto').setLevel(logging.CRITICAL)

config = get_config()
s3Manager = S3Manager(config)
app = Flask(__name__)

# app.debug = True
app.config.update(
    CELERY_BROKER_URL=config.get('REDISTOGO_URL'),
    CELERY_RESULT_BACKEND=config.get('REDISTOGO_URL'),
    API_KEY=config.get('GIF2HTML5_API_KEY'),
)
celery = make_celery(app)


@celery.task(bind=False, default_retry_delay=30)
def convert_video(gif_url, webhook):
    logging.debug('Converting video')
Пример #6
0
import os
import json
import logging
import requests
import sys

from gif2html5.s3_manager import S3Manager
from gif2html5.config_parser import get_config
from gif2html5.video_manager import convert as convert_gif
from gif2html5.celery import make_celery


logging.basicConfig(stream=sys.stdout, level=logging.DEBUG)
logging.getLogger('boto').setLevel(logging.CRITICAL)

config = get_config()
s3Manager = S3Manager(config)
app = Flask(__name__)

# app.debug = True
app.config.update(
    CELERY_BROKER_URL=config.get('REDISTOGO_URL'),
    CELERY_RESULT_BACKEND=config.get('REDISTOGO_URL'),
    API_KEY=config.get('GIF2HTML5_API_KEY'),
)
celery = make_celery(app)


@celery.task(bind=False, default_retry_delay=30)
def convert_video(gif_url, webhook):
    logging.debug('Converting video')
Пример #7
0
 def setUp(self):
     self.s3Manager = S3Manager(get_config())
Пример #8
0
    def get_s3_path(self):
        config = get_config()

        return "https://%s.s3.amazonaws.com:443/%s/%s" % (config.get('BUCKET'), config.get('FOLDER'), get_current_date())
Пример #9
0
    def delete_all_files_in_s3(self):
        s3Manager = S3Manager(get_config())

        bucket = s3Manager.get_bucket()
        bucketListResultSet = bucket.list()
        bucket.delete_keys([key.name for key in bucketListResultSet])