File tree Expand file tree Collapse file tree 6 files changed +25
-24
lines changed
Expand file tree Collapse file tree 6 files changed +25
-24
lines changed Original file line number Diff line number Diff line change 11/AppStorage /
22/__pycache__ /
3- /links.txt
3+ /links.txt
4+ /build /
5+ /dist /
6+ /main.spec
Original file line number Diff line number Diff line change @@ -7,4 +7,17 @@ def isLinksFileEmpty():
77 if (len (fileData ) < 1 ):
88 return True
99 else :
10- return False
10+ return False
11+
12+ def isFolderExists ():
13+ isExists = os .path .exists ("AppStorage" )
14+
15+ if (not isExists ):
16+ os .mkdir ("AppStorage" )
17+
18+ def isLinksFileExists ():
19+ isExists = os .path .exists ("links.txt" )
20+
21+ if (not isExists ):
22+ print ("Your links.txt file is not exists. New one created." )
23+ file = open ("links.txt" , "x" )
Original file line number Diff line number Diff line change 11import os
2-
3- def CheckLinksFile ():
4- isExists = os .path .exists ("links.txt" )
5-
6- if (not isExists ):
7- print ("Your links.txt file is not exists. New one created." )
8- file = open ("links.txt" , "x" )
92
103def RemoveLines ():
114 file = open ("links.txt" , "w" )
Original file line number Diff line number Diff line change 33# Input is going to be [url, fileName]
44
55import os
6+ from Checker import isFolderExists
67
78def CheckFile (fileName ):
89 path = "AppStorage/" + fileName + ".txt"
@@ -11,19 +12,10 @@ def CheckFile(fileName):
1112 if (not isExists ):
1213 open ((path ), "x" )
1314
14- def CheckFolder ():
15- # In this function, I will handle folder existence.
16- # If folder not exists, function gonna be create new folder.
17-
18- isExists = os .path .exists ("AppStorage" )
19-
20- if (not isExists ):
21- os .mkdir ("AppStorage" )
22-
2315def WriteData (Data ):
2416 # Data -> [URL, fileName]
2517 path = "AppStorage/" + Data [1 ] + ".txt"
26- CheckFolder () # Ensure the folder exists
18+ isFolderExists ()
2719 CheckFile (Data [1 ]) # Ensure the file exists
2820
2921 with open (path , "a" ) as file :
Original file line number Diff line number Diff line change 11from LinkExtractor import Extract
2- from Saver import CheckFolder , WriteData
3- from Remover import CheckLinksFile , RemoveLines
4- from Checker import isLinksFileEmpty
2+ from Saver import WriteData
3+ from Remover import RemoveLines
4+ from Checker import isLinksFileEmpty , isFolderExists , isLinksFileExists
55
66def main ():
7- CheckLinksFile ()
7+ isLinksFileExists ()
88
99 if (isLinksFileEmpty ):
1010 print ("Your links.txt file is empty. Fill it with your desired log lines to proceed." )
1111 else :
1212 fileData = open ("links.txt" , "r" ).readlines ()
13- CheckFolder ()
13+ isFolderExists ()
1414
1515 for x in fileData :
1616 data = Extract (x )
You can’t perform that action at this time.
0 commit comments