Add export for all collections and all playlists

This commit is contained in:
JonnyWong16 2020-10-01 14:40:28 -07:00
parent d1172f4975
commit 2803a6095b
No known key found for this signature in database
GPG key ID: B1F1F9807184697A
5 changed files with 98 additions and 61 deletions

View file

@ -28,6 +28,7 @@ DOCUMENTATION :: END
<input type="hidden" id="export_rating_key" name="export_rating_key" value="${rating_key or ''}" />
<input type="hidden" id="export_media_type" name="export_media_type" value="${media_type or ''}" />
<input type="hidden" id="export_sub_media_type" name="export_sub_media_type" value="${sub_media_type or ''}" />
<input type="hidden" id="export_library_export" name="export_library_export" value="${library_export or ''}" />
<div class="form-group">
<label for="metadata_export_level_select">Metadata Export Level</label>
<div class="row">
@ -194,6 +195,7 @@ DOCUMENTATION :: END
$('#export_custom_metadata_fields').val(),
$('#export_custom_media_info_fields').val()
].filter(Boolean).join(',');
var library_export = $('#export_library_export').val()
$.ajax({
url: 'export_metadata',
@ -205,7 +207,8 @@ DOCUMENTATION :: END
file_format: file_format,
include_thumb: include_thumb,
include_art: include_art,
custom_fields: custom_fields
custom_fields: custom_fields,
library_export: library_export
},
async: true,
success: function (data) {

View file

@ -614,8 +614,8 @@ DOCUMENTATION :: END
<div class="btn-group">
<button class="btn btn-dark export-button" id="toggle-export-modal" data-toggle="modal" data-target="#export-modal"
data-section_id="${data['section_id']}" data-rating_key="${data['rating_key']}"
data-media_type="${data['media_type']}" data-sub_media_type="${data['sub_media_type'] or ''}">
<i class="fa fa-file-export"></i> Export Metadata
data-media_type="${data['media_type']}" data-sub_media_type="${data['sub_media_type'] or data['playlist_type'] or ''}">
<i class="fa fa-file-export"></i> Export metadata
</button>
</div>
<div class="btn-group">

View file

@ -322,6 +322,13 @@ DOCUMENTATION :: END
</div>
<div class="button-bar">
% if _session['user_group'] == 'admin':
<div class="btn-group">
<button class="btn btn-dark export-button" id="toggle-export-modal" data-toggle="modal" data-target="#export-modal"
data-section_id="${data['section_id']}" data-media_type="collection" data-sub_media_type="${data['section_type']}"
data-library_export="collection">
<i class="fa fa-file-export"></i> Export collections
</button>
</div>
<div class="btn-group">
<button class="btn btn-dark refresh-collections-table-button" id="refresh-collections-table">
<i class="fa fa-refresh"></i> Refresh collections
@ -362,6 +369,14 @@ DOCUMENTATION :: END
</div>
<div class="button-bar">
% if _session['user_group'] == 'admin':
<% playlist_sub_media_type = {'movie': 'video', 'show': 'video', 'artist': 'audio', 'photo': 'photo'} %>
<div class="btn-group">
<button class="btn btn-dark export-button" id="toggle-export-modal" data-toggle="modal" data-target="#export-modal"
data-section_id="${data['section_id']}" data-media_type="playlist" data-sub_media_type="${playlist_sub_media_type[data['section_type']]}"
data-library_export="playlist">
<i class="fa fa-file-export"></i> Export playlists
</button>
</div>
<div class="btn-group">
<button class="btn btn-dark refresh-playlists-table-button" id="refresh-playlists-table">
<i class="fa fa-refresh"></i> Refresh playlists
@ -403,8 +418,9 @@ DOCUMENTATION :: END
% if _session['user_group'] == 'admin':
<div class="btn-group">
<button class="btn btn-dark export-button" id="toggle-export-modal" data-toggle="modal" data-target="#export-modal"
data-section_id="${data['section_id']}" data-media_type="${'photoalbum' if data['section_type'] == 'photo' else data['section_type']}">
<i class="fa fa-file-export"></i> Export Metadata
data-section_id="${data['section_id']}" data-media_type="${'photoalbum' if data['section_type'] == 'photo' else data['section_type']}"
data-library_export="all">
<i class="fa fa-file-export"></i> Export metadata
</button>
</div>
<div class="btn-group">
@ -705,12 +721,14 @@ DOCUMENTATION :: END
});
});
$("#toggle-export-modal").click(function() {
$(".export-button").click(function() {
$.ajax({
url: 'export_metadata_modal',
data: {
section_id: $(this).data('section_id'),
media_type: $(this).data('media_type')
media_type: $(this).data('media_type'),
sub_media_type: $(this).data('sub_media_type'),
library_export: $(this).data('library_export')
},
cache: false,
async: true,