Ejemplo n.º 1
0
def compress_multiple_files():

    file_list = fileopenbox(multiple=True)
    choices = ["bz2", "gz", "xz"]
    msg = "Select any one option"
    mode = choicebox(msg, choices=choices)
    send_recv.send_multiple_files(file_list, sock, f"multi_{mode}")
    save_dir = diropenbox()
    send_recv.recv_file(save_dir + '/compressed.tar.' + mode, sock)
Ejemplo n.º 2
0
def compress_image():

    file = fileopenbox()
    text = "Enter quality factor 10 - 100"
    title = "Image compression"
    d_int = 75
    lower = 10
    upper = 100
    output = integerbox(text, title, d_int, lower, upper)
    send_recv.send_file(file, sock, "img" + "_" + str(output))
    save_file = filesavebox()
    send_recv.recv_file(save_file, sock)
Ejemplo n.º 3
0
def decompress_text():

    file = fileopenbox()
    choices = ["Huffman", "Shannon-Fano", "LZW", "RLE"]

    # mesaage / question to be asked
    msg = "Select decompression Algorithm"

    # opening a choice box using our msg and choices
    method = choicebox(msg, choices=choices)
    send_recv.send_file(file, sock, "decomp_" + method)
    save_file = filesavebox()
    send_recv.recv_file(save_file, sock)
Ejemplo n.º 4
0
def compress_text():

    file = fileopenbox(filetypes=['All files', '*'])
    choices = ["Huffman", "Shannon-Fano", "LZW", "RLE"]

    # mesaage / question to be asked
    msg = "Select compression Algorithm"

    # opening a choice box using our msg and choices
    method = choicebox(msg, choices=choices)
    send_recv.send_file(file, sock, "comp_" + method)
    time.sleep(1)
    save_file = filesavebox()
    send_recv.recv_file(save_file + "." + method[:3].lower(), sock)
Ejemplo n.º 5
0
def compress_aud():
    file = fileopenbox()
    send_recv.send_file(file, sock, "aud")
    save_file = filesavebox()
    send_recv.recv_file(save_file, sock)
Ejemplo n.º 6
0
def decompress_archive():
    file = fileopenbox()
    send_recv.send_file(file, sock, "decomp_archive")
    send_recv.recv_file('', sock)
Ejemplo n.º 7
0
from helpers.img_com import compressMe
import config
from helpers import con

HOST = '127.0.0.1'
PORT = 45001

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

s.bind((config.HOST, config.PORT))

s.listen(1)
(client_socket, address) = s.accept()

# s.setblocking(False)
method = send_recv.recv_file("./recvd", client_socket)
print(method)
result = ''

if (method[0:3] == "img"):
    method, quality = method.split("_")
    print(quality)
    print("image comp")
    result = compressMe("./recvd", False, int(quality))
    print(result)
elif (method[0:3] == "vid"):
    ip = "./recvd"
    result = "./compressed.mp4"
    subprocess.run('ffmpeg -i ' + ip + ' -vcodec libx265 -crf 28 ' + result,
                   shell=True)