-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
161 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Generated by Django 4.2.6 on 2023-10-23 21:02 | ||
|
||
from django.db import migrations, models | ||
import django.utils.timezone | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("core", "0003_provider_shortname"), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name="Settings", | ||
fields=[ | ||
("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), | ||
("created_at", models.DateTimeField(db_index=True, default=django.utils.timezone.now)), | ||
("updated_at", models.DateTimeField(auto_now=True)), | ||
("enabled", models.BooleanField(default=True)), | ||
("name", models.CharField(help_text="Settings Name")), | ||
("value", models.CharField(help_text="Value of the setting")), | ||
], | ||
options={ | ||
"abstract": False, | ||
}, | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import os | ||
from os.path import getsize, join | ||
|
||
from celery import Celery | ||
from django.conf import settings | ||
|
||
from core.models import Settings | ||
from core.shared import CommonResponse | ||
|
||
app = Celery("tasks") | ||
|
||
|
||
@app.task | ||
def calcolate_persistinfo() -> CommonResponse: | ||
out = CommonResponse() | ||
total_bytessize = 0 | ||
total_counter = 0 | ||
for root, _, files in os.walk(settings.PERSIST_AUDIO_ROOTDIR): | ||
for fname in files: | ||
total_bytessize += getsize(join(root, fname)) | ||
total_counter += 1 | ||
Settings.objects.get_or_create(name="persist_total_size", value=total_bytessize) | ||
Settings.objects.get_or_create(name="persist_total_count", value=total_counter) | ||
out.status = "success" | ||
return out.__dict__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{% extends "base.html" %} | ||
|
||
{% block title %} | ||
VerbaCap - Settings | ||
{% endblock title %} | ||
{% block content %} | ||
<h1 class="text-center p-1">Settings</h1> | ||
<p class="text-center">The page contains all the settings for the tool</p> | ||
<div class="row"> | ||
<div class="col-6"> | ||
<div class="card bg-dark"> | ||
<div class="card-header text-center">Persist Audio Counter</div> | ||
<div class="card-body"> | ||
<blockquote class="blockquote mb-0 text-center"> | ||
<p>Current number of files: {{ total_count.value }}</p> | ||
<footer class="blockquote-footer text-end fs-6"> | ||
Last Update: {{ total_count.updated_at | date:"SHORT_DATETIME_FORMAT" }} | ||
</footer> | ||
</blockquote> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="col-6"> | ||
<div class="card bg-dark"> | ||
<div class="card-header text-center">Persist Audio File Size</div> | ||
<div class="card-body"> | ||
<blockquote class="blockquote mb-0 text-center"> | ||
<p>Total Size: {{ total_size.value | filesizeformat }}</p> | ||
<footer class="blockquote-footer text-end fs-6"> | ||
Last Update: {{ total_count.updated_at | date:"SHORT_DATETIME_FORMAT" }} | ||
</footer> | ||
</blockquote> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
{% endblock content %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
[{"model":"core.provider","pk":1,"fields":{"created_at":"2023-08-08T20:45:50Z","updated_at":"2023-08-19T14:41:52.986Z","enabled":true,"name":"Youtube","icon":"fa-brands fa-youtube","color":"#FF0000","shortname":"yt"}},{"model":"core.provider","pk":2,"fields":{"created_at":"2023-08-08T20:45:50Z","updated_at":"2023-08-19T14:41:52.986Z","enabled":true,"name":"Youtube-Playlist","icon":"fa-brands fa-youtube","color":"#FF0000","shortname":"yt-playlist"}},{"model":"django_celery_beat.crontabschedule","pk":1,"fields":{"minute":"50","hour":"23","day_of_week":"*","day_of_month":"*","month_of_year":"*","timezone":"UTC"}},{"model":"django_celery_beat.periodictask","pk":2,"fields":{"name":"import_episodes_yt_channels","task":"youtube.tasks.import_episodes_yt_channels","interval":null,"crontab":1,"solar":null,"clocked":null,"args":"[]","kwargs":"{}","queue":null,"exchange":null,"routing_key":null,"headers":"{}","priority":null,"expires":null,"expire_seconds":null,"one_off":false,"start_time":null,"enabled":true,"last_run_at":"2023-09-05T20:45:00.042Z","total_run_count":1,"date_changed":"2023-09-05T20:48:00.995Z","description":""}},{"model":"django_celery_beat.periodictask","pk":3,"fields":{"name":"import_episodes_yt_playlist","task":"youtube.tasks.import_episodes_yt_playlist","interval":null,"crontab":1,"solar":null,"clocked":null,"args":"[]","kwargs":"{}","queue":null,"exchange":null,"routing_key":null,"headers":"{}","priority":null,"expires":null,"expire_seconds":null,"one_off":false,"start_time":null,"enabled":true,"last_run_at":"2023-09-05T20:45:00.042Z","total_run_count":1,"date_changed":"2023-09-05T20:48:00.995Z","description":""}},{"model":"django_celery_beat.periodictask","pk":4,"fields":{"name":"import_episodes_sk_playlist","task":"spreaker.tasks.import_episodes_sk","interval":null,"crontab":1,"solar":null,"clocked":null,"args":"[]","kwargs":"{}","queue":null,"exchange":null,"routing_key":null,"headers":"{}","priority":null,"expires":null,"expire_seconds":null,"one_off":false,"start_time":null,"enabled":true,"last_run_at":"2023-09-05T20:45:00.042Z","total_run_count":1,"date_changed":"2023-09-05T20:48:00.995Z","description":""}},{"model":"core.provider","pk":3,"fields":{"created_at":"2023-10-04T20:43:37Z","updated_at":"2023-10-04T20:45:12.736Z","enabled":true,"name":"Spreaker","icon":"fa-regular fa-star","color":"#ffc107","shortname":"sk"}}] | ||
[{"model":"core.provider","pk":1,"fields":{"created_at":"2023-08-08T20:45:50Z","updated_at":"2023-08-19T14:41:52.986Z","enabled":true,"name":"Youtube","icon":"fa-brands fa-youtube","color":"#FF0000","shortname":"yt"}},{"model":"core.provider","pk":2,"fields":{"created_at":"2023-08-08T20:45:50Z","updated_at":"2023-08-19T14:41:52.986Z","enabled":true,"name":"Youtube-Playlist","icon":"fa-brands fa-youtube","color":"#FF0000","shortname":"yt-playlist"}},{"model":"django_celery_beat.crontabschedule","pk":1,"fields":{"minute":"50","hour":"23","day_of_week":"*","day_of_month":"*","month_of_year":"*","timezone":"UTC"}},{"model":"django_celery_beat.periodictask","pk":2,"fields":{"name":"import_episodes_yt_channels","task":"youtube.tasks.import_episodes_yt_channels","interval":null,"crontab":1,"solar":null,"clocked":null,"args":"[]","kwargs":"{}","queue":null,"exchange":null,"routing_key":null,"headers":"{}","priority":null,"expires":null,"expire_seconds":null,"one_off":false,"start_time":null,"enabled":true,"last_run_at":"2023-09-05T20:45:00.042Z","total_run_count":1,"date_changed":"2023-09-05T20:48:00.995Z","description":""}},{"model":"django_celery_beat.periodictask","pk":3,"fields":{"name":"import_episodes_yt_playlist","task":"youtube.tasks.import_episodes_yt_playlist","interval":null,"crontab":1,"solar":null,"clocked":null,"args":"[]","kwargs":"{}","queue":null,"exchange":null,"routing_key":null,"headers":"{}","priority":null,"expires":null,"expire_seconds":null,"one_off":false,"start_time":null,"enabled":true,"last_run_at":"2023-09-05T20:45:00.042Z","total_run_count":1,"date_changed":"2023-09-05T20:48:00.995Z","description":""}},{"model":"django_celery_beat.periodictask","pk":4,"fields":{"name":"import_episodes_sk_playlist","task":"spreaker.tasks.import_episodes_sk","interval":null,"crontab":1,"solar":null,"clocked":null,"args":"[]","kwargs":"{}","queue":null,"exchange":null,"routing_key":null,"headers":"{}","priority":null,"expires":null,"expire_seconds":null,"one_off":false,"start_time":null,"enabled":true,"last_run_at":"2023-09-05T20:45:00.042Z","total_run_count":1,"date_changed":"2023-09-05T20:48:00.995Z","description":""}},{"model":"django_celery_beat.periodictask","pk":5,"fields":{"name":"calcolate_persistsize","task":"core.tasks.calcolate_persistinfo","interval":null,"crontab":1,"solar":null,"clocked":null,"args":"[]","kwargs":"{}","queue":null,"exchange":null,"routing_key":null,"headers":"{}","priority":null,"expires":null,"expire_seconds":null,"one_off":false,"start_time":null,"enabled":true,"last_run_at":"2023-09-05T20:45:00.042Z","total_run_count":1,"date_changed":"2023-09-05T20:48:00.995Z","description":""}},{"model":"core.provider","pk":3,"fields":{"created_at":"2023-10-04T20:43:37Z","updated_at":"2023-10-04T20:45:12.736Z","enabled":true,"name":"Spreaker","icon":"fa-regular fa-star","color":"#ffc107","shortname":"sk"}}] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters