<gh_stars>0
import fitz
import os
import sys
from tkinter.filedialog import askopenfilenames
from tkinter.filedialog import asksaveasfilename


def get_savepath():
    filename = asksaveasfilename(defaultextension=".pdf", filetypes=(("PDF", "*.pdf"),("All Files", "*.*") ))
    if filename is None:
        exit(1)
    else:
        return filename
    
def get_files():
        filetype = (
            ('PDF', '*.pdf'),
        )
        filename = askopenfilenames(filetypes=filetype)
        return filename

if __name__ == "__main__":
    if len(sys.argv) == 1:
        print('\033[91m' + '''
  ____   ____   _____  ____          _                        _               
 |  _ \ |  _ \ |  ___|| __ )  _   _ | |__    ___  _ __  __ _ | |_  ___   _ __ 
 | |_) || | | || |_   |  _ \ | | | || '_ \  / _ \| '__|/ _` || __|/ _ \ | '__|
 |  __/ | |_| ||  _|  | |_) || |_| || | | ||  __/| |  | (_| || |_| (_) || |   
 |_|    |____/ |_|    |____/  \__,_||_| |_| \___||_|   \__,_| \__|\___/ |_|   
                                                                               ''' + '\033[0m')
        print('\033[1m' +"-merge" + '\033[0m' + "\t\t you can merge PDF files")
        print('\033[1m' +"-split" + '\033[0m' + "\t you can split PDF files")
        print("This project currently just runs on the terminal!")
        exit(0)
    if sys.argv[1] == '-merge':
        final_file =fitz.open() 
        print('Please select the files you want to merge!')
        merge_list = [x for x in get_files()]
        for item in merge_list:
            final_file.insert_pdf(fitz.open(item))
        final_file.save(get_savepath())
import fitz
import os
import sys
from tkinter.filedialog import askopenfilenames
from tkinter.filedialog import asksaveasfilename


def get_savepath():
    filename = asksaveasfilename(defaultextension=".pdf", filetypes=(("PDF", "*.pdf"),("All Files", "*.*") ))
    if filename is None:
        exit(1)
    else:
        return filename
    
def get_files():
        filetype = (
            ('PDF', '*.pdf'),
        )
        filename = askopenfilenames(filetypes=filetype)
        return filename

if __name__ == "__main__":
    if len(sys.argv) == 1:
        print('\033[91m' + '''
  ____   ____   _____  ____          _                        _               
 |  _ \ |  _ \ |  ___|| __ )  _   _ | |__    ___  _ __  __ _ | |_  ___   _ __ 
 | |_) || | | || |_   |  _ \ | | | || '_ \  / _ \| '__|/ _` || __|/ _ \ | '__|
 |  __/ | |_| ||  _|  | |_) || |_| || | | ||  __/| |  | (_| || |_| (_) || |   
 |_|    |____/ |_|    |____/  \__,_||_| |_| \___||_|   \__,_| \__|\___/ |_|   
                                                                               ''' + '\033[0m')
        print('\033[1m' +"-merge" + '\033[0m' + "\t\t you can merge PDF files")
        print('\033[1m' +"-split" + '\033[0m' + "\t you can split PDF files")
        print("This project currently just runs on the terminal!")
        exit(0)
    if sys.argv[1] == '-merge':
        final_file =fitz.open() 
        print('Please select the files you want to merge!')
        merge_list = [x for x in get_files()]
        for item in merge_list:
            final_file.insert_pdf(fitz.open(item))
        final_file.save(get_savepath())
____   ____   _____  ____          _                        _                 |  _ \ |  _ \ |  ___|| __ )  _   _ | |__    ___  _ __  __ _ | |_  ___   _ __   | |_) || | | || |_   |  _ \ | | | || '_ \  / _ \| '__|/ _` || __|/ _ \ | '__|  |  __/ | |_| ||  _|  | |_) || |_| || | | ||  __/| |  | (_| || |_| (_) || |     |_|    |____/ |_|    |____/  \__,_||_| |_| \___||_|   \__,_| \__|\___/ |_|