Add item counts to database

* Add schedule task to refresh libraries list
* Update library stats to use library_sections table
This commit is contained in:
Jonathan Wong 2015-12-06 21:07:56 -08:00
parent 771885f27f
commit 8f367d140f
7 changed files with 227 additions and 71 deletions

View file

@ -9,23 +9,16 @@ Variable names: data [array]
data[array_index] :: Usable parameters
data['type'] Returns the type of the library. Either 'movie', 'show', 'photo', or 'artist'.
data['rows'] Returns an array containing stat data
data Returns an array containing stat data
data[array_index]['rows'] :: Usable parameters
data[array_index] :: Usable parameters
title Returns the title of the library.
section_name Returns the title of the library.
section_type Returns the type of the library.
thumb Returns the thumb of the library.
count Returns the number of items in the library.
count_type Returns the sorting type for the library
== Only if 'type' is 'show'
episode_count Return the number of episodes in the library.
episode_count_type Return the sorting type for the episodes.
== Only if 'type' is 'artist'
album_count Return the number of episodes in the library.
album_count_type Return the sorting type for the episodes.
count Returns the number of top level items in the library.
parent_count Returns the number of parent items in the library.
child_count Returns the number of child items in the library.
DOCUMENTATION :: END
</%doc>
@ -37,37 +30,58 @@ DOCUMENTATION :: END
<li>
<div class="home-platforms-instance-info">
<div class="home-platforms-instance-name">
% if library['type'] != 'photo':
% if library['section_type'] != 'photo':
<h4>
<a href="info?library_id=${library['rows']['key']}" title="${library['rows']['title']}">${library['rows']['title']}</a>
<a href="info?library_id=${library['section_id']}" title="${library['section_name']}">${library['section_name']}</a>
</h4>
% else:
<h4>${library['rows']['title']}</h4>
<h4>${library['section_name']}</h4>
% endif
</div>
% if library['section_type'] == 'movie':
<div class="home-platforms-instance-playcount">
<h5>${library['rows']['count_type']}</h5>
<h3>${library['rows']['count']}</h3>
<h5>All Movies</h5>
<h3>${library['count']}</h3>
<p> items</p>
</div>
% if library['type'] == 'show':
<div class="home-platforms-instance-playcount" style="padding-left: 10px;">
<h5>${library['rows']['episode_count_type']}</h5>
<h3>${library['rows']['episode_count']}</h3>
% elif library['section_type'] == 'show':
<div class="home-platforms-instance-playcount">
<h5>All Shows</h5>
<h3>${library['count']}</h3>
<p> items</p>
</div>
% endif
% if library['type'] == 'artist':
<div class="home-platforms-instance-playcount" style="padding-left: 10px;">
<h5>${library['rows']['album_count_type']}</h5>
<h3>${library['rows']['album_count']}</h3>
<h5>All Episodes</h5>
<h3>${library['child_count']}</h3>
<p> items</p>
</div>
% elif library['section_type'] == 'artist':
<div class="home-platforms-instance-playcount">
<h5>All Artists</h5>
<h3>${library['count']}</h3>
<p> items</p>
</div>
<div class="home-platforms-instance-playcount" style="padding-left: 10px;">
<h5>All Albums</h5>
<h3>${library['parent_count']}</h3>
<p> items</p>
</div>
% elif library['section_type'] == 'photo':
<div class="home-platforms-instance-playcount">
<h5>All Albums</h5>
<h3>${library['count']}</h3>
<p> items</p>
</div>
<div class="home-platforms-instance-playcount" style="padding-left: 10px;">
<h5>All Photos</h5>
<h3>${library['child_count']}</h3>
<p> items</p>
</div>
% endif
</div>
% if library['rows']['thumb']:
% if library['thumb']:
<div class="home-platforms-instance-poster">
<div class="home-platforms-library-thumb" style="background-image: url(pms_image_proxy?img=${library['rows']['thumb']}&width=300&height=300&fallback=poster);"></div>
<div class="home-platforms-library-thumb" style="background-image: url(pms_image_proxy?img=${library['thumb']}&width=300&height=300&fallback=poster);"></div>
</div>
% else:
<div class="home-platforms-instance-poster">

View file

@ -348,7 +348,7 @@ available_notification_agents = sorted(notifiers.available_notification_agents()
<h3>Friends List</h3>
</div>
<div class="form-group">
<label for="refresh_users_interval">User List Refresh Interval</label>
<label for="refresh_users_interval">Users List Refresh Interval</label>
<div class="row">
<div class="col-md-2">
<input type="text" class="form-control" data-parsley-type="integer" id="refresh_users_interval" name="refresh_users_interval" value="${config['refresh_users_interval']}" size="5" data-parsley-range="[1,24]" data-parsley-trigger="change" data-parsley-errors-container="#refresh_users_interval_error" required>
@ -359,9 +359,29 @@ available_notification_agents = sorted(notifiers.available_notification_agents()
</div>
<div class="checkbox">
<label>
<input type="checkbox" id="refresh_users_on_startup" name="refresh_users_on_startup" value="1" ${config['refresh_users_on_startup']}> Refresh User List on Startup
<input type="checkbox" id="refresh_users_on_startup" name="refresh_users_on_startup" value="1" ${config['refresh_users_on_startup']}> Refresh Users List on Startup
</label>
<p class="help-block">Refresh the user list when PlexPy starts.</p>
<p class="help-block">Refresh the users list when PlexPy starts.</p>
</div>
<div class="padded-header">
<h3>Libraries List</h3>
</div>
<div class="form-group">
<label for="refresh_libraries_interval">Libraries List Refresh Interval</label>
<div class="row">
<div class="col-md-2">
<input type="text" class="form-control" data-parsley-type="integer" id="refresh_libraries_interval" name="refresh_libraries_interval" value="${config['refresh_libraries_interval']}" size="5" data-parsley-range="[1,24]" data-parsley-trigger="change" data-parsley-errors-container="#refresh_libraries_interval_error" required>
</div>
<div id="refresh_libraries_interval_error" class="alert alert-danger settings-alert" role="alert"></div>
</div>
<p class="help-block">The interval (in hours) PlexPy will request an updated libraries list from your Plex Media Server. 1 minimum, 24 maximum.</p>
</div>
<div class="checkbox">
<label>
<input type="checkbox" id="refresh_libraries_on_startup" name="refresh_libraries_on_startup" value="1" ${config['refresh_libraries_on_startup']}> Refresh Libraries List on Startup
</label>
<p class="help-block">Refresh the libraries list when PlexPy starts.</p>
</div>
<p><input type="button" class="btn btn-bright save-button" value="Save" data-success="Changes saved successfully"></p>