Merge branch 'metafy-social:master' into master

This commit is contained in:
Samartha 2022-10-06 23:07:05 +05:30 committed by GitHub
commit e5e20cf9a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 201 additions and 23 deletions

View File

@ -61,13 +61,6 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
<sub><b>Null</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/PGautam27">
<img src="https://avatars.githubusercontent.com/u/92343715?v=4" width="100;" alt="PGautam27"/>
<br />
<sub><b>P Gautam</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/bartick">
<img src="https://avatars.githubusercontent.com/u/69100224?v=4" width="100;" alt="bartick"/>
@ -75,6 +68,13 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
<sub><b>Bartick Maiti</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/PGautam27">
<img src="https://avatars.githubusercontent.com/u/92343715?v=4" width="100;" alt="PGautam27"/>
<br />
<sub><b>P Gautam</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/muratonuryildirim">
<img src="https://avatars.githubusercontent.com/u/77264793?v=4" width="100;" alt="muratonuryildirim"/>
@ -82,14 +82,21 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
<sub><b>Murat Onur Yildirim</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/Ayudh-65">
<img src="https://avatars.githubusercontent.com/u/68161774?v=4" width="100;" alt="Ayudh-65"/>
<br />
<sub><b>Null</b></sub>
</a>
</td></tr>
<tr>
<td align="center">
<a href="https://github.com/Abbhiishek">
<img src="https://avatars.githubusercontent.com/u/86338762?v=4" width="100;" alt="Abbhiishek"/>
<br />
<sub><b>Abhishek Kushwaha</b></sub>
</a>
</td></tr>
<tr>
</td>
<td align="center">
<a href="https://github.com/Farhan-2222">
<img src="https://avatars.githubusercontent.com/u/87274221?v=4" width="100;" alt="Farhan-2222"/>
@ -111,13 +118,6 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
<sub><b>Mohd Arsh Ali </b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/Ayudh-65">
<img src="https://avatars.githubusercontent.com/u/68161774?v=4" width="100;" alt="Ayudh-65"/>
<br />
<sub><b>Null</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/Montekkundan">
<img src="https://avatars.githubusercontent.com/u/87750128?v=4" width="100;" alt="Montekkundan"/>
@ -240,6 +240,13 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
<sub><b>Aswin Shailajan</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/jrafaaael">
<img src="https://avatars.githubusercontent.com/u/70046023?v=4" width="100;" alt="jrafaaael"/>
<br />
<sub><b>Null</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/noobyysauraj">
<img src="https://avatars.githubusercontent.com/u/81681419?v=4" width="100;" alt="noobyysauraj"/>
@ -253,15 +260,15 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
<br />
<sub><b>Srinjoy Pati</b></sub>
</a>
</td>
</td></tr>
<tr>
<td align="center">
<a href="https://github.com/accodes21">
<img src="https://avatars.githubusercontent.com/u/101868279?v=4" width="100;" alt="accodes21"/>
<br />
<sub><b>Aarya Chopkar</b></sub>
</a>
</td></tr>
<tr>
</td>
<td align="center">
<a href="https://github.com/akashJainAJ11">
<img src="https://avatars.githubusercontent.com/u/94193834?v=4" width="100;" alt="akashJainAJ11"/>
@ -296,15 +303,15 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
<br />
<sub><b>Nafis Adnan Mondal</b></sub>
</a>
</td>
</td></tr>
<tr>
<td align="center">
<a href="https://github.com/devtayade">
<img src="https://avatars.githubusercontent.com/u/84332795?v=4" width="100;" alt="devtayade"/>
<br />
<sub><b>Null</b></sub>
</a>
</td></tr>
<tr>
</td>
<td align="center">
<a href="https://github.com/yashbrid03">
<img src="https://avatars.githubusercontent.com/u/65955929?v=4" width="100;" alt="yashbrid03"/>
@ -339,7 +346,8 @@ Thanks a lot for spending your time helping! Keep rocking 🍻
<br />
<sub><b>Smit Shah</b></sub>
</a>
</td>
</td></tr>
<tr>
<td align="center">
<a href="https://github.com/SameerSahu007">
<img src="https://avatars.githubusercontent.com/u/29480670?v=4" width="100;" alt="SameerSahu007"/>

View File

@ -0,0 +1,28 @@
# Audio Converter
CLI tool to convert an audio file from one extension to another (e.g. mp3 to wav)
## Requirements
- [FFmpeg](https://ffmpeg.org/)
## Usage
### Convert all audio files in a specific directory
```bash
python3 audio-converter.py -p <YOUR-PATH-WAS-HERE> -e <THE-DESIRED-EXTENSION>
```
e.g.
```bash
python3 audio-converter.py -p /home/username/Music -e .wav
```
### Convert specific audio file
```bash
python3 audio-converter.py -p <YOUR-PATH-WAS-HERE> -e <THE-DESIRED-EXTENSION>
```
e.g.
```bash
python3 audio-converter.py -p /home/username/Music/test.mp3 -e .wav
```

View File

@ -0,0 +1,51 @@
import subprocess
import os
import argparse
parser = argparse.ArgumentParser(
description='A program to convert audio to another audio format'
)
parser.add_argument(
'-p',
'--path',
type=str,
help='''
The full path of file to convert OR
the full path of folder that contains all files to convert'
''',
required=True
)
parser.add_argument(
'-e',
'--extension',
type=str,
help='The type of extension to convert the audio',
default='.mp3',
required=False
)
def convert(file, extension):
file_name, _ = file.split('.')
output_name = file_name + extension
subprocess.run(['ffmpeg', '-i', file, output_name])
def convert_all(path, extension):
for _, _, files in os.walk(path):
for file in files:
convert(file, extension)
if __name__ == "__main__":
args = parser.parse_args()
path = args.path
extension = args.extension
os.chdir(os.path.dirname(path))
if (os.path.isdir(path)):
convert_all(path=path, extension=extension)
else:
convert(file=path, extension=extension)

View File

@ -0,0 +1,19 @@
# PDF Delete Pages
A simple Tkinter GUI application that deletes specified pages from a PDF and outputs a new PDF file with only the desired pages.
### Installing Requirements
- Open Windows Command Prompt
- Run command ``` pip install PyPDF2 ```
### Usage
- Install the requirements (Python3 and PyPDF2 module)
- Run the application script
- Select the PDF file
- Enter page numbers to be deleted
- Wait for confirmation
- New PDF file will be generated at the location of the script.
### Screenshots
![Screenshot1](/scripts/PDF-delete-pages/example/screenshot1.jpg?raw=true)
![Screenshot2](/scripts/PDF-delete-pages/example/screenshot2.jpg?raw=true)

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

View File

@ -0,0 +1,72 @@
from PyPDF2 import PdfFileWriter, PdfFileReader
import os
import tkinter as tk
from tkinter import ttk
from tkinter.filedialog import askopenfilename
win = tk.Tk()
win.geometry("400x200")
win.title("Delete PDF Pages")
def pagedel():
pages_del = pages.get()
pages_to_delete = pages_del.strip().split(",")
pages_to_delete = [(int(i) - 1) for i in pages_to_delete]
with open(path, "rb") as pdf_file:
pdf_reader = PdfFileReader(pdf_file)
num_pages = pdf_reader.numPages
out_of_index_page = []
for num in pages_to_delete:
if num > num_pages:
out_of_index_page.append(num)
if len(out_of_index_page) == 0:
infile = PdfFileReader(path, "rb")
output = PdfFileWriter()
for i in range(infile.getNumPages()):
if i not in pages_to_delete:
p = infile.getPage(i)
output.addPage(p)
inputfile_name = ((path.split("\\")[-1]).split(".pdf"))[0]
output_name = inputfile_name + "_deleted.pdf"
with open(output_name, "wb") as f:
output.write(f)
print(f"\nThe output pdf is saved as: {output_name}\n")
else:
print("\nPage number entered is greater than the No of Pages in PDF")
print("Please Check & Re-Try\n")
def getpages():
global pages, path
user_path = askopenfilename().strip()
path = os.path.normpath(user_path)
label2 = ttk.Label(win, text="Enter page numbers to be deleted seperated by commas:\n(Eg: 1,2) ")
label2.grid(row=0, column=0, padx=50, pady=20)
pages = tk.Entry(win, width = 30)
pages.grid(row=1, column=0, padx=50, pady=0)
button2 = ttk.Button(win, text="Enter", width=30, command=pagedel)
button2.grid(row=2, column=0, padx=50, pady=10)
label1 = ttk.Label(win, text="Select PDF File: ")
label1.grid(row=0, column=0, padx=100, pady=40)
button1 = ttk.Button(win, text="Select File", width=30, command=getpages)
button1.grid(row=1, column=0, padx=100, pady=0)
win.mainloop()