bhargavnova / python-helper-modules

MIT License
9 stars 27 forks source link

Universal different files converter using python script | Multiple Contributors | Add your own conversation function. | Follow the guideline #55

Open bhargavnova opened 1 year ago

bhargavnova commented 1 year ago

Objective

Developing a versatile Python script that serves as a universal file converter, capable of converting various file formats to different formats. This tool will provide users a seamless way to convert files such as documents, images, audio, and more, enabling compatibility across different applications and platforms.

Features

Example Usage

import file_converter

# for standalone function, but for the main script we will be using the argument from the shell.
# Convert a PDF document to a Word document
file_converter.convert('input.pdf', 'output.docx', input_format='pdf', output_format='docx')

# Convert a PNG image to a JPEG image
file_converter.convert('input.png', 'output.jpg', input_format='png', output_format='jpeg')

# Convert an MP3 audio file to a WAV audio file
file_converter.convert('input.mp3', 'output.wav', input_format='mp3', output_format='wav')

Difficulty: Beginner/Intermediate/Advanced

Tags: Python, File Conversion, Universal Converter, Compatibility

Additional Information

Contribution Guidelines

The updated guidelines can be found here.

Important Note:

Happy Coding!!

Please follow the below guidelines.

  1. folder name must be convert_{ext1}_to_{ext2} (ex: convert_srt_to_lrc) #btw both are lyrics files extensions
  2. add a script with the same name as the folder name.
  3. add __init__.py inside the same folder.
  4. write your code using OOP for beginners if they don't know that, you can simply write a function also no worries as long as that works :). if it's OOP based then main method will be according to first point. and for funtion the name will be according to first point.
  5. after writing modify the config.yml file, to add your function in the main script, that's it, I have already configured the convert_me.py script, so no need to modify anything.
  6. currently all the functions will take only two arguments, input_file_path and output_file_path, but if you want to add more, you might need to modify the code in the convert_me.py file
  7. that's it, Check the README.md file in the folder convert_srt_to_lrc, you can add your GitHub username there. under Features section.

Tracker

Done Conversion can be worked on? Bugs Contributor Improvement Required
🟢 srt to lrc Y @bhargavnova Y
🟢 pdf to docx Y Y @harshjais369 Y
[ ] pdf to txt
[ ] pdf to html
[ ] pdf to image (jpg, png, etc.) Y
🟡 docx to pdf @naylin-dev Y (Only works for windows, because docx2pdf requires Microsoft word, Linux support required)
[ ] docx to txt
[ ] docx to html
[ ] docx to pdf
🟢 txt to pdf Y @pranalibose
🟢 txt to csv Y @kom-senapati
🟢 csv to json Y @scove
🟢 csv to xml Y @scove
[ ] csv to excel (xlsx)
🟢 json to csv Y @scove
[ ] json to xml
[ ] xml to json
[ ] xml to csv
[ ] image (jpg, png, etc.) to pdf Y
[ ] image (jpg, png, etc.) to text
[ ] image (jpg, png, etc.) to grayscale Y
[ ] audio (mp3, wav, etc.) to text
[ ] audio (mp3, wav, etc.) to spectrogram image
[ ] video (mp4, etc.) to audio (mp3, wav, etc.) Y
[ ] video (mp4, etc.) to images (frames) Y
[ ] video (mp4, etc.) to gif Y
[ ] audio (mp3, wav, etc.) to spectrogram image
[ ] html to pdf Y
[ ] html to text Y
[ ] html to image Y
[ ] html to docx Y
[ ] html to markdown Y
🟢 markdown to html Y @kom-senapati
[ ] markdown to pdf Y
[ ] markdown to docx Y
[ ] epub to pdf Y
🔴 epub to mobi
[ ] mobi to pdf
[ ] pdf to epub
🔴 pdf to mobi
[ ] excel (xlsx, csv) to pdf Y
[ ] excel (xlsx, csv) to html Y
[ ] excel (xlsx, csv) to json
[ ] excel (xlsx, csv) to xml
[ ] excel (xlsx, csv) to text
[ ] xml to excel (xlsx, csv)
🔴 pdf to excel (xlsx, csv)
🔴 pdf to json
🔴 pdf to xml
bhargavnova commented 1 year ago

Added universal_file_converter clone this repo, add ur conversation function inside _my_utils/_utils/ there is one function added already convert_srt_to_lrc use that as a reference. :) Just have to add your own function. modify the config.yml file. modify the func_list.txt file.

Happy Coding!

Comment what are you going to work on, and start working, just make sure someone is not working on the same function as you are. you can check previous comments for that, or check the code itself.

harshjais369 commented 1 year ago

Hey @bhargavnova , seems very interesting and fun to work on this issue. I'm thinking to start it by first building a pdf to docx converter. Could you please assign me this issue under hacktoberfest label?

bhargavnova commented 1 year ago

Sure @harshjais369, go ahead.

bhargavnova commented 1 year ago

I have added one template folder which contains class-based .py file and function-based .py file, you can choose any of those to get started, and add your function inside _my_utils/_utils/

Note: This Issue can have multiple contributors so anyone can submit their own conversation function, just mention here what you are going to work on. if you have any doubts feel free to ask.

harshjais369 commented 1 year ago

@bhargavnova Thank you! I have built my function, and will raise a PR after a few hours later..

scove commented 1 year ago

Can I try CSV to JSON?

scove commented 1 year ago

I will take JSON to CSV as well :smile:

kom-senapati commented 1 year ago

I can do the txt to csv part.

kom-senapati commented 1 year ago

I am also doing the markdown to html.

scove commented 1 year ago

I will add CSV to XML :grinning:

pranalibose commented 1 year ago

Hey @bhargavnova , I would like to work on this. Can I take up pdf to txt and txt to pdf?

kom-senapati commented 10 months ago

I can do html to markdown.

naylin-dev commented 1 month ago

I want to add docx to pdf.

naylin-dev commented 1 month ago

I also want to add image to grayscale.