Compare commits

...

31 Commits

Author SHA1 Message Date
JonnyWong16
86a9230da8 v1.4.14 2016-10-12 21:06:34 -07:00
JonnyWong16
86f84766c1 Allow disable script timeout 2016-10-12 21:00:52 -07:00
JonnyWong16
fdc7078e5c API key readonly instead of disabled 2016-10-12 20:55:32 -07:00
JonnyWong16
c649ebfcc0 Fix typo under Flush Temporary Sessions 2016-10-10 22:47:41 -07:00
JonnyWong16
6aa0d4cd0b Check for metadata before attempting to write session history 2016-10-10 22:46:48 -07:00
JonnyWong16
1a2e205c1f v1.4.13 2016-10-08 23:42:18 -07:00
JonnyWong16
5dd04cb8ab Temporarily set stopped time when connection is lost 2016-10-08 22:56:43 -07:00
JonnyWong16
62d05e5e08 Add supplementary URL option to Pushover 2016-10-08 22:45:16 -07:00
JonnyWong16
1c087ec856 Add backup days option 2016-10-08 22:29:30 -07:00
JonnyWong16
010c12da67 Use human file size in table 2016-10-03 21:36:02 -07:00
JonnyWong16
9bdac38561 Merge pull request #859 from logaritmisk/human-file-size
Human file size for media info table
2016-10-03 21:30:26 -07:00
logaritmisk
790ca9c90a Human file size for media info table. 2016-10-03 22:27:21 +02:00
JonnyWong16
58f72d2d9c Merge pull request #856 from Hellowlol/imgfix
fix for image proxy for api.
2016-10-02 12:09:33 -07:00
Hellowlol
285e6513ed fix for image proxy for api. 2016-10-02 20:38:51 +02:00
JonnyWong16
412bc8cf2d Move watched percent to General settings 2016-09-30 19:38:20 -07:00
JonnyWong16
45cd8b8a00 Cleanup kill script 2016-09-30 00:35:31 -07:00
JonnyWong16
ae2227959e Fix 0b10e68 2016-09-29 23:35:33 -07:00
JonnyWong16
b50c92f919 Rename get_log 2016-09-29 23:31:33 -07:00
JonnyWong16
93a1d9c164 Run script in a new thread with timeout
* Also fixes script output not sent to logger
2016-09-29 23:31:15 -07:00
JonnyWong16
0b10e68c60 Force refresh Plex.tv token in settings
* Removes the old PlexPy device and fetches a new token
2016-09-29 21:21:07 -07:00
JonnyWong16
73ac4076ac Disable manual changing of API key 2016-09-29 18:51:35 -07:00
JonnyWong16
5968b82a0b Add pms_image_proxy to api 2016-09-27 22:20:10 -07:00
JonnyWong16
ce1d2a0fd9 Fix success message show incorrectly when sending test notification
* Due to saving the settings before sending the notification
2016-09-27 21:48:09 -07:00
JonnyWong16
de3f813b46 Add flush temporary sessions button in settings 2016-09-27 21:47:12 -07:00
JonnyWong16
4797b1a3b7 Add new librarys to homepage automatically 2016-09-26 22:20:44 -07:00
JonnyWong16
3e996d284d Disable posters by default for all notification agents 2016-09-25 22:05:02 -07:00
JonnyWong16
420c5a0836 Fix Browser config section 2016-09-25 22:04:25 -07:00
JonnyWong16
c6b953055a Fix admin username not shown in login logs 2016-09-24 19:37:09 -07:00
JonnyWong16
1cd0c112a6 Fix PlexPy log level filter 2016-09-24 19:29:26 -07:00
JonnyWong16
492d28ea37 Update pytz library 2016-09-19 21:48:14 -07:00
JonnyWong16
4eb7e03b67 Update Readme 2016-09-19 19:08:26 -07:00
158 changed files with 805 additions and 467 deletions

22
API.md
View File

@@ -772,7 +772,7 @@ Get the metadata for a media item.
``` ```
Required parameters: Required parameters:
rating_key (str): Rating key of the item rating_key (str): Rating key of the item
media_info (bool): True or False wheter to get media info media_info (bool): True or False whether to get media info
Optional parameters: Optional parameters:
None None
@@ -1793,6 +1793,26 @@ Returns:
``` ```
### pms_image_proxy
Gets an image from the PMS and saves it to the image cache directory.
```
Required parameters:
img (str): /library/metadata/153037/thumb/1462175060
or
rating_key (str): 54321
Optional parameters:
width (str): 150
height (str): 255
fallback (str): "poster", "cover", "art"
refresh (bool): True or False whether to refresh the image cache
Returns:
None
```
### refresh_libraries_list ### refresh_libraries_list
Refresh the PlexPy libraries list. Refresh the PlexPy libraries list.

View File

@@ -1,5 +1,36 @@
# Changelog # Changelog
## v1.4.14 (2016-10-12)
* Fix: History logging locking up if media is removed from Plex before PlexPy can save the session.
* Fix: Unable to save API key in the settings.
* Fix: Some typos in the settings. (Thanks @Leafar3456)
* Change: Disable script timeout by setting timeout to 0 seconds.
## v1.4.13 (2016-10-08)
* New: Option to set the number of days to keep PlexPy backups.
* New: Option to add a supplementary url to Pushover notifications.
* New: Option to set a timeout duration for script notifications.
* New: Added flush temporary sessions button to extra settings for emergency use.
* New: Added pms_image_proxy to the API.
* Fix: Insanely long play durations being recorded when connection to the Plex server is lost.
* Fix: Script notification output not being sent to the logger.
* Fix: New libraries not being added to homepage automatically.
* Fix: Success message shown incorrectly when sending a test notification.
* Fix: PlexPy log level filter not working.
* Fix: Admin username not shown in login logs.
* Fix: FeatHub link in readme document.
* Change: Posters disabled by default for all notification agents.
* Change: Disable manual changing of the PlexPy API key.
* Change: Force refresh the Plex.tv token when fetching a new token.
* Change: Script notifications run in a new thread with the timeout setting.
* Change: Watched percent moved to general settings.
* Change: Use human readable file sizes to the media info tables. (Thanks @logaritmisk)
* Change: Update pytz library.
## v1.4.12 (2016-09-18) ## v1.4.12 (2016-09-18)
* Fix: PMS update check not working for MacOSX. * Fix: PMS update check not working for MacOSX.

View File

@@ -35,7 +35,7 @@ In case you read this because you are posting an issue, please take a minute and
## Feature Requests ## Feature Requests
Feature requests are handled on [FeatHub](http://feathub.com/drzoidberg33/plexpy). Feature requests are handled on [FeatHub](http://feathub.com/JonnyWong16/plexpy).
1. Search the existing requests to see if your suggestion has already been submitted. 1. Search the existing requests to see if your suggestion has already been submitted.
2. If a similar request exists, give it a thumbs up (+1), or add additional comments to the request. 2. If a similar request exists, give it a thumbs up (+1), or add additional comments to the request.

View File

@@ -8,7 +8,7 @@ Reporting Issues:
Please use [Gist](http://gist.github.com) or [Pastebin](http://pastebin.com/). Please use [Gist](http://gist.github.com) or [Pastebin](http://pastebin.com/).
Feature Requests: Feature Requests:
* Feature requests are handled on FeatHub: http://feathub.com/drzoidberg33/plexpy * Feature requests are handled on FeatHub: http://feathub.com/JonnyWong16/plexpy
* Do not post them on the GitHub issues tracker. * Do not post them on the GitHub issues tracker.
--> -->

View File

@@ -74,7 +74,7 @@ This project is based on code from [Headphones](https://github.com/rembo10/headp
## Feature Requests ## Feature Requests
Feature requests are handled on [FeatHub](http://feathub.com/drzoidberg33/plexpy). Feature requests are handled on [FeatHub](http://feathub.com/JonnyWong16/plexpy).
1. Search the existing requests to see if your suggestion has already been submitted. 1. Search the existing requests to see if your suggestion has already been submitted.
2. If a similar request exists, give it a thumbs up (+1), or add additional comments to the request. 2. If a similar request exists, give it a thumbs up (+1), or add additional comments to the request.

View File

@@ -3055,3 +3055,13 @@ a:hover .overlay-refresh-image:hover {
padding-top: 10px; padding-top: 10px;
padding-bottom: 10px; padding-bottom: 10px;
} }
#plexpy-log-levels label,
#plex-log-levels label {
margin-bottom: 0;
}
#api_key.form-control[readonly] {
background-color: #555;
}
#api_key.form-control[readonly]:focus {
background-color: #fff;
}

View File

@@ -65,8 +65,8 @@ function confirmAjaxCall(url, msg, loader_msg, callback) {
url: url, url: url,
type: 'POST', type: 'POST',
complete: function (xhr, status) { complete: function (xhr, status) {
result = $.parseJSON(xhr.responseText); var result = $.parseJSON(xhr.responseText);
msg = result.message; var msg = result.message;
if (result.result == 'success') { if (result.result == 'success') {
showMsg('<i class="fa fa-check"></i> ' + msg, false, true, 5000) showMsg('<i class="fa fa-check"></i> ' + msg, false, true, 5000)
} else { } else {
@@ -80,9 +80,9 @@ function confirmAjaxCall(url, msg, loader_msg, callback) {
}); });
} }
function doAjaxCall(url, elem, reload, form, callback) { function doAjaxCall(url, elem, reload, form, showMsg, callback) {
// Set Message // Set Message
feedback = $("#ajaxMsg"); feedback = (showMsg) ? $("#ajaxMsg") : $();
update = $("#updatebar"); update = $("#updatebar");
if (update.is(":visible")) { if (update.is(":visible")) {
var height = update.height() + 35; var height = update.height() + 35;
@@ -449,3 +449,20 @@ $('*').on('click', '.refresh_pms_image', function (e) {
} }
} }
}); });
// Taken from http://stackoverflow.com/questions/10420352/converting-file-size-in-bytes-to-human-readable#answer-14919494
function humanFileSize(bytes, si) {
var thresh = si ? 1000 : 1024;
if (Math.abs(bytes) < thresh) {
return bytes + ' B';
}
var units = si
? ['kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']
: ['KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB'];
var u = -1;
do {
bytes /= thresh;
++u;
} while (Math.abs(bytes) >= thresh && u < units.length - 1);
return bytes.toFixed(1) + '&nbsp;' + units[u];
}

View File

@@ -4,7 +4,7 @@ var time_format = 'hh:mm a';
$.ajax({ $.ajax({
url: 'get_date_formats', url: 'get_date_formats',
type: 'GET', type: 'GET',
success: function(data) { success: function (data) {
date_format = data.date_format; date_format = data.date_format;
time_format = data.time_format; time_format = data.time_format;
} }
@@ -16,10 +16,10 @@ media_info_table_options = {
"destroy": true, "destroy": true,
"language": { "language": {
"search": "Search: ", "search": "Search: ",
"lengthMenu":"Show _MENU_ entries per page", "lengthMenu": "Show _MENU_ entries per page",
"info":"Showing _START_ to _END_ of _TOTAL_ library items", "info": "Showing _START_ to _END_ of _TOTAL_ library items",
"infoEmpty":"Showing 0 to 0 of 0 entries", "infoEmpty": "Showing 0 to 0 of 0 entries",
"infoFiltered":"<span class='hidden-md hidden-sm hidden-xs'>(filtered from _MAX_ total entries)</span>", "infoFiltered": "<span class='hidden-md hidden-sm hidden-xs'>(filtered from _MAX_ total entries)</span>",
"emptyTable": "No data in table", "emptyTable": "No data in table",
"loadingRecords": '<i class="fa fa-refresh fa-spin"></i> Loading items...</div>' "loadingRecords": '<i class="fa fa-refresh fa-spin"></i> Loading items...</div>'
}, },
@@ -28,7 +28,7 @@ media_info_table_options = {
"processing": false, "processing": false,
"serverSide": true, "serverSide": true,
"pageLength": 25, "pageLength": 25,
"order": [ 1, 'asc'], "order": [1, 'asc'],
"autoWidth": false, "autoWidth": false,
"scrollX": true, "scrollX": true,
"columnDefs": [ "columnDefs": [
@@ -110,7 +110,7 @@ media_info_table_options = {
}, },
"width": "20%", "width": "20%",
"className": "no-wrap", "className": "no-wrap",
}, },
{ {
"targets": [2], "targets": [2],
"data": "container", "data": "container",
@@ -194,7 +194,7 @@ media_info_table_options = {
"data": "file_size", "data": "file_size",
"createdCell": function (td, cellData, rowData, row, col) { "createdCell": function (td, cellData, rowData, row, col) {
if (cellData !== null && cellData !== '') { if (cellData !== null && cellData !== '') {
$(td).html(Math.round(cellData / Math.pow(1024, 2)).toString() + ' MiB'); $(td).html(humanFileSize(cellData));
} else { } else {
if (rowData['section_type'] != 'photo' && get_file_sizes != null) { if (rowData['section_type'] != 'photo' && get_file_sizes != null) {
get_file_sizes = true; get_file_sizes = true;
@@ -280,10 +280,10 @@ media_info_table_options = {
} }
$("#media_info_table-SID-" + section_id + "_info").append('<span class="hidden-md hidden-sm hidden-xs"> with a total file size of ' + $("#media_info_table-SID-" + section_id + "_info").append('<span class="hidden-md hidden-sm hidden-xs"> with a total file size of ' +
Math.round(settings.json.filtered_file_size / Math.pow(1024, 3)).toString() + ' GiB' + humanFileSize(settings.json.filtered_file_size) +
' (filtered from ' + Math.round(settings.json.total_file_size / Math.pow(1024, 3)).toString() + ' GiB)</span>'); ' (filtered from ' + humanFileSize(settings.json.total_file_size) + ')</span>');
}, },
"preDrawCallback": function(settings) { "preDrawCallback": function (settings) {
var msg = "<i class='fa fa-refresh fa-spin'></i>&nbspFetching rows..."; var msg = "<i class='fa fa-refresh fa-spin'></i>&nbspFetching rows...";
showMsg(msg, false, false, 0) showMsg(msg, false, false, 0)
}, },

View File

@@ -28,7 +28,7 @@
<option disabled>&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;</option> <option disabled>&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;</option>
<option value="DEBUG">Debug</option> <option value="DEBUG">Debug</option>
<option value="INFO">Info</option> <option value="INFO">Info</option>
<option value="WARN">Warning</option> <option value="WARNING">Warning</option>
<option value="ERROR">Error</option> <option value="ERROR">Error</option>
</select> </select>
</label> </label>
@@ -198,7 +198,7 @@
var selected_log_level = null; var selected_log_level = null;
function loadPlexPyLogs(selected_log_level) { function loadPlexPyLogs(selected_log_level) {
log_table_options.ajax = { log_table_options.ajax = {
url: "getLog", url: "get_log",
type: 'post', type: 'post',
data: function (d) { data: function (d) {
return { return {

View File

@@ -148,7 +148,7 @@
$('#save-notification-item').click(function () { $('#save-notification-item').click(function () {
// Reload modal to update certain fields // Reload modal to update certain fields
doAjaxCall('set_notification_config', $(this), 'tabs', true, reloadModal); doAjaxCall('set_notification_config', $(this), 'tabs', true, true, reloadModal);
return false; return false;
}); });
@@ -176,7 +176,7 @@
}) })
$('#test_notifier').click(function () { $('#test_notifier').click(function () {
doAjaxCall('set_notification_config', $(this), 'tabs', true, sendTestNotification); doAjaxCall('set_notification_config', $(this), 'tabs', true, false, sendTestNotification);
}); });
function sendTestNotification() { function sendTestNotification() {
@@ -219,7 +219,7 @@
$('#pushbullet_apikey, #pushover_apitoken, #scripts_folder, #join_apikey').on('change', function () { $('#pushbullet_apikey, #pushover_apitoken, #scripts_folder, #join_apikey').on('change', function () {
// Reload modal to update certain fields // Reload modal to update certain fields
doAjaxCall('set_notification_config', $(this), 'tabs', true, reloadModal); doAjaxCall('set_notification_config', $(this), 'tabs', true, false, reloadModal);
return false; return false;
}); });

View File

@@ -129,6 +129,16 @@
</label> </label>
<p class="help-block">Include current activity in the history tables. Statistics will not be counted until the stream has ended.</p> <p class="help-block">Include current activity in the history tables. Statistics will not be counted until the stream has ended.</p>
</div> </div>
<div class="form-group">
<label for="notify_watched_percent">Watched Percent</label>
<div class="row">
<div class="col-md-2">
<input type="text" class="form-control" data-parsley-type="integer" id="notify_watched_percent" name="notify_watched_percent" value="${config['notify_watched_percent']}" size="5" data-parsley-range="[50,95]" data-parsley-trigger="change" data-parsley-errors-container="#notify_watched_percent_error" required>
</div>
<div id="notify_watched_percent_error" class="alert alert-danger settings-alert" role="alert"></div>
</div>
<p class="help-block">Set the percentage for a media item to be considered as watched. Minimum 50, Maximum 95.</p>
</div>
<div class="padded-header"> <div class="padded-header">
<h3>Backup</h3> <h3>Backup</h3>
@@ -143,6 +153,19 @@
</div> </div>
<p class="help-block">The interval (in hours) PlexPy will backup the database and configuration file. Minimum 1, maximum 24, default 6.</p> <p class="help-block">The interval (in hours) PlexPy will backup the database and configuration file. Minimum 1, maximum 24, default 6.</p>
</div> </div>
<div class="form-group">
<label for="backup_interval">Backup Days</label>
<div class="row">
<div class="col-md-2">
<input type="text" class="form-control" data-parsley-type="integer" id="backup_days" name="backup_days" value="${config['backup_days']}" size="5" data-parsley-min="1" data-parsley-trigger="change" data-parsley-errors-container="#backup_days_error" required>
</div>
<div id="backup_days_error" class="alert alert-danger settings-alert" role="alert"></div>
</div>
<p class="help-block">
The number of days to keep scheduled backups. Minimum 1, default 3.<br />
Note: Manual backups are not removed automatically.
</p>
</div>
<div class="padded-header"> <div class="padded-header">
<h3>Directories</h3> <h3>Directories</h3>
@@ -518,7 +541,7 @@
<div class="row"> <div class="row">
<div class="col-md-6"> <div class="col-md-6">
<div class="input-group"> <div class="input-group">
<input class="form-control" type="text" name="api_key" id="api_key" value="${config['api_key']}" size="20"> <input class="form-control" type="text" name="api_key" id="api_key" value="${config['api_key']}" size="20" readonly>
<span class="input-group-btn"> <span class="input-group-btn">
<button class="btn btn-form" type="button" id="generate_api">Generate</button> <button class="btn btn-form" type="button" id="generate_api">Generate</button>
</span> </span>
@@ -736,6 +759,20 @@
</div> </div>
<p class="help-block">Backlink protection via anonymizer service, must end in "?".</p> <p class="help-block">Backlink protection via anonymizer service, must end in "?".</p>
</div> </div>
<div class="form-group">
<label>Flush Temporary Sessions</label>
<p class="help-block">
Attempt to fix history logging by flushing out all of the temporary sessions in the database.<br />
Warning: This will reset all currently active sessions. For emergency use only when history logging is stuck!
</p>
<div class="row">
<div class="col-md-4">
<div class="btn-group">
<button class="btn btn-form" type="button" id="delete_temp_sessions">Flush</button>
</div>
</div>
</div>
</div>
<div class="padded-header"> <div class="padded-header">
<h3>Database Import Tool</h3> <h3>Database Import Tool</h3>
@@ -887,16 +924,6 @@
<h3>Current Activity Notifications</h3> <h3>Current Activity Notifications</h3>
</div> </div>
<div class="form-group">
<label for="notify_watched_percent">Watched Percent</label>
<div class="row">
<div class="col-md-2">
<input type="text" class="form-control" data-parsley-type="integer" id="notify_watched_percent" name="notify_watched_percent" value="${config['notify_watched_percent']}" size="5" data-parsley-range="[50,95]" data-parsley-trigger="change" data-parsley-errors-container="#notify_watched_percent_error" required>
</div>
<div id="notify_watched_percent_error" class="alert alert-danger settings-alert" role="alert"></div>
</div>
<p class="help-block">Set the progress percentage of when a watched notification should be triggered. Minimum 50, Maximum 95.</p>
</div>
<div class="checkbox"> <div class="checkbox">
<label> <label>
<input type="checkbox" name="notify_consecutive" id="notify_consecutive" value="1" ${config['notify_consecutive']}> Allow Consecutive Notifications <input type="checkbox" name="notify_consecutive" id="notify_consecutive" value="1" ${config['notify_consecutive']}> Allow Consecutive Notifications
@@ -1533,11 +1560,11 @@
<div class="modal-body" id="modal-text"> <div class="modal-body" id="modal-text">
<div> <div>
<p class="help-block"> <p class="help-block">
This will attempt to fetch your token for you. This will not work on Internet Explorer 9 or lower. This will attempt to fetch a new Plex.tv token for you. PlexPy does not store your username and password.
PlexPy does not store your username and password. Note: This will not work on Internet Explorer 9 or lower.
</p> </p>
<div class="form-group"> <div class="form-group">
<label for="pms_username">PMS Username</label> <label for="pms_username">Plex.tv Username</label>
<div class="row"> <div class="row">
<div class="col-md-6"> <div class="col-md-6">
<input type="text" class="form-control" id="pms_username" name="pms_username" size="30"> <input type="text" class="form-control" id="pms_username" name="pms_username" size="30">
@@ -1546,7 +1573,7 @@
<p class="help-block">Username for Plex.tv authentication.</p> <p class="help-block">Username for Plex.tv authentication.</p>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="pms_password">PMS Password</label> <label for="pms_password">Plex.tv Password</label>
<div class="row"> <div class="row">
<div class="col-md-6"> <div class="col-md-6">
<input type="password" class="form-control" id="pms_password" name="pms_password" size="30"> <input type="password" class="form-control" id="pms_password" name="pms_password" size="30">
@@ -2190,7 +2217,7 @@ $(document).ready(function() {
function saveSettings() { function saveSettings() {
if (configForm.parsley().validate()) { if (configForm.parsley().validate()) {
doAjaxCall('configUpdate', $(this), 'tabs', true, postSaveChecks); doAjaxCall('configUpdate', $(this), 'tabs', true, true, postSaveChecks);
return false; return false;
} else { } else {
showMsg('<i class="fa fa-exclamation-circle"></i> Please verify your settings.', false, true, 5000, true) showMsg('<i class="fa fa-exclamation-circle"></i> Please verify your settings.', false, true, 5000, true)
@@ -2273,6 +2300,12 @@ $(document).ready(function() {
confirmAjaxCall(url, msg); confirmAjaxCall(url, msg);
}); });
$("#delete_temp_sessions").click(function () {
var msg = 'Are you sure you want to flush the temporary sessions?<br /><strong>This will reset all currently active sessions.</strong>';
var url = 'delete_temp_sessions';
confirmAjaxCall(url, msg);
});
$('#api_key').click(function(){ $('#api_key').select() }); $('#api_key').click(function(){ $('#api_key').select() });
$("#generate_api").click(function() { $("#generate_api").click(function() {
$.get('generateAPI', $.get('generateAPI',
@@ -2368,21 +2401,24 @@ $(document).ready(function() {
if ((pms_username !== '') && (pms_password !== '')) { if ((pms_username !== '') && (pms_password !== '')) {
$.ajax({ $.ajax({
type: 'GET', type: 'GET',
url: 'get_pms_token', url: 'get_plexpy_pms_token',
data: { data: {
username: pms_username, username: pms_username,
password: pms_password password: pms_password,
force: true
}, },
cache: false, cache: false,
async: true, async: true,
complete: function(xhr, status) { complete: function(xhr, status) {
var authToken = $.parseJSON(xhr.responseText); var result = $.parseJSON(xhr.responseText);
if (authToken) { var msg = result.message;
$("#pms-token-status").html('<i class="fa fa-check"></i> Authentication successful!'); if (result.result == 'success') {
var authToken = result.token;
$("#pms-token-status").html('<i class="fa fa-check"></i> ' + msg);
$("#pms_token").val(authToken); $("#pms_token").val(authToken);
$('#pms-auth-modal').modal('hide'); $('#pms-auth-modal').modal('hide');
} else { } else {
$("#pms-token-status").html('<i class="fa fa-exclamation-circle"></i> Invalid username or password.'); $("#pms-token-status").html('<i class="fa fa-exclamation-circle"></i> ' + msg);
} }
loadUpdateDistros(); loadUpdateDistros();
} }

View File

@@ -418,7 +418,7 @@
if ((pms_username !== '') && (pms_password !== '')) { if ((pms_username !== '') && (pms_password !== '')) {
$.ajax({ $.ajax({
type: 'GET', type: 'GET',
url: 'get_pms_token', url: 'get_plexpy_pms_token',
data: { data: {
username: pms_username, username: pms_username,
password: pms_password password: pms_password
@@ -426,15 +426,17 @@
cache: false, cache: false,
async: true, async: true,
complete: function (xhr, status) { complete: function (xhr, status) {
var authToken = $.parseJSON(xhr.responseText); var result = $.parseJSON(xhr.responseText);
if (authToken) { var msg = result.message;
$("#pms-token-status").html('<i class="fa fa-check"></i> Authentication successful!'); if (result.result == 'success') {
var authToken = result.token;
$("#pms-token-status").html('<i class="fa fa-check"></i> ' + msg);
$('#pms-token-status').fadeIn('fast'); $('#pms-token-status').fadeIn('fast');
$("#pms_token").val(authToken); $("#pms_token").val(authToken);
authenticated = true; authenticated = true;
getServerOptions(authToken) getServerOptions(authToken)
} else { } else {
$("#pms-token-status").html('<i class="fa fa-exclamation-circle"></i> Invalid username or password.'); $("#pms-token-status").html('<i class="fa fa-exclamation-circle"></i> ' + msg);
} }
} }
}); });

View File

@@ -8,9 +8,9 @@ See the datetime section of the Python Library Reference for information
on how to use these modules. on how to use these modules.
''' '''
# The Olson database is updated several times a year. # The IANA (nee Olson) database is updated several times a year.
OLSON_VERSION = '2014j' OLSON_VERSION = '2016f'
VERSION = '2014.10' # Switching to pip compatible version numbering. VERSION = '2016.6.1' # Switching to pip compatible version numbering.
__version__ = VERSION __version__ = VERSION
OLSEN_VERSION = OLSON_VERSION # Old releases had this misspelling OLSEN_VERSION = OLSON_VERSION # Old releases had this misspelling
@@ -25,11 +25,6 @@ __all__ = [
import sys, datetime, os.path, gettext import sys, datetime, os.path, gettext
try:
from pkg_resources import resource_stream
except ImportError:
resource_stream = None
from pytz.exceptions import AmbiguousTimeError from pytz.exceptions import AmbiguousTimeError
from pytz.exceptions import InvalidTimeError from pytz.exceptions import InvalidTimeError
from pytz.exceptions import NonExistentTimeError from pytz.exceptions import NonExistentTimeError
@@ -57,7 +52,7 @@ except NameError: # Python 3.x
... ...
UnicodeEncodeError: ... UnicodeEncodeError: ...
""" """
s.encode('US-ASCII') # Raise an exception if not ASCII s.encode('ASCII') # Raise an exception if not ASCII
return s # But return the original string - not a byte string. return s # But return the original string - not a byte string.
else: # Python 2.x else: # Python 2.x
@@ -73,7 +68,7 @@ else: # Python 2.x
... ...
UnicodeEncodeError: ... UnicodeEncodeError: ...
""" """
return s.encode('US-ASCII') return s.encode('ASCII')
def open_resource(name): def open_resource(name):
@@ -88,11 +83,17 @@ def open_resource(name):
raise ValueError('Bad path segment: %r' % part) raise ValueError('Bad path segment: %r' % part)
filename = os.path.join(os.path.dirname(__file__), filename = os.path.join(os.path.dirname(__file__),
'zoneinfo', *name_parts) 'zoneinfo', *name_parts)
if not os.path.exists(filename) and resource_stream is not None: if not os.path.exists(filename):
# http://bugs.launchpad.net/bugs/383171 - we avoid using this # http://bugs.launchpad.net/bugs/383171 - we avoid using this
# unless absolutely necessary to help when a broken version of # unless absolutely necessary to help when a broken version of
# pkg_resources is installed. # pkg_resources is installed.
return resource_stream(__name__, 'zoneinfo/' + name) try:
from pkg_resources import resource_stream
except ImportError:
resource_stream = None
if resource_stream is not None:
return resource_stream(__name__, 'zoneinfo/' + name)
return open(filename, 'rb') return open(filename, 'rb')
@@ -241,7 +242,7 @@ class UTC(datetime.tzinfo):
return "UTC" return "UTC"
UTC = utc = UTC() # UTC is a singleton UTC = utc = UTC() # UTC is a singleton
def _UTC(): def _UTC():
@@ -329,7 +330,7 @@ class _CountryTimezoneDict(LazyDict):
zone_tab = open_resource('zone.tab') zone_tab = open_resource('zone.tab')
try: try:
for line in zone_tab: for line in zone_tab:
line = line.decode('US-ASCII') line = line.decode('UTF-8')
if line.startswith('#'): if line.startswith('#'):
continue continue
code, coordinates, zone = line.split(None, 4)[:3] code, coordinates, zone = line.split(None, 4)[:3]
@@ -357,7 +358,7 @@ class _CountryNameDict(LazyDict):
zone_tab = open_resource('iso3166.tab') zone_tab = open_resource('iso3166.tab')
try: try:
for line in zone_tab.readlines(): for line in zone_tab.readlines():
line = line.decode('US-ASCII') line = line.decode('UTF-8')
if line.startswith('#'): if line.startswith('#'):
continue continue
code, name = line.split(None, 1) code, name = line.split(None, 1)
@@ -404,9 +405,11 @@ class _FixedOffset(datetime.tzinfo):
def normalize(self, dt, is_dst=False): def normalize(self, dt, is_dst=False):
'''Correct the timezone information on the given datetime''' '''Correct the timezone information on the given datetime'''
if dt.tzinfo is self:
return dt
if dt.tzinfo is None: if dt.tzinfo is None:
raise ValueError('Naive time - no tzinfo set') raise ValueError('Naive time - no tzinfo set')
return dt.replace(tzinfo=self) return dt.astimezone(self)
def FixedOffset(offset, _tzinfos = {}): def FixedOffset(offset, _tzinfos = {}):
@@ -599,6 +602,7 @@ all_timezones = \
'America/Eirunepe', 'America/Eirunepe',
'America/El_Salvador', 'America/El_Salvador',
'America/Ensenada', 'America/Ensenada',
'America/Fort_Nelson',
'America/Fort_Wayne', 'America/Fort_Wayne',
'America/Fortaleza', 'America/Fortaleza',
'America/Glace_Bay', 'America/Glace_Bay',
@@ -731,6 +735,7 @@ all_timezones = \
'Asia/Bahrain', 'Asia/Bahrain',
'Asia/Baku', 'Asia/Baku',
'Asia/Bangkok', 'Asia/Bangkok',
'Asia/Barnaul',
'Asia/Beirut', 'Asia/Beirut',
'Asia/Bishkek', 'Asia/Bishkek',
'Asia/Brunei', 'Asia/Brunei',
@@ -802,6 +807,7 @@ all_timezones = \
'Asia/Thimbu', 'Asia/Thimbu',
'Asia/Thimphu', 'Asia/Thimphu',
'Asia/Tokyo', 'Asia/Tokyo',
'Asia/Tomsk',
'Asia/Ujung_Pandang', 'Asia/Ujung_Pandang',
'Asia/Ulaanbaatar', 'Asia/Ulaanbaatar',
'Asia/Ulan_Bator', 'Asia/Ulan_Bator',
@@ -907,6 +913,7 @@ all_timezones = \
'Etc/Zulu', 'Etc/Zulu',
'Europe/Amsterdam', 'Europe/Amsterdam',
'Europe/Andorra', 'Europe/Andorra',
'Europe/Astrakhan',
'Europe/Athens', 'Europe/Athens',
'Europe/Belfast', 'Europe/Belfast',
'Europe/Belgrade', 'Europe/Belgrade',
@@ -927,6 +934,7 @@ all_timezones = \
'Europe/Jersey', 'Europe/Jersey',
'Europe/Kaliningrad', 'Europe/Kaliningrad',
'Europe/Kiev', 'Europe/Kiev',
'Europe/Kirov',
'Europe/Lisbon', 'Europe/Lisbon',
'Europe/Ljubljana', 'Europe/Ljubljana',
'Europe/London', 'Europe/London',
@@ -954,6 +962,7 @@ all_timezones = \
'Europe/Tallinn', 'Europe/Tallinn',
'Europe/Tirane', 'Europe/Tirane',
'Europe/Tiraspol', 'Europe/Tiraspol',
'Europe/Ulyanovsk',
'Europe/Uzhgorod', 'Europe/Uzhgorod',
'Europe/Vaduz', 'Europe/Vaduz',
'Europe/Vatican', 'Europe/Vatican',
@@ -1177,6 +1186,7 @@ common_timezones = \
'America/Edmonton', 'America/Edmonton',
'America/Eirunepe', 'America/Eirunepe',
'America/El_Salvador', 'America/El_Salvador',
'America/Fort_Nelson',
'America/Fortaleza', 'America/Fortaleza',
'America/Glace_Bay', 'America/Glace_Bay',
'America/Godthab', 'America/Godthab',
@@ -1224,7 +1234,6 @@ common_timezones = \
'America/Moncton', 'America/Moncton',
'America/Monterrey', 'America/Monterrey',
'America/Montevideo', 'America/Montevideo',
'America/Montreal',
'America/Montserrat', 'America/Montserrat',
'America/Nassau', 'America/Nassau',
'America/New_York', 'America/New_York',
@@ -1249,7 +1258,6 @@ common_timezones = \
'America/Regina', 'America/Regina',
'America/Resolute', 'America/Resolute',
'America/Rio_Branco', 'America/Rio_Branco',
'America/Santa_Isabel',
'America/Santarem', 'America/Santarem',
'America/Santiago', 'America/Santiago',
'America/Santo_Domingo', 'America/Santo_Domingo',
@@ -1297,6 +1305,7 @@ common_timezones = \
'Asia/Bahrain', 'Asia/Bahrain',
'Asia/Baku', 'Asia/Baku',
'Asia/Bangkok', 'Asia/Bangkok',
'Asia/Barnaul',
'Asia/Beirut', 'Asia/Beirut',
'Asia/Bishkek', 'Asia/Bishkek',
'Asia/Brunei', 'Asia/Brunei',
@@ -1356,6 +1365,7 @@ common_timezones = \
'Asia/Tehran', 'Asia/Tehran',
'Asia/Thimphu', 'Asia/Thimphu',
'Asia/Tokyo', 'Asia/Tokyo',
'Asia/Tomsk',
'Asia/Ulaanbaatar', 'Asia/Ulaanbaatar',
'Asia/Urumqi', 'Asia/Urumqi',
'Asia/Ust-Nera', 'Asia/Ust-Nera',
@@ -1394,6 +1404,7 @@ common_timezones = \
'Canada/Pacific', 'Canada/Pacific',
'Europe/Amsterdam', 'Europe/Amsterdam',
'Europe/Andorra', 'Europe/Andorra',
'Europe/Astrakhan',
'Europe/Athens', 'Europe/Athens',
'Europe/Belgrade', 'Europe/Belgrade',
'Europe/Berlin', 'Europe/Berlin',
@@ -1413,6 +1424,7 @@ common_timezones = \
'Europe/Jersey', 'Europe/Jersey',
'Europe/Kaliningrad', 'Europe/Kaliningrad',
'Europe/Kiev', 'Europe/Kiev',
'Europe/Kirov',
'Europe/Lisbon', 'Europe/Lisbon',
'Europe/Ljubljana', 'Europe/Ljubljana',
'Europe/London', 'Europe/London',
@@ -1438,6 +1450,7 @@ common_timezones = \
'Europe/Stockholm', 'Europe/Stockholm',
'Europe/Tallinn', 'Europe/Tallinn',
'Europe/Tirane', 'Europe/Tirane',
'Europe/Ulyanovsk',
'Europe/Uzhgorod', 'Europe/Uzhgorod',
'Europe/Vaduz', 'Europe/Vaduz',
'Europe/Vatican', 'Europe/Vatican',

View File

@@ -15,13 +15,13 @@ from pytz.tzinfo import memorized_datetime, memorized_timedelta
def _byte_string(s): def _byte_string(s):
"""Cast a string or byte string to an ASCII byte string.""" """Cast a string or byte string to an ASCII byte string."""
return s.encode('US-ASCII') return s.encode('ASCII')
_NULL = _byte_string('\0') _NULL = _byte_string('\0')
def _std_string(s): def _std_string(s):
"""Cast a string or byte string to an ASCII string.""" """Cast a string or byte string to an ASCII string."""
return str(s.decode('US-ASCII')) return str(s.decode('ASCII'))
def build_tzinfo(zone, fp): def build_tzinfo(zone, fp):
head_fmt = '>4s c 15x 6l' head_fmt = '>4s c 15x 6l'
@@ -66,7 +66,7 @@ def build_tzinfo(zone, fp):
i += 3 i += 3
# Now build the timezone object # Now build the timezone object
if len(transitions) == 0: if len(ttinfo) ==1 or len(transitions) == 0:
ttinfo[0][0], ttinfo[0][2] ttinfo[0][0], ttinfo[0][2]
cls = type(zone, (StaticTzInfo,), dict( cls = type(zone, (StaticTzInfo,), dict(
zone=zone, zone=zone,

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More