Skip to content

Commit

Permalink
init updates
Browse files Browse the repository at this point in the history
  • Loading branch information
ravi-prakash1907 committed May 22, 2021
1 parent dc3fa46 commit f13af98
Show file tree
Hide file tree
Showing 4 changed files with 141 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM python:3.2
LABEL maintainer="ravi.cs20@iiitmk.ac.in"

WORKDIR /root

RUN git clone --depth=1 https://github.com/ravi-prakash1907/CaterApp.git && \
cd /root/CaterApp && \
pip3 install . -r requirements.txt && \
cd caterapp

CMD /bin/bash
17 changes: 17 additions & 0 deletions caterapp/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# cater
An instent file sharing application based on TCP

### Accessing through Terminal/Command-line
The python version of this application is latest!

1. Open the app by running ```python3 cater.py```
2. The the desired option.
- If you are the sender:
- Set up your `IP-Address` or `Hosting URL`
- Wait for the reciver to connect
- Choose the files that you want to send
- If you are the receiver
- Provide the sender's `IP-Address` or `Hosting URL`
- Wait for the files to arrive
3. _You can use localhost (127.0.0.1) for testing on the same machine._

112 changes: 112 additions & 0 deletions caterapp/cater.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
## importing modules
from shareBox import server as sender
from shareBox import client as receiver
from random import randint

######################


## banner printer
def printBanner():
## defining the banner
banner=''' 888
888
888
.d8888b 8888b. 888888 .d88b. 888d888 8888b. 88888b. 88888b.
d88P" "88b 888 d8P Y8b 888P" "88b 888 "88b 888 "88b
888 .d888888 888 88888888 888 .d888888 888 888 888 888
Y88b. 888 888 Y88b. Y8b. 888 888 888 888 d88P 888 d88P
"Y8888P "Y888888 "Y888 "Y8888 888 "Y888888 88888P" 88888P"
888 888
______________________________________________________ 888 ____ 888 _____
888 888
Using v1.1 888 888 '''

## printing greeting
print("\n welcome to:",end="")

## choosing a color banner
colorCode = 31 + randint(1,100) % 7
BANNERCOLOR = '\033[' + str(colorCode) + 'm' # 31 to 37

## printting the banner
print(BANNERCOLOR + banner)

## resetting the colors
BANNERCOLOR = '\033[m'
print(BANNERCOLOR + "")

return


######################################


class cater():
def __init__(self, menuOption=""):
## greeting
printBanner()
## menu
self.__mainMenu = "\n Menu\n"+"-"*6+"\n\n1. Send Files! \n2. Receive Files!"+menuOption
self.choice = self.__menu__()

## main menu
def __menu__(self):
print(self.__mainMenu)
ch = input("\nEnter your choice: ")
return ch

## mainApp
def cater(self):
## making host to share files
if self.choice == '1':
Sender = sender.server()
print("\n"+"-"*20+"\n")
Sender.server()
return True
## making client to get files
elif self.choice == '2':
Receiver = receiver.client()
print("\n"+"-"*20+"\n")
Receiver.client()
return True
## invalid input
else:
print("\n"+"-"*20+"\n")
return False

## if ran at least once
flag = False

######################
def app():
flag = True
firstRun = True
addOnMenu = ''

while flag:
## creating an instance
caterApp = cater(addOnMenu)
## sharing the files
flag = caterApp.cater()

## adding exit choice in menu
if flag and firstRun:
firstRun = False
if firstRun is False:
addOnMenu = "\n* Any other key to exit!!"

## deleting current instence on Secreat Share App
del(caterApp)

## exit prompt
if firstRun:
print("\nSomething went wrong!!\nApp terminated unexpectedly!!")
else:
print("\nThanks for using 'cater'!\n")


#############################################

if __name__ == '__main__':
app()
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cater>=0.1

0 comments on commit f13af98

Please sign in to comment.