# Path: operators/tools/get_text_strips.py
# def get_text_strips(scene, channel=None):
#     """Get all the text strips in the edit channel"""
# 
#     if channel == None:
#         channel = scene.subtitle_edit_channel
# 
#     all_strips = list(sorted(scene.sequence_editor.sequences,
#             key=lambda x: x.frame_start))
# 
#     text_strips = []
#     for strip in all_strips:
#         if (strip.channel == channel and
#                 strip.type == 'TEXT'):
#             text_strips.append(strip)
# 
#     return text_strips


import bpy
from .tools.get_text_strips import get_text_strips

class SEQUENCER_OT_duration_x_2(bpy.types.Operator):
    bl_label = 'Dur x 2'
    bl_idname = 'sequencerextra.duration_x_two'
    bl_description = 'Make all text strips in subtitle edit channel twice as long'

    @classmethod
    def poll(self, context):
        scene = context.scene
        try:
            text_strips = get_text_strips(scene)

            if len(text_strips) > 0:
                return True
            else:
                return False
        except AttributeError:
            return False

    def execute(self, context):
        scene = context.scene
        fps = scene.render.fps / scene.render.fps_base

# Path: operators/tools/get_text_strips.py
# def get_text_strips(scene, channel=None):
#     """Get all the text strips in the edit channel"""
# 
#     if channel == None:
#         channel = scene.subtitle_edit_channel
# 
#     all_strips = list(sorted(scene.sequence_editor.sequences,
#             key=lambda x: x.frame_start))
# 
#     text_strips = []
#     for strip in all_strips:
#         if (strip.channel == channel and
#                 strip.type == 'TEXT'):
#             text_strips.append(strip)
# 
#     return text_strips


# Path: operators/duration_adjust.py
import bpy
from .tools.get_text_strips import get_text_strips


class SEQUENCER_OT_duration_x_2(bpy.types.Operator):
    bl_label = 'Dur x 2'
    bl_idname = 'sequencerextra.duration_x_two'
    bl_description = 'Make all text strips in subtitle edit channel twice as long'

    @classmethod
    def poll(self, context):
        scene = context.scene
        try:
            text_strips = get_text_strips(scene)

            if len(text_strips) > 0:
                return True
            else:
                return False
        except AttributeError:
            return False

    def execute(self, context):
        scene = context.scene
        fps = scene.render.fps / scene.render.fps_base

        text_strips = get_text_strips(scene)