reveal the wget magic
This commit is contained in:
Binary file not shown.
@@ -22,7 +22,7 @@ try:
|
|||||||
except ImportError:
|
except ImportError:
|
||||||
MARKDOWN_AVAILABLE = False
|
MARKDOWN_AVAILABLE = False
|
||||||
|
|
||||||
VERSION = "20211116"
|
VERSION = "20220217"
|
||||||
IMAGE_EXTENSIONS = ["png", "gif", "jpg", "jpeg", "tif", "tiff"]
|
IMAGE_EXTENSIONS = ["png", "gif", "jpg", "jpeg", "tif", "tiff"]
|
||||||
AUDIO_EXTENSIONS = ["wav", "mp3", "ogg"]
|
AUDIO_EXTENSIONS = ["wav", "mp3", "ogg"]
|
||||||
VIDEO_EXTENSIONS = ["mp4", "ogg", "webm"]
|
VIDEO_EXTENSIONS = ["mp4", "ogg", "webm"]
|
||||||
@@ -319,11 +319,15 @@ def get_filelink(path, fname, images=False, media=False):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def get_wget_command():
|
||||||
|
return 'wget -qO - "$URL" | grep "^#FILE " | cut -c7- | sed "s,^,$URL," | xargs -n1 wget -Nc'
|
||||||
|
|
||||||
|
|
||||||
def get_download_lines(files, recursive=False):
|
def get_download_lines(files, recursive=False):
|
||||||
s = "\n<!--\n"
|
s = "\n<!--\n"
|
||||||
for f in files:
|
for f in files:
|
||||||
s += "#FILE %s\n" % (urllib.parse.quote(f),)
|
s += "#FILE %s\n" % (urllib.parse.quote(f),)
|
||||||
s += "#DL-CMD:\n#URL=[insert URL] && wget -qO - $URL | grep '^#FILE ' | cut -c7- | sed \"s,^,$URL,\" | xargs -n1 wget -Nc"
|
s += "#DL-CMD:\n#URL=[insert URL] && " + get_wget_command()
|
||||||
if recursive:
|
if recursive:
|
||||||
s += "x"
|
s += "x"
|
||||||
s += "\n-->\n"
|
s += "\n-->\n"
|
||||||
@@ -503,7 +507,8 @@ def get_readme(path, no_read):
|
|||||||
def get_header(opts):
|
def get_header(opts):
|
||||||
opts_str = setup2JSON(opts)
|
opts_str = setup2JSON(opts)
|
||||||
|
|
||||||
js_code = """
|
js_code = (
|
||||||
|
"""
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
/*
|
/*
|
||||||
Table sorting script by Joost de Valk, check it out at http://www.joostdevalk.nl/code/sortable-table/.
|
Table sorting script by Joost de Valk, check it out at http://www.joostdevalk.nl/code/sortable-table/.
|
||||||
@@ -825,9 +830,17 @@ function alternate(table) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
function show_wget_magic() {
|
||||||
|
document.getElementById("wget_magic").innerHTML = 'URL="' + document.URL +'" && ' +
|
||||||
|
'"""
|
||||||
|
+ get_wget_command()
|
||||||
|
+ """';
|
||||||
|
document.getElementById("wget_magic").classList.toggle("hidden");
|
||||||
|
window.scrollTo(0,document.body.scrollHeight);
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
"""
|
"""
|
||||||
|
)
|
||||||
css_style = """
|
css_style = """
|
||||||
<style>
|
<style>
|
||||||
/* Style modified from: https://css-tricks.com/snippets/php/display-styled-directory-contents/ */
|
/* Style modified from: https://css-tricks.com/snippets/php/display-styled-directory-contents/ */
|
||||||
@@ -849,6 +862,7 @@ function alternate(table) {
|
|||||||
}
|
}
|
||||||
.container {
|
.container {
|
||||||
margin: 20px;
|
margin: 20px;
|
||||||
|
margin-bottom: 0px;
|
||||||
box-shadow: 0 5px 10px -5px rgba(0,0,0,0.5);
|
box-shadow: 0 5px 10px -5px rgba(0,0,0,0.5);
|
||||||
position: relative;
|
position: relative;
|
||||||
background: #eee;
|
background: #eee;
|
||||||
@@ -916,24 +930,24 @@ function alternate(table) {
|
|||||||
color: #222;
|
color: #222;
|
||||||
}
|
}
|
||||||
.right {
|
.right {
|
||||||
text-align: right;
|
text-align: right;
|
||||||
}
|
}
|
||||||
.bytes {
|
.bytes {
|
||||||
font-size: xx-small;
|
font-size: xx-small;
|
||||||
}
|
}
|
||||||
.image {
|
.image {
|
||||||
max-width: 90%;
|
max-width: 90%;
|
||||||
}
|
}
|
||||||
.audio {
|
.audio {
|
||||||
width: 90%;
|
width: 90%;
|
||||||
padding-left: 5px;
|
padding-left: 5px;
|
||||||
}
|
}
|
||||||
.video {
|
.video {
|
||||||
width: 320;
|
width: 320;
|
||||||
height: 240;
|
height: 240;
|
||||||
}
|
}
|
||||||
.container pre {
|
.container pre {
|
||||||
margin: 10px 10px 10px 10px;
|
margin: 10px 10px 10px 10px;
|
||||||
}
|
}
|
||||||
.readme {
|
.readme {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
@@ -944,13 +958,13 @@ function alternate(table) {
|
|||||||
}
|
}
|
||||||
@media only screen and (max-width: 600px) {
|
@media only screen and (max-width: 600px) {
|
||||||
.container {
|
.container {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
min-width: 800px;
|
min-width: 800px;
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
table {
|
table {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
width: 800px;
|
width: 800px;monilla yrityksi
|
||||||
}
|
}
|
||||||
td {
|
td {
|
||||||
padding-top: 10px;
|
padding-top: 10px;
|
||||||
@@ -962,6 +976,31 @@ function alternate(table) {
|
|||||||
word-break: break-all;
|
word-break: break-all;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#wget_container {
|
||||||
|
display: inline-block;
|
||||||
|
margin-left: 20px;
|
||||||
|
margin-right: 20px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
#wget_toggle {
|
||||||
|
display: inline-block;
|
||||||
|
cursor: pointer;
|
||||||
|
background-color: #EB6000;
|
||||||
|
color: white;
|
||||||
|
padding: 5px;
|
||||||
|
box-shadow: 0 5px 10px -5px rgba(0,0,0,0.5);
|
||||||
|
}
|
||||||
|
#wget_magic {
|
||||||
|
white-space: pre-wrap;
|
||||||
|
word-wrap: break-word;
|
||||||
|
padding: 20px;
|
||||||
|
background-color: #eee;
|
||||||
|
margin: 0px;
|
||||||
|
box-shadow: 0 5px 10px -5px rgba(0,0,0,0.5);
|
||||||
|
}
|
||||||
|
.hidden {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
"""
|
"""
|
||||||
header = (
|
header = (
|
||||||
@@ -995,7 +1034,12 @@ function alternate(table) {
|
|||||||
|
|
||||||
|
|
||||||
def get_footer(readme):
|
def get_footer(readme):
|
||||||
return """</tbody></table>{README}</div>
|
return """</tbody></table>{README}
|
||||||
|
</div>
|
||||||
|
<div id=wget_container>
|
||||||
|
<div id=wget_toggle onclick="show_wget_magic()">wget?</div>
|
||||||
|
<pre id=wget_magic class=hidden></pre>
|
||||||
|
</div>
|
||||||
</body></html>""".format(
|
</body></html>""".format(
|
||||||
README=readme
|
README=readme
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user