add re_sync_thumbs to frontend

This commit is contained in:
simon 2021-11-01 16:42:07 +07:00
parent 1f0e305527
commit b2a4f88980
5 changed files with 30 additions and 1 deletions

View File

@ -51,6 +51,9 @@ Detect the YouTube ID from filename, this accepts the default yt-dlp naming conv
- Maybe start with a subset of your files to import to make sure everything goes well...
- Follow the logs to monitor progress and errors: `docker-compose logs -f tubearchivist`.
## Embed thumbnails into media file
This will write or overwrite all thumbnails in the media file using the downloaded thumbnail. This is only necessary if you didn't download the files with the option *Embed Thumbnail* enabled or want to make sure all media files get the newest thumbnail. Follow the docker-compose logs to monitor progress.
## Backup Database
This will backup your metadata into a zip file. The file will get stored at *cache/backup* and will contain the necessary files to restore the Elasticsearch index formatted **nd-json** files plus a complete export of the index in a set of conventional **json** files.

View File

@ -261,7 +261,6 @@ class ThumbManager:
def write_all_thumbs(video_list):
"""rewrite the thumbnail into media file"""
print("start video thumbnail embed process")
counter = 1
for video in video_list:
# loop through all videos

View File

@ -111,6 +111,13 @@
<button onclick="manualImport()">Start import</button>
</div>
</div>
<div class="settings-group">
<h2>Embed thumbnails into media file.</h2>
<p>Set extracted youtube thumbnail as cover art of the media file.</p>
<div id="re-embed">
<button onclick="reEmbed()">Start process</button>
</div>
</div>
<div class="settings-group">
<h2>Backup database</h2>
<p>Export your database to a zip file stored at <span class="settings-current">cache/backup</span>.</p>

View File

@ -34,6 +34,7 @@ from home.tasks import (
download_single,
extrac_dl,
kill_dl,
re_sync_thumbs,
rescan_filesystem,
run_backup,
run_manual_import,
@ -689,6 +690,7 @@ class PostData:
"forgetIgnore": self.forget_ignore,
"addSingle": self.add_single,
"manual-import": self.manual_import,
"re-embed": self.re_embed,
"db-backup": self.db_backup,
"db-restore": self.db_restore,
"fs-rescan": self.fs_rescan,
@ -840,6 +842,13 @@ class PostData:
run_manual_import.delay()
return {"success": True}
@staticmethod
def re_embed():
"""rewrite thumbnails into media files"""
print("start video thumbnail embed process")
re_sync_thumbs.delay()
return {"success": True}
@staticmethod
def db_backup():
"""backup es to zip from settings page"""

View File

@ -143,6 +143,17 @@ function manualImport() {
toReplace.appendChild(message);
}
function reEmbed() {
var payload = JSON.stringify({'re-embed': true});
sendPost(payload);
// clear button
var message = document.createElement('p');
message.innerText = 'processing thumbnails';
var toReplace = document.getElementById('re-embed');
toReplace.innerHTML = '';
toReplace.appendChild(message);
}
function dbBackup() {
var payload = JSON.stringify({'db-backup': true});
sendPost(payload)