Skip to content
This repository was archived by the owner on May 25, 2022. It is now read-only.

Commit 6bc436f

Browse files
authored
Merge pull request #7 from chavarera/master
pulling data
2 parents 3b75ce6 + 878896d commit 6bc436f

File tree

81 files changed

+3029
-30
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+3029
-30
lines changed

.github/ISSUE_TEMPLATE/feature_request.md

Lines changed: 0 additions & 20 deletions
This file was deleted.

README.md

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
# mini-projects-python
2-
A collection of simple python mini projects to enhance your python skills
32

3+
A collection of simple python mini projects to enhance your python skills
44

55
If you want to learn about python visit [Here](https://github.com/chavarera/PythonScript)
6+
67
## Steps To Follow
8+
79
- Select an issue
810
- Open [project here](https://github.com/chavarera/python-mini-projects)
911
- Create a fork of the project
@@ -15,6 +17,8 @@ If you want to learn about python visit [Here](https://github.com/chavarera/Pyth
1517
- Push the code
1618
- Create a pull request
1719

20+
## Connect On Social media
21+
[Join WhatsApp group](https://chat.whatsapp.com/Ghp25kidWLaGrAVA0G0GAa)
1822
## Contributors ✨
1923

2024
Thanks goes to these wonderful people
@@ -31,7 +35,7 @@ Sr no | Project Name | Author
3135
9 | [WishList App Using Django](https://github.com/chavarera/python-mini-projects/tree/master/projects/WishList) | [Ravi Chavare](https://github.com/chavarera)
3236
10 | [Split Folders into Subfolders](https://github.com/chavarera/python-mini-projects/tree/master/projects/split%20folder%20into%20subfolders) | [Ravi Chavare](https://github.com/chavarera)
3337
11 | [Download bulk images](https://github.com/chavarera/python-mini-projects/tree/master/projects/download%20images%20from%20website) | [Mitesh](https://github.com/Mitesh2499)
34-
12 | [Ranom word from file](https://github.com/chavarera/python-mini-projects/tree/master/projects/Random_word_from_list) |
38+
12 | [Random word from file](https://github.com/chavarera/python-mini-projects/tree/master/projects/Random_word_from_list) |
3539
13 | [Battery notification](https://github.com/chavarera/python-mini-projects/tree/master/projects/battery%20notification) | [Mitesh](https://github.com/Mitesh2499)
3640
14 | [Calculate age](https://github.com/chavarera/python-mini-projects/tree/master/projects/Calculate%20age) | [Gaodong](https://github.com/xlgd)
3741
15 | [Text file analysis](https://github.com/chavarera/python-mini-projects/tree/master/projects/Textfile%20analysis) | [m044de](https://github.com/m044de/)
@@ -40,4 +44,35 @@ Sr no | Project Name | Author
4044
18 | [Send emails](https://github.com/chavarera/python-mini-projects/tree/master/projects/send%20email%20from%20CSV) | [Mitesh](https://github.com/Mitesh2499)
4145
19 | [Get Ipaddress and Hostname of Website](https://github.com/chavarera/python-mini-projects/tree/master/projects/Find%20Out%20Hostname%20and%20IP%20address) | [Nuh Mohammed](https://github.com/NuhMohammed)|
4246
20 | [Progressbar using tqdm](https://github.com/chavarera/python-mini-projects/tree/master/projects/Terminal%20Progress%20Bar%20with%20Images%20Resizing) | [Mitesh](https://github.com/Mitesh2499)
43-
47+
21 | [Get meta information of images](https://github.com/Xlgd/python-mini-projects/tree/master/projects/Get%20meta%20information%20of%20images) | [Gaodong](https://github.com/xlgd)
48+
22 | [Captures Frames from video](https://github.com/chavarera/python-mini-projects/tree/master/projects/Capture_Video_Frames) | [phileinSophos](https://github.com/phileinSophos/)
49+
23 | [Fetch Wifi Saved Password Windows](https://github.com/chavarera/python-mini-projects/tree/master/projects/Get%20Wifi%20password) | [Mitesh](https://github.com/Mitesh2499)
50+
24 | [Save Screenshot of given Website](https://github.com/chavarera/python-mini-projects/tree/master/projects/snapshot%20of%20given%20website) | [m044de](https://github.com/m044de/)
51+
25 | [Split files using no of lines](https://github.com/chavarera/python-mini-projects/tree/master/projects/Split_File) | [phileinSophos](https://github.com/phileinSophos/)
52+
26 | [Encode and decode text using key](https://github.com/chavarera/python-mini-projects/tree/master/projects/create%20script%20to%20encode%20and%20decode%20text) | [Gaodong](https://github.com/xlgd)
53+
27 | [captures screenshot at regular interval of time](https://github.com/chavarera/python-mini-projects/tree/master/projects/capture_screenshot) | [d33pc](https://github.com/d33pc/)
54+
28 | [Create password hash](https://github.com/chavarera/python-mini-projects/tree/master/projects/hashing%20passwords) | [m044de](https://github.com/m044de/)
55+
29 | [Encrypt file and folders](https://github.com/chavarera/python-mini-projects/tree/master/projects/create%20a%20script%20to%20encrypt%20files%20and%20folder) | [Gaodong](https://github.com/xlgd)
56+
30 | [Decimal to binary and vice versa](https://github.com/chavarera/python-mini-projects/tree/master/projects/decimal%20to%20binary%20convertor%20and%20vice%20versa) | [Alan Anaya](https://github.com/alananayaa/)
57+
31 | [Cli Based Todo Application](https://github.com/chavarera/python-mini-projects/tree/master/projects/CLI%20Todo) | [Audrey Yang](https://github.com/audrey-yang)
58+
32 | [Currency Convertor cli app](https://github.com/chavarera/python-mini-projects/tree/master/projects/Currency%20Converter) | [github-of-wone](https://github.com/github-of-wone/)
59+
33 | [Stopwatch Application](https://github.com/chavarera/python-mini-projects/tree/master/projects/create%20a%20simple%20stopwatch) | [Gaodong](https://github.com/xlgd)
60+
34 | [CLI Proxy Tester](https://github.com/chavarera/python-mini-projects/tree/master/projects/cli_proxy_tester) | [Ingo Kleiber](https://github.com/IngoKl)
61+
35 | [XML to JSON file Convertor](https://github.com/chavarera/python-mini-projects/tree/master/projects/Convert_XML_To_JSON) | [John Kirtley](https://github.com/johnkirtley)
62+
36 | [Compress file and folders](https://github.com/chavarera/python-mini-projects/tree/master/projects/write%20script%20to%20compress%20folder%20and%20files) | [Gaodong](https://github.com/xlgd)
63+
37 | [Find IMDB movie ratings](https://github.com/chavarera/python-mini-projects/tree/master/projects/Find%20IMDb%20rating) | [ShivSt](https://github.com/ShivSt)
64+
38 | [Convert dictionary to python object](https://github.com/chavarera/python-mini-projects/tree/master/projects/convert_dictionary_to_python_object) | [Varun-22](https://github.com/Varun-22)
65+
39 | [move files to alphabetically arranged folders](https://github.com/chavarera/python-mini-projects/tree/master/projects/Write%20script%20to%20move%20files%20into%20alphabetically%20ordered%20folder) | [Chathura Nimesh](https://github.com/kana800/)
66+
40 | [Scrape Youtube video comment](https://github.com/chavarera/python-mini-projects/tree/master/projects/Web%20scraping%20a%20youtube%20comment) | [Saicharan67](https://github.com/Saicharan67)
67+
41 | [Website Summerization](https://github.com/chavarera/python-mini-projects/tree/master/projects/Web%20scraping%20a%20youtube%20comment) | [Believe Ohiozua](https://github.com/believeohiozua)
68+
42 | [Text To speech(mp3)](https://github.com/chavarera/python-mini-projects/tree/master/projects/TextToSpeech) | [Sergej Dikun](https://github.com/Serhazor)
69+
43 | [Image format conversio)](https://github.com/chavarera/python-mini-projects/tree/master/projects/convert_Imgs) | [Ramon Ferreira](https://github.com/ramonfsk)
70+
44 | [Save random article from wikipedia](https://github.com/chavarera/python-mini-projects/tree/master/projects/Random_Wikipedia_Article) | [Rakshit Puri](https://github.com/skate1512)
71+
45 | [Check website connectivity](https://github.com/chavarera/python-mini-projects/tree/master/projects/check%20website%20connectivity) | [Shiv Thakur](https://github.com/ShivSt)
72+
46 | [Fetch city weather information](https://github.com/chavarera/python-mini-projects/tree/master/projects/Fetch%20Current%20Weather) | [Kushal Agrawal](https://github.com/kushal98)
73+
47 | [Calculator App](https://github.com/chavarera/python-mini-projects/tree/master/projects/Create%20calculator%20app) | [Gaodong](https://github.com/xlgd)
74+
48 | [Merge Csv files](https://github.com/chavarera/python-mini-projects/tree/master/projects/Merge%20CSV%20Files) | [Kushal Agrawal](https://github.com/kushal98)
75+
49 | [Fetch tweets and save in csv](https://github.com/chavarera/python-mini-projects/tree/master/projects/Fetch%20and%20Store%20Tweets) | [Kushal Agrawal](https://github.com/kushal98)
76+
50 | [Language Translator using googletrans](https://github.com/chavarera/python-mini-projects/tree/master/projects/Language%20Translator) | [Ashiqur Rahman Tusher](https://github.com/ashikurt77)
77+
51 | [Split video using timeperiod](https://github.com/chavarera/python-mini-projects/tree/master/projects/split%20a%20video%20file%20by%20given%20time%20period) | [Chathura Nimesh](https://github.com/kana800/)
78+
52 | [Fetch unique words from file](https://github.com/chavarera/python-mini-projects/tree/master/projects/Unique%20words%20in%20a%20file) | [Rakshit Puri](https://github.com/skate1512)

projects/CLI Todo/README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Simple CLI Todo App
2+
Simple Todo app with command line interface. Supports adding, deleting, and viewing task entries.
3+
4+
## Dependencies
5+
Requires Python 3 and Click
6+
7+
Install Click: `pip install click`
8+
9+
## How to use
10+
### Running
11+
`python todo.py [command]`
12+
13+
### Commands
14+
|Command | Description|
15+
|-------|-------|
16+
|`add`| Adds a task. Prompts user for task text. |
17+
|`done`| Deletes a task. Prompts user for task id. |
18+
|`tasks`| Displays all inputted tasks. |

projects/CLI Todo/todo.py

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
import click
2+
3+
@click.group()
4+
@click.pass_context
5+
def todo(ctx):
6+
'''Simple CLI Todo App'''
7+
ctx.ensure_object(dict)
8+
#Open todo.txt – first line contains latest ID, rest contain tasks and IDs
9+
with open('./todo.txt') as f:
10+
content = f.readlines()
11+
#Transfer data from todo.txt to the context
12+
ctx.obj['LATEST'] = int(content[:1][0])
13+
ctx.obj['TASKS'] = {en.split('```')[0]:en.split('```')[1][:-1] for en in content[1:]}
14+
15+
@todo.command()
16+
@click.pass_context
17+
def tasks(ctx):
18+
'''Display tasks'''
19+
if ctx.obj['TASKS']:
20+
click.echo('YOUR TASKS\n**********')
21+
#Iterate through all the tasks stored in the context
22+
for i, task in ctx.obj['TASKS'].items():
23+
click.echo('• ' + task + ' (ID: ' + i + ')')
24+
click.echo('')
25+
else:
26+
click.echo('No tasks yet! Use ADD to add one.\n')
27+
28+
@todo.command()
29+
@click.pass_context
30+
@click.option('-add', '--add_task', prompt='Enter task to add')
31+
def add(ctx, add_task):
32+
'''Add a task'''
33+
if add_task:
34+
#Add task to list in context
35+
ctx.obj['TASKS'][ctx.obj['LATEST']] = add_task
36+
click.echo('Added task "' + add_task + '" with ID ' + str(ctx.obj['LATEST']))
37+
#Open todo.txt and write current index and tasks with IDs (separated by " ``` ")
38+
curr_ind = [str(ctx.obj['LATEST'] + 1)]
39+
tasks = [str(i) + '```' + t for (i, t) in ctx.obj['TASKS'].items()]
40+
with open('./todo.txt', 'w') as f:
41+
f.writelines(['%s\n' % en for en in curr_ind + tasks])
42+
43+
@todo.command()
44+
@click.pass_context
45+
@click.option('-fin', '--fin_taskid', prompt='Enter ID of task to finish', type=int)
46+
def done(ctx, fin_taskid):
47+
'''Delete a task by ID'''
48+
#Find task with associated ID
49+
if str(fin_taskid) in ctx.obj['TASKS'].keys():
50+
task = ctx.obj['TASKS'][str(fin_taskid)]
51+
#Delete task from task list in context
52+
del ctx.obj['TASKS'][str(fin_taskid)]
53+
click.echo('Finished and removed task "' + task + '" with id ' + str(fin_taskid))
54+
#Open todo.txt and write current index and tasks with IDs (separated by " ``` ")
55+
if ctx.obj['TASKS']:
56+
curr_ind = [str(ctx.obj['LATEST'] + 1)]
57+
tasks = [str(i) + '```' + t for (i, t) in ctx.obj['TASKS'].items()]
58+
with open('./todo.txt', 'w') as f:
59+
f.writelines(['%s\n' % en for en in curr_ind + tasks])
60+
else:
61+
#Resets ID tracker to 0 if list is empty
62+
with open('./todo.txt', 'w') as f:
63+
f.writelines([str(0) + '\n'])
64+
else:
65+
click.echo('Error: no task with id ' + str(fin_taskid))
66+
67+
if __name__ == '__main__':
68+
todo()

projects/CLI Todo/todo.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0

projects/Calculate age/calculate.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
# -*- coding: utf-8 -*-
12
import time
23

4+
35
# judge the leap year
46
def judge_leap_year(year):
57
if (year % 4) == 0:
@@ -13,15 +15,18 @@ def judge_leap_year(year):
1315
else:
1416
return False
1517

18+
1619
# returns the number of days in each month
1720
def month_days(month, leap_year):
18-
if month == 1 or month == 3 or month == 5 or month == 7 or month == 8 or month == 10 or month == 12:
21+
if month == 1 or month == 3 or month == 5 or month == 7:
22+
return 31
23+
elif month == 8 or month == 10 or month == 12:
1924
return 31
2025
elif month == 4 or month == 6 or month == 9 or month == 11:
2126
return 30
2227
elif month == 2 and leap_year:
2328
return 29
24-
elif month ==2 and (not leap_year):
29+
elif month == 2 and (not leap_year):
2530
return 28
2631

2732

@@ -30,7 +35,7 @@ def month_days(month, leap_year):
3035
localtime = time.localtime(time.time())
3136

3237
year = int(age)
33-
month = year* 12 + localtime.tm_mon
38+
month = year * 12 + localtime.tm_mon
3439
day = 0
3540

3641
begin_year = int(localtime.tm_year) - year
@@ -48,6 +53,5 @@ def month_days(month, leap_year):
4853
day = day + month_days(m, leap_year)
4954

5055
day = day + localtime.tm_mday
51-
52-
53-
print("%s's age is %d years or %d months or %d days" % (name, year, month, day))
56+
print("%s's age is %d years or " % (name, year), end="")
57+
print("%d months or %d days" % (month, day))
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Capture Video Frames
2+
##### Execute
3+
`python capture_video_frames.py <video_file>`
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import os
2+
import shutil
3+
import sys
4+
import cv2
5+
6+
class FrameCapture:
7+
'''
8+
Class definition to capture frames
9+
'''
10+
def __init__(self, file_path):
11+
'''
12+
initializing directory where the captured frames will be stored.
13+
Also truncating the directory where captured frames are stored, if exists.
14+
'''
15+
self.directory = "captured_frames"
16+
self.file_path = file_path
17+
if os.path.exists(self.directory):
18+
shutil.rmtree(self.directory)
19+
os.mkdir(self.directory)
20+
21+
def capture_frames(self):
22+
'''
23+
This method captures the frames from the video file provided.
24+
This program makes use of openCV library
25+
'''
26+
cv2_object = cv2.VideoCapture(self.file_path)
27+
28+
frame_number = 0
29+
frame_found = 1
30+
31+
while frame_found:
32+
frame_found, image = cv2_object.read()
33+
capture = f'{self.directory}/frame{frame_number}.jpg'
34+
cv2.imwrite(capture, image)
35+
36+
frame_number += 1
37+
38+
if __name__ == '__main__':
39+
file_path = sys.argv[1]
40+
fc = FrameCapture(file_path)
41+
fc.capture_frames()
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import json
2+
import xmltodict
3+
4+
with open('input.xml') as xml_file:
5+
parsed_data = xmltodict.parse(xml_file.read())
6+
7+
xml_file.close()
8+
9+
json_conversion = json.dumps(parsed_data)
10+
11+
with open('output.json', 'w') as json_file:
12+
json_file.write(json_conversion)
13+
14+
json_file.close()

0 commit comments

Comments
 (0)