mirror of
https://github.com/tubearchivist/tubearchivist
synced 2024-11-19 15:25:51 +00:00
backup functionality to frontend and tasks
This commit is contained in:
parent
e53cfc5a32
commit
c657baca97
@ -15,6 +15,7 @@ from home.src.download import (
|
||||
)
|
||||
from home.src.config import AppConfig
|
||||
from home.src.reindex import reindex_old_documents, ManualImport
|
||||
from home.src.index_management import backup_all_indexes
|
||||
from home.src.helper import get_lock
|
||||
|
||||
|
||||
@ -93,3 +94,9 @@ def run_manual_import():
|
||||
finally:
|
||||
if have_lock:
|
||||
my_lock.release()
|
||||
|
||||
@shared_task
|
||||
def run_backup():
|
||||
""" called from settings page, dump backup to zip file """
|
||||
backup_all_indexes()
|
||||
print('backup finished')
|
||||
|
@ -114,17 +114,24 @@
|
||||
</div>
|
||||
<div class="settings-group">
|
||||
<h2>Manual media files import.</h2>
|
||||
<p>Add files to the cache/import folder. Make sure to follow the instructions on <a href="https://github.com/bbilly1/tubearchivist#import-your-existing-library" target="_blank">Github</a>.</p>
|
||||
<p>Add files to the <span class="settings-current">cache/import</span> folder. Make sure to follow the instructions on <a href="https://github.com/bbilly1/tubearchivist#import-your-existing-library" target="_blank">Github</a>.</p>
|
||||
<div id="manual-import">
|
||||
<button onclick="manualImport()">Start import</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="settings-group">
|
||||
<p>Rescan filesystem.</p>
|
||||
<h2>Backup database</h2>
|
||||
<p>Export your database to a zip file stored at <span class="settings-current">cache/backup</span>.</p>
|
||||
<div id="db-backup">
|
||||
<button onclick="dbBackup()">Start backup</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="settings-group">
|
||||
<p>Restore from backup.</p>
|
||||
<i>Coming soon</i>
|
||||
</div>
|
||||
<div class="settings-group">
|
||||
<p>Backup database.</p>
|
||||
<p>Rescan filesystem.</p>
|
||||
<i>Coming soon</i>
|
||||
</div>
|
||||
{% endblock content %}
|
@ -31,7 +31,8 @@ from home.tasks import (
|
||||
download_pending,
|
||||
extrac_dl,
|
||||
download_single,
|
||||
run_manual_import
|
||||
run_manual_import,
|
||||
run_backup
|
||||
)
|
||||
|
||||
|
||||
@ -442,7 +443,8 @@ class PostData:
|
||||
VALID_KEYS = [
|
||||
"watched", "rescan_pending", "ignore", "dl_pending",
|
||||
"unsubscribe", "sort_order", "hide_watched", "show_subed_only",
|
||||
"channel-search", "video-search", "dlnow", "manual-import"
|
||||
"channel-search", "video-search", "dlnow", "manual-import",
|
||||
"db-backup"
|
||||
]
|
||||
|
||||
def __init__(self, post_dict):
|
||||
@ -514,6 +516,9 @@ class PostData:
|
||||
elif task == 'manual-import':
|
||||
print('starting manual import')
|
||||
run_manual_import.delay()
|
||||
elif task == 'db-backup':
|
||||
print('backing up database')
|
||||
run_backup.delay()
|
||||
return {'success': True}
|
||||
|
||||
def search_channels(self, search_query):
|
||||
|
@ -91,6 +91,17 @@ function manualImport() {
|
||||
toReplace.appendChild(message);
|
||||
}
|
||||
|
||||
function dbBackup() {
|
||||
var payload = JSON.stringify({'db-backup': true});
|
||||
sendPost(payload)
|
||||
// clear button
|
||||
var message = document.createElement('p');
|
||||
message.innerText = 'backing up archive';
|
||||
var toReplace = document.getElementById('db-backup');
|
||||
toReplace.innerHTML = '';
|
||||
toReplace.appendChild(message);
|
||||
}
|
||||
|
||||
// player
|
||||
function createPlayer(button) {
|
||||
var mediaUrl = button.getAttribute('data-src');
|
||||
|
Loading…
Reference in New Issue
Block a user