Example #1
0
async def sgif(self):
    simpsons = compuglobal.Frinkiac()
    screencap = simpsons.get_random_screencap()
    gif = screencap.get_gif_url()
    self.bot.say(gif)
import compuglobal

# ----------------------------------------------------------------------------
# This an example of the basic image/gif functionality available
# ----------------------------------------------------------------------------

# The API used as the example here is Frinkiac (The Simpsons)
# Everything below can be used for any of the APIs (Morbotron, Master of All
# Science etc.)
frinkiac = compuglobal.Frinkiac()

# Getting a screencap from The Simpsons using search terms
searched_screencap = frinkiac.search_for_screencap('Stupid Sexy Flanders')

# Getting a random screencap from The Simpsons
random_screencap = frinkiac.get_random_screencap()

# Gets the image of the screencap without any captions
image = random_screencap.get_image_url()

# Gets the image of the screencap with captions matching the quotes of the
# screencap embedded in the image
captioned_image = random_screencap.get_meme_url()

# Gets the image of the screencap with 'Aurora Borealis?' embedded as the
# caption
custom_meme = random_screencap.get_meme_url(caption='Aurora Borealis?')

# Gets the gif of the screencap with captions embedded
# All gifs use a default gif length of ~7,000ms (7 sec) (starting
# 3,000ms (3 sec) before the screencap and ending 4,000ms (4 sec) after the
Example #3
0
import compuglobal

# ----------------------------------------------------------------------------
# This an example of the different APIs that are available for use:
# ----------------------------------------------------------------------------

# The Simpsons
simpsons = compuglobal.Frinkiac()

# Futurama
futurama = compuglobal.Morbotron()

# Rick and Morty
rick_and_morty = compuglobal.MasterOfAllScience()

# 30 Rock
thirty_rock = compuglobal.GoodGodLemon()

# West Wing
west_wing = compuglobal.CapitalBeatUs()

# The Simpsons' steamed hams skit
steamed_hams = compuglobal.FrinkiHams()
Example #4
0
import json
import unittest

import compuglobal


FRINKIAC = compuglobal.Frinkiac()

with open('frinkiac.json') as frinkiac:
    frinkiac_data = json.load(frinkiac)


def frames_to_json(frames):
    output = []
    for frame in frames:
        output.append(frame.json)

    return output


class CompuGlobalAPITestCase(unittest.TestCase):
    def test_json_to_caption_1(self):
        """Tests json converting to caption"""
        self.assertEqual(FRINKIAC.json_to_caption(frinkiac_data['test_1']),
                         '( yells) STUPID, SEXY FLANDERS! OW, MY LEGS! THIS IS '
                         'THE WORST PAIN EVER... ')
        self.assertEqual(FRINKIAC.json_to_caption(frinkiac_data['test_2']),
                         'Marge? Homer, I don\'t want to alarm you, ')
        self.assertEqual(FRINKIAC.json_to_caption(frinkiac_data['test_3']),
                         'Moris:you die. ( screams) ')