Author SHA1 Message Date
Pierre Geeraert 4d728c8e68 addign this for the syntax but this solution is too slow
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
Gitea Actions Demo / changes (push) Has been cancelled
Gitea Actions Demo / Build-dockerfile (push) Has been cancelled
2025-12-04 16:44:46 +00:00
Pierre Geeraert ef3aed4ba2 Good now , but still long, let's try again
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 6m52s
2025-12-04 16:24:33 +00:00
Pierre Geeraert 8f30fdb88c should be good now
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 6m53s
2025-12-04 16:16:31 +00:00
Pierre Geeraert d4b67906cd try again the path
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 9m29s
2025-12-04 16:03:56 +00:00
Pierre Geeraert 075fa32ea2 shunt as I need this to run to debug first
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 1m20s
2025-12-04 16:00:50 +00:00
Pierre Geeraert f71f678662 fix path
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
2025-12-04 16:00:02 +00:00
Pierre Geeraert 457857df32 changing gitignore
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 1m7s
2025-12-04 15:57:03 +00:00
Pierre Geeraert 49adc84f5c cache issue 2025-12-04 15:56:33 +00:00
Pierre Geeraert a2a9a8c3a0 renaming dockerfile
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 1m16s
2025-12-04 15:53:11 +00:00
Pierre Geeraert a62db898aa fixing path
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 1m14s
2025-12-04 15:50:08 +00:00
Pierre Geeraert a2a6e5c5fe avoid runnign if requirements is modified
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 1m20s
2025-12-04 15:15:28 +00:00
Pierre Geeraert b9307efba2 work on a different workflow just for requirements 2025-12-04 15:06:03 +00:00
Pierre Geeraert 52ccff4086 try different caching method
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 4m40s
2025-12-04 14:24:29 +00:00
Pierre Geeraert 7f59856da3 adding share_task
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
2025-12-04 14:21:26 +00:00
Pierre Geeraert 10dc913080 adding the check_and_create_destination_folder function but not applied yet to incremental
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
2025-12-04 14:17:09 +00:00
Pierre Geeraert 1d2f190459 rename url var
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 5m17s
2025-12-04 11:42:14 +00:00
Pierre Geeraert 859ab9cfaf add proxy on the othe rrequest as well
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 6m9s
2025-12-04 11:34:32 +00:00
Pierre Geeraert 924d3dabb9 add proxy on requests module
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 4m15s
2025-12-03 12:41:50 +00:00
Pierre Geeraert b227337ced 1.526 SyntaxError: expected ':'
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 6m2s
2025-12-03 12:27:18 +00:00
Pierre Geeraert 717ffb4b8a urlparse was its own built-in (i.e., NOT pip-installable) module in Python 2, and was moved to urllib.parse
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 4m45s
2025-12-03 12:17:13 +00:00
8 changed files with 163 additions and 38 deletions
+16
View File
@@ -0,0 +1,16 @@
FROM gitea.tryton.geeraert.eu/pi-ux-ce/python:3
ENV PYTHONUNBUFFERED 1
WORKDIR /code/
# Copy only the requirements file first (Changes infrequently)
COPY requirements.txt ./
RUN --mount=type=cache,target=/root/.cache/pip pip install --upgrade pip
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
+15
View File
@@ -0,0 +1,15 @@
django
psycopg2
requests
proxmoxer
docker
kubernetes
ruamel.yaml
pyyaml
django-bootstrap-v5
jinja2
watchdog
celery
redis
lxml
requests
+84 -4
View File
@@ -2,10 +2,89 @@ name: Gitea Actions Demo
run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀 run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀
on: on:
push: push:
#paths-ignore:
# - 'requirements.txt'
issue_comment: issue_comment:
types: [created] types: [created]
jobs: jobs:
# Job to check for file changes and set an output
changes:
runs-on: ubuntu-latest
outputs:
requirements_changed: ${{ steps.filter.outputs.requirements }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
requirements:
- 'requirements.txt'
Build-dockerfile:
runs-on: ubuntu-latest
needs: changes
if: ${{ needs.changes.outputs.requirements_changed == 'true' }}
steps:
- run: echo "🔎 The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}."
- name: Check out repository code
uses: actions/checkout@v4
- run: echo "💡 The ${{ gitea.repository }} repository has been cloned to the runner."
- name: List files in the repository
run: |
ls ${{ gitea.workspace }}
- name: Compute next version
id: versioning
run: |
latest="${{ vars.PYTHON_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"
- uses: actions/cache@v3
with:
path: /root/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: inject cache into docker
uses: reproducible-containers/buildkit-cache-dance@v3.1.0
with:
cache-source: /root/.cache/pip
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to gitea
uses: docker/login-action@v3
with:
registry: gitea.tryton.geeraert.eu
username: ${{ secrets.USERNAME_GITEA }}
password: ${{ secrets.PASSWORD_GITEA }}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: "{{defaultContext}}:.gitea/python_build"
push: true
tags: |
gitea.tryton.geeraert.eu/pi-ux-ce/modified-python:latest
gitea.tryton.geeraert.eu/pi-ux-ce/modified-python:${{ env.next_version }}
cache-from: type=registry,ref=gitea.tryton.geeraert.eu/pi-ux-ce/modified-python:buildcache
cache-to: type=registry,ref=gitea.tryton.geeraert.eu/pi-ux-ce/modified-python:buildcache,mode=max
- 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/PYTHON_VERSION \
-d "{\"Value\":\"$next_version\"}"
Explore-Gitea-Actions: Explore-Gitea-Actions:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
@@ -27,12 +106,13 @@ jobs:
echo "------------------------------------------------" echo "------------------------------------------------"
echo "Next version: $next_version" echo "Next version: $next_version"
- name: Cache pip - uses: actions/cache@v3
uses: actions/cache@v3
with: with:
path: /root/.cache/pip path: /root/.cache/pip
key: pip key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys: pip restore-keys: |
${{ runner.os }}-pip-
- name: inject cache into docker - name: inject cache into docker
uses: reproducible-containers/buildkit-cache-dance@v3.1.0 uses: reproducible-containers/buildkit-cache-dance@v3.1.0
+1
View File
@@ -3,3 +3,4 @@
venv/* venv/*
*__pycache__* *__pycache__*
Webcal-python/* Webcal-python/*
.idea/*
+42 -15
View File
@@ -16,7 +16,8 @@ import mimetypes
import ruamel.yaml import ruamel.yaml
import yaml import yaml
from urllib import request as urlrequest from urllib import request as urlrequest
import urlparse from urllib import parse as urlparse
@@ -27,7 +28,12 @@ proxy = urlrequest.ProxyHandler({
'https': proxy_url # Add the handler for HTTPS 'https': proxy_url # Add the handler for HTTPS
}) })
destination_folder = "/tmp/stash" proxies = {
"http" : proxy_url,
"https" : proxy_url
}
destination_folder = "/tmp/stash/"
def hello(request): def hello(request):
return HttpResponse('<h1>Hello stash!</h1>') return HttpResponse('<h1>Hello stash!</h1>')
@@ -36,16 +42,29 @@ def form(request):
def album(request): def album(request):
return render(request, 'album_form.html',{}) return render(request, 'album_form.html',{})
def check_and_create_destination_folder(name):
#check if the output directory exist and create if not
if not os.path.isdir(destination_folder):
os.makedirs(destination_folder)
#check if the named directory exist and create if not
destination_named_folder = os.path.join(destination_folder,name)
if not os.path.isdir(destination_named_folder):
os.makedirs(destination_named_folder)
return destination_named_folder
def album_form(request): def album_form(request):
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 = request.GET.get('external_galleries')
album_downloader(name=name,url=url,external_galleries=external_galleries) album_downloader.delay(name=name,url=url,external_galleries=external_galleries)
text_generated = "successfully sent to the album downloader" text_generated = "successfully sent to the album downloader"
return HttpResponse(text_generated, content_type="text/plain") return HttpResponse(text_generated, content_type="text/plain")
@shared_task()
def album_downloader(name,url,external_galleries): def album_downloader(name,url,external_galleries):
print(name+" "+url+" "+external_galleries) print(name+" "+url+" "+external_galleries)
@@ -54,9 +73,14 @@ def album_downloader(name,url,external_galleries):
req = urlrequest.Request(url) req = urlrequest.Request(url)
urlcurl = urlrequest.urlopen(req).read() urlcurl = urlrequest.urlopen(req).read()
page = requests.get(url)
page = requests.get(url,proxies=proxies)
webpage = html.fromstring(page.content) webpage = html.fromstring(page.content)
#create the prerequisites folder
destination_named_folder = check_and_create_destination_folder(name=name)
#get all URLs from the code source (searching for href tag on the code) #get all URLs from the code source (searching for href tag on the code)
#https://stackoverflow.com/questions/21455349/xpath-query-get-attribute-href-from-a-tag #https://stackoverflow.com/questions/21455349/xpath-query-get-attribute-href-from-a-tag
@@ -65,31 +89,34 @@ def album_downloader(name,url,external_galleries):
#search for the href that contains the galleries #search for the href that contains the galleries
webpage_all_album_url = webpage.xpath("//a[contains(@href,'pornpics.com/galleries/')]/@href") webpage_all_album_url = webpage.xpath("//a[contains(@href,'pornpics.com/galleries/')]/@href")
#print(webpage_all_album_url[3]) #print(webpage_all_album_url[3])
#print(webpage_all_album_url) #print(webpage_all_album_url)
for album in webpage_all_album_url: for album in webpage_all_album_url:
print("Album "+album) print("Album "+album)
print("") print("")
page = requests.get(album) page = requests.get(album,proxies=proxies)
webpage = html.fromstring(page.content) webpage = html.fromstring(page.content)
images_list = webpage.xpath("//a[contains(@href,'cdni.pornpics.com/1280/')]/@href") images_list = webpage.xpath("//a[contains(@href,'cdni.pornpics.com/1280/')]/@href")
images_downloader(name=name,images_url_list=images_list) images_downloader.delay(name=name,images_url_list=images_list,destination_named_folder=destination_named_folder)
print(images_list) print(images_list)
return 0 return 0
@shared_task()
def images_downloader(name,images_url_list,destination_named_folder):
for image_url in images_url_list:
split = urlparse.urlsplit(image_url)
#filename = destination_folder + split.path.split("/")[-1]
filename = os.path.join(destination_named_folder,split.path.split("/")[-1])
def images_downloader(name,images_url_list);
for imnage_url in images_url_list: print("downloading: "+filename+" -- "+image_url)
split = urlparse.urlsplit(url)
filename = destination_folder + split.path.split("/")[-1]
print("downloading: "+filename)
opener = urlrequest.build_opener(proxy) opener = urlrequest.build_opener(proxy)
urlrequest.install_opener(opener) urlrequest.install_opener(opener)
urlrequest.urlretrieve(url, filename ) urlrequest.urlretrieve(image_url, filename )
return 0 return 0
@@ -10915,7 +10915,6 @@
<div class="col mb-5"> <div class="col mb-5">
<div class="card h-100"> <div class="card h-100">
<!-- Sale badge--> <!-- Sale badge-->
<div class="badge bg-dark text-white position-absolute" style="top: 0.5rem; right: 0.5rem">Sale</div>
<!-- Product image--> <!-- Product image-->
<img class="card-img-top" src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTUHI8m7S7bMhMC2WldjOFV4e9pjeK0m9asEw&s" alt="..." /> <img class="card-img-top" src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTUHI8m7S7bMhMC2WldjOFV4e9pjeK0m9asEw&s" alt="..." />
<!-- Product details--> <!-- Product details-->
@@ -10963,17 +10962,15 @@
<div class="col mb-5"> <div class="col mb-5">
<div class="card h-100"> <div class="card h-100">
<!-- Sale badge--> <!-- Sale badge-->
<div class="badge bg-dark text-white position-absolute" style="top: 0.5rem; right: 0.5rem">Sale</div>
<!-- Product image--> <!-- Product image-->
<img class="card-img-top" src="https://dummyimage.com/450x300/dee2e6/6c757d.jpg" alt="..." /> <img class="card-img-top" src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRlAP1QLW33zVG3dF-EmGalwc7L0uMUJEzRBA&s" alt="..." />
<!-- Product details--> <!-- Product details-->
<div class="card-body p-4"> <div class="card-body p-4">
<div class="text-center"> <div class="text-center">
<!-- Product name--> <!-- Product name-->
<h5 class="fw-bolder">Sale Item</h5> <h5 class="fw-bolder">Reddit</h5>
<!-- Product price--> <!-- Product price-->
<span class="text-muted text-decoration-line-through">$50.00</span> https://www.reddit.com/
$25.00
</div> </div>
</div> </div>
<!-- Product actions--> <!-- Product actions-->
@@ -10990,7 +10987,7 @@
<div class="card-body p-4"> <div class="card-body p-4">
<div class="text-center"> <div class="text-center">
<!-- Product name--> <!-- Product name-->
<h5 class="fw-bolder">Fancy Product</h5> <h5 class="fw-bolder">Regifs</h5>
<!-- Product price--> <!-- Product price-->
$120.00 - $280.00 $120.00 - $280.00
</div> </div>
+1 -11
View File
@@ -1,19 +1,9 @@
FROM gitea.tryton.geeraert.eu/pi-ux-ce/python:3 FROM gitea.tryton.geeraert.eu/pi-ux-ce/modified-python:latest
ENV PYTHONUNBUFFERED 1 ENV PYTHONUNBUFFERED 1
WORKDIR /code/ WORKDIR /code/
# Copy only the requirements file first (Changes infrequently)
COPY requirements.txt ./
RUN --mount=type=cache,target=/root/.cache/pip pip install --upgrade pip
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 the rest of your application code (Changes frequently, invalidates subsequent cache)
COPY . ./ COPY . ./
RUN python django_code/manage.py migrate RUN python django_code/manage.py migrate
-1
View File
@@ -13,4 +13,3 @@ celery
redis redis
lxml lxml
requests requests
urlparse