0

I need help on how to turn this one python script into a discord bot command in discord.py

import os
from subprocess import Popen, PIPE, call
import math
for file in os.listdir("/mnt/c/Users/Isiah/Videos/Community/Community.S01.Season.1.720p.5.1Ch.Web-DL.ReEnc-DeeJayAhmed"):
    if file.endswith(".mkv"):
        full_path = "/mnt/c/Users/Isiah/Videos/Community/Community.S01.Season.1.720p.5.1Ch.Web-DL.ReEnc-DeeJayAhmed/" + file 
        caption_file = "/mnt/c/Users/Isiah/Videos/Community/Community.S01.Season.1.720p.5.1Ch.Web-DL.ReEnc-DeeJayAhmed/" + file[:-3] + "srt"
        process = Popen('ffprobe -i ' + full_path + ' -show_entries format=duration -v quiet -of csv="p=0"', stdout=PIPE, stderr=PIPE, shell=True)
        stdout, stderr = process.communicate()
        stdout = math.floor(float(stdout))
        number_secs = stdout // 10
        for x in range(0, int(number_secs)):
            seek_time = x*15
            seek_time = str(seek_time)
            call("ffmpeg " "-ss " + seek_time + " -copyts -i " + full_path + " -vf subtitles=" + caption_file + " -q:v 3 -vframes 1 "+ file[10:16] +"_"+ str(x) + ".jpg", shell=True)
  • 1
    It looks like you want us to write some code for you. While many users are willing to produce code for a coder in distress, they usually only help when the poster has already tried to solve the problem on their own. A good way to demonstrate this effort is to include the code you've written so far, example input (if there is any), the expected output, and the output you actually get (console output, tracebacks, etc.). The more detail you provide, the more answers you are likely to receive. Check the [FAQ] and [ask]. – Hedgy Feb 14 '20 at 02:51
  • Does this answer your question? [Discord.py Bot sending file to Discord Channel](https://stackoverflow.com/questions/50860397/discord-py-bot-sending-file-to-discord-channel) – metatoaster Feb 14 '20 at 02:56
  • https://discordpy.readthedocs.io/en/latest/quickstart.html should help you get off the ground. – SIGSTACKFAULT Feb 14 '20 at 03:41

0 Answers0