Skip to content

Commit 5b5b168

Browse files
committed
ui updated in url chart
1 parent ff071ab commit 5b5b168

File tree

1 file changed

+19
-28
lines changed

1 file changed

+19
-28
lines changed

โ€Žsrc/url.shโ€Ž

Lines changed: 19 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,17 @@ source "${Dir}"/inspect.sh
1818
# source inspect.sh
1919

2020
# url.contentSize(url) -> int
21-
# Gives you size of content file in MBs.
21+
# Gives you size of content file in MiB.
2222
# Args:
2323
# url (str) > takes url as string.
2424
# Returns:
25-
# size (int) > size in MBs (eg: 60).
25+
# size (int) > size in MiB (eg: 60).
2626
url.contentSize(){
2727
# checking required functions.
2828
inspect.is_func 'wget';
29-
local contentSizeVar="$(wget --spider "${1}" --no-check-certificate 2>&1)";
30-
local contentSize="$(echo "${contentSizeVar}" | grep -i length: | awk '{print $2}')";
31-
echo "$(( contentSize/1048576 ))";
29+
local ContentSizeVar="$(wget --spider "${1}" --no-check-certificate 2>&1)";
30+
local ContentSize="$(echo "${ContentSizeVar}" | grep -i length: | awk '{print $2}')";
31+
echo "$(( ContentSize/1048576 ))";
3232
}
3333

3434
# url.contentChart(urls,*paths)
@@ -37,42 +37,33 @@ url.contentSize(){
3737
# urls (array) > takes one or array of urls.
3838
# paths (array) > Optional: takes file paths.
3939
url.contentChart(){
40-
inspect.ScreenSize '81' '38';
41-
# taking urls and content path.
40+
inspect.ScreenSize '50' '12';
4241
local ARGs=("${@}")
43-
# size of all contents.
4442
local PuraSize=0;
45-
# turning off cursor of terminal.
4643
setCursor off;
47-
echo;
48-
say.success "๐Ÿ“ฆ Getting Information Urls";
49-
echo -e "
50-
โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”“
51-
โ”ƒ INFORMATION FILES โ”ƒ
52-
โ”ฃโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ซ
53-
โ”ƒ FILE NAME FILE SIZE โ”ƒ
54-
โ”—โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”›";
44+
echo -e "
45+
โ•ญโ”€ Content โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ";
46+
echo -e " โ”‚ โ”‚";
47+
printf " โ”‚ %-34s %-7s โ”‚\n" 'Content' 'Size';
48+
printf " โ”‚ %-34s %-7s โ”‚\n" 'โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€' 'โ”€โ”€โ”€โ”€โ”€โ”€โ”€';
5549
for ARG in "${ARGs[@]}"
5650
do
57-
# url of content.
5851
local ContentUrl="$(echo "${ARG}" | awk '{print $1}')";
59-
# path of content.
6052
local ContentPath="$(echo "${ARG}" | awk '{print $2}')";
61-
# check if path is provided.
62-
[[ -z "${Path}" ]] &&
53+
[[ -z "${ContentPath}" ]] &&
6354
local ContentVar="$(echo "${ContentUrl}" | awk -F/ '{print $NF}')" ||
6455
local ContentVar="$(echo "${ContentPath}" | awk -F/ '{print $NF}')";
65-
# taking content size of url.
6656
local ContentSize="$(url.contentSize "${ContentUrl}")";
67-
printf " โ”ƒ ${Green}%-36s${Clear} ${Yelo}%8s${Clear} โ”ƒ\n" "${ContentVar}" "${ContentSize} MB";
68-
echo -e " โ”—โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”›";
69-
# add all size of contents.
57+
printf " โ”‚ ${Green}%-34s${Clear} ${Yelo}%3s${Clear} %-3s โ”‚\n" "${ContentVar}" "${ContentSize}" 'MiB';
7058
local PuraSize=$(( PuraSize+ContentSize ))
7159
done
72-
# print total content size.
73-
printf " โ”ƒ [ ${Yelo}%5s${Clear} ] โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€> ${Green}%7s${Clear} %-2s โ”ƒ" "TOTAL" "${PuraSize} MB";
74-
echo -e "\n โ”—โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”›";
60+
echo -e " โ”‚ โ”‚";
61+
echo -e " โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ\n";
62+
echo -e " โ•ญโ”€ TOTAL โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ";
63+
printf " โ”‚ %14s: ${Green}%4s${Clear} %3s โ”‚\n" "Download Size" "${PuraSize}" 'MiB';
64+
echo -e " โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ";
7565
setCursor on;
66+
return 0;
7667
}
7768

7869
# url.getContent(urls,*paths)

0 commit comments

Comments
ย (0)