-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.py
94 lines (70 loc) · 2.15 KB
/
run.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
import os, subprocess
#yadcall
def desktoporpandora():
if os.path.isdir("/usr/pandora"):
runningmachine="pandora"
yadcall="./yad"
#locate smplayer
else:
runningmachine="desktop"
yadcall="yad"
#quitprocedure
def createcoursefolder():
if not os.path.isdir("COURSES"):
os.makedirs("COURSES")
def getFolderSize(folder):
total_size = os.path.getsize(folder)
for item in os.listdir(folder):
itempath = os.path.join(folder, item)
if os.path.isfile(itempath):
total_size += os.path.getsize(itempath)
elif os.path.isdir(itempath):
total_size += getFolderSize(itempath)
return total_size
#see if i cannot simplify this function...
def returnfolders(directory):
contentdirs=[]
for element in os.listdir(directory):
if os.path.isdir(element):
contentdirs.append(str(element))
finalstring=""
for element in contentdirs:
finalstring+="> "+str(element)+" "+getFolderSize(element)+" "
return finalstring
def returnfiles(directory):
contentfiles=[]
for element in os.listdir(directory):
if os.path.isfile(element):
contentfiles.append(str(element))
finalstring=""
for element in contentfiles:
finalstring+=str(element)+" "+os.path.getsize(element)+" "
return finalstring
def firsttimeusage():
if os.path.isfile("firsttime.txt"):
return False
else:
with open("firsttime.txt", 'a'):
os.utime("firsttime.txt", None)
return True
def checkloginpass():
if os.path.isfile("login.txt") and os.path.isfile("password.txt"):
return True
else:
return False
def displaymenu():
pass
def locatesmplayer():
smplayerlocation=""
for item in os.listdir("/media/"):
if not "smplayer2_r6.pnd" in item:
continue
else:
smplayerlocation=item
print smplayerlocation
return smplayerlocation
def main():
createcoursefolder()
if firsttimeusage()==True:
pass #display welcome message
#locate smplayer