Add files via upload

This commit is contained in:
Akash Bora
2023-06-05 19:21:29 +05:30
committed by GitHub
parent 7a9688b4e9
commit ddd40da62f
4 changed files with 36 additions and 36 deletions

View File

@@ -65,10 +65,10 @@ def library(input_video, output, mode, extract_from="", fluidity=0, size=0, s=0,
os.mkdir("cache_ffg")
base = os.path.basename(input_video)
fin = os.path.join("cache_ffg",base[:-4]+".mpg")
subprocess.call(f'"{ffgac}" -i "{input_video}" -an -vcodec mpeg2video -f rawvideo -mpv_flags +nopimb -qscale:v 6 -r 30 -g "{gop}" -y "{fin}"')
subprocess.call(f'"{ffgac}" -i "{input_video}" -an -vcodec mpeg2video -f rawvideo -mpv_flags +nopimb -qscale:v 6 -r 30 -g "{gop}" -y "{fin}"', shell=True)
os.mkdir(os.path.join("cache_ffg","raws"))
framelist=[]
subprocess.call(f'"{ffgac}" -i "{fin}" -vcodec copy cache_ffg/raws/frames_%04d.raw')
subprocess.call(f'"{ffgac}" -i "{fin}" -vcodec copy cache_ffg/raws/frames_%04d.raw', shell=True)
frames=os.listdir(os.path.join("cache_ffg","raws"))
siz=size
framelist.extend(frames)
@@ -100,10 +100,10 @@ def library(input_video, output, mode, extract_from="", fluidity=0, size=0, s=0,
base = os.path.basename(input_video)
fin = os.path.join("cache_ffg",base[:-4]+".mpg")
qua=''
subprocess.call(f'"{ffgac}" -i "{input_video}" -an -vcodec mpeg2video -f rawvideo -mpv_flags +nopimb -qscale:v 6 -r 30 -g "{gop}" -y "{fin}"')
subprocess.call(f'"{ffgac}" -i "{input_video}" -an -vcodec mpeg2video -f rawvideo -mpv_flags +nopimb -qscale:v 6 -r 30 -g "{gop}" -y "{fin}"', shell=True)
os.mkdir(os.path.join("cache_ffg","raws"))
framelist=[]
subprocess.call(f'"{ffgac}" -i "{fin}" -vcodec copy cache_ffg/raws/frames_%04d.raw')
subprocess.call(f'"{ffgac}" -i "{fin}" -vcodec copy cache_ffg/raws/frames_%04d.raw', shell=True)
kil=e
po=s
if po==0:
@@ -130,10 +130,10 @@ def library(input_video, output, mode, extract_from="", fluidity=0, size=0, s=0,
base = os.path.basename(input_video)
fin = os.path.join("cache_ffg",base[:-4]+".mpg")
qua=''
subprocess.call(f'"{ffgac}" -i "{input_video}" -an -vcodec mpeg2video -f rawvideo -mpv_flags +nopimb -qscale:v 6 -r 30 -g "{gop}" -y "{fin}"')
os.mkdir("cache_ffg/raws")
subprocess.call(f'"{ffgac}" -i "{input_video}" -an -vcodec mpeg2video -f rawvideo -mpv_flags +nopimb -qscale:v 6 -r 30 -g "{gop}" -y "{fin}"', shell=True)
os.mkdir(os.path.join("cache_ffg","raws"))
framelist=[]
subprocess.call(f'"{ffgac}" -i "{fin}" -vcodec copy cache_ffg/raws/frames_%04d.raw')
subprocess.call(f'"{ffgac}" -i "{fin}" -vcodec copy cache_ffg/raws/frames_%04d.raw', shell=True)
repeat=r
po=f-1
frames=os.listdir(os.path.join("cache_ffg","raws"))

View File

@@ -25,10 +25,7 @@ def mosh(infile, outfile, m, c, n, a, f, k):
kill = k
if filein is None or os.path.exists(filein) == False:
print("> step 0/5: valid input file required!")
print("use -h to see help")
exit()
return
#define temp directory and files
temp_nb = random.randint(10000, 99999)

View File

@@ -1,7 +1,7 @@
#Author: Akash Bora
#License: MIT | Copyright (c) 2023 Akash Bora
currentversion = 2.0
currentversion = 2.01
#Import required modules
import tkinter
@@ -18,6 +18,7 @@ import webbrowser
import requests
import time
import random
import warnings
#Import the local datamosh library
from DatamoshLib.Tomato import tomato
@@ -84,20 +85,20 @@ def ChangeModeLeft():
dynamic()
frame_info = customtkinter.CTkFrame(master=frame_right, width=520, height=100)
frame_info.place(x=20,y=20)
mode_info = customtkinter.CTkLabel(master=frame_info,text=current, corner_radius=10, width=320, height=50, fg_color=("white", "gray38"))
mode_info.place(x=100,y=25)
frame_info.pack(padx=10, pady=10, fill="x", expand=True, anchor="n")
play_icon = Image.open(resource(os.path.join("Assets","Icons","right_icon.png"))).resize((20, 20), Image.Resampling.LANCZOS)
left_but = customtkinter.CTkButton(master=frame_info, image=customtkinter.CTkImage(play_icon.transpose(Image.Transpose.FLIP_LEFT_RIGHT)),
text="", width=50, height=50, corner_radius=10, fg_color=("white", "gray38"), hover_color=("gray90","gray25"), command=ChangeModeLeft)
left_but.place(x=20,y=25)
left_but.pack(padx=10, pady=10, fill="x", side="left", anchor="n")
mode_info = customtkinter.CTkLabel(master=frame_info,text=current, corner_radius=10, width=320, height=50, fg_color=("white", "gray38"))
mode_info.pack(padx=10, pady=10, fill="x", expand=True, side="left", anchor="n")
right_but = customtkinter.CTkButton(master=frame_info, image=customtkinter.CTkImage(play_icon), text="", width=50, height=50,
corner_radius=10, fg_color=("white", "gray38"), hover_color=("gray90","gray25"), command=ChangeModeRight)
right_but.place(x=450,y=25)
right_but.pack(padx=10, pady=10, fill="x", side="right", anchor="n")
#Open video function
previous = ""
@@ -180,8 +181,9 @@ def view_info():
window_UI.minsize(410,200)
window_UI.title("About")
window_UI.wm_iconbitmap()
window_UI.iconphoto(False, icopath)
window_UI.after(300, lambda: window_UI.iconphoto(False, icopath))
info_setting.configure(state=tkinter.DISABLED)
window_UI.resizable(False, False)
window_UI.wm_transient(root)
def check():
@@ -236,7 +238,7 @@ infopng = customtkinter.CTkImage(Image.open(resource(os.path.join("Assets","Icon
info_setting = customtkinter.CTkButton(master=frame_left, image=infopng, text="", width=40, height=40, corner_radius=10,
fg_color=customtkinter.ThemeManager.theme["CTkButton"]["text_color_disabled"],
hover_color=("grey50","gray25"), command=view_info)
info_setting.place(x=10,y=470)
info_setting.pack(padx=10, pady=10, anchor="s", side="left")
def close_top2():
window_UI2.destroy()
@@ -258,7 +260,8 @@ def change_param():
window_UI2.minsize(410,200)
window_UI2.title("Custom FFmpeg Parameters")
window_UI2.wm_iconbitmap()
window_UI2.iconphoto(False, icopath)
window_UI2.resizable(False, False)
window_UI2.after(300, lambda: window_UI2.iconphoto(False, icopath))
ff_setting.configure(state=tkinter.DISABLED)
window_UI2.wm_transient(root)
@@ -275,7 +278,7 @@ settingpng = customtkinter.CTkImage(Image.open(resource(os.path.join("Assets","I
ff_setting = customtkinter.CTkButton(master=frame_left, image=settingpng, text="", width=40, height=40, corner_radius=10,
fg_color=customtkinter.ThemeManager.theme["CTkButton"]["text_color_disabled"],
hover_color=("grey50","gray25"), command=change_param)
ff_setting.place(x=120,y=470)
ff_setting.pack(padx=(65,10), pady=10, anchor="s", side="right")
#Validation for entries
def only_numbers(char):
@@ -664,7 +667,7 @@ def ffmpeg_convert(inputpath, parameters, outputpath, extra=''):
#Main function of the whole program
def do_the_mosh():
global ofile, sfile, param
last_used = current
if previous=="":
tkinter.messagebox.showinfo("No Video imported!","Please import a video file!")
return
@@ -748,13 +751,13 @@ def do_the_mosh():
os.remove(mfile)
if not changed:
param=""
except:
pass
except Exception as e:
warnings.warn(str(e))
#Check the result and complete the task
if os.path.exists(sfile):
tkinter.messagebox.showinfo("Exported!", "File exported successfully, \nFile Location:" +str(sfile))
ProcessLabel.configure(text="Last used: "+current)
ProcessLabel.configure(text="Last used: "+last_used)
else:
tkinter.messagebox.showerror("Oops!", "Something went wrong! \nPlease recheck the settings and try again.")
ProcessLabel.configure(text='Recheck the settings and try again!')
@@ -762,13 +765,12 @@ def do_the_mosh():
button_open.configure(state=tkinter.NORMAL)
button_mosh.configure(state=tkinter.NORMAL)
#Bottom Widgets
ProcessLabel = customtkinter.CTkLabel(master=frame_right, width=400, height=30,corner_radius=10, text="START DATAMOSHING!", fg_color=("white", "gray38"))
ProcessLabel.place(x=20,y=430)
ProcessLabel.pack(padx=10, pady=10, fill="x", expand=True, side="left")
button_mosh = customtkinter.CTkButton(master=frame_right, height=30,width=110,corner_radius=10, text="MOSH", command=Threadthis)
button_mosh.place(x=430,y=430)
button_mosh.pack(padx=(0,10), pady=10, fill="x", side="right")
root.mainloop()

View File

@@ -46,12 +46,12 @@ if missing:
else:
subprocess.call('python3 -m pip install '+y, shell=True)
except:
print("Unable to download! \nThis are the required ones: "+str(required)+"\nUse 'pip install module_name' to download the modules one by one")
print("Unable to download! \nThis are the required ones: "+str(required)+"\nUse 'pip install module_name' to download the modules one by one.")
time.sleep(3)
sys.exit()
elif res=="N" or res=="n":
print("Without the modules you can't open this program. Please install them first! \nThis are the required one: "+str(required)
+"\nUse 'pip install module_name' to download modules one by one manually")
+"\nUse 'pip install module_name' to download modules one by one manually.")
time.sleep(3)
sys.exit()
else:
@@ -85,7 +85,7 @@ if (os.path.exists(os.path.join("FFglitch","ffgac")) or
checkffglitch()
else:
print("ffgac/ffedit not found inside ffglitch folder, you cannot run the ffglitch modes without these programs")
res2 = input("Do you want to download ffglitch now? (Y/N): ")
res2 = input("Do you want to download ffglitch modes? (Y/N): ")
while not ((res2=="Y") or (res2=="y") or (res2=="N") or (res2=="n")):
print("Please choose a valid option!")
res2 = input("Do you want to download ffglitch now? (Y/N): ")
@@ -102,9 +102,10 @@ else:
try:
import requests
response = requests.get(URL)
open("FFglitch//ffglitch.zip", "wb").write(response.content)
open(os.path.join("FFglitch","ffglitch.zip"), "wb").write(response.content)
except:
print("Unable to download ffglitch from site! Check your connection or download it manually from: | https://github.com/Akascape/FFglitch-0.9.3-executables |")
print("Unable to download ffglitch from site, try again running this setup!")
print("Check your connection or download it manually from: | https://github.com/Akascape/FFglitch-0.9.3-executables |")
print("Paste the files (ffgac and ffedit) inside FFglitch folder.")
time.sleep(3)
sys.exit()
@@ -125,7 +126,7 @@ else:
except:
print("Something went wrong!")
elif res2=="N" or res2=="n":
print("ffglitch modes cannot run without ffgac and ffedit, download them manually and paste them inside the FFglitch folder.")
print("ffglitch modes cannot run without ffgac and ffedit packages, download them manually and paste them inside the FFglitch folder.")
#Everything done!
print("Setup Complete!")