Compare commits
32
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f6506aeeca | ||
|
|
795720dcd2 | ||
|
|
85962b11a6 | ||
|
|
c1229b348e | ||
|
|
06358c4c07 | ||
|
|
fffde38fed | ||
|
|
13bfc40c6a | ||
|
|
9024a1eab6 | ||
|
|
aa851a7779 | ||
|
|
ac3d20d072 | ||
|
|
02f16516f1 | ||
|
|
c8301113e5 | ||
|
|
73fd35ad40 | ||
|
|
996ed3d776 | ||
|
|
05feced28f | ||
|
|
fe844437fb | ||
|
|
3de05c08bc | ||
|
|
e6509e0932 | ||
|
|
ce95ed4854 | ||
|
|
3bf2d553c8 | ||
|
|
b3fb490c16 | ||
|
|
5e8c2c73fd | ||
|
|
a75aabbec6 | ||
|
|
583522a422 | ||
|
|
a9b4a95e0c | ||
|
|
8b68d52be0 | ||
|
|
8f52aca2b4 | ||
|
|
744f920854 | ||
|
|
fe43d274cb | ||
|
|
53f4c17a08 | ||
|
|
f728cdafb4 | ||
|
|
21b4b9b7fb |
@@ -17,6 +17,16 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
ls ${{ gitea.workspace }}
|
ls ${{ gitea.workspace }}
|
||||||
|
|
||||||
|
- name: Compute next version
|
||||||
|
id: versioning
|
||||||
|
run: |
|
||||||
|
latest="${{ vars.VERSION }}"
|
||||||
|
next_version=$(echo "$latest" | awk -F. -v OFS=. '{$NF += 1 ; print}')
|
||||||
|
echo "next_version=$next_version" >> $GITHUB_ENV
|
||||||
|
echo "Variables used :"
|
||||||
|
echo "------------------------------------------------"
|
||||||
|
echo "Next version: $next_version"
|
||||||
|
|
||||||
- name: Cache pip
|
- name: Cache pip
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
@@ -29,7 +39,6 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
cache-source: /root/.cache/pip
|
cache-source: /root/.cache/pip
|
||||||
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
@@ -44,11 +53,12 @@ jobs:
|
|||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
push: true
|
push: true
|
||||||
#build-contexts: pip_cache=${{steps.vars.outputs.pip-dir}}
|
tags: |
|
||||||
tags: gitea.tryton.geeraert.eu/pi-ux-ce/django-python:latest
|
gitea.tryton.geeraert.eu/pi-ux-ce/django-python:latest
|
||||||
|
gitea.tryton.geeraert.eu/pi-ux-ce/django-python:${{ env.next_version }}
|
||||||
cache-from: type=registry,ref=gitea.tryton.geeraert.eu/pi-ux-ce/django-python:buildcache
|
cache-from: type=registry,ref=gitea.tryton.geeraert.eu/pi-ux-ce/django-python:buildcache
|
||||||
cache-to: type=registry,ref=gitea.tryton.geeraert.eu/pi-ux-ce/django-python:buildcache,mode=max
|
cache-to: type=registry,ref=gitea.tryton.geeraert.eu/pi-ux-ce/django-python:buildcache,mode=max
|
||||||
|
|
||||||
- name: drop the pod to force pulling the new image
|
- name: drop the pod to force pulling the new image
|
||||||
uses: actions-hub/kubectl@master
|
uses: actions-hub/kubectl@master
|
||||||
env:
|
env:
|
||||||
@@ -56,3 +66,10 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
args: rollout restart deployment django -n django
|
args: rollout restart deployment django -n django
|
||||||
- run: echo "🍏 This job's status is ${{ job.status }}."
|
- run: echo "🍏 This job's status is ${{ job.status }}."
|
||||||
|
|
||||||
|
- name: update version in the variable
|
||||||
|
run: |
|
||||||
|
curl -X PUT -H "Content-Type: application/json" \
|
||||||
|
--user ${{ secrets.USERNAME_GITEA }}:${{ secrets.PASSWORD_GITEA }} \
|
||||||
|
https://gitea.tryton.geeraert.eu/api/v1/repos/pi-ux-ce/${{ github.event.repository.name }}/actions/variables/VERSION \
|
||||||
|
-d "{\"Value\":\"$next_version\"}"
|
||||||
@@ -0,0 +1,299 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||||
|
<title>Stash form</title>
|
||||||
|
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto|Varela+Round">
|
||||||
|
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css">
|
||||||
|
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
|
||||||
|
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
|
||||||
|
|
||||||
|
<style>
|
||||||
|
@charset "UTF-8";
|
||||||
|
.m-b-xs {
|
||||||
|
margin-bottom: 2%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.m-b-md {
|
||||||
|
margin-bottom: 10%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.m-t-xs {
|
||||||
|
margin-top: 2%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.m-t-sm {
|
||||||
|
margin-top: 5%;
|
||||||
|
}
|
||||||
|
|
||||||
|
* {
|
||||||
|
outline: 0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
padding: 2% 0;
|
||||||
|
background-color: #37404a;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
font-family: "Roboto", sans-serif;
|
||||||
|
font-size: 2.2em;
|
||||||
|
font-weight: 300;
|
||||||
|
color: #85ffc7;
|
||||||
|
text-transform: uppercase;
|
||||||
|
}
|
||||||
|
|
||||||
|
p {
|
||||||
|
font-family: "Roboto", sans-serif;
|
||||||
|
font-size: 1.1em;
|
||||||
|
font-weight: 300;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
a:hover {
|
||||||
|
text-decoration: none;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
#survey-form label,
|
||||||
|
#survey-form .labels {
|
||||||
|
display: block;
|
||||||
|
margin-bottom: 2%;
|
||||||
|
font-family: "Roboto", sans-serif;
|
||||||
|
font-size: 1.1em;
|
||||||
|
font-weight: 300;
|
||||||
|
color: #fff;
|
||||||
|
letter-spacing: 0.5px;
|
||||||
|
}
|
||||||
|
#survey-form input::-webkit-input-placeholder {
|
||||||
|
color: transparent !important;
|
||||||
|
}
|
||||||
|
#survey-form input::-moz-placeholder {
|
||||||
|
color: transparent !important;
|
||||||
|
}
|
||||||
|
#survey-form input:-ms-input-placeholder {
|
||||||
|
color: transparent !important;
|
||||||
|
}
|
||||||
|
#survey-form input:-moz-placeholder {
|
||||||
|
color: transparent !important;
|
||||||
|
}
|
||||||
|
#survey-form input,
|
||||||
|
#survey-form select {
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
overflow: hidden;
|
||||||
|
outline: none;
|
||||||
|
border: 2px solid #333;
|
||||||
|
}
|
||||||
|
#survey-form input {
|
||||||
|
margin-top: 1.5%;
|
||||||
|
padding: 0 0 5px 0;
|
||||||
|
background: transparent;
|
||||||
|
border: none;
|
||||||
|
outline: none;
|
||||||
|
border-bottom: 2px solid #fff;
|
||||||
|
font-size: 1.1em;
|
||||||
|
font-weight: 300;
|
||||||
|
color: #85ffc7;
|
||||||
|
}
|
||||||
|
#survey-form input:focus {
|
||||||
|
border-color: #85ffc7;
|
||||||
|
}
|
||||||
|
#survey-form [type=checkbox],
|
||||||
|
#survey-form [type=radio] {
|
||||||
|
display: inline-block;
|
||||||
|
width: auto;
|
||||||
|
margin: 0px 10px 0 0;
|
||||||
|
}
|
||||||
|
#survey-form [type=checkbox],
|
||||||
|
#survey-form [type=radio] {
|
||||||
|
display: inline-block;
|
||||||
|
margin: 0 10px 0 0 !important;
|
||||||
|
position: relative;
|
||||||
|
top: 5px;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
-webkit-appearance: none;
|
||||||
|
-moz-appearance: none;
|
||||||
|
-o-appearance: none;
|
||||||
|
appearance: none;
|
||||||
|
height: 23px;
|
||||||
|
width: 23px;
|
||||||
|
transition: all 0.15s ease-out 0s;
|
||||||
|
background: #37404a;
|
||||||
|
color: #fff;
|
||||||
|
cursor: pointer;
|
||||||
|
outline: none;
|
||||||
|
z-index: 1000;
|
||||||
|
border: 1px solid #fff;
|
||||||
|
}
|
||||||
|
#survey-form [type=checkbox]:hover,
|
||||||
|
#survey-form [type=radio]:hover {
|
||||||
|
border-color: #85ffc7;
|
||||||
|
}
|
||||||
|
#survey-form [type=checkbox]:checked:before,
|
||||||
|
#survey-form [type=radio]:checked:before {
|
||||||
|
display: inline-block;
|
||||||
|
height: 21px;
|
||||||
|
width: 21px;
|
||||||
|
position: relative;
|
||||||
|
left: 0;
|
||||||
|
bottom: 0;
|
||||||
|
content: "";
|
||||||
|
text-align: center;
|
||||||
|
font-family: "Glyphicons Halflings";
|
||||||
|
line-height: 20px;
|
||||||
|
font-size: 15px;
|
||||||
|
color: #85ffc7;
|
||||||
|
}
|
||||||
|
#survey-form [type=checkbox]:focus,
|
||||||
|
#survey-form [type=radio]:focus {
|
||||||
|
outline: none;
|
||||||
|
border-color: #fff;
|
||||||
|
}
|
||||||
|
#survey-form [type=radio] {
|
||||||
|
border-radius: 50%;
|
||||||
|
}
|
||||||
|
#survey-form [type=radio]:after {
|
||||||
|
border-radius: 50%;
|
||||||
|
}
|
||||||
|
#survey-form [type=number] {
|
||||||
|
width: 45px;
|
||||||
|
}
|
||||||
|
#survey-form [type=number]::-webkit-inner-spin-button, #survey-form [type=number]::-webkit-outer-spin-button {
|
||||||
|
-webkit-appearance: none;
|
||||||
|
-moz-appearance: none;
|
||||||
|
appearance: none;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
#survey-form select {
|
||||||
|
height: 40px;
|
||||||
|
padding-left: 5px;
|
||||||
|
background-color: #37404a;
|
||||||
|
border: 2px solid #fff;
|
||||||
|
color: #85ffc7;
|
||||||
|
}
|
||||||
|
#survey-form select option {
|
||||||
|
padding: 5px 10px;
|
||||||
|
font-weight: 300;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
#survey-form select option:hover {
|
||||||
|
background-color: #85ffc7;
|
||||||
|
}
|
||||||
|
#survey-form textarea {
|
||||||
|
resize: none;
|
||||||
|
margin-top: 2%;
|
||||||
|
padding: 10px 10px 0px 20px;
|
||||||
|
width: 100%;
|
||||||
|
height: 90px;
|
||||||
|
color: #85ffc7;
|
||||||
|
background-color: #37404a;
|
||||||
|
border: 2px solid #fff;
|
||||||
|
}
|
||||||
|
#survey-form .btn {
|
||||||
|
display: inline-block;
|
||||||
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
margin: 3% 0 0 0;
|
||||||
|
height: 45px;
|
||||||
|
text-transform: uppercase;
|
||||||
|
text-decoration: none;
|
||||||
|
cursor: pointer;
|
||||||
|
border: 3px solid #85ffc7;
|
||||||
|
border-radius: 0;
|
||||||
|
font-weight: 500;
|
||||||
|
font-size: 1.2em;
|
||||||
|
color: #85ffc7;
|
||||||
|
text-align: center;
|
||||||
|
background: none;
|
||||||
|
transition: color 0.25s ease;
|
||||||
|
}
|
||||||
|
#survey-form .btn:after {
|
||||||
|
position: absolute;
|
||||||
|
content: "";
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 0;
|
||||||
|
height: 100%;
|
||||||
|
background-color: #85ffc7;
|
||||||
|
transform-origin: left;
|
||||||
|
transition: width 0.5s ease;
|
||||||
|
z-index: -1;
|
||||||
|
}
|
||||||
|
#survey-form .btn:hover {
|
||||||
|
color: #37404a;
|
||||||
|
}
|
||||||
|
#survey-form .btn:hover:after {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
#survey-form fieldset {
|
||||||
|
margin: 5% 0 0 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.copyright {
|
||||||
|
text-align: center;
|
||||||
|
font-size: 10px;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
.copyright i {
|
||||||
|
color: #ef5350;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media only screen and (max-width: 600px) {
|
||||||
|
body {
|
||||||
|
padding: 8% 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<main id="main" class="container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-xs-12 col-lg-offset-3 col-lg-6">
|
||||||
|
<div class="m-b-md text-center">
|
||||||
|
<h1 id="title">fapello Form</h1>
|
||||||
|
<p id="description" class="description" class="text-center">Download form</p>
|
||||||
|
</div>
|
||||||
|
<form method="GET" action="/stash/fapello-form/" id="survey-form" name="survey-form">
|
||||||
|
|
||||||
|
<fieldset>
|
||||||
|
<label for="name" id="name-label">
|
||||||
|
Name *
|
||||||
|
<input class="" type="text" id="name" name="name" placeholder="Enter your name (required)" required />
|
||||||
|
</label>
|
||||||
|
</fieldset>
|
||||||
|
<fieldset>
|
||||||
|
<label for="url" id="url-label">
|
||||||
|
URL of one image before the increment *
|
||||||
|
<input class="" type="url" id="url" name="url" placeholder="Enter the URL before the increment(required)" required />
|
||||||
|
</label>
|
||||||
|
</fieldset>
|
||||||
|
<fieldset>
|
||||||
|
<label for="url_suffix" id="url_suffix-label">
|
||||||
|
suffix URL of one image after the increment *
|
||||||
|
<input class="" type="string" id="url_suffix" name="url_suffix" placeholder="Enter the URL suffix (Example .png)(required)" required />
|
||||||
|
</label>
|
||||||
|
</fieldset>
|
||||||
|
<fieldset>
|
||||||
|
<label for="maximum_increment" id="maximum_increment_label">
|
||||||
|
Maximum increment value *
|
||||||
|
<input class="" type="text" id="maximum_increment" name="maximum_increment" placeholder="Enter the maximum increment(required)" required />
|
||||||
|
</label>
|
||||||
|
</fieldset>
|
||||||
|
<fieldset>
|
||||||
|
<label for="Minimum_increment" id="Minimum_increment_label">
|
||||||
|
Minimum increment value
|
||||||
|
<input class="" type="text" id="Minimum_increment" name="Minimum_increment" placeholder="Enter the minimum increment (default 1)" />
|
||||||
|
</label>
|
||||||
|
</fieldset>
|
||||||
|
<button id="submit" type="submit" class="btn">Submit the form</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
</html>
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||||
<title>Scaled up</title>
|
<title>Stash form</title>
|
||||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto|Varela+Round">
|
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto|Varela+Round">
|
||||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css">
|
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css">
|
||||||
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
|
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
|
||||||
@@ -277,7 +277,7 @@
|
|||||||
<fieldset>
|
<fieldset>
|
||||||
<label for="external_galleries">
|
<label for="external_galleries">
|
||||||
Any external galleries ?
|
Any external galleries ?
|
||||||
<textarea id="external_galleries" maxlength="194"></textarea>
|
<textarea id="external_galleries" name="external_galleries" ></textarea>
|
||||||
</label>
|
</label>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<button id="submit" type="submit" class="btn">Submit the form</button>
|
<button id="submit" type="submit" class="btn">Submit the form</button>
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
from .celery_settings import app as celery_app
|
||||||
|
|
||||||
|
__all__ = ("celery_app",)
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
import os
|
||||||
|
from celery import Celery
|
||||||
|
|
||||||
|
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'django_code.settings')
|
||||||
|
|
||||||
|
app = Celery("django_code")
|
||||||
|
app.config_from_object("django.conf:settings", namespace="CELERY")
|
||||||
|
app.autodiscover_tasks()
|
||||||
@@ -124,3 +124,6 @@ STATIC_URL = 'static/'
|
|||||||
|
|
||||||
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
||||||
#
|
#
|
||||||
|
# Celery settings
|
||||||
|
CELERY_BROKER_URL = "redis://django-redis-svc:6379"
|
||||||
|
CELERY_RESULT_BACKEND = "redis://django-redis-svc:6379"
|
||||||
@@ -61,7 +61,9 @@ urlpatterns = [
|
|||||||
################## kubernetes_connection#####
|
################## kubernetes_connection#####
|
||||||
path('stash/hello/', stashapp.hello),
|
path('stash/hello/', stashapp.hello),
|
||||||
path('stash/form/', stashapp.form),
|
path('stash/form/', stashapp.form),
|
||||||
|
path('stash/fapello/', stashapp.fapello),
|
||||||
path('stash/submit-form/', stashapp.handle_survey_form, name='submit_form'),
|
path('stash/submit-form/', stashapp.handle_survey_form, name='submit_form'),
|
||||||
|
path('stash/fapello-form/', stashapp.fapello_form, name='submit_form'),
|
||||||
|
|
||||||
|
|
||||||
# path('bookstack/', docker_connection.apps.hello),
|
# path('bookstack/', docker_connection.apps.hello),
|
||||||
|
|||||||
@@ -14,3 +14,10 @@ from django.core.wsgi import get_wsgi_application
|
|||||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'django_code.settings')
|
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'django_code.settings')
|
||||||
|
|
||||||
application = get_wsgi_application()
|
application = get_wsgi_application()
|
||||||
|
https_proxy = "gluetun-svc.gluetun.svc:8888"
|
||||||
|
|
||||||
|
proxyDict = {
|
||||||
|
"https" : https_proxy,
|
||||||
|
}
|
||||||
|
|
||||||
|
#os.environ["PROXIES"] = proxyDict
|
||||||
@@ -2,45 +2,114 @@ from django.apps import AppConfig
|
|||||||
from django.http import HttpResponse
|
from django.http import HttpResponse
|
||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
from django.shortcuts import redirect
|
from django.shortcuts import redirect
|
||||||
from jinja2 import Environment, FileSystemLoader
|
#from jinja2 import Environment, FileSystemLoader
|
||||||
from django.core.files import File
|
from django.core.files import File
|
||||||
from kubernetes import client, config
|
from kubernetes import client, config
|
||||||
|
from celery import shared_task
|
||||||
|
|
||||||
import time
|
import time
|
||||||
import random
|
import random
|
||||||
import mimetypes
|
import mimetypes
|
||||||
import ruamel.yaml
|
import ruamel.yaml
|
||||||
import yaml
|
import yaml
|
||||||
import urllib.request
|
from urllib import request as urlrequest
|
||||||
|
|
||||||
|
proxy_host = "gluetun-svc.gluetun.svc:8888"
|
||||||
|
|
||||||
|
|
||||||
def hello(request):
|
def hello(request):
|
||||||
return HttpResponse('<h1>Hello stash!</h1>')
|
return HttpResponse('<h1>Hello stash!</h1>')
|
||||||
def form(request):
|
def form(request):
|
||||||
return render(request, 'stash_form.html',{})
|
return render(request, 'stash_form.html',{})
|
||||||
|
|
||||||
|
def fapello(request):
|
||||||
|
return render(request, 'fapello_form.html',{})
|
||||||
|
|
||||||
|
def fapello_form(request):
|
||||||
|
stash_folder = "/tmp/stash"
|
||||||
|
name = request.GET.get('name')
|
||||||
|
url = request.GET.get('url')
|
||||||
|
url_suffix = request.GET.get('url_suffix')
|
||||||
|
maximum_increment = int(request.GET.get('maximum_increment'))
|
||||||
|
minimum_increment = request.GET.get('minimum_increment')
|
||||||
|
|
||||||
|
increment_and_download.delay(minimum_increment=minimum_increment,maximum_increment=maximum_increment,url=url,url_suffix=url_suffix,stash_folder=stash_folder,name=name)
|
||||||
|
|
||||||
|
#return HttpResponse(minimum_increment, content_type="text/plain")
|
||||||
|
|
||||||
|
# if minimum_increment == None:
|
||||||
|
# minimum_increment = 1
|
||||||
|
#
|
||||||
|
# text_generated = ""
|
||||||
|
#
|
||||||
|
# for increment in range(minimum_increment,maximum_increment):
|
||||||
|
# if len(str(increment)) == 3:
|
||||||
|
# increment_generated ='0' + str(increment)
|
||||||
|
# elif len(str(increment)) == 2:
|
||||||
|
# increment_generated ='00' + str(increment)
|
||||||
|
# elif len(str(increment)) == 1:
|
||||||
|
# increment_generated ='000' + str(increment)
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# urllib.request.urlretrieve(url+increment_generated+url_suffix, stash_folder+"/"+increment_generated+url_suffix)
|
||||||
|
# text_generated = "\n downloading for "+name+" "+url+increment_generated+url_suffix
|
||||||
|
text_generated = "successfully sent to celery"
|
||||||
|
return HttpResponse(text_generated, content_type="text/plain")
|
||||||
|
|
||||||
|
@shared_task()
|
||||||
|
def increment_and_download(minimum_increment,maximum_increment,url,url_suffix,stash_folder,name):
|
||||||
|
if minimum_increment == None:
|
||||||
|
minimum_increment = 1
|
||||||
|
|
||||||
|
text_generated = ""
|
||||||
|
|
||||||
|
for increment in range(minimum_increment,maximum_increment):
|
||||||
|
if len(str(increment)) == 3:
|
||||||
|
increment_generated ='0' + str(increment)
|
||||||
|
elif len(str(increment)) == 2:
|
||||||
|
increment_generated ='00' + str(increment)
|
||||||
|
elif len(str(increment)) == 1:
|
||||||
|
increment_generated ='000' + str(increment)
|
||||||
|
|
||||||
|
req = urlrequest.Request(url+increment_generated+url_suffix)
|
||||||
|
req.set_proxy(proxy_host, 'https')
|
||||||
|
urlrequest.urlretrieve(req, stash_folder+"/"+increment_generated+url_suffix)
|
||||||
|
text_generated = "\n downloading for "+name+" "+url+increment_generated+url_suffix
|
||||||
|
return text_generated
|
||||||
def handle_survey_form(request):
|
def handle_survey_form(request):
|
||||||
config.load_kube_config(config_file='/kubeconfig/config')
|
config.load_kube_config(config_file='/kubeconfig/config')
|
||||||
v1 = client.BatchV1Api()
|
v1 = client.BatchV1Api()
|
||||||
name = request.GET.get('name')
|
name = request.GET.get('name')
|
||||||
url = request.GET.get('url')
|
url = request.GET.get('url')
|
||||||
external_galleries = request.GET.get('external_galleries')
|
external_galleries = str(request.GET.get('external_galleries'))
|
||||||
|
|
||||||
|
stash_folder = "/stash"
|
||||||
|
|
||||||
|
if external_galleries:
|
||||||
|
print("external_galleries is not null")
|
||||||
|
performer_external_galleries = stash_folder+"/"+name+"_external_galleries.txt"
|
||||||
|
with open(performer_external_galleries, "a") as f:
|
||||||
|
f.write(external_galleries)
|
||||||
|
skip_searching_gallery = True
|
||||||
|
else:
|
||||||
|
print("external_galleries is null")
|
||||||
|
skip_searching_gallery = False
|
||||||
|
|
||||||
with open('django_code/stash_management/templates/template.stash-pornpics-dowloader.job.yml', 'r') as file:
|
with open('django_code/stash_management/templates/template.stash-pornpics-dowloader.job.yml', 'r') as file:
|
||||||
#get the manifest in a variable template_manifest from the manifest file
|
#get the manifest in a variable template_manifest from the manifest file
|
||||||
template_manifest = yaml.safe_load(file)
|
template_manifest = yaml.safe_load(file)
|
||||||
|
|
||||||
#edit the container name
|
#edit the container name
|
||||||
template_manifest['metadata']['name'] ="stash-pornpics-dowloader"+name
|
template_manifest['metadata']['name'] ="stash-pornpics-dowloader-"+name
|
||||||
template_manifest['spec']['template']['spec']['containers'][0]['name'] ="stash-pornpics-dowloader-"+name
|
template_manifest['spec']['template']['spec']['containers'][0]['name'] ="stash-pornpics-dowloader-"+name
|
||||||
|
|
||||||
#edit the command based on the input
|
#edit the command based on the input
|
||||||
command=['bash', '/config/download.sh', '--http_proxy', 'http://gluetun-svc.gluetun.svc:8888', '--BASE_URL', url, '--pornstars', name,'--external_gallery', external_galleries]
|
command=['bash', '/config/download.sh', '--http_proxy', 'http://gluetun-svc.gluetun.svc:8888', '--BASE_URL', url, '--pornstars', name]
|
||||||
template_manifest['spec']['template']['spec']['containers'][0]['command']=command
|
template_manifest['spec']['template']['spec']['containers'][0]['command']=command
|
||||||
|
|
||||||
|
|
||||||
#execute based on the value
|
#execute based on the value
|
||||||
api_response = v1.create_namespaced_job(body=template_manifest,namespace='stash')
|
api_response = v1.create_namespaced_job(body=template_manifest,namespace='stash')
|
||||||
|
|
||||||
return HttpResponse(api_response)
|
return HttpResponse(api_response)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+14
-5
@@ -1,13 +1,22 @@
|
|||||||
FROM python:3
|
FROM gitea.tryton.geeraert.eu/pi-ux-ce/python:3
|
||||||
|
|
||||||
|
ENV PYTHONUNBUFFERED 1
|
||||||
|
|
||||||
WORKDIR /code/
|
WORKDIR /code/
|
||||||
|
|
||||||
|
# Copy only the requirements file first (Changes infrequently)
|
||||||
COPY requirements.txt ./
|
COPY requirements.txt ./
|
||||||
COPY django_code ./
|
|
||||||
|
|
||||||
RUN --mount=type=cache,target=/root/.cache/pip pip install --upgrade pip
|
|
||||||
RUN --mount=type=cache,target=/root/.cache/pip pip install --no-cache-dir -r requirements.txt
|
RUN --mount=type=cache,target=/root/.cache/pip pip install --upgrade pip
|
||||||
COPY . .
|
RUN --mount=type=cache,target=/root/.cache/pip pip list --outdated
|
||||||
|
RUN --mount=type=cache,target=/root/.cache/pip pip install --upgrade wheel
|
||||||
|
RUN --mount=type=cache,target=/root/.cache/pip pip install --upgrade setuptools
|
||||||
|
RUN --mount=type=cache,target=/root/.cache/pip pip install -r requirements.txt
|
||||||
|
|
||||||
|
# Copy the rest of your application code (Changes frequently, invalidates subsequent cache)
|
||||||
|
COPY . ./
|
||||||
RUN python django_code/manage.py migrate
|
RUN python django_code/manage.py migrate
|
||||||
|
|
||||||
|
# CMD is the command run when the container starts
|
||||||
CMD [ "python","django_code/manage.py","runserver","0.0.0.0:8000" ]
|
CMD [ "python","django_code/manage.py","runserver","0.0.0.0:8000" ]
|
||||||
|
|||||||
+83
@@ -0,0 +1,83 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#install required packages
|
||||||
|
apk add curl wget
|
||||||
|
|
||||||
|
#named argument generation
|
||||||
|
skip_searching_gallery="${skip_searching_gallery:-false}"
|
||||||
|
|
||||||
|
|
||||||
|
while [ $# -gt 0 ]; do
|
||||||
|
if [[ $1 == "--"* ]]; then
|
||||||
|
v="${1/--/}"
|
||||||
|
declare "$v"="$2"
|
||||||
|
shift
|
||||||
|
fi
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
|
||||||
|
#check if we will use a HTTP proxy or not
|
||||||
|
|
||||||
|
if [[ -z $http_proxy ]]; then
|
||||||
|
echo "not using proxy"
|
||||||
|
curl_command="curl"
|
||||||
|
else
|
||||||
|
echo "using proxy"
|
||||||
|
curl_command="curl -x $http_proxy"
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
#dowload from https://www.pornpics.com/pornstars/eiby-shine/
|
||||||
|
DESTINATION_FOLDER="/data"
|
||||||
|
PROXY_HTTP="http://gluetun-svc.gluetun.svc:8888"
|
||||||
|
|
||||||
|
#BASE_URL="https://www.pornpics.com/pornstars/eiby-shine/"
|
||||||
|
#pornstars="eiby-shine"
|
||||||
|
|
||||||
|
#BASE_URL="https://www.pornpics.com/?q=shy+imp"
|
||||||
|
#pornstars="shy-imp"
|
||||||
|
|
||||||
|
#BASE_URL="https://www.pornpics.com/pornstars/gloria-sol/"
|
||||||
|
#pornstars="gloria-sol"
|
||||||
|
|
||||||
|
|
||||||
|
#BASE_URL="https://www.pornpics.com/pornstars/becky-summer"
|
||||||
|
#pornstars="becky-summer"
|
||||||
|
|
||||||
|
|
||||||
|
#clear files beforehand
|
||||||
|
|
||||||
|
echo "Pornstar: "$pornstars
|
||||||
|
echo "URL: "$BASE_URL
|
||||||
|
|
||||||
|
mkdir -p $DESTINATION_FOLDER/$pornstars
|
||||||
|
|
||||||
|
if [[ $skip_searching_gallery == true ]]; then
|
||||||
|
echo "not looping through galleries"
|
||||||
|
echo "using existing file instead"
|
||||||
|
#because we need to keep the file $DESTINATION_FOLDER/$pornstars-urls_of_galleries.txt with the existing URL , in this condition,
|
||||||
|
#no deletion of this file
|
||||||
|
echo $external_gallery > $DESTINATION_FOLDER/$pornstars-urls_of_galleries.txt
|
||||||
|
else
|
||||||
|
echo "looping through galleries"
|
||||||
|
#because we will re-generate this file, can be emptied
|
||||||
|
echo "" > $DESTINATION_FOLDER/$pornstars-urls_of_galleries.txt
|
||||||
|
$curl_command -s $BASE_URL | grep -Eo "(http|https)://[a-zA-Z0-9./?=_%:-]*" | grep "https://www.pornpics.com/galleries/" |sort -u >> $DESTINATION_FOLDER/$pornstars-urls_of_galleries.txt
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "" > $DESTINATION_FOLDER/$pornstars-image_to_download.txt
|
||||||
|
|
||||||
|
|
||||||
|
for f in $(cat $DESTINATION_FOLDER/$pornstars-urls_of_galleries.txt ); do
|
||||||
|
$curl_command $f | grep -Eo "(http|https)://[a-zA-Z0-9./?=_%:-]*" | grep "https://cdni.pornpics.com/1280" >> $DESTINATION_FOLDER/$pornstars-image_to_download.txt
|
||||||
|
echo $f
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
for g in $(cat $DESTINATION_FOLDER/$pornstars-image_to_download.txt ); do
|
||||||
|
$curl_command -O --output-dir $DESTINATION_FOLDER/$pornstars $g
|
||||||
|
# wget -e use_proxy=yes -e http_proxy=$PROXY_HTTP $g -P $DESTINATION_FOLDER/$pornstars
|
||||||
|
echo $g
|
||||||
|
done
|
||||||
|
exit 0
|
||||||
+4
-1
@@ -7,4 +7,7 @@ kubernetes
|
|||||||
ruamel.yaml
|
ruamel.yaml
|
||||||
pyyaml
|
pyyaml
|
||||||
django-bootstrap-v5
|
django-bootstrap-v5
|
||||||
jinja2
|
jinja2
|
||||||
|
watchdog
|
||||||
|
celery
|
||||||
|
redis
|
||||||
Reference in New Issue
Block a user