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 1
1
/AppStorage /
2
2
/__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():
7
7
if (len (fileData ) < 1 ):
8
8
return True
9
9
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 1
1
import 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" )
9
2
10
3
def RemoveLines ():
11
4
file = open ("links.txt" , "w" )
Original file line number Diff line number Diff line change 3
3
# Input is going to be [url, fileName]
4
4
5
5
import os
6
+ from Checker import isFolderExists
6
7
7
8
def CheckFile (fileName ):
8
9
path = "AppStorage/" + fileName + ".txt"
@@ -11,19 +12,10 @@ def CheckFile(fileName):
11
12
if (not isExists ):
12
13
open ((path ), "x" )
13
14
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
-
23
15
def WriteData (Data ):
24
16
# Data -> [URL, fileName]
25
17
path = "AppStorage/" + Data [1 ] + ".txt"
26
- CheckFolder () # Ensure the folder exists
18
+ isFolderExists ()
27
19
CheckFile (Data [1 ]) # Ensure the file exists
28
20
29
21
with open (path , "a" ) as file :
Original file line number Diff line number Diff line change 1
1
from 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
5
5
6
6
def main ():
7
- CheckLinksFile ()
7
+ isLinksFileExists ()
8
8
9
9
if (isLinksFileEmpty ):
10
10
print ("Your links.txt file is empty. Fill it with your desired log lines to proceed." )
11
11
else :
12
12
fileData = open ("links.txt" , "r" ).readlines ()
13
- CheckFolder ()
13
+ isFolderExists ()
14
14
15
15
for x in fileData :
16
16
data = Extract (x )
You can’t perform that action at this time.
0 commit comments