Skip to content
This repository was archived by the owner on Apr 24, 2025. It is now read-only.

Commit 9cd467d

Browse files
Merge branch 'main' into dependabot/pip/projects/QRCode-Generator/pillow-10.2.0
2 parents 3d36050 + 16cd1fe commit 9cd467d

8 files changed

Lines changed: 428 additions & 281 deletions

File tree

README.md

Lines changed: 260 additions & 253 deletions
Large diffs are not rendered by default.

projects/Internet-speed-test/README.md

Lines changed: 19 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,54 +3,48 @@
33
**This is a internet speed tester made in python**
44

55
## Getting Started
6+
67
- Clone this repo
7-
- Run the following commands -
8-
```
8+
- Run the following commands -
9+
10+
```bash
911
pip install requirements.txt
1012
```
13+
1114
OR
12-
```
15+
16+
```bash
1317
pip3 install requirements.txt
1418
```
1519

1620
- Then
17-
```
21+
22+
```bash
1823
python main.py
1924
```
25+
2026
OR
21-
```
27+
28+
```bash
2229
python3 main.py
2330
```
2431

2532
## Libraries
26-
speedtest-cli
27-
```
28-
pip install speedtest-cli
29-
```
30-
OR
31-
```
32-
pip3 install speedtest-cli
33-
```
34-
35-
## Troubleshooting
36-
if you have an error of "AttributeError: module 'speedtest' has no attribute 'Speedtest'" when running
37-
following https://stackoverflow.com/questions/66249874/python-speedtest-has-no-attribute-speedtest
3833

39-
try:
34+
speedtest-cli
4035

41-
First
42-
```
43-
pip uninstall speedtest
44-
```
45-
Followed by
46-
```
36+
```bash
4737
pip install speedtest-cli
4838
```
49-
and then run again
5039

40+
OR
5141

42+
```bash
43+
pip3 install speedtest-cli
44+
```
5245

5346
## Author
47+
5448
![Shreejan-35](https://github.com/Shreejan-35)
5549

5650
That's all.
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
speedtest==0.0.1
2-
speedtest_cli==2.1.3
1+
speedtest_cli
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
import os
2+
import shutil
3+
4+
def main():
5+
dir_path = input("Enter the directory path of the files: ")
6+
7+
try:
8+
print("Organising your files into [ images - music - video - executable - archive - torrent - document - code - design files]")
9+
for filename in os.listdir(dir_path):
10+
absname = os.path.join(dir_path, filename)
11+
# Check if files are images and you can add more extensions
12+
if filename.lower().endswith((".png", ".jpg", ".jpeg", ".gif", ".bmp", ".pbm", ".pnm")):
13+
# If images folder doesn't exist then create new folder
14+
if not os.path.exists("images"):
15+
os.makedirs("images")
16+
shutil.move(absname, "images")
17+
18+
# Check if files are music and you can add more extensions
19+
elif filename.lower().endswith((".wav", ".mp3", ".flac", ".3gp", ".aa", ".aax", ".aiff", ".raw")):
20+
# If music folder doesn't exist then create new folder
21+
if not os.path.exists("music"):
22+
os.makedirs("music")
23+
shutil.move(absname, "music")
24+
25+
# Check if files are videos and you can add more extensions
26+
elif filename.lower().endswith((".webm", ".mp4")):
27+
# If video folder doesn't exist then create new folder
28+
if not os.path.exists("video"):
29+
os.makedirs("video")
30+
shutil.move(absname, "video")
31+
32+
# Check if files are executables
33+
elif filename.lower().endswith((".exe", ".msi", ".deb" , "dmg")):
34+
# If executables folder doesn't exist then create new folder
35+
if not os.path.exists("executables"):
36+
os.makedirs("executables")
37+
shutil.move(absname, "executables")
38+
39+
# Check if files are archive files
40+
elif filename.lower().endswith((".rar", ".tar" , ".zip" , ".gz")):
41+
# If archive folder doesn't exist then create new folder
42+
if not os.path.exists("archives"):
43+
os.makedirs("archives")
44+
shutil.move(absname, "archives")
45+
46+
# Check if files are torrent files
47+
elif filename.lower().endswith((".torrent",)):
48+
# If torrent folder doesn't exist then create new folder
49+
if not os.path.exists("torrent"):
50+
os.makedirs("torrent")
51+
shutil.move(absname, "torrent")
52+
53+
# Check if files are documents
54+
elif filename.lower().endswith((".txt", ".pdf", ".docx" , "doc")):
55+
# If documents folder doesn't exist then create new folder
56+
if not os.path.exists("documents"):
57+
os.makedirs("documents")
58+
shutil.move(absname, "documents")
59+
60+
# Check if files are code files
61+
elif filename.lower().endswith((".py", ".php", ".html" , ".css" , ".js")):
62+
# If code folder doesn't exist then create new folder
63+
if not os.path.exists("code"):
64+
os.makedirs("code")
65+
shutil.move(absname, "code")
66+
67+
# Check if files are design files
68+
elif filename.lower().endswith((".psd", ".ai")):
69+
# If design folder doesn't exist then create new folder
70+
if not os.path.exists("design-files"):
71+
os.makedirs("design-files")
72+
shutil.move(absname, "design-files")
73+
74+
except OSError:
75+
print("Error happened ...... try again")
76+
finally:
77+
# When script is finished clear screen and display message
78+
os.system("cls" if os.name == "nt" else "clear")
79+
print("Finished organising your files")
80+
81+
if __name__ == "__main__":
82+
main()

projects/QuickWordCloud/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ mypy-extensions==0.4.3
1111
numpy==1.23.3
1212
packaging==21.3
1313
pathspec==0.10.1
14-
Pillow==10.0.1
14+
Pillow==10.2.0
1515
platformdirs==2.5.2
1616
pluggy==1.0.0
1717
pyparsing==3.0.9
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import os
2+
3+
def main():
4+
img_types = ['jpg', 'png', 'jpeg']
5+
dir_path = input("Enter the directory path of the images: ")
6+
7+
for i, f in enumerate(os.listdir(dir_path)):
8+
absname = os.path.join(dir_path, f)
9+
img_type = absname.split('.')[-1]
10+
11+
if img_type in img_types:
12+
while True:
13+
newname = input(f"Enter the new name for {f} (without extension): ")
14+
newname = '{}.{}'.format(newname, img_type)
15+
new_absname = os.path.join(dir_path, newname)
16+
if not os.path.exists(new_absname):
17+
os.rename(absname, new_absname)
18+
break
19+
else:
20+
print("A file with this name already exists. Please enter a different name.")
21+
22+
print('Done renaming images.')
23+
24+
if __name__ == "__main__":
25+
main()
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Pillow

projects/Resize_Image/resize.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import os
2+
from PIL import Image
3+
4+
def resize_image(image_path, size):
5+
im = Image.open(image_path)
6+
im = im.resize(size)
7+
return im
8+
9+
10+
def main():
11+
choice = input("Do you want to resize multiple images? (yes/no): ")
12+
width = int(input("Enter the width: "))
13+
height = int(input("Enter the height: "))
14+
size = (width, height)
15+
16+
images = []
17+
if choice.lower() == 'yes':
18+
dir_path = input("Enter the directory path of the images: ")
19+
for filename in os.listdir(dir_path):
20+
if filename.endswith('.png') or filename.endswith('.jpg'):
21+
image_path = os.path.join(dir_path, filename)
22+
images.append((image_path, resize_image(image_path, size)))
23+
else:
24+
image_path = input("Enter the image path: ")
25+
images.append((image_path, resize_image(image_path, size)))
26+
27+
output_folder = input("Enter the output folder: ")
28+
os.makedirs(output_folder, exist_ok=True)
29+
30+
for image_path, im in images:
31+
new_image_name = input(f"Enter the new name for {os.path.basename(image_path)}: ")
32+
output_path = os.path.join(output_folder, new_image_name)
33+
im.save(output_path)
34+
print(f"Resized image is saved as {output_path}.")
35+
36+
print('Done resizing images.')
37+
38+
if __name__ == "__main__":
39+
main()

0 commit comments

Comments
 (0)