Example #1
0
def _create_inline_result(submission, identifier: str):
    video_preview = _get_video_preview(submission)
    caption = f"{submission.subreddit_name_prefixed}: {submission.title}"
    mod = AbstractModule()
    if video_preview is not None:
        return InlineQueryResultVideo(id=identifier,
                                      video_url=mod.downsize_dash_link(
                                          video_preview["fallback_url"], 720),
                                      video_duration=video_preview["duration"],
                                      thumb_url=_get_thumbnail(submission),
                                      mime_type="video/mp4",
                                      title=submission.title,
                                      caption=caption)
    elif _is_gif_submission(submission):
        return InlineQueryResultVideo(id=identifier,
                                      video_url=submission.url,
                                      thumb_url=_get_thumbnail(submission),
                                      mime_type="video/mp4",
                                      title=submission.title,
                                      caption=caption)
    else:
        return InlineQueryResultPhoto(
            id=identifier,
            photo_url=submission.url,
            thumb_url=_get_thumbnail(submission),
            title=submission.title,
            description=submission.subreddit.display_name,
            caption=caption)
Example #2
0
 def __init__(self, raw_dir):
     AbstractModule.__init__(self)
     self.directory = os.path.join(raw_dir, self.directory)
Example #3
0
 def __init__(self, raw_dir):
     AbstractModule.__init__(self)
     self.directory = raw_dir
 def __init__(self):
     AbstractModule.__init__(self)
Example #5
0
 def __init__(self):
     """
     Set the type to 2 
     """
     AbstractModule.__init__(self)
Example #6
0
 def __init__(self, raw_dir):
     self.directory = 'abusix/'
     AbstractModule.__init__(self)
     self.directory = os.path.join(raw_dir, self.directory)