Beispiel #1
0
def go():
    flo = VideoFlo()
    idea = Idea()
    idea.read_user_input(flo)
    if not idea.exists():
        print('Directory for {} not found'.format(idea.name))
        return

    davinci = Davinci()
    if davinci.resolve is None:
        return

    davinci.set_project_manager()
    if davinci.project_manager is None:
        return

    is_new = davinci.open_project(idea)
    if davinci.project is None:
        return

    if is_new:
        davinci.import_timeline()
    davinci.workspace_setup()
    davinci.import_files()

    if not idea.offline:
        trello = Trello()
        if not trello.lists_exist(['Finish'], idea.channel):
            return

        success = trello.move_card(idea, 'Finish')
        if not success:
            return

    update_tag('Finish', idea.path)
Beispiel #2
0
def go():
    davinci = Davinci()
    if davinci.resolve is None:
        return

    davinci.get_current_project()
    if davinci.project is None:
        print('Could not get current DaVinci project')
        return

    flo = VideoFlo()
    project_name = davinci.project.GetName()
    channel = flo.get_channel(project_name)
    if channel is None:
        return

    idea = Idea()
    idea.from_project(project_name, channel)
    if not idea.exists():
        print('Directory for {} not found'.format(project_name))
        return

    args = flo.get_finish_edit_arguments()
    if not args.offline:
        trello = Trello()
        if not trello.lists_exist(['Render'], idea.channel):
            return

        success = trello.move_card(idea, 'Render')
        if not success:
            return

    davinci.export_project(idea)
    update_tag('Render', idea.path)
Beispiel #3
0
def go():
    flo = VideoFlo()
    idea = Idea()
    idea.read_user_input(flo)
    if not idea.exists():
        print('Directory for {} not found'.format(idea.name))
        return

    open_dir(idea.path)
Beispiel #4
0
def go():
    flo = VideoFlo()
    idea = Idea()
    idea.read_user_input(flo)

    trello = Trello()
    if not idea.offline:
        if not trello.lists_exist(['Script'], idea.channel):
            return
        card_id, board_id = trello.make_card(idea)
        if card_id is None or board_id is None:
            return

        if not trello.add_filename_to_card(card_id, board_id, idea.name):
            trello.delete_card(card_id)
            return

    idea_directory = idea.make_directory()
    if idea_directory is None:
        if not idea.offline:
            trello.delete_card(card_id)
        return

    idea.make_files()
    idea.make_directories()

    if not idea.offline:
        trello.save_card(card_id, idea)

    add_tag('Script', idea.path, do_open=True)
Beispiel #5
0
def loop(channel, trello, args, renderable):

    davinci = Davinci()
    if davinci.resolve is None:
        return
    davinci.open_deliver_page()

    total = len(renderable)
    print('Rendering {} videos for {}'.format(total, channel.name))
    counter = 0
    finished = 0
    start_time = datetime.now()
    for path in renderable:
        counter = counter + 1
        project_name = os.path.basename(path)
        idea = Idea()
        idea.from_project(project_name, channel)
        if not idea.exists():
            print('Directory for {} not found'.format(project_name))
            return

        davinci.load_project(idea)
        print('Rendering {}/{} ({})'.format(counter, total, idea.name))
        stats = davinci.render_video()
        success = stats['success']
        if success and not args.preview:
            idea.save_render_stats(stats)
            update_tag('Upload', idea.path)
            if not args.offline:
                success = trello.move_card(idea, 'Upload')
                trello.set_render_stats(idea, stats)
        finished = finished + 1 if success else finished

    duration = datetime.now() - start_time
    print('Rendered {}/{} videos in {}'.format(finished, total, duration))
Beispiel #6
0
    def sync(self, channel):
        channel_path = Path(channel.path)
        for stage_file in list(channel_path.rglob(STAGEFILE)):
            project_name = os.path.basename(os.path.dirname(stage_file))
            with open(stage_file) as f:
                stage = f.read().strip()
                if stage not in STAGES:
                    print("Invalid name '{}' at {}".format(stage, stage_file))
                    continue

            # TODO: this will move a card from EDIT to EDIT, for example
            print('Move {} to {}'.format(project_name, stage))
            success = True
            #success = trello.move_card(idea, stage)
            if not success:
                print("ERROR: Unable to sync {}".format(project_name))
                continue

            # instantiate idea object
            idea = Idea()
            idea.from_project(project_name, channel)
            if not idea.exists():
                print('Directory for {} not found'.format(path))
                continue

            if 'SCRIPT' == stage:
                pass
                #card_id, board_id = self.make_card(idea)
                #if card_id is None or board_id is None:
                #    continue
                #if not self.add_filename_to_card(card_id, board_id, idea.name):
                #    self.delete_card(card_id)
                #    return
                #self.save_card(card_id, idea)

            if 'UPLOAD' == stage:
                # TODO
                pass
Beispiel #7
0
def go():
    flo = VideoFlo()
    idea = Idea()
    idea.read_user_input(flo)

    if not idea.exists():
        print('Directory for {} not found'.format(idea.name))
        return

    if not idea.offline:
        trello = Trello()
        if not trello.lists_exist(['Edit'], idea.channel):
            return

        success = trello.move_card(idea, 'Edit')
        if not success:
            return

    idea.copy_screen_recordings(flo)

    update_tag('Edit', idea.path)
Beispiel #8
0
def get_upload_dict(channel, trello, limit):
    print('Checking videos for {}'.format(channel.name))
    uploadable = trello.get_list('Upload', channel)
    upload_dict = {}

    total_upload_size = 0
    count = 0
    warn = 0
    for item in uploadable:
        metadata = {
            'title': item['name'],
            'description': item['desc'],
            'scheduled': item['due'],
            'tags': trello.get_checklist(item['idChecklists'], 'tags'),
            'hashtags': trello.get_checklist(item['idChecklists'], 'hashtags'),
        }

        card_id = item['id']
        path = channel.find_path_for_id(card_id)
        if path is None:
            print('Could not find local path for {}'.format(name))
            continue

        path = Path(path)
        project_name = os.path.basename(path)

        idea = Idea()
        idea.from_project(project_name, channel)
        if not idea.exists():
            print('Directory for {} not found'.format(path))
            return

        print('Checking {}'.format(path))
        count = count + 1

        # video thumbnail
        thumbnail = get_thumbnail(path)
        warn = warn + 1 if thumbnail is None else warn

        # video file
        video_file = get_video_file(path)
        if video_file is None:
            warn = warn + 1
            continue

        video = Video(path, video_file, channel, metadata, thumbnail, idea)
        warn = warn + 1 if not video.check_title() else warn
        warn = warn + 1 if not video.check_description() else warn
        warn = warn + 1 if not video.check_date() else warn
        warn = warn + 1 if not video.check_tags() else warn
        warn = warn + 1 if not video.check_hashtags() else warn
        video.format_description()

        total_upload_size += video.video_size

        upload_dict[card_id] = video

        if count == limit:
            break


    total_upload_gb = round(total_upload_size / (1024 * 1024 * 1024), 3)
    print('Total size of upload: {} GB'.format(total_upload_gb))

    if warn == 0 and count > 0:
        return upload_dict
    elif count == 0:
        print('No videos ready for upload')
    else:
        print('{} problem(s) found'.format(warn))

    return {}