Skip to content

Commit 6b9d723

Browse files
committed
Requested changes made
1 parent d13bfe7 commit 6b9d723

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

scripts/deduplicate.py

+17-5
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,20 @@
88
EURO = [
99
"b9f4175382a404007e19d3566061e36c",
1010
"9076ddd6ddf0bffc24e6ac71c1353d33",
11-
"1d7fb4e154e7198dfb39d16d9800844d"
11+
"1d7fb4e154e7198dfb39d16d9800844d",
1212
]
1313

14+
1415
def main():
1516
# Gets the full path of the www/l directory.
16-
path = Path().resolve().parent.joinpath("www", "l")
17+
path = (
18+
Path(os.path.dirname(os.path.abspath(__file__)))
19+
.resolve()
20+
.parent.joinpath("www", "l")
21+
)
22+
# Check if the directory is exists.
23+
if not os.path.exists(str(path)):
24+
raise Exception("The www/l folder doesn't exists!")
1725
# Stores the original files
1826
original_files = {}
1927
for root, dirs, files in os.walk(path):
@@ -42,7 +50,11 @@ def main():
4250
# by-nc/1.0/80x15.png --> by-nc - first
4351
# x 1.0
4452
# --> 80x15.png - last
45-
parent = Path(path).joinpath(os.path.join(Path(relative).parts[0], Path(relative).parts[-1]))
53+
parent = Path(path).joinpath(
54+
os.path.join(
55+
Path(relative).parts[0], Path(relative).parts[-1]
56+
)
57+
)
4658

4759
# If the file contains an euro symbol, add -e tag to the end of file
4860
# to avoid the overwriting.
@@ -63,13 +75,13 @@ def main():
6375
# Will be deleted and replaced with symbolic link
6476
# that points to "by-nc/80x15.png"
6577
if str(parent) != str(f):
66-
symlinks = [ str(f) ]
78+
symlinks = [str(f)]
6779
if not os.path.exists(str(parent)):
6880
copyfile(str(f), str(parent))
6981

7082
original_files[digest] = {
7183
"base": str(parent),
72-
"symlinks": symlinks
84+
"symlinks": symlinks,
7385
}
7486
# Start deleting the duplicated files and create
7587
# symbolic links instead.

0 commit comments

Comments
 (0)