Compare commits

...

213 Commits

Author SHA1 Message Date
JonnyWong16
7d11e1de2d v2.1.29-beta 2019-04-14 13:43:58 -07:00
JonnyWong16
36aa4a6be3 Update API docs 2019-04-13 23:14:41 -07:00
JonnyWong16
24ed63e07c Add undelete button to edit library/user modal 2019-04-13 22:56:32 -07:00
JonnyWong16
f41ed9953a Improve API response codes 2019-04-13 22:53:56 -07:00
JonnyWong16
6970231687 Log script return status code 2019-04-13 22:01:03 -07:00
JonnyWong16
ea036aa354 Fix typo in notifier config triggers 2019-04-13 18:05:40 -07:00
JonnyWong16
d0a7c2f92c Fix typo in notification parameters list 2019-04-10 18:32:54 -07:00
JonnyWong16
f07acd839b Missing closing div tag in c1fd798 2019-04-07 14:22:49 -07:00
JonnyWong16
c1fd798fe9 Add prefix and suffix text modifiers to notifications 2019-04-04 19:21:26 -07:00
JonnyWong16
2f8d2f23fe Add user IP table column IDs 2019-03-30 13:22:01 -07:00
JonnyWong16
b65a30263e Fix user IP address last seen 2019-03-30 12:10:30 -07:00
JonnyWong16
766e33df0e Add getPlexHeaders function 2019-03-26 09:10:09 -07:00
JonnyWong16
68df0f07c8 Return API result error when unauthenticaed 2019-03-21 10:22:34 -07:00
JonnyWong16
819829554b Use global port and root when getting self URL 2019-03-21 08:50:28 -07:00
JonnyWong16
18a38b16b1 Fix a9169d2 2019-03-20 08:58:30 -07:00
JonnyWong16
a9169d2b53 Fix terminate stream when both session_key and session_id are provided 2019-03-20 08:49:15 -07:00
JonnyWong16
76b9b3e474 Improve terminate stream error messages 2019-03-18 11:57:08 -07:00
JonnyWong16
00405f0b18 Change wording in activity header 2019-03-18 10:42:02 -07:00
JonnyWong16
9dfeccdaed Fix update metadata serach only returning 3 results 2019-03-17 18:19:11 -07:00
JonnyWong16
b6d044fe8f Fix API search not using the limit parameter 2019-03-17 17:59:18 -07:00
JonnyWong16
e949b1486e v2.1.28 2019-03-10 14:47:26 -07:00
JonnyWong16
8e1b6efc51 Reword unable to delete from Cloudinary log message 2019-03-10 14:32:45 -07:00
JonnyWong16
00012ffe09 Merge pull request #1344 from Jabcob/patch-1
Update init.systemd
2019-03-10 14:28:01 -07:00
Jabcob
bcf6b4de77 Update init.systemd
Edited user creation and directory ownership instructions in the configuration notes for clarity. Current version may give novice users the impression that the ownership command is only executed on CentOS/Fedora.
2019-03-09 15:39:26 -06:00
JonnyWong16
b1516e9963 Improve mass delete from Cloudinary 2019-03-08 17:49:28 -08:00
JonnyWong16
231de3a7a5 Merge pull request #1343 from samwiseg0/fix/relayed_int
Fix relayed to be an integer vs string
2019-03-06 18:33:05 -08:00
samwiseg0
b611ea659e Fix relayed to be an integer vs string 2019-03-06 17:02:12 -08:00
JonnyWong16
6e9f299c19 Add secure/insecure icon to activity card 2019-03-05 21:55:13 -08:00
JonnyWong16
61fac10079 v2.1.27-beta 2019-03-03 15:30:42 -08:00
JonnyWong16
536e8add17 Encode email exception to unicode 2019-03-03 14:10:05 -08:00
JonnyWong16
cb81bcac57 Return default blank content type (Fixes Tautulli/Tautulli-Issues#165) 2019-03-03 13:39:45 -08:00
JonnyWong16
5dd7806c0e Combine recently added manually due to change in Plex recently added API 2019-03-02 18:42:43 -08:00
JonnyWong16
2a707fc512 Fix typo in f6f5df3 2019-02-24 14:39:07 -08:00
JonnyWong16
469e54a22c Add current release/version to update_check API 2019-02-24 14:36:21 -08:00
JonnyWong16
f6f5df3d1e Add ability to dismiss browser warning 2019-02-24 14:27:34 -08:00
JonnyWong16
ae0960d2e2 Merge pull request #1341 from Arcanemagus/systemd-restart-note
Add Systemd auto restart policy
2019-02-24 14:00:30 -08:00
Landon Abney
a646cc36a1 Enable by default
With the protections from an infinite restart loop in place this should 
be safe to enable by default.
2019-02-24 13:58:19 -08:00
Landon Abney
b243ac5f5c Add burst failure protection
If the process fails 3 times within 90 seconds of a start attempt 
consider it permanently failed and stop all further attempts to restart 
it automatically.
2019-02-24 13:55:33 -08:00
JonnyWong16
bca7744bc5 Remove unicode from Email notification failed error message 2019-02-24 12:51:27 -08:00
JonnyWong16
2fc826c88f Fix some local variable references (Also Fixes Tautulli/Tautulli-Issues#155) 2019-02-24 12:34:55 -08:00
JonnyWong16
6397b1e5a7 Show tags in notification text preview modal 2019-02-24 11:18:18 -08:00
Landon Abney
85b9a47a0d Add note on how to restart automatically
If Tautulli ever crashes due to a failure of some sort the policies 
mentioned here will automatically restart it, with the caveat that they 
will _always_ restart it, even if it is going to crash right away again!
2019-02-22 23:09:34 -08:00
JonnyWong16
5749ab7c92 Remove execute permision from systemd init script (Fixes Tautulli/Tautulli-Issues#149) 2019-02-22 19:50:06 -08:00
JonnyWong16
dcb56cfd20 Add message to complete setup wizard 2019-02-20 21:38:13 -08:00
JonnyWong16
90849f9196 Remove crypto donation 2019-02-20 20:56:50 -08:00
JonnyWong16
5b77cab575 Update Patreon URL 2019-02-20 20:55:59 -08:00
JonnyWong16
6a21d7690a Improve data sanitation (Fixes Tautulli/Tautulli-Issues#161) 2019-02-20 18:35:04 -08:00
JonnyWong16
037e983350 Change PMS beta update check URL 2019-02-19 21:20:34 -08:00
JonnyWong16
aa023f0166 v2.1.26 2018-12-01 15:50:04 -08:00
JonnyWong16
571b5461c0 Fix stream info graph modal history table (Fixes Tautulli/Tautulli-Issues#142) 2018-12-01 15:30:16 -08:00
JonnyWong16
a749b71f7f Fix activity resume after buffering 2018-12-01 15:17:33 -08:00
JonnyWong16
ac259214f7 Merge pull request #1333 from samwiseg00/add/user_email
Add user_email parameter for notifications
2018-11-04 11:49:42 -08:00
JonnyWong16
e11803685c Fix API error when missing cmd 2018-11-04 11:49:13 -08:00
samwiseg00
e4c3601312 Add user_email parameter for notifications 2018-11-04 14:18:34 -05:00
JonnyWong16
56a91de2c4 v2.1.25 2018-11-03 16:23:21 -07:00
JonnyWong16
e2d217a981 Merge pull request #1332 from samwiseg00/add/livetv_image
Add live TV images for current activity
2018-11-03 12:12:10 -07:00
samwiseg00
b484f27724 Add logic for live tv in current activity 2018-11-03 14:56:53 -04:00
samwiseg00
eb04a2e579 Fix poster image failback 2018-11-03 14:55:56 -04:00
samwiseg00
c66d8ecd5f Add new images for live tv activity 2018-11-03 14:55:30 -04:00
JonnyWong16
79b5f3c36f Merge pull request #1331 from samwiseg00/fix/pms_video_codec
Override * in video codecs
2018-11-02 19:59:48 -07:00
samwiseg00
4a78424b75 Override * in video codecs 2018-11-01 22:38:15 -04:00
JonnyWong16
4f78d0c98a Missing " in settings alert error 2018-10-31 17:49:33 -07:00
JonnyWong16
91b84b4437 Placeholder "-" for burn subtitle codec 2018-10-29 20:47:02 -07:00
JonnyWong16
8a9b3dc782 Override * in audio codecs 2018-10-29 20:46:37 -07:00
JonnyWong16
944df6cec1 v2.1.24-beta 2018-10-29 18:48:05 -07:00
JonnyWong16
354d46e940 Merge pull request #1330 from Arcanemagus/pytz-2018.6
Update pytz to 2018.6
2018-10-24 17:10:22 -04:00
Landon Abney
71cb2d9c4c Update pytz to 2018.6
Update the pytz library files to those from the 2018.6 release.
2018-10-24 12:48:53 -07:00
JonnyWong16
c08cec40cb Log colon 2018-10-23 22:45:28 -07:00
JonnyWong16
dee544c951 Update tzlocal to v1.5.1 2018-10-23 22:40:49 -07:00
JonnyWong16
f42581a5a6 Merge pull request #1329 from samwiseg00/add/timezone_log
Determine system timezone, log the timezone, and display it in the web ui config table
2018-10-23 22:05:06 -07:00
samwiseg00
fdc9f165a4 Add system timezone to the web configuration table 2018-10-23 21:55:32 -07:00
samwiseg00
8fff796700 Log system timezone on startup 2018-10-23 21:55:03 -07:00
samwiseg00
c64a115d29 Add logic to determine system timezone 2018-10-23 21:54:32 -07:00
JonnyWong16
d731ad851c Add queued tasks modal 2018-10-22 22:01:16 -07:00
JonnyWong16
c098175ba9 Merge pull request #1328 from samwiseg00/fix/on_change
Fix transcode change creating invalid sessions in the DB
2018-10-19 19:48:41 -07:00
JonnyWong16
d728f7a11e Version graphs to bypass cache 2018-10-19 18:58:26 -07:00
samwiseg00
7271e66ab8 Fix transcode change creating invalid sessions in the DB 2018-10-18 22:19:36 -04:00
JonnyWong16
5c54283df7 Merge pull request #1326 from samwiseg00/update/telegram_limit
Update character limit for telegram to reflect API changes.
2018-10-16 18:00:28 -07:00
samwiseg00
86b1d0f51d Update character limit for telegram to reflect API changes. 2018-10-16 16:23:56 -04:00
JonnyWong16
f2fedb182c Make local storage unique to Tautulli instance 2018-10-15 18:20:16 -07:00
JonnyWong16
1bce850765 v2.1.23-beta 2018-10-14 09:23:50 -07:00
JonnyWong16
ebe5c3168f Fix minor jquery expression error 2018-10-14 09:15:55 -07:00
JonnyWong16
6e4fa3ef63 Save state of history media type toggle 2018-10-13 22:12:08 -07:00
JonnyWong16
ec7afcdbc4 Fix default local storage chart visibility 2018-10-13 21:54:22 -07:00
JonnyWong16
0f2e25ba72 Save state of homepage recently added type 2018-10-13 21:51:26 -07:00
JonnyWong16
115b05ee7f Reword buffer threshold setting 2018-10-13 21:33:58 -07:00
JonnyWong16
85b4116491 Force buffer threshold to 10 2018-10-13 21:33:43 -07:00
JonnyWong16
863bb4033c Merge pull request #1325 from samwiseg00/change/buffer_threshhold
Change the default buffer threshold and bump the version number
2018-10-13 21:11:10 -07:00
samwiseg00
92672ddda8 Bump version & change default buffer from 3 to 10 2018-10-14 00:08:02 -04:00
JonnyWong16
018356b85e Save home stats config to local storage instead of server 2018-10-13 20:27:08 -07:00
JonnyWong16
d93390f8ed Change home stats type to 'plays' or 'duration' 2018-10-13 20:26:42 -07:00
JonnyWong16
e36be32b8e Set local storage before loading graphs 2018-10-13 20:22:36 -07:00
JonnyWong16
0e0fb2e2b8 Save graph config to local storage instead of server 2018-10-13 18:07:26 -07:00
JonnyWong16
be0144bbe1 Add button for recently added videos on homepage 2018-10-13 17:36:58 -07:00
JonnyWong16
0d30df6853 Add Other Video libraries to newsletters 2018-10-13 17:24:58 -07:00
JonnyWong16
77460f7617 Change type to media_type 2018-10-13 17:24:42 -07:00
JonnyWong16
c70cc535e5 Add library agent to database 2018-10-13 17:23:36 -07:00
JonnyWong16
16733bbe04 Revert column graph widths 2018-10-13 15:57:02 -07:00
JonnyWong16
1686b70c1c Show remote app device token and id 2018-10-13 15:43:19 -07:00
JonnyWong16
1ef4fd294a Save graph visibility state 2018-10-13 15:42:36 -07:00
JonnyWong16
83a4dfc0de Merge pull request #1324 from Arcanemagus/too-fast-buffer
Don't double notify on fast buffer triggers
2018-10-11 18:12:26 -07:00
samwiseg00
2eb82e8732 Change default buffering threshold for new installs 2018-10-11 16:55:45 -04:00
Landon Abney
67f70fab90 Don't double notify on fast buffer triggers
If two buffer notifications come in at the same second right at the cusp 
of the notification trigger the difference between the current and last 
trigger would be 0, causing it to send two notifications.

Change the initial value to `None` to prevent this from happening.
2018-10-11 13:29:21 -07:00
JonnyWong16
fb2362be24 Merge pull request #1323 from samwiseg00/fix/transcode_change
Fix transcode decision change for some clients
2018-10-10 21:09:05 -07:00
samwiseg00
612bf079de Fix transcode decision change for some clients 2018-10-10 16:46:40 -04:00
JonnyWong16
a88047eb9c Merge pull request #1322 from samwiseg00/fix/buffering_state_activity
Fix client buffering identification in certain scenarios
2018-10-09 20:45:57 -07:00
JonnyWong16
7bdef05a45 Fix download API commands 2018-10-09 08:27:48 -07:00
samwiseg00
1a46e09928 Fix client buffering identification in certain scenarios 2018-10-08 10:54:09 -04:00
JonnyWong16
4302c4bc0d Reverse sorting when retriving old rating key list from database 2018-10-06 20:15:19 -07:00
JonnyWong16
3b0f31c112 Merge pull request #1318 from Sheigutn/view-offset-fix
Don't overwrite view offset when processing session history
2018-10-06 18:59:35 -07:00
JonnyWong16
a976d65e9c Lock down some settings for Docker container 2018-10-06 14:19:01 -07:00
Florian Böhm
40559471cf Remove code to update view offset for every websocket event 2018-10-06 11:01:13 +02:00
JonnyWong16
6bb6e27378 Merge pull request #1321 from samwiseg00/add/notify_state_change
Add the ability to notify on transcode decision state change
2018-10-05 21:07:08 -07:00
JonnyWong16
03751abc0e v2.1.22 2018-10-05 21:04:17 -07:00
samwiseg00
8ab5d88db5 Create transcode decision columns for new DBs 2018-10-05 23:18:33 -04:00
samwiseg00
d80919140b Upgrade existing DB for transcode decision 2018-10-05 23:18:18 -04:00
samwiseg00
1e3a347782 Populate NULL text fields after a DB update 2018-10-05 23:18:00 -04:00
samwiseg00
a6e8372d47 Add transcode decision change to notifiers 2018-10-05 23:17:28 -04:00
samwiseg00
ce59692089 Fix typo in the comments 2018-10-05 23:17:06 -04:00
samwiseg00
df76a02478 Account for changing transcode decisions from websocket events 2018-10-05 23:16:49 -04:00
JonnyWong16
a94207691f Improve OAuth polling 2018-09-30 21:05:12 -07:00
JonnyWong16
dbc53ca710 Fix websocket not connecting after setup wizard 2018-09-29 15:32:13 -07:00
JonnyWong16
4c9ddbd8b7 Fix incorrectly showing 127.0.0.1 server in setup wizard 2018-09-29 15:31:55 -07:00
JonnyWong16
045c69f5d8 Catch exception when retrieiving data for notifier configs 2018-09-28 18:21:04 -07:00
JonnyWong16
71ae314c46 Make sure proxy handler priority is before auth handler (Fixes Tautulli/Tautulli-Issues#123) 2018-09-27 18:05:28 -07:00
JonnyWong16
c8575bbc0f v2.1.21 2018-09-21 18:16:48 -07:00
Florian Böhm
af3944734f Fix for usage of wrong view offset field when serializing to session_history
Also add code to update view offset in sessions table more often
2018-09-20 01:17:39 +02:00
JonnyWong16
f1b3a6f7b6 Merge pull request #1316 from Arcanemagus/fix_content_rating_type
Fix the type of the Content Rating notification parameter (Fixes Tautulli/Tautulli-Issues#122)
2018-09-19 12:49:31 -07:00
Landon Abney
8a94f6d63a Fix the type of the Content Rating notification parameter
The "Content Rating" notification parameter was incorrectly marked as an
integer, leading to all values being cast to the number 0. This made it
so every single content rating was the same value in conditions.
2018-09-19 12:46:28 -07:00
JonnyWong16
9b8fb73a7a Merge pull request #1312 from samwiseg00/add/init_distro
Add chown instructions per major distros
2018-09-19 08:41:05 -07:00
JonnyWong16
67c333e86e Add X-Plex-Token log filter 2018-09-16 10:24:07 -07:00
JonnyWong16
cfa0b20419 Fix music showing as pre-tautulli in stream info (Fixes Tautulli/Tautulli-Issues#120) 2018-09-16 09:56:32 -07:00
samwiseg00
4b2930c890 Add chown instructions per major distros 2018-09-15 16:54:49 -03:00
JonnyWong16
d98565ea12 Merge pull request #1309 from Sheigutn/refresh-image-patch
Move refresh image button to right div for track results
2018-09-15 10:28:08 -07:00
Florian Böhm
471f7c184a Replace album-item with cover-item
Also add missing quotation mark in artist cover div
2018-09-12 21:52:57 +02:00
Florian Böhm
3d4a5e6547 Move refresh image span to right div 2018-09-12 15:45:49 +02:00
JonnyWong16
382322d5e7 Always format notification subject 2018-09-11 18:08:40 -07:00
JonnyWong16
c0ae25611b Merge pull request #1152 from wilmardo/execute-permission-init-scripts
Adds execute permission to fedora.centos and systemd init-scripts
2018-09-11 17:45:45 -07:00
JonnyWong16
f025533582 Merge pull request #1308 from ldumont/fix_systemd_group
Fix typo in systemd group value
2018-09-10 08:29:49 -07:00
Loïc Dumont
fd28e5183a Fix typo in systemd group value 2018-09-10 07:35:45 +02:00
JonnyWong16
185099f183 Check for alternative reverse proxy headers 2018-09-09 10:57:14 -07:00
JonnyWong16
cd6289046e Fallback directories to data dir 2018-09-08 23:16:14 -07:00
JonnyWong16
955dc795ff Update javascript uuidv4 function 2018-09-06 23:23:55 -07:00
JonnyWong16
1b772e60a9 Add browser warning for IE/Edge 2018-09-06 22:51:01 -07:00
JonnyWong16
c6f4c17a81 Remove polling flag 2018-09-05 17:45:51 -07:00
JonnyWong16
1e68a81fe1 Stop polling if OAuth popup closed 2018-09-05 17:44:04 -07:00
JonnyWong16
4944ce1ca0 v2.1.20 2018-09-05 08:55:20 -07:00
JonnyWong16
f04873446a v2.1.20-beta 2018-09-02 18:06:45 -07:00
JonnyWong16
505b6b616e Add session_id parameter to get_activity API command 2018-09-02 11:27:34 -07:00
JonnyWong16
87dd43d699 Merge pull request #1305 from samwiseg00/fix/systemd_init
Change init script group value to be compatible with CentOS
2018-09-02 11:21:18 -07:00
samwiseg00
a48ebef9ae Change init script group value 2018-08-31 13:27:15 -04:00
JonnyWong16
e40483525b Redirect root to http_root 2018-08-27 21:41:11 -07:00
JonnyWong16
ebc563fd26 Remove unused pnotify css from login page 2018-08-27 21:39:40 -07:00
JonnyWong16
5bb3e189fe Update API docs 2018-08-27 21:27:09 -07:00
JonnyWong16
ed08df5224 Try getting missing parent_rating_key from parent_thumb first 2018-08-27 21:06:52 -07:00
JonnyWong16
ae2584b6f6 Helper function for splitting script args 2018-08-27 20:56:32 -07:00
JonnyWong16
f0e2355231 Log folder/file location on startup 2018-08-27 16:05:39 -07:00
JonnyWong16
878c48b491 Fix video and audio not showing on activity cards after refresh 2018-08-26 15:36:21 -07:00
JonnyWong16
ecfbb4de9b Fetch missing parent rating key when season is hidden 2018-08-24 22:02:21 -07:00
JonnyWong16
731af75c54 Merge pull request #1304 from samwiseg00/feature/add_env
Add TAUTULLI_PUBLIC_URL to environment variables
2018-08-24 08:07:21 -07:00
samwiseg00
9817da6012 Add TAUTULLI_PUBLIC_URL to environment variables 2018-08-24 02:59:34 -04:00
JonnyWong16
dd3f75f154 Add return_hash to pms_image_proxy API 2018-08-23 19:12:22 -07:00
JonnyWong16
1eee03fa8f Merge pull request #1303 from samwiseg00/feature/add_timestamp
Add UTC timestamp to notification params + OCD + Change discord timestamp function
2018-08-22 18:35:20 -07:00
samwiseg00
02af6c4e6c Change discord timestamp function to metadata params 2018-08-22 00:22:01 -04:00
samwiseg00
b8a9c4f5b7 Add UTC ISO time to notification handler 2018-08-22 00:21:49 -04:00
samwiseg00
0b227dc69e PEP8 functions in helpers 2018-08-22 00:18:54 -04:00
JonnyWong16
8228018dd0 Add sending notification log message 2018-08-20 14:49:00 -07:00
JonnyWong16
5c3086a049 Chnage get_notify_text_preview to POST 2018-08-19 15:08:27 -07:00
JonnyWong16
4f397b032e v2.1.19-beta 2018-08-19 08:38:39 -07:00
JonnyWong16
3a05b8ec69 Fix switching tray icon on update check 2018-08-18 15:35:25 -07:00
JonnyWong16
84ef02aa03 Add update check to Windows tray icon 2018-08-18 15:30:59 -07:00
JonnyWong16
5d82ed9415 Update newsletter config note 2018-08-18 15:06:49 -07:00
JonnyWong16
524183c2cb Fix spaces in newsletter (Resolves #1302) 2018-08-17 21:08:27 -07:00
JonnyWong16
53b361d410 Allow override for PYTHONPATH in scripts 2018-08-15 20:17:48 -07:00
JonnyWong16
30c7c6592e Merge pull request #1301 from samwiseg00/refactor-oauth-login
Refactor OAuth Login
2018-08-15 20:06:07 -07:00
JonnyWong16
88b0b888a1 Merge pull request #1300 from samwiseg00/fix-db-backup
Fix API creating a backup every sql query
2018-08-15 20:05:48 -07:00
samwiseg00
c2dcd98939 Verify that we are checking for a server 2018-08-15 21:48:25 -04:00
samwiseg00
56e9845b2c Change method for determining server list for OAuth 2018-08-15 21:48:13 -04:00
samwiseg00
6b94292c7e Fix API creating a backup every sql query 2018-08-15 16:31:31 -04:00
JonnyWong16
13dac9c1ea Refactor update check 2018-08-14 19:23:20 -07:00
JonnyWong16
4f4a66f7e7 Restart after chaging system tray setting 2018-08-14 00:14:03 -07:00
JonnyWong16
1bd7cf4d4c Close system tray icon on shutdown 2018-08-13 23:57:26 -07:00
JonnyWong16
b1ec49341e Add Windows system tray icon 2018-08-13 19:53:15 -07:00
JonnyWong16
aeccc2db71 Fix incorrect HTTP_ROOT when launching browser 2018-08-13 18:54:12 -07:00
JonnyWong16
6be5397a2d Decode script args before formatting 2018-08-13 09:34:31 -07:00
JonnyWong16
427201a4ce Add recently added XML shortcut 2018-08-12 14:32:45 -07:00
JonnyWong16
5736e12bc3 Format Webhook data strings only 2018-08-12 10:54:39 -07:00
JonnyWong16
4648e3df5f Add webhook notification agent 2018-08-12 10:31:27 -07:00
JonnyWong16
9dbb681f22 Add donate button to Tautulli updated modal 2018-08-11 09:50:59 -07:00
JonnyWong16
658260f1f6 Add x264 to hardware encoders 2018-08-10 22:44:45 -07:00
JonnyWong16
f93e745f0b Fix retrieving email msg id 2018-07-29 20:34:35 -07:00
JonnyWong16
0821c14aae Add option for threaded newsletter emails 2018-07-29 10:28:34 -07:00
JonnyWong16
1b216a35d4 Remove Notify My Android 2018-07-28 11:01:52 -07:00
JonnyWong16
7b4eadb140 Update systemd script instructions 2018-07-28 09:35:23 -07:00
JonnyWong16
a8a676b794 v2.1.18 2018-07-27 13:53:45 -07:00
JonnyWong16
2f40850100 Fix search bar width (Fixes Tautulli/Tautulli-Issues#104) 2018-07-26 17:25:31 -07:00
JonnyWong16
f16560cb40 Fix activity progress bar showing incorrect 100% 2018-07-25 18:48:33 -07:00
JonnyWong16
ab92e48d2e Fix auto resizing textareas scrolling to the top on focus 2018-07-25 18:39:40 -07:00
JonnyWong16
ce2982d948 Skip formatting bad parameters in notification text 2018-07-25 16:23:01 -07:00
JonnyWong16
89d1a5782a v2.1.17-beta 2018-07-22 17:45:02 -07:00
JonnyWong16
97cf2ebe19 Make monitor websocket ping/pong an advanced config option 2018-07-22 17:39:21 -07:00
JonnyWong16
4ef36a464a Set datatables save state duration to indefinitely 2018-07-22 17:35:10 -07:00
JonnyWong16
54ec9ad7da Remove unused libs 2018-07-22 13:54:07 -07:00
JonnyWong16
bfdfdaaad1 Image alt text to Tautulli 2018-07-17 09:44:00 -07:00
JonnyWong16
5bd51b2a17 Don't join empty paths 2018-07-16 09:36:13 -07:00
JonnyWong16
35778cfe72 Use os.pathsep for PYTHONPATH 2018-07-16 09:02:17 -07:00
JonnyWong16
f81649c4d3 Update nullrefer to HTTPS 2018-07-10 15:46:01 -07:00
JonnyWong16
59162713e7 Fix ajax loader message refresh icon spacing 2018-07-10 08:51:55 -07:00
JonnyWong16
188b728dd0 Fix save settings loader 2018-07-10 08:50:56 -07:00
JonnyWong16
3446f5543d Check local server directly 2018-07-10 08:12:12 -07:00
JonnyWong16
ab5384cfdf Discover localhost server 2018-07-09 19:31:11 -07:00
JonnyWong16
e567134ee1 Use default selected stream for media info in notifications 2018-07-06 19:41:03 -07:00
Wilmar
634e003bb7 Adds execute permission to fedora.centos and systemd init-scripts 2017-11-21 01:09:54 +01:00
707 changed files with 8132 additions and 4522 deletions

34
API.md
View File

@@ -1,9 +1,15 @@
# API Reference # API Reference
The API is still pretty new and needs some serious cleaning up on the backend but should be reasonably functional. There are no error codes yet.
## General structure ## General structure
The API endpoint is `http://ip:port + HTTP_ROOT + /api/v2?apikey=$apikey&cmd=$command` The API endpoint is
```
http://IP_ADDRESS:PORT + [/HTTP_ROOT] + /api/v2?apikey=$apikey&cmd=$command
```
Example:
```
http://localhost:8181/api/v2?apikey=66198313a092496b8a725867d2223b5f&cmd=get_metadata&rating_key=153037
```
Response example (default `json`) Response example (default `json`)
``` ```
@@ -354,7 +360,8 @@ Required parameters:
None None
Optional parameters: Optional parameters:
None session_key (int): Session key for the session info to return, OR
session_id (str): Session ID for the session info to return
Returns: Returns:
json: json:
@@ -726,7 +733,7 @@ Required parameters:
Optional parameters: Optional parameters:
grouping (int): 0 or 1 grouping (int): 0 or 1
time_range (str): The time range to calculate statistics, '30' time_range (str): The time range to calculate statistics, '30'
stats_type (int): 0 for plays, 1 for duration stats_type (str): plays or duration
stats_count (str): The number of top items to list, '5' stats_count (str): The number of top items to list, '5'
Returns: Returns:
@@ -886,6 +893,7 @@ Returns:
json: json:
{"child_count": null, {"child_count": null,
"count": 887, "count": 887,
"deleted_section": 0,
"do_notify": 1, "do_notify": 1,
"do_notify_created": 1, "do_notify_created": 1,
"keep_history": 1, "keep_history": 1,
@@ -1140,7 +1148,8 @@ Returns:
"video_language_code": "", "video_language_code": "",
"video_profile": "high", "video_profile": "high",
"video_ref_frames": "4", "video_ref_frames": "4",
"video_width": "1920" "video_width": "1920",
"selected": 0
}, },
{ {
"audio_bitrate": "384", "audio_bitrate": "384",
@@ -1153,7 +1162,8 @@ Returns:
"audio_profile": "", "audio_profile": "",
"audio_sample_rate": "48000", "audio_sample_rate": "48000",
"id": "511664", "id": "511664",
"type": "2" "type": "2",
"selected": 1
}, },
{ {
"id": "511953", "id": "511953",
@@ -1164,7 +1174,8 @@ Returns:
"subtitle_language": "English", "subtitle_language": "English",
"subtitle_language_code": "eng", "subtitle_language_code": "eng",
"subtitle_location": "external", "subtitle_location": "external",
"type": "3" "type": "3",
"selected": 1
} }
] ]
} }
@@ -1765,7 +1776,7 @@ Returns:
### get_recently_added ### get_recently_added
Get all items that where recelty added to plex. Get all items that where recently added to plex.
``` ```
Required parameters: Required parameters:
@@ -1773,7 +1784,7 @@ Required parameters:
Optional parameters: Optional parameters:
start (str): The item number to start at start (str): The item number to start at
type (str): The media type: movie, show, artist media_type (str): The media type: movie, show, artist
section_id (str): The id of the Plex library section section_id (str): The id of the Plex library section
Returns: Returns:
@@ -2435,7 +2446,7 @@ Required parameters:
body (str): The body of the message body (str): The body of the message
Optional parameters: Optional parameters:
None script_args (str): The arguments for script notifications
Returns: Returns:
None None
@@ -2496,6 +2507,7 @@ Optional parameters:
img_format (str): png img_format (str): png
fallback (str): "poster", "cover", "art" fallback (str): "poster", "cover", "art"
refresh (bool): True or False whether to refresh the image cache refresh (bool): True or False whether to refresh the image cache
return_hash (bool): True or False to return the self-hosted image hash instead of the image
Returns: Returns:
None None

View File

@@ -1,5 +1,203 @@
# Changelog # Changelog
## v2.1.29-beta (2019-04-14)
* Monitoring:
* Change: "Required Bandwidth" changed to "Reserved Bandwidth" in order to match the Plex dashboard.
* Notifications:
* New: Added prefix and suffix notification text modifiers. See the "Notification Text Modifiers" help modal for details.
* UI:
* New: Added "Undelete" button to the edit library and edit user modals.
* Fix: User IP address history table showing incorrect "Last Seen" values.
* API:
* Fix: Search API only returning 3 results.
* Fix: Terminate stream API failing when both session_key and session_id were provided.
* Change: Improved API response HTTP status codes and error messages.
## v2.1.28 (2019-03-10)
* Monitoring:
* New: Added secure/insecure connection icon on the activity cards. Requires Plex Media Server v1.15+.
* Other:
* Change: Improved mass deleting of all images from Cloudinary. Requires all previous images on Cloudinary to be manually tagged with "tautulli". New uploads are automatically tagged.
## v2.1.27-beta (2019-03-03)
* Monitoring:
* Fix: Error when playing synced optimized versions.
* Change: Show message to complete the setup wizard instead of error communicating with server message.
* Change: URL changed on Plex.tv for Plex Media Server beta updates.
* Notifications:
* New: Show the media type exclusion tags in the text preview modal.
* Fix: Unicode error in the Email notification failed response message.
* Fix: Error when a notification agent response is missing the "Content-Type" header.
* UI:
* Fix: Usernames were not being sanitized in dropdown selectors.
* Change: Different display of "All" recently added items on the homepage due to change in the Plex Media Server v1.15+ API.
* API:
* New: Added current Tautulli version to update_check API response.
* Change: API no longer returns sanitized HTML response data.
* Other:
* New: Added auto-restart to systemd init script.
* Fix: Patreon donation URL.
* Remove: Crypto donation options.
## v2.1.26 (2018-12-01)
* Monitoring:
* Fix: Resume event not being triggered after buffering.
* Notifications:
* New: Added user email as a notification parameter.
* Graphs:
* Fix: History model showing no results for stream info graph.
* API:
* Fix: API returning error when missing a cmd.
## v2.1.25 (2018-11-03)
* Monitoring:
* Fix: Audio and video codec showing up as * on the activity cards.
* New: Poster and background image on the activity cards for live TV.
* UI:
* Fix: Alert message for invalid Tautulli Public Domain setting.
## v2.1.24-beta (2018-10-29)
* Monitoring:
* Fix: Transcode change events creating invalid sessions in the database.
* Notifications:
* Change: Update Telegram character limit to 1024.
* History:
* Fix: Save history table states separately for multiple Tautulli instances.
* Graphs:
* Fix: Save graphs states separately for multiple Tautulli instances.
* Change: Version graphs to bypass browser cache.
* UI:
* New: Added queued tasks modals to the scheduled tasks table for debugging.
* Other:
* Change: Updated timezone info and display in configuration table.
## v2.1.23-beta (2018-10-14)
* Monitoring:
* Fix: Buffer events not being triggered properly.
* Fix: Watched progress sometimes not saved correctly. (Thanks @Sheigutn)
* Notifications:
* New: Added notification trigger for transcode decision change.
* Fix: Multiple buffer notifications being triggered within the same second.
* Change: Default buffer notification threshold changed to 10 for buffer thresholds less than 10.
* Newsletter:
* New: Added Other Video libraries to the newsletter.
* Homepage:
* New: Added Other Video type to recently added on the homepage.
* Change: Save homepage recently added media type toggle state.
* Change: Save homepage stats config to local storage instead of the server.
* History:
* Change: Save history table media type toggle state.
* Graphs:
* Change: Save series visibility state when toggling the legend.
* Change: Save graph config to local storage instead of the server.
* UI:
* New: Show the remote app device token and id in the edit device modal.
* Change: Lock certain settings if using the Tautulli docker container.
* API:
* Fix: download_config, download_database, download_log, and download_plex_log API commands not working.
* Change: get_recently_added command 'type' parameter renamed to 'media_type'. Backwards compatibility is maintained.
* Change: get_home_stats command 'stats_type' parameter change to string 'plays' or 'duration'. Backwards compatibility is maintained.
## v2.1.22 (2018-10-05)
* Notifications:
* Fix: Notification agent settings not loading when failed to retrieve some data.
* UI:
* Fix: Incorrectly showing localhost server in the setup wizard.
* Other:
* Fix: Incorrect redirect to HTTP when HTTPS proxy header is present.
* Fix: Websocket not connecting automatically after the setup wizard.
## v2.1.21 (2018-09-21)
* Notifications:
* Fix: Content Rating notification condition always evaluating to True. (Thanks @Arcanemagus)
* Fix: Script arguments not showing substituted values in the notification logs.
* UI:
* New: Unsupported browser warning when using IE or Edge.
* Fix: Misaligned refresh image icon in album search results. (Thanks @Sheigutn)
* Fix: Music history showing as pre-Tautulli in stream info modal.
* Other:
* Fix: Typo in Systemd init script group value. (Thanks @ldumont)
* Fix: Execute permissions in Fedora/CentOS and Systemd init scripts. (Thanks @wilmardo)
* Fix: Systemd init script instructions per Linux distro. (Thanks @samwiseg00)
* Change: Fallback to Tautulli data directory if logs/backup/cache/newsletter directories are not writable.
* Change: Check for alternative reverse proxy headers if X-Forwarded-Host is missing.
## v2.1.20 (2018-09-05)
* No changes.
## v2.1.20-beta (2018-09-02)
* Monitoring:
* Fix: Fetch messing season info when "Hide Seasons" is enabled for a show.
* Fix: Video and Audio details sometimes missing on activity cards.
* Notifications:
* New: Added UTC timestamp to notification parameters. (Thanks @samwiseg00)
* New: Added TAUTULLI_PUBLIC_URL to script environment variables. (Thanks @samwiseg00)
* UI:
* Change: Automatically redirect '/' to HTTP root if enabled.
* API:
* New: Added return_hash parameter to pms_image_proxy command.
* New: Added session_id parameter to get_activity command.
* Other:
* Change: Linux systemd startup script to use the "tautulli" group permission. (Thanks @samwiseg00)
## v2.1.19-beta (2018-08-19)
* Notifications:
* New: Added Webhook notification agent.
* Fix: Scripts failing due to unicode characters in substituted script arguments.
* Change: Ability to override PYTHONPATH for scripts.
* Remove: Notify My Android notification agent.
* Newsletters:
* New: Added option for threaded newsletter emails.
* Fix: Missing space in newsletter format.
* UI:
* New: Added Windows system tray icon.
* Fix: Plex OAuth not working with Plex remote access disabled. (Thanks @samwiseg00)
* API:
* Fix: SQL command creating a database backup every time. (Thanks @samwiseg00)
## v2.1.18 (2018-07-27)
* Monitoring:
* Fix: Progress bar on activity cards showing incorrect 100% when starting a stream.
* Notifications:
* Fix: Notification text boxes scrolling to top when inputting text.
* Change: Skip formatting invalid notification parameters instead of returning default text.
* UI:
* Fix: Padding around search bar causing the navigation bar to break on smaller screens.
## v2.1.17-beta (2018-07-22)
* Notifications:
* Change: Use default selected stream for media info in notifications.
* UI:
* New: Automatically discover localhost Plex servers in server selection dropdown.
* Change: Save Datatables state indefinitely.
## v2.1.16-beta (2018-07-06) ## v2.1.16-beta (2018-07-06)
* Monitoring: * Monitoring:

View File

@@ -28,9 +28,12 @@ import sys
sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), 'lib')) sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), 'lib'))
import argparse import argparse
import datetime
import locale import locale
import pytz
import signal import signal
import time import time
import tzlocal
import plexpy import plexpy
from plexpy import config, database, logger, webstart from plexpy import config, database, logger, webstart
@@ -106,6 +109,17 @@ def main():
logger.initLogger(console=not plexpy.QUIET, log_dir=False, logger.initLogger(console=not plexpy.QUIET, log_dir=False,
verbose=plexpy.VERBOSE) verbose=plexpy.VERBOSE)
try:
plexpy.SYS_TIMEZONE = str(tzlocal.get_localzone())
plexpy.SYS_UTC_OFFSET = datetime.datetime.now(pytz.timezone(plexpy.SYS_TIMEZONE)).strftime('%z')
except (pytz.UnknownTimeZoneError, LookupError, ValueError) as e:
logger.error("Could not determine system timezone: %s" % e)
plexpy.SYS_TIMEZONE = 'Unknown'
plexpy.SYS_UTC_OFFSET = '+0000'
if os.getenv('TAUTULLI_DOCKER', False) == 'True':
plexpy.DOCKER = True
if args.dev: if args.dev:
plexpy.DEV = True plexpy.DEV = True
logger.debug(u"Tautulli is running in the dev environment.") logger.debug(u"Tautulli is running in the dev environment.")
@@ -204,10 +218,10 @@ def main():
# Force the http port if neccessary # Force the http port if neccessary
if args.port: if args.port:
http_port = args.port plexpy.HTTP_PORT = args.port
logger.info('Using forced web server port: %i', http_port) logger.info('Using forced web server port: %i', plexpy.HTTP_PORT)
else: else:
http_port = int(plexpy.CONFIG.HTTP_PORT) plexpy.HTTP_PORT = int(plexpy.CONFIG.HTTP_PORT)
# Check if pyOpenSSL is installed. It is required for certificate generation # Check if pyOpenSSL is installed. It is required for certificate generation
# and for CherryPy. # and for CherryPy.
@@ -221,7 +235,7 @@ def main():
# Try to start the server. Will exit here is address is already in use. # Try to start the server. Will exit here is address is already in use.
web_config = { web_config = {
'http_port': http_port, 'http_port': plexpy.HTTP_PORT,
'http_host': plexpy.CONFIG.HTTP_HOST, 'http_host': plexpy.CONFIG.HTTP_HOST,
'http_root': plexpy.CONFIG.HTTP_ROOT, 'http_root': plexpy.CONFIG.HTTP_ROOT,
'http_environment': plexpy.CONFIG.HTTP_ENVIRONMENT, 'http_environment': plexpy.CONFIG.HTTP_ENVIRONMENT,
@@ -238,8 +252,12 @@ def main():
# Open webbrowser # Open webbrowser
if plexpy.CONFIG.LAUNCH_BROWSER and not args.nolaunch and not plexpy.DEV: if plexpy.CONFIG.LAUNCH_BROWSER and not args.nolaunch and not plexpy.DEV:
plexpy.launch_browser(plexpy.CONFIG.HTTP_HOST, http_port, plexpy.launch_browser(plexpy.CONFIG.HTTP_HOST, plexpy.HTTP_PORT,
plexpy.CONFIG.HTTP_ROOT) plexpy.HTTP_ROOT)
# Windows system tray icon
if os.name == 'nt' and plexpy.CONFIG.WIN_SYS_TRAY:
plexpy.win_system_tray()
# Wait endlessy for a signal to happen # Wait endlessy for a signal to happen
while True: while True:

View File

@@ -43,18 +43,18 @@
<div class="container"> <div class="container">
<div id="ajaxMsg" class="ajaxMsg"></div> <div id="ajaxMsg" class="ajaxMsg"></div>
% if _session['user_group'] == 'admin': % if _session['user_group'] == 'admin':
% if plexpy.CONFIG.CHECK_GITHUB and not plexpy.CURRENT_VERSION: % if plexpy.CONFIG.CHECK_GITHUB and plexpy.UPDATE_AVAILABLE is None:
<div id="updatebar" style="display: none;"> <div id="updatebar" style="display: none;">
You are running an unknown version of Tautulli.<br /> You are running an unknown version of Tautulli.<br />
<a href="update">Update</a> or <a href="#" id="updateDismiss">Dismiss</a> <a href="update">Update</a> or <a href="#" id="updateDismiss">Dismiss</a>
</div> </div>
% elif plexpy.CONFIG.CHECK_GITHUB and plexpy.COMMITS_BEHIND > 0 and plexpy.common.BRANCH in ('master', 'beta') and plexpy.common.RELEASE != plexpy.LATEST_RELEASE: % elif plexpy.CONFIG.CHECK_GITHUB and plexpy.UPDATE_AVAILABLE == 'release':
<div id="updatebar" style="display: none;"> <div id="updatebar" style="display: none;">
A <a href="${anon_url('https://github.com/%s/%s/releases/tag/%s' % (plexpy.CONFIG.GIT_USER, plexpy.CONFIG.GIT_REPO, plexpy.LATEST_RELEASE))}" target="_blank"> A <a href="${anon_url('https://github.com/%s/%s/releases/tag/%s' % (plexpy.CONFIG.GIT_USER, plexpy.CONFIG.GIT_REPO, plexpy.LATEST_RELEASE))}" target="_blank">
new release (${plexpy.LATEST_RELEASE})</a> of Tautulli is available!<br /> new release (${plexpy.LATEST_RELEASE})</a> of Tautulli is available!<br />
<a href="update">Update</a> or <a href="#" id="updateDismiss">Dismiss</a> <a href="update">Update</a> or <a href="#" id="updateDismiss">Dismiss</a>
</div> </div>
% elif plexpy.CONFIG.CHECK_GITHUB and plexpy.COMMITS_BEHIND > 0 and plexpy.CURRENT_VERSION != plexpy.LATEST_VERSION and plexpy.INSTALL_TYPE != 'win': % elif plexpy.CONFIG.CHECK_GITHUB and plexpy.UPDATE_AVAILABLE == 'commit':
<div id="updatebar" style="display: none;"> <div id="updatebar" style="display: none;">
A <a href="${anon_url('https://github.com/%s/%s/compare/%s...%s' % (plexpy.CONFIG.GIT_USER, plexpy.CONFIG.GIT_REPO, plexpy.CURRENT_VERSION, plexpy.LATEST_VERSION))}" target="_blank"> A <a href="${anon_url('https://github.com/%s/%s/compare/%s...%s' % (plexpy.CONFIG.GIT_USER, plexpy.CONFIG.GIT_REPO, plexpy.CURRENT_VERSION, plexpy.LATEST_VERSION))}" target="_blank">
newer version</a> of Tautulli is available!<br /> newer version</a> of Tautulli is available!<br />
@@ -75,7 +75,7 @@
<span class="icon-bar"></span> <span class="icon-bar"></span>
</button> </button>
<a class="navbar-brand" href="home" title="Tautulli"> <a class="navbar-brand" href="home" title="Tautulli">
<img src="${http_root}images/logo-tautulli-45.png" height="45" alt="PlexPy"> <img src="${http_root}images/logo-tautulli-45.png" height="45" alt="Tautulli">
</a> </a>
</div> </div>
<div class="collapse navbar-collapse navbar-right" id="navbar-collapse-1"> <div class="collapse navbar-collapse navbar-right" id="navbar-collapse-1">
@@ -140,7 +140,7 @@
<li><a href="#" data-target="#donate-modal" data-toggle="modal"><i class="fa fa-fw fa-heart"></i> Donate</a></li> <li><a href="#" data-target="#donate-modal" data-toggle="modal"><i class="fa fa-fw fa-heart"></i> Donate</a></li>
<li role="separator" class="divider"></li> <li role="separator" class="divider"></li>
% if plexpy.CONFIG.CHECK_GITHUB: % if plexpy.CONFIG.CHECK_GITHUB:
<li><a href="#" id="nav-update"><i class="fa fa-fw fa-arrow-circle-up"></i> Check for Updates</a></li> <li><a href="#" id="nav-update"><i class="fa fa-fw fa-arrow-alt-circle-up"></i> Check for Updates</a></li>
% endif % endif
<li><a href="#" id="nav-restart"><i class="fa fa-fw fa-refresh"></i> Restart</a></li> <li><a href="#" id="nav-restart"><i class="fa fa-fw fa-refresh"></i> Restart</a></li>
<li><a href="#" id="nav-shutdown"><i class="fa fa-fw fa-power-off"></i> Shutdown</a></li> <li><a href="#" id="nav-shutdown"><i class="fa fa-fw fa-power-off"></i> Shutdown</a></li>
@@ -209,7 +209,7 @@ ${next.modalIncludes()}
</div> </div>
</div> </div>
% else: % else:
<div id="donate-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="crypto-donate-modal"> <div id="donate-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="donate-modal">
<div class="modal-dialog" role="document"> <div class="modal-dialog" role="document">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
@@ -230,17 +230,13 @@ ${next.modalIncludes()}
<ul id="donation_type" class="nav nav-pills" role="tablist" style="display: flex; justify-content: center; margin: 10px 0;"> <ul id="donation_type" class="nav nav-pills" role="tablist" style="display: flex; justify-content: center; margin: 10px 0;">
<li class="active"><a href="#patreon-donation" role="tab" data-toggle="tab">Patreon</a></li> <li class="active"><a href="#patreon-donation" role="tab" data-toggle="tab">Patreon</a></li>
<li><a href="#paypal-donation" role="tab" data-toggle="tab">PayPal</a></li> <li><a href="#paypal-donation" role="tab" data-toggle="tab">PayPal</a></li>
<li><a href="#crypto-donation" role="tab" data-toggle="tab" class="crypto-donation" data-coin="bitcoin" data-name="Bitcoin" data-address="3FdfJAyNWU15Sf11U9FTgPHuP1hPz32eEN">Bitcoin</a></li>
<li><a href="#crypto-donation" role="tab" data-toggle="tab" class="crypto-donation" data-coin="bitcoincash" data-name="Bitcoin Cash" data-address="1H2atabxAQGaFAWYQEiLkXKSnK9CZZvt2n">Bitcoin Cash</a></li>
<li><a href="#crypto-donation" role="tab" data-toggle="tab" class="crypto-donation" data-coin="ethereum" data-name="Ethereum" data-address="0x77ae4c2b8de1a1ccfa93553db39971da58c873d3">Ethereum</a></li>
<li><a href="#crypto-donation" role="tab" data-toggle="tab" class="crypto-donation" data-coin="litecoin" data-name="Litecoin" data-address="LWpPmUqQYHBhMV83XSCsHzPmKLhJt6r57J">Litecoin</a></li>
</ul> </ul>
<div class="tab-content"> <div class="tab-content">
<div role="tabpanel" class="tab-pane active" id="patreon-donation" style="text-align: center"> <div role="tabpanel" class="tab-pane active" id="patreon-donation" style="text-align: center">
<p> <p>
Click the button below to continue to Patreon. Click the button below to continue to Patreon.
</p> </p>
<a href="${anon_url('https://www.patreon.com/bePatron?u=10078609')}" target="_blank"> <a href="${anon_url('https://www.patreon.com/join/tautulli')}" target="_blank">
<img src="images/become_a_patron_button.png" alt="Become a Patron" height="40"> <img src="images/become_a_patron_button.png" alt="Become a Patron" height="40">
</a> </a>
</div> </div>
@@ -252,12 +248,6 @@ ${next.modalIncludes()}
<img src="images/gold-rect-paypal-34px.png" alt="PayPal"> <img src="images/gold-rect-paypal-34px.png" alt="PayPal">
</a> </a>
</div> </div>
<div role="tabpanel" class="tab-pane" id="crypto-donation">
<label>QR Code</label>
<pre id="crypto_qr_code" style="text-align: center"></pre>
<label><span id="crypto_type_label"></span> Address</label>
<pre id="crypto_address" style="text-align: center"></pre>
</div>
</div> </div>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
@@ -293,7 +283,6 @@ ${next.modalIncludes()}
<script src="${http_root}js/pnotify.custom.min.js"></script> <script src="${http_root}js/pnotify.custom.min.js"></script>
<script src="${http_root}js/platform.min.js"></script> <script src="${http_root}js/platform.min.js"></script>
<script src="${http_root}js/script.js${cache_param}"></script> <script src="${http_root}js/script.js${cache_param}"></script>
<script src="${http_root}js/jquery.qrcode.min.js"></script>
<script src="${http_root}js/jquery.tripleclick.min.js"></script> <script src="${http_root}js/jquery.tripleclick.min.js"></script>
% if _session['user_group'] == 'admin' and BROWSER_NOTIFIERS: % if _session['user_group'] == 'admin' and BROWSER_NOTIFIERS:
<script src="${http_root}js/ajaxNotifications.js"></script> <script src="${http_root}js/ajaxNotifications.js"></script>
@@ -362,19 +351,9 @@ ${next.modalIncludes()}
$('#nav-update').click(function () { $('#nav-update').click(function () {
$(this).html('<i class="fa fa-fw fa-spin fa-refresh"></i> Checking'); $(this).html('<i class="fa fa-fw fa-spin fa-refresh"></i> Checking');
checkUpdate(function () { $('#nav-update').html('<i class="fa fa-fw fa-arrow-circle-up"></i> Check for Updates'); }); checkUpdate(function () { $('#nav-update').html('<i class="fa fa-fw fa-arrow-alt-circle-up"></i> Check for Updates'); });
}); });
$('#donation_type a.crypto-donation').on('shown.bs.tab', function () {
var crypto_coin = $(this).data('coin');
var crypto_name = $(this).data('name');
var crypto_address = $(this).data('address')
$('#crypto_qr_code').empty().qrcode({
text: crypto_coin + ":" + crypto_address
});
$('#crypto_type_label').html(crypto_name);
$('#crypto_address').html(crypto_address);
});
% endif % endif
$('.dropdown-toggle').click(function (e) { $('.dropdown-toggle').click(function (e) {

View File

@@ -22,11 +22,11 @@ DOCUMENTATION :: END
% if plexpy.CURRENT_VERSION: % if plexpy.CURRENT_VERSION:
<tr> <tr>
<td>Git Branch:</td> <td>Git Branch:</td>
<td><a class="no-highlight" href="${anon_url('https://github.com/%s/%s/tree/%s' % (plexpy.CONFIG.GIT_USER, plexpy.CONFIG.GIT_REPO, plexpy.CONFIG.GIT_BRANCH))}">${plexpy.CONFIG.GIT_BRANCH}</a></td> <td><a class="no-highlight" href="${anon_url('https://github.com/%s/%s/tree/%s' % (plexpy.CONFIG.GIT_USER, plexpy.CONFIG.GIT_REPO, plexpy.CONFIG.GIT_BRANCH))}" target="_blank">${plexpy.CONFIG.GIT_BRANCH}</a></td>
</tr> </tr>
<tr> <tr>
<td>Git Commit Hash:</td> <td>Git Commit Hash:</td>
<td><a class="no-highlight" href="${anon_url('https://github.com/%s/%s/commit/%s' % (plexpy.CONFIG.GIT_USER, plexpy.CONFIG.GIT_REPO, plexpy.CURRENT_VERSION))}">${plexpy.CURRENT_VERSION}</a></td> <td><a class="no-highlight" href="${anon_url('https://github.com/%s/%s/commit/%s' % (plexpy.CONFIG.GIT_USER, plexpy.CONFIG.GIT_REPO, plexpy.CURRENT_VERSION))}" target="_blank">${plexpy.CURRENT_VERSION}</a></td>
</tr> </tr>
% endif % endif
<tr> <tr>
@@ -71,6 +71,10 @@ DOCUMENTATION :: END
<td>Platform:</td> <td>Platform:</td>
<td>${common.PLATFORM} ${common.PLATFORM_RELEASE} (${common.PLATFORM_VERSION + (' - {}'.format(common.PLATFORM_LINUX_DISTRO) if common.PLATFORM_LINUX_DISTRO else '')})</td> <td>${common.PLATFORM} ${common.PLATFORM_RELEASE} (${common.PLATFORM_VERSION + (' - {}'.format(common.PLATFORM_LINUX_DISTRO) if common.PLATFORM_LINUX_DISTRO else '')})</td>
</tr> </tr>
<tr>
<td>System Timezone:</td>
<td>${plexpy.SYS_TIMEZONE} (${'UTC{}'.format(plexpy.SYS_UTC_OFFSET)})
</tr>
<tr> <tr>
<td>Python Version:</td> <td>Python Version:</td>
<td>${sys.version}</td> <td>${sys.version}</td>

View File

@@ -676,7 +676,9 @@ textarea.form-control:focus {
color: #F9AA03; color: #F9AA03;
margin: 5px 40px 5px 0; margin: 5px 40px 5px 0;
} }
.form-control[readonly] { .form-control[disabled],
.form-control[readonly],
fieldset[disabled] .form-control {
background-color: #555; background-color: #555;
} }
.form-control[readonly]:focus { .form-control[readonly]:focus {
@@ -2151,6 +2153,10 @@ div.advanced-setting {
li.advanced-setting { li.advanced-setting {
border-left: 1px solid #cc7b19; border-left: 1px solid #cc7b19;
} }
.docker-setting {
color: #cc7b19;
margin-left: 10px;
}
.user-info-wrapper { .user-info-wrapper {
} }
.user-info-poster-face { .user-info-poster-face {
@@ -3288,7 +3294,7 @@ pre::-webkit-scrollbar-thumb {
} }
} }
#search_form { #search_form {
width: 300px; width: 270px;
padding: 8px 15px; padding: 8px 15px;
} }
#search_form span.input-textbox { #search_form span.input-textbox {
@@ -3361,6 +3367,34 @@ pre::-webkit-scrollbar-thumb {
.notification-params tr:nth-child(even) td { .notification-params tr:nth-child(even) td {
background-color: rgba(255,255,255,0.010); background-color: rgba(255,255,255,0.010);
} }
.activity-queue {
width: 100%;
margin-top: 10px;
background-color: #282828;
}
.activity-queue th {
padding-left: 10px;
height: 30px;
}
.activity-queue th:first-child {
width: 268px;
}
.activity-queue th:nth-child(2) {
width: 125px;
}
.activity-queue th:nth-child(3) {
width: 175px;
}
.activity-queue td {
height: 25px;
padding: 5px 10px;
}
.activity-queue tr:nth-child(odd) td {
background-color: rgba(255,255,255,0.035);
}
.activity-queue tr:nth-child(even) td {
background-color: rgba(255,255,255,0.010);
}
#days-selection label, #days-selection label,
#months-selection label { #months-selection label {
margin-bottom: 0; margin-bottom: 0;
@@ -4162,4 +4196,21 @@ a[data-tab-destination] {
} }
.fa-blank { .fa-blank {
visibility: hidden; visibility: hidden;
}
#browser-warning {
height: 25px;
width: 100%;
background: #cc7b19;
text-align: center;
font-weight: bold;
padding: 2px 10px;
position: absolute;
top: 0;
z-index: 9999;
}
.help-block li {
margin-top: 0;
color: #737373;
} }

View File

@@ -80,7 +80,9 @@ DOCUMENTATION :: END
data-rating_key="${data['rating_key']}" data-parent_rating_key="${data['parent_rating_key']}" data-grandparent_rating_key="${data['grandparent_rating_key']}"> data-rating_key="${data['rating_key']}" data-parent_rating_key="${data['parent_rating_key']}" data-grandparent_rating_key="${data['grandparent_rating_key']}">
<div class="dashboard-activity-container"> <div class="dashboard-activity-container">
<% <%
if data['channel_stream'] == 0: if data['live'] == 1:
background_url = 'images/art-live.png'
elif data['channel_stream'] == 0:
background_url = 'pms_image_proxy?img=' + data['art'] + '&width=500&height=280&opacity=40&background=282828&blur=3&fallback=art&refresh=true' background_url = 'pms_image_proxy?img=' + data['art'] + '&width=500&height=280&opacity=40&background=282828&blur=3&fallback=art&refresh=true'
else: else:
if (data['art'] and data['art'].startswith('http')) or (data['thumb'] and data['thumb'].startswith('http')): if (data['art'] and data['art'].startswith('http')) or (data['thumb'] and data['thumb'].startswith('http')):
@@ -93,7 +95,9 @@ DOCUMENTATION :: END
% if data['media_type'] == 'track': % if data['media_type'] == 'track':
<div id="poster-${sk}-bg" class="dashboard-activity-poster" style="background-image: url(pms_image_proxy?img=${data['parent_thumb']}&width=300&height=300&opacity=60&background=282828&blur=3&fallback=cover&refresh=true);"></div> <div id="poster-${sk}-bg" class="dashboard-activity-poster" style="background-image: url(pms_image_proxy?img=${data['parent_thumb']}&width=300&height=300&opacity=60&background=282828&blur=3&fallback=cover&refresh=true);"></div>
% endif % endif
% if data['channel_stream'] == 0: % if data['live'] == 1:
<div id="poster-${sk}" class="dashboard-activity-poster" style="background-image: url(images/poster-live.png);"></div>
% elif data['channel_stream'] == 0:
% if data['media_type'] == 'movie': % if data['media_type'] == 'movie':
<a id="poster-url-${sk}" href="${href}" title="${data['title']}"> <a id="poster-url-${sk}" href="${href}" title="${data['title']}">
<div id="poster-${sk}" class="dashboard-activity-poster" style="background-image: url(pms_image_proxy?img=${data['thumb']}&width=300&height=450&fallback=poster&refresh=true);"></div> <div id="poster-${sk}" class="dashboard-activity-poster" style="background-image: url(pms_image_proxy?img=${data['thumb']}&width=300&height=450&fallback=poster&refresh=true);"></div>
@@ -113,7 +117,7 @@ DOCUMENTATION :: END
<div id="poster-${sk}" class="dashboard-activity-poster" style="background-image: url(pms_image_proxy?img=${data['parent_thumb'] or data['thumb']}&width=300&height=450&fallback=poster&refresh=true);"></div> <div id="poster-${sk}" class="dashboard-activity-poster" style="background-image: url(pms_image_proxy?img=${data['parent_thumb'] or data['thumb']}&width=300&height=450&fallback=poster&refresh=true);"></div>
% endif % endif
% else: % else:
<div id="poster-${sk}" class="dashboard-activity-poster" style="background-image: url(images/art.png);"></div> <div id="poster-${sk}" class="dashboard-activity-poster" style="background-image: url(images/poster.png);"></div>
% endif % endif
% else: % else:
% if data['channel_icon'].startswith('http'): % if data['channel_icon'].startswith('http'):
@@ -279,10 +283,17 @@ DOCUMENTATION :: END
<li class="dashboard-activity-info-item"> <li class="dashboard-activity-info-item">
<div class="sub-heading">Location</div> <div class="sub-heading">Location</div>
<div class="sub-value time-right"> <div class="sub-value time-right">
% if data['secure'] is not None:
% if data['secure']:
<span data-toggle="tooltip" title="Secure Connection"><i class="fa fa-lock"></i></span>
% else:
<span data-toggle="tooltip" title="Insecure Connection"><i class="fa fa-unlock"></i></span>
% endif
% endif
<span id="location-${sk}">${data['location'].upper()}</span>: <span id="location-${sk}">${data['location'].upper()}</span>:
% if data['ip_address'] != 'N/A': % if data['ip_address'] != 'N/A':
<span class="ip-container"><span class="ip-address">${data['ip_address']}</span></span> <span class="ip-container"><span class="ip-address">${data['ip_address']}</span></span>
% if data['relay']: % if data['relayed']:
<span data-toggle="tooltip" title="Plex Relay"><i class="fa fa-exclamation-circle"></i></span> <span data-toggle="tooltip" title="Plex Relay"><i class="fa fa-exclamation-circle"></i></span>
% else: % else:
<a href="#" class="external_ip-modal" data-toggle="modal" data-target="#ip-info-modal" data-ip="${data['ip_address']}"> <a href="#" class="external_ip-modal" data-toggle="modal" data-target="#ip-info-modal" data-ip="${data['ip_address']}">
@@ -313,7 +324,7 @@ DOCUMENTATION :: END
bw = str(bw) + ' kbps' bw = str(bw) + ' kbps'
%> %>
<span id="stream-bandwidth-${sk}">${bw}</span> <span id="stream-bandwidth-${sk}">${bw}</span>
<span id="streaming-brain-${sk}" data-toggle="tooltip" title="Streaming Brain Estimate (Required Bandwidth)"><i class="fa fa-info-circle"></i></span> <span id="streaming-brain-${sk}" data-toggle="tooltip" title="Streaming Brain Estimate (Reserved Bandwidth)"><i class="fa fa-info-circle"></i></span>
% elif data['synced_version'] == 1 or data['channel_stream'] == 1: % elif data['synced_version'] == 1 or data['channel_stream'] == 1:
<span id="stream-bandwidth-${sk}">None</span> <span id="stream-bandwidth-${sk}">None</span>
% else: % else:

View File

@@ -21,6 +21,7 @@ parent_count Returns the parent item count for the library.
child_count Returns the child item count for the library. child_count Returns the child item count for the library.
do_notify Returns bool value for whether to send notifications for the library. do_notify Returns bool value for whether to send notifications for the library.
keep_history Returns bool value for whether to keep history for the library. keep_history Returns bool value for whether to keep history for the library.
deleted_section Returns bool value for whether the library is marked as deleted.
DOCUMENTATION :: END DOCUMENTATION :: END
</%doc> </%doc>
@@ -59,6 +60,12 @@ DOCUMENTATION :: END
<p class="help-block">DANGER ZONE! Click the purge button to remove all history logged for this library. This is permanent!</p> <p class="help-block">DANGER ZONE! Click the purge button to remove all history logged for this library. This is permanent!</p>
</div> </div>
% endif % endif
% if data['deleted_section']:
<div class="form-group">
<button class="btn btn-bright" id="undelete-library">Undelete</button>
<p class="help-block">Click to re-add the library to the Tautulli libraries list.</p>
</div>
% endif
</fieldset> </fieldset>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
@@ -100,6 +107,12 @@ DOCUMENTATION :: END
confirmAjaxCall(url, msg, { section_id: '${data["section_id"]}' }, null, function () { location.reload(); }); confirmAjaxCall(url, msg, { section_id: '${data["section_id"]}' }, null, function () { location.reload(); });
}); });
$('#undelete-library').click(function () {
var msg = 'Are you sure you want to undelete this user?';
var url = 'undelete_library';
confirmAjaxCall(url, msg, { section_id: '${data["section_id"]}' }, null, function () { location.reload(); });
});
$(document).ready(function() { $(document).ready(function() {
// Move #confirm-modal to parent container // Move #confirm-modal to parent container
if (!($('#edit-library-modal').next().is('#confirm-modal-purge'))) { if (!($('#edit-library-modal').next().is('#confirm-modal-purge'))) {

View File

@@ -21,6 +21,7 @@ is_restricted Returns bool value for whether the user account is restricte
do_notify Returns bool value for whether to send notifications for the user. do_notify Returns bool value for whether to send notifications for the user.
keep_history Returns bool value for whether to keep history for the user. keep_history Returns bool value for whether to keep history for the user.
allow_guest Returns bool value for whether to allow guest access for the user. allow_guest Returns bool value for whether to allow guest access for the user.
deleted_user Returns bool value for whether the user is marked as deleted.
DOCUMENTATION :: END DOCUMENTATION :: END
</%doc> </%doc>
@@ -74,6 +75,12 @@ DOCUMENTATION :: END
<p class="help-block">DANGER ZONE! Click the purge button to remove all history logged for this user. This is permanent!</p> <p class="help-block">DANGER ZONE! Click the purge button to remove all history logged for this user. This is permanent!</p>
</div> </div>
% endif % endif
% if data['deleted_user']:
<div class="form-group">
<button class="btn btn-bright" id="undelete-user">Undelete</button>
<p class="help-block">Click to re-add the user to the Tautulli users list.</p>
</div>
% endif
</fieldset> </fieldset>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
@@ -122,6 +129,12 @@ DOCUMENTATION :: END
confirmAjaxCall(url, msg, { user_id: '${data["user_id"]}' }, null, function () { location.reload(); }); confirmAjaxCall(url, msg, { user_id: '${data["user_id"]}' }, null, function () { location.reload(); });
}); });
$('#undelete-user').click(function () {
var msg = 'Are you sure you want to undelete this user?';
var url = 'undelete_user';
confirmAjaxCall(url, msg, { user_id: '${data["user_id"]}' }, null, function () { location.reload(); });
});
$(document).ready(function() { $(document).ready(function() {
// Move #confirm-modal-purge to parent container // Move #confirm-modal-purge to parent container
if (!($('#edit-user-modal').next().is('#confirm-modal-purge'))) { if (!($('#edit-user-modal').next().is('#confirm-modal-purge'))) {

View File

@@ -21,137 +21,109 @@
</label> </label>
</div> </div>
<div class="btn-group" style="margin-right: 2px;" data-toggle="buttons" id="yaxis-selection"> <div class="btn-group" style="margin-right: 2px;" data-toggle="buttons" id="yaxis-selection">
% if config['graph_type'] == 'duration':
<label class="btn btn-dark"> <label class="btn btn-dark">
<input type="radio" name="yaxis-options" id="yaxis-count" value="plays" autocomplete="off"> Play Count <input type="radio" name="yaxis-options" id="yaxis-plays" value="plays" autocomplete="off"> Play Count
</label>
<label class="btn btn-dark active">
<input type="radio" name="yaxis-options" id="yaxis-duration" value="duration" autocomplete="off" checked> Play Duration
</label>
% else:
<label class="btn btn-dark active">
<input type="radio" name="yaxis-options" id="yaxis-count" value="plays" autocomplete="off" checked> Play Count
</label> </label>
<label class="btn btn-dark"> <label class="btn btn-dark">
<input type="radio" name="yaxis-options" id="yaxis-duration" value="duration" autocomplete="off"> Play Duration <input type="radio" name="yaxis-options" id="yaxis-duration" value="duration" autocomplete="off"> Play Duration
</label> </label>
% endif
</div> </div>
<div class="input-group pull-right" style="width: 1px;" id="days-selection"> <div class="input-group pull-right" style="width: 1px;" id="days-selection">
<span class="input-group-addon btn-dark inactive">Last</span> <span class="input-group-addon btn-dark inactive">Last</span>
<input type="number" class="form-control number-input" name="graph-days" id="graph-days" value="${config['graph_days']}" min="1" data-default="7" data-toggle="tooltip" title="Min: 1 day" /> <input type="number" class="form-control number-input" name="graph-days" id="graph-days" value="30" min="1" data-default="7" data-toggle="tooltip" title="Min: 1 day" />
<span class="input-group-addon btn-dark inactive">days</span> <span class="input-group-addon btn-dark inactive">days</span>
</div> </div>
<div class="input-group pull-right" style="width: 1px;" id="months-selection"> <div class="input-group pull-right" style="width: 1px;" id="months-selection">
<span class="input-group-addon btn-dark inactive">Last</span> <span class="input-group-addon btn-dark inactive">Last</span>
<input type="number" class="form-control number-input" name="graph-months" id="graph-months" value="${config['graph_months']}" min="1" data-default="12" data-toggle="tooltip" title="Min: 1 month" /> <input type="number" class="form-control number-input" name="graph-months" id="graph-months" value="12" min="1" data-default="12" data-toggle="tooltip" title="Min: 1 month" />
<span class="input-group-addon btn-dark inactive">months</span> <span class="input-group-addon btn-dark inactive">months</span>
</div> </div>
</div> </div>
</div> </div>
<div class='table-card-back'> <div class='table-card-back'>
<ul class="nav nav-pills" role="tablist" id="graph-tabs"> <ul class="nav nav-pills" role="tablist" id="graph-tabs">
% if config['graph_tab'] == 'tabs-3': <li role="presentation"><a href="#tabs-1" aria-controls="tabs-1" data-toggle="tab" role="tab">Plays by Period</a></li>
<li role="presentation"><a href="#tabs-1" aria-controls="tabs-1" data-toggle="tab" role="tab">Plays by period</a></li>
<li role="presentation"><a href="#tabs-2" aria-controls="tabs-2" data-toggle="tab" role="tab">Stream Info</a></li>
<li role="presentation" class="active"><a href="#tabs-3" aria-controls="tabs-3" data-toggle="tab" role="tab">Play Totals</a></li>
% elif config['graph_tab'] == 'tabs-2':
<li role="presentation"><a href="#tabs-1" aria-controls="tabs-1" data-toggle="tab" role="tab">Plays by period</a></li>
<li role="presentation" class="active"><a href="#tabs-2" aria-controls="tabs-2" data-toggle="tab" role="tab">Stream Info</a></li>
<li role="presentation"><a href="#tabs-3" aria-controls="tabs-3" data-toggle="tab" role="tab">Play Totals</a></li>
% else:
<li role="presentation" class="active"><a href="#tabs-1" aria-controls="tabs-1" data-toggle="tab" role="tab">Plays by period</a></li>
<li role="presentation"><a href="#tabs-2" aria-controls="tabs-2" data-toggle="tab" role="tab">Stream Info</a></li> <li role="presentation"><a href="#tabs-2" aria-controls="tabs-2" data-toggle="tab" role="tab">Stream Info</a></li>
<li role="presentation"><a href="#tabs-3" aria-controls="tabs-3" data-toggle="tab" role="tab">Play Totals</a></li> <li role="presentation"><a href="#tabs-3" aria-controls="tabs-3" data-toggle="tab" role="tab">Play Totals</a></li>
% endif
</ul> </ul>
<div class="tab-content"> <div class="tab-content">
% if config['graph_tab'] != 'tabs-2' and config['graph_tab'] != 'tabs-3':
<div role="tabpanel" class="tab-pane active" id="tabs-1">
% else:
<div role="tabpanel" class="tab-pane" id="tabs-1"> <div role="tabpanel" class="tab-pane" id="tabs-1">
% endif <div class="row">
<div class="row"> <div class="col-md-12">
<div class="col-md-12"> <h4><i class="fa fa-history"></i> Daily <span class="yaxis-text">Play count</span> <small>Last <span class="days">30</span> days</small></h4>
<h4><i class="fa fa-history"></i> Daily <span class="yaxis-text">Play count</span> <small>Last <span class="days">30</span> days</small></h4> <p class="help-block">
<p class="help-block"> The total play count or duration of tv, movies, and music played per day. Click a graph point to open up a list of items played for that specific date.
The total play count or duration of tv, movies, and music played per day. Click a graph point to open up a list of items played for that specific date. </p>
</p> <div class="graphs-instance">
<div class="graphs-instance"> <div class="watch-chart" id="graph_plays_by_day">
<div class="watch-chart" id="chart_div_plays_by_day"> <div class="graphs-load"><i class="fa fa-refresh fa-spin"></i> Loading chart...</div>
<div class="graphs-load"><i class="fa fa-refresh fa-spin"></i> Loading chart...</div> <br>
<br>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<h4><i class="fa fa-calendar"></i> <span class="yaxis-text">Play count</span> by day of week <small>Last <span class="days">30</span> days</small></h4>
<p class="help-block">
The combined total of tv, movies, and music played per day of the week.
</p>
<div class="graphs-instance">
<div class="watch-chart" id="chart_div_plays_by_dayofweek" style="float: left;">
<div class="graphs-load">
<i class="fa fa-refresh fa-spin"></i> Loading chart...
</div>
<br>
</div>
</div>
</div>
<div class="col-md-6">
<h4><i class="fa fa-clock-o"></i> <span class="yaxis-text">Play count</span> by hour of day <small>Last <span class="days">30</span> days</small></h4>
<p class="help-block">
The combined total of tv, movies, and music played per hour of the day.
</p>
<div class="graphs-instance">
<div class="watch-chart" id="chart_div_plays_by_hourofday">
<div class="graphs-load">
<i class="fa fa-refresh fa-spin"></i> Loading chart...
</div>
<br>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<h4><i class="fa fa-television"></i> <span class="yaxis-text">Play count</span> by top 10 platforms <small>Last <span class="days">30</span> days</small></h4>
<p class="help-block">
The combined total of tv, movies, and music played by top 10 most active platforms.
</p>
<div class="graphs-instance">
<div class="watch-chart" id="chart_div_plays_by_platform" style="float: left;">
<div class="graphs-load">
<i class="fa fa-refresh fa-spin"></i> Loading chart...
</div>
<br>
</div>
</div>
</div>
<div class="col-md-6">
<h4><i class="fa fa-user"></i> <span class="yaxis-text">Play count</span> by top 10 users <small>Last <span class="days">30</span> days</small></h4>
<p class="help-block">
The combined total of tv, movies, and music played by top 10 most active users.
</p>
<div class="graphs-instance">
<div class="watch-chart" id="chart_div_plays_by_user">
<div class="graphs-load">
<i class="fa fa-refresh fa-spin"></i> Loading chart...
</div>
<br>
</div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="row">
% if config['graph_tab'] == 'tabs-2': <div class="col-md-6">
<div role="tabpanel" class="tab-pane active" id="tabs-2"> <h4><i class="fa fa-calendar"></i> <span class="yaxis-text">Play count</span> by day of week <small>Last <span class="days">30</span> days</small></h4>
% else: <p class="help-block">
The combined total of tv, movies, and music played per day of the week.
</p>
<div class="graphs-instance">
<div class="watch-chart" id="graph_plays_by_dayofweek" style="float: left;">
<div class="graphs-load">
<i class="fa fa-refresh fa-spin"></i> Loading chart...
</div>
<br>
</div>
</div>
</div>
<div class="col-md-6">
<h4><i class="fa fa-clock-o"></i> <span class="yaxis-text">Play count</span> by hour of day <small>Last <span class="days">30</span> days</small></h4>
<p class="help-block">
The combined total of tv, movies, and music played per hour of the day.
</p>
<div class="graphs-instance">
<div class="watch-chart" id="graph_plays_by_hourofday">
<div class="graphs-load">
<i class="fa fa-refresh fa-spin"></i> Loading chart...
</div>
<br>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<h4><i class="fa fa-television"></i> <span class="yaxis-text">Play count</span> by top 10 platforms <small>Last <span class="days">30</span> days</small></h4>
<p class="help-block">
The combined total of tv, movies, and music played by top 10 most active platforms.
</p>
<div class="graphs-instance">
<div class="watch-chart" id="graph_plays_by_platform" style="float: left;">
<div class="graphs-load">
<i class="fa fa-refresh fa-spin"></i> Loading chart...
</div>
<br>
</div>
</div>
</div>
<div class="col-md-6">
<h4><i class="fa fa-user"></i> <span class="yaxis-text">Play count</span> by top 10 users <small>Last <span class="days">30</span> days</small></h4>
<p class="help-block">
The combined total of tv, movies, and music played by top 10 most active users.
</p>
<div class="graphs-instance">
<div class="watch-chart" id="graph_plays_by_user">
<div class="graphs-load">
<i class="fa fa-refresh fa-spin"></i> Loading chart...
</div>
<br>
</div>
</div>
</div>
</div>
</div>
<div role="tabpanel" class="tab-pane" id="tabs-2"> <div role="tabpanel" class="tab-pane" id="tabs-2">
% endif
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<h4><i class="fa fa-video-camera"></i> Daily Stream type breakdown <small>Last <span class="days">30</span> days</small></h4> <h4><i class="fa fa-video-camera"></i> Daily Stream type breakdown <small>Last <span class="days">30</span> days</small></h4>
@@ -159,7 +131,7 @@
The total play count or duration of tv, movies, and music by the transcode decision. Click a graph point to open up a list of items played for that specific date. The total play count or duration of tv, movies, and music by the transcode decision. Click a graph point to open up a list of items played for that specific date.
</p> </p>
<div class="graphs-instance"> <div class="graphs-instance">
<div class="watch-chart" id="chart_div_plays_by_stream_type"> <div class="watch-chart" id="graph_plays_by_stream_type">
<div class="graphs-load"><i class="fa fa-refresh fa-spin"></i> Loading chart...</div> <div class="graphs-load"><i class="fa fa-refresh fa-spin"></i> Loading chart...</div>
<br> <br>
</div> </div>
@@ -173,7 +145,7 @@
The combined total of tv and movies by their original resolution (pre-transcoding). The combined total of tv and movies by their original resolution (pre-transcoding).
</p> </p>
<div class="graphs-instance"> <div class="graphs-instance">
<div class="watch-chart" id="chart_div_plays_by_source_resolution" style="float: left;"> <div class="watch-chart" id="graph_plays_by_source_resolution" style="float: left;">
<div class="graphs-load"><i class="fa fa-refresh fa-spin"></i> Loading chart... <div class="graphs-load"><i class="fa fa-refresh fa-spin"></i> Loading chart...
</div> </div>
<br> <br>
@@ -186,7 +158,7 @@
The combined total of tv and movies by their streamed resolution (post-transcoding). The combined total of tv and movies by their streamed resolution (post-transcoding).
</p> </p>
<div class="graphs-instance"> <div class="graphs-instance">
<div class="watch-chart" id="chart_div_plays_by_stream_resolution"> <div class="watch-chart" id="graph_plays_by_stream_resolution">
<div class="graphs-load"><i class="fa fa-refresh fa-spin"></i> Loading chart... <div class="graphs-load"><i class="fa fa-refresh fa-spin"></i> Loading chart...
</div> </div>
<br> <br>
@@ -201,7 +173,7 @@
The combined total of tv, movies, and music by platform and stream type. The combined total of tv, movies, and music by platform and stream type.
</p> </p>
<div class="graphs-instance"> <div class="graphs-instance">
<div class="watch-chart" id="chart_div_plays_by_platform_by_stream_type" style="float: left;"> <div class="watch-chart" id="graph_plays_by_platform_by_stream_type" style="float: left;">
<div class="graphs-load"><i class="fa fa-refresh fa-spin"></i> Loading chart... <div class="graphs-load"><i class="fa fa-refresh fa-spin"></i> Loading chart...
</div> </div>
<br> <br>
@@ -214,7 +186,7 @@
The combined total of tv, movies, and music by user and stream type. The combined total of tv, movies, and music by user and stream type.
</p> </p>
<div class="graphs-instance"> <div class="graphs-instance">
<div class="watch-chart" id="chart_div_plays_by_user_by_stream_type" style="float: left;"> <div class="watch-chart" id="graph_plays_by_user_by_stream_type" style="float: left;">
<div class="graphs-load"><i class="fa fa-refresh fa-spin"></i> Loading chart... <div class="graphs-load"><i class="fa fa-refresh fa-spin"></i> Loading chart...
</div> </div>
<br> <br>
@@ -223,12 +195,7 @@
</div> </div>
</div> </div>
</div> </div>
% if config['graph_tab'] == 'tabs-3':
<div role="tabpanel" class="tab-pane active" id="tabs-3">
% else:
<div role="tabpanel" class="tab-pane" id="tabs-3"> <div role="tabpanel" class="tab-pane" id="tabs-3">
% endif
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<h4><i class="fa fa-calendar"></i> Plays by month <small>Last <span class="months">12</span> months</small></h4> <h4><i class="fa fa-calendar"></i> Plays by month <small>Last <span class="months">12</span> months</small></h4>
@@ -236,7 +203,7 @@
The combined total of tv, movies, and music by month. The combined total of tv, movies, and music by month.
</p> </p>
<div class="graphs-instance"> <div class="graphs-instance">
<div class="watch-chart" id="chart_div_plays_by_month"> <div class="watch-chart" id="graph_plays_by_month">
<div class="graphs-load"><i class="fa fa-refresh fa-spin"></i> Loading chart... <div class="graphs-load"><i class="fa fa-refresh fa-spin"></i> Loading chart...
</div> </div>
<br> <br>
@@ -266,7 +233,7 @@
<script src="${http_root}js/dataTables.bootstrap.pagination.js"></script> <script src="${http_root}js/dataTables.bootstrap.pagination.js"></script>
<script> <script>
var selected_user_id = null var selected_user_id = null;
// Modal popup dialog // Modal popup dialog
function selectHandler(selectedDate, selectedSeries) { function selectHandler(selectedDate, selectedSeries) {
@@ -311,27 +278,61 @@
console.log("Failed to retrieve history modal data."); console.log("Failed to retrieve history modal data.");
} }
} }
function getGraphVisibility(chart_name, data_series) {
var chart_key = 'HighCharts_' + chart_name;
var chart_visibility = JSON.parse(getLocalStorage(chart_key, null)) || [];
chart_visibility = chart_visibility.reduce(function(obj, s) {
obj[s.name] = s.visible;
return obj;
}, {});
return data_series.map(function(s) {
var obj = Object.assign({}, s);
obj.visible = (chart_visibility[s.name] !== false);
return obj
});
}
function setGraphVisibility(chart_name, data_series, series_name) {
var chart_key = 'HighCharts_' + chart_name;
var chart_visibility = data_series.map(function(s) {
return {name: s.name, visible: (s.name === series_name) ? !s.visible : s.visible}
});
setLocalStorage(chart_key, JSON.stringify(chart_visibility));
}
</script> </script>
<script src="${http_root}js/graphs/plays_by_day.js"></script> <script src="${http_root}js/graphs/plays_by_day.js${cache_param}"></script>
<script src="${http_root}js/graphs/plays_by_dayofweek.js"></script> <script src="${http_root}js/graphs/plays_by_dayofweek.js${cache_param}"></script>
<script src="${http_root}js/graphs/plays_by_hourofday.js"></script> <script src="${http_root}js/graphs/plays_by_hourofday.js${cache_param}"></script>
<script src="${http_root}js/graphs/plays_by_platform.js"></script> <script src="${http_root}js/graphs/plays_by_platform.js${cache_param}"></script>
<script src="${http_root}js/graphs/plays_by_user.js"></script> <script src="${http_root}js/graphs/plays_by_user.js${cache_param}"></script>
<script src="${http_root}js/graphs/plays_by_stream_type.js"></script> <script src="${http_root}js/graphs/plays_by_stream_type.js${cache_param}"></script>
<script src="${http_root}js/graphs/plays_by_source_resolution.js"></script> <script src="${http_root}js/graphs/plays_by_source_resolution.js${cache_param}"></script>
<script src="${http_root}js/graphs/plays_by_stream_resolution.js"></script> <script src="${http_root}js/graphs/plays_by_stream_resolution.js${cache_param}"></script>
<script src="${http_root}js/graphs/plays_by_platform_by_stream_type.js"></script> <script src="${http_root}js/graphs/plays_by_platform_by_stream_type.js${cache_param}"></script>
<script src="${http_root}js/graphs/plays_by_user_by_stream_type.js"></script> <script src="${http_root}js/graphs/plays_by_user_by_stream_type.js${cache_param}"></script>
<script src="${http_root}js/graphs/plays_by_month.js"></script> <script src="${http_root}js/graphs/plays_by_month.js${cache_param}"></script>
<script> <script>
$(document).ready(function () { $(document).ready(function () {
// Initial values for graph from config // Initial values for graph from local storage
var yaxis = "${config['graph_type']}"; var yaxis = getLocalStorage('graph_type', 'plays');
var current_day_range = ${config['graph_days']}; var current_day_range = getLocalStorage('graph_days', 30);
var current_month_range = ${config['graph_months']}; var current_month_range = getLocalStorage('graph_months', 12);
var current_tab = "${'#' + config['graph_tab']}"; var current_tab = '#' + getLocalStorage('graph_tab', 'tabs-1');
$('#yaxis-' + yaxis).prop('checked', true);
$('#yaxis-' + yaxis).closest('label').addClass('active');
$('#graph-days').val(current_day_range);
$('#graph-months').val(current_month_range);
$('#graph-tabs a[href="' + current_tab + '"]').closest('li').addClass('active');
$(current_tab).addClass('active');
$('.days').html(current_day_range); $('.days').html(current_day_range);
$('.months').html(current_month_range); $('.months').html(current_month_range);
@@ -352,9 +353,6 @@
} }
}); });
var music_visible = (${config['music_logging_enable']} == 1 ? true : false);
function dataSecondsToHours(data) { function dataSecondsToHours(data) {
$.each(data.series, function (i, series) { $.each(data.series, function (i, series) {
series.data = $.map(series.data, function (value) { series.data = $.map(series.data, function (value) {
@@ -379,8 +377,8 @@
$.each(data.categories, function (i, day) { $.each(data.categories, function (i, day) {
dateArray.push(moment(day, 'YYYY-MM-DD').valueOf()); dateArray.push(moment(day, 'YYYY-MM-DD').valueOf());
// Highlight the weekend // Highlight the weekend
if ((moment(day, 'YYYY-MM-DD').format('ddd') == 'Sat') || if ((moment(day, 'YYYY-MM-DD').format('ddd') === 'Sat') ||
(moment(day, 'YYYY-MM-DD').format('ddd') == 'Sun')) { (moment(day, 'YYYY-MM-DD').format('ddd') === 'Sun')) {
hc_plays_by_day_options.xAxis.plotBands.push({ hc_plays_by_day_options.xAxis.plotBands.push({
from: i-0.5, from: i-0.5,
to: i+0.5, to: i+0.5,
@@ -391,8 +389,7 @@
if (yaxis === 'duration') { dataSecondsToHours(data); } if (yaxis === 'duration') { dataSecondsToHours(data); }
hc_plays_by_day_options.yAxis.min = 0; hc_plays_by_day_options.yAxis.min = 0;
hc_plays_by_day_options.xAxis.categories = dateArray; hc_plays_by_day_options.xAxis.categories = dateArray;
hc_plays_by_day_options.series = data.series; hc_plays_by_day_options.series = getGraphVisibility(hc_plays_by_day_options.chart.renderTo, data.series);
hc_plays_by_day_options.series[2].visible = music_visible;
var hc_plays_by_day = new Highcharts.Chart(hc_plays_by_day_options); var hc_plays_by_day = new Highcharts.Chart(hc_plays_by_day_options);
} }
}); });
@@ -405,8 +402,7 @@
success: function(data) { success: function(data) {
if (yaxis === 'duration') { dataSecondsToHours(data); } if (yaxis === 'duration') { dataSecondsToHours(data); }
hc_plays_by_dayofweek_options.xAxis.categories = data.categories; hc_plays_by_dayofweek_options.xAxis.categories = data.categories;
hc_plays_by_dayofweek_options.series = data.series; hc_plays_by_dayofweek_options.series = getGraphVisibility(hc_plays_by_dayofweek_options.chart.renderTo, data.series);
hc_plays_by_dayofweek_options.series[2].visible = music_visible;
var hc_plays_by_dayofweek = new Highcharts.Chart(hc_plays_by_dayofweek_options); var hc_plays_by_dayofweek = new Highcharts.Chart(hc_plays_by_dayofweek_options);
} }
}); });
@@ -419,8 +415,7 @@
success: function(data) { success: function(data) {
if (yaxis === 'duration') { dataSecondsToHours(data); } if (yaxis === 'duration') { dataSecondsToHours(data); }
hc_plays_by_hourofday_options.xAxis.categories = data.categories; hc_plays_by_hourofday_options.xAxis.categories = data.categories;
hc_plays_by_hourofday_options.series = data.series; hc_plays_by_hourofday_options.series = getGraphVisibility(hc_plays_by_hourofday_options.chart.renderTo, data.series);
hc_plays_by_hourofday_options.series[2].visible = music_visible;
var hc_plays_by_hourofday = new Highcharts.Chart(hc_plays_by_hourofday_options); var hc_plays_by_hourofday = new Highcharts.Chart(hc_plays_by_hourofday_options);
} }
}); });
@@ -433,8 +428,7 @@
success: function(data) { success: function(data) {
if (yaxis === 'duration') { dataSecondsToHours(data); } if (yaxis === 'duration') { dataSecondsToHours(data); }
hc_plays_by_platform_options.xAxis.categories = data.categories; hc_plays_by_platform_options.xAxis.categories = data.categories;
hc_plays_by_platform_options.series = data.series; hc_plays_by_platform_options.series = getGraphVisibility(hc_plays_by_platform_options.chart.renderTo, data.series);
hc_plays_by_platform_options.series[2].visible = music_visible;
var hc_plays_by_platform = new Highcharts.Chart(hc_plays_by_platform_options); var hc_plays_by_platform = new Highcharts.Chart(hc_plays_by_platform_options);
} }
}); });
@@ -447,11 +441,12 @@
success: function(data) { success: function(data) {
if (yaxis === 'duration') { dataSecondsToHours(data); } if (yaxis === 'duration') { dataSecondsToHours(data); }
hc_plays_by_user_options.xAxis.categories = data.categories; hc_plays_by_user_options.xAxis.categories = data.categories;
hc_plays_by_user_options.series = data.series; hc_plays_by_user_options.series = getGraphVisibility(hc_plays_by_user_options.chart.renderTo, data.series);
hc_plays_by_user_options.series[2].visible = music_visible;
var hc_plays_by_user = new Highcharts.Chart(hc_plays_by_user_options); var hc_plays_by_user = new Highcharts.Chart(hc_plays_by_user_options);
} }
}); });
$('#graph-tabs a[href="#tabs-1"]').tab('show')
} }
function loadGraphsTab2(time_range, yaxis) { function loadGraphsTab2(time_range, yaxis) {
@@ -482,7 +477,7 @@
if (yaxis === 'duration') { dataSecondsToHours(data); } if (yaxis === 'duration') { dataSecondsToHours(data); }
hc_plays_by_stream_type_options.yAxis.min = 0; hc_plays_by_stream_type_options.yAxis.min = 0;
hc_plays_by_stream_type_options.xAxis.categories = dateArray; hc_plays_by_stream_type_options.xAxis.categories = dateArray;
hc_plays_by_stream_type_options.series = data.series; hc_plays_by_stream_type_options.series = getGraphVisibility(hc_plays_by_stream_type_options.chart.renderTo, data.series);
var hc_plays_by_stream_type = new Highcharts.Chart(hc_plays_by_stream_type_options); var hc_plays_by_stream_type = new Highcharts.Chart(hc_plays_by_stream_type_options);
} }
}); });
@@ -495,7 +490,7 @@
success: function(data) { success: function(data) {
if (yaxis === 'duration') { dataSecondsToHours(data); } if (yaxis === 'duration') { dataSecondsToHours(data); }
hc_plays_by_source_resolution_options.xAxis.categories = data.categories; hc_plays_by_source_resolution_options.xAxis.categories = data.categories;
hc_plays_by_source_resolution_options.series = data.series; hc_plays_by_source_resolution_options.series = getGraphVisibility(hc_plays_by_source_resolution_options.chart.renderTo, data.series);
var hc_plays_by_source_resolution = new Highcharts.Chart(hc_plays_by_source_resolution_options); var hc_plays_by_source_resolution = new Highcharts.Chart(hc_plays_by_source_resolution_options);
} }
}); });
@@ -508,7 +503,7 @@
success: function(data) { success: function(data) {
if (yaxis === 'duration') { dataSecondsToHours(data); } if (yaxis === 'duration') { dataSecondsToHours(data); }
hc_plays_by_stream_resolution_options.xAxis.categories = data.categories; hc_plays_by_stream_resolution_options.xAxis.categories = data.categories;
hc_plays_by_stream_resolution_options.series = data.series; hc_plays_by_stream_resolution_options.series = getGraphVisibility(hc_plays_by_stream_resolution_options.chart.renderTo, data.series);
var hc_plays_by_stream_resolution = new Highcharts.Chart(hc_plays_by_stream_resolution_options); var hc_plays_by_stream_resolution = new Highcharts.Chart(hc_plays_by_stream_resolution_options);
} }
}); });
@@ -521,7 +516,7 @@
success: function(data) { success: function(data) {
if (yaxis === 'duration') { dataSecondsToHours(data); } if (yaxis === 'duration') { dataSecondsToHours(data); }
hc_plays_by_platform_by_stream_type_options.xAxis.categories = data.categories; hc_plays_by_platform_by_stream_type_options.xAxis.categories = data.categories;
hc_plays_by_platform_by_stream_type_options.series = data.series; hc_plays_by_platform_by_stream_type_options.series = getGraphVisibility(hc_plays_by_platform_by_stream_type_options.chart.renderTo, data.series);
var hc_plays_by_platform_by_stream_type = new Highcharts.Chart(hc_plays_by_platform_by_stream_type_options); var hc_plays_by_platform_by_stream_type = new Highcharts.Chart(hc_plays_by_platform_by_stream_type_options);
} }
}); });
@@ -534,10 +529,12 @@
success: function(data) { success: function(data) {
if (yaxis === 'duration') { dataSecondsToHours(data); } if (yaxis === 'duration') { dataSecondsToHours(data); }
hc_plays_by_user_by_stream_type_options.xAxis.categories = data.categories; hc_plays_by_user_by_stream_type_options.xAxis.categories = data.categories;
hc_plays_by_user_by_stream_type_options.series = data.series; hc_plays_by_user_by_stream_type_options.series = getGraphVisibility(hc_plays_by_user_by_stream_type_options.chart.renderTo, data.series);
var hc_plays_by_user_by_stream_type = new Highcharts.Chart(hc_plays_by_user_by_stream_type_options); var hc_plays_by_user_by_stream_type = new Highcharts.Chart(hc_plays_by_user_by_stream_type_options);
} }
}); });
$('#graph-tabs a[href="#tabs-2"]').tab('show')
} }
function loadGraphsTab3(time_range, yaxis) { function loadGraphsTab3(time_range, yaxis) {
@@ -555,51 +552,52 @@
if (yaxis === 'duration') { dataSecondsToHours(data); } if (yaxis === 'duration') { dataSecondsToHours(data); }
hc_plays_by_month_options.yAxis.min = 0; hc_plays_by_month_options.yAxis.min = 0;
hc_plays_by_month_options.xAxis.categories = data.categories; hc_plays_by_month_options.xAxis.categories = data.categories;
hc_plays_by_month_options.series = data.series; hc_plays_by_month_options.series = getGraphVisibility(hc_plays_by_month_options.chart.renderTo, data.series);
hc_plays_by_month_options.series[2].visible = music_visible;
var hc_plays_by_month = new Highcharts.Chart(hc_plays_by_month_options); var hc_plays_by_month = new Highcharts.Chart(hc_plays_by_month_options);
} }
}); });
$('#graph-tabs a[href="#tabs-3"]').tab('show')
} }
// Set initial state // Set initial state
if (current_tab == '#tabs-1') { loadGraphsTab1(current_day_range, yaxis); } if (current_tab === '#tabs-1') { loadGraphsTab1(current_day_range, yaxis); }
if (current_tab == '#tabs-2') { loadGraphsTab2(current_day_range, yaxis); } if (current_tab === '#tabs-2') { loadGraphsTab2(current_day_range, yaxis); }
if (current_tab == '#tabs-3') { loadGraphsTab3(current_month_range, yaxis); } if (current_tab === '#tabs-3') { loadGraphsTab3(current_month_range, yaxis); }
// Tab1 opened // Tab1 opened
$('#graph-tabs a[href="#tabs-1"]').on('shown.bs.tab', function (e) { $('#graph-tabs a[href="#tabs-1"]').on('shown.bs.tab', function (e) {
e.preventDefault(); e.preventDefault();
current_tab = $(this).attr('href'); current_tab = $(this).attr('href');
setLocalStorage('graph_tab', current_tab.replace('#',''));
loadGraphsTab1(current_day_range, yaxis); loadGraphsTab1(current_day_range, yaxis);
$.post('set_graph_config', { graph_tab: current_tab.replace('#','') }); });
})
// Tab2 opened // Tab2 opened
$('#graph-tabs a[href="#tabs-2"]').on('shown.bs.tab', function (e) { $('#graph-tabs a[href="#tabs-2"]').on('shown.bs.tab', function (e) {
e.preventDefault(); e.preventDefault();
current_tab = $(this).attr('href'); current_tab = $(this).attr('href');
setLocalStorage('graph_tab', current_tab.replace('#',''));
loadGraphsTab2(current_day_range, yaxis); loadGraphsTab2(current_day_range, yaxis);
$.post('set_graph_config', { graph_tab: current_tab.replace('#','') }); });
})
// Tab3 opened // Tab3 opened
$('#graph-tabs a[href="#tabs-3"]').on('shown.bs.tab', function (e) { $('#graph-tabs a[href="#tabs-3"]').on('shown.bs.tab', function (e) {
e.preventDefault(); e.preventDefault();
current_tab = $(this).attr('href'); current_tab = $(this).attr('href');
setLocalStorage('graph_tab', current_tab.replace('#',''));
loadGraphsTab3(current_month_range, yaxis); loadGraphsTab3(current_month_range, yaxis);
$.post('set_graph_config', { graph_tab: current_tab.replace('#','') }); });
})
// Date range changed // Date range changed
$('#graph-days').tooltip({ container: 'body', placement: 'top', html: true }); $('#graph-days').tooltip({ container: 'body', placement: 'top', html: true });
$('#graph-days').on('change', function() { $('#graph-days').on('change', function() {
forceMinMax($(this)); forceMinMax($(this));
current_day_range = $(this).val(); current_day_range = $(this).val();
if (current_tab == '#tabs-1') { loadGraphsTab1(current_day_range, yaxis); } setLocalStorage('graph_days', current_day_range);
if (current_tab == '#tabs-2') { loadGraphsTab2(current_day_range, yaxis); } if (current_tab === '#tabs-1') { loadGraphsTab1(current_day_range, yaxis); }
if (current_tab === '#tabs-2') { loadGraphsTab2(current_day_range, yaxis); }
$('.days').html(current_day_range); $('.days').html(current_day_range);
$.post('set_graph_config', { graph_days: current_day_range });
}); });
// Month range changed // Month range changed
@@ -607,26 +605,26 @@
$('#graph-months').on('change', function() { $('#graph-months').on('change', function() {
forceMinMax($(this)); forceMinMax($(this));
current_month_range = $(this).val(); current_month_range = $(this).val();
if (current_tab == '#tabs-3') { loadGraphsTab3(current_month_range, yaxis); } setLocalStorage('graph_months', current_month_range);
if (current_tab === '#tabs-3') { loadGraphsTab3(current_month_range, yaxis); }
$('.months').html(current_month_range); $('.months').html(current_month_range);
$.post('set_graph_config', { graph_months: current_month_range });
}); });
// User changed // User changed
$('#graph-user').on('change', function() { $('#graph-user').on('change', function() {
selected_user_id = $(this).val() || null; selected_user_id = $(this).val() || null;
if (current_tab == '#tabs-1') { loadGraphsTab1(current_day_range, yaxis); } if (current_tab === '#tabs-1') { loadGraphsTab1(current_day_range, yaxis); }
if (current_tab == '#tabs-2') { loadGraphsTab2(current_day_range, yaxis); } if (current_tab === '#tabs-2') { loadGraphsTab2(current_day_range, yaxis); }
if (current_tab == '#tabs-3') { loadGraphsTab3(current_month_range, yaxis); } if (current_tab === '#tabs-3') { loadGraphsTab3(current_month_range, yaxis); }
}); });
// Y-axis changed // Y-axis changed
$('#yaxis-selection').on('change', function() { $('#yaxis-selection').on('change', function() {
yaxis = $('input[name=yaxis-options]:checked', '#yaxis-selection').val(); yaxis = $('input[name=yaxis-options]:checked', '#yaxis-selection').val();
if (current_tab == '#tabs-1') { loadGraphsTab1(current_day_range, yaxis); } setLocalStorage('graph_type', yaxis);
if (current_tab == '#tabs-2') { loadGraphsTab2(current_day_range, yaxis); } if (current_tab === '#tabs-1') { loadGraphsTab1(current_day_range, yaxis); }
if (current_tab == '#tabs-3') { loadGraphsTab3(current_month_range, yaxis); } if (current_tab === '#tabs-2') { loadGraphsTab2(current_day_range, yaxis); }
$.post('set_graph_config', { graph_type: yaxis }); if (current_tab === '#tabs-3') { loadGraphsTab3(current_month_range, yaxis); }
}); });
function setGraphFormat(type) { function setGraphFormat(type) {

View File

@@ -32,17 +32,17 @@
</div> </div>
% endif % endif
<div class="btn-group" data-toggle="buttons" id="media_type-selection"> <div class="btn-group" data-toggle="buttons" id="media_type-selection">
<label class="btn btn-dark active"> <label class="btn btn-dark">
<input type="radio" name="media_type-filter" id="history-all" value="" autocomplete="off"> All <input type="radio" name="media_type-filter" id="history-all" value="all" autocomplete="off"> All
</label> </label>
<label class="btn btn-dark"> <label class="btn btn-dark">
<input type="radio" name="media_type-filter" id="history-movies" value="movie" autocomplete="off"> Movies <input type="radio" name="media_type-filter" id="history-movie" value="movie" autocomplete="off"> Movies
</label> </label>
<label class="btn btn-dark"> <label class="btn btn-dark">
<input type="radio" name="media_type-filter" id="history-tv_shows" value="episode" autocomplete="off"> TV Shows <input type="radio" name="media_type-filter" id="history-episode" value="episode" autocomplete="off"> TV Shows
</label> </label>
<label class="btn btn-dark"> <label class="btn btn-dark">
<input type="radio" name="media_type-filter" id="history-music" value="track" autocomplete="off"> Music <input type="radio" name="media_type-filter" id="history-track" value="track" autocomplete="off"> Music
</label> </label>
</div> </div>
<div class="btn-group"> <div class="btn-group">
@@ -154,6 +154,7 @@
selected_filter = $('input[name=media_type-filter]:checked', '#media_type-selection'); selected_filter = $('input[name=media_type-filter]:checked', '#media_type-selection');
$(selected_filter).closest('label').addClass('active'); $(selected_filter).closest('label').addClass('active');
media_type = $(selected_filter).val(); media_type = $(selected_filter).val();
setLocalStorage('history_media_type', media_type);
history_table.draw(); history_table.draw();
}); });
@@ -163,8 +164,12 @@
}); });
} }
var media_type = null; var media_type = getLocalStorage('history_media_type', 'all');
var selected_user_id = "${_session['user_group']}" == "admin" ? null : "${_session['user_id']}"; var selected_user_id = "${_session['user_group']}" == "admin" ? null : "${_session['user_id']}";
$('#history-' + media_type).prop('checked', true);
$('#history-' + media_type).closest('label').addClass('active');
loadHistoryTable(media_type, selected_user_id); loadHistoryTable(media_type, selected_user_id);
% if _session['user_group'] == 'admin': % if _session['user_group'] == 'admin':

View File

@@ -54,7 +54,7 @@
json_data: JSON.stringify(d), json_data: JSON.stringify(d),
user_id: "${data['user_id']}", user_id: "${data['user_id']}",
start_date: "${data['start_date']}", start_date: "${data['start_date']}",
media_type: "${data.get('media_type')}", media_type: "${data.get('media_type') or 'all'}",
transcode_decision: "${data.get('transcode_decision')}" transcode_decision: "${data.get('transcode_decision')}"
}; };
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 112 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

View File

@@ -15,9 +15,9 @@
<h3><span id="sessions-xml">Activity</span> &nbsp;&nbsp; <h3><span id="sessions-xml">Activity</span> &nbsp;&nbsp;
<small> <small>
<span id="currentActivityHeader" style="display: none;"> <span id="currentActivityHeader" style="display: none;">
Streams: <span id="currentActivityHeader-streams"></span> | Sessions: <span id="currentActivityHeader-streams"></span> |
Bandwidth: <span id="currentActivityHeader-bandwidth"></span> Bandwidth: <span id="currentActivityHeader-bandwidth"></span>
<span id="currentActivityHeader-bandwidth-tooltip" data-toggle="tooltip" title="Streaming Brain Estimate (Required Bandwidth)"><i class="fa fa-info-circle"></i></span> <span id="currentActivityHeader-bandwidth-tooltip" data-toggle="tooltip" title="Streaming Brain Estimate (Reserved Bandwidth)"><i class="fa fa-info-circle"></i></span>
</span> </span>
</small> </small>
</h3> </h3>
@@ -27,6 +27,8 @@
<div class="text-muted" id="dashboard-checking-activity"><i class="fa fa-refresh fa-spin"></i> Checking for activity...</div> <div class="text-muted" id="dashboard-checking-activity"><i class="fa fa-refresh fa-spin"></i> Checking for activity...</div>
% elif config['pms_is_cloud']: % elif config['pms_is_cloud']:
<div id="dashboard-no-activity" class="text-muted">Plex Cloud server is sleeping.</div> <div id="dashboard-no-activity" class="text-muted">Plex Cloud server is sleeping.</div>
% elif not config['first_run_complete']:
<div id="dashboard-no-activity" class="text-muted">The Tautulli setup wizard has not been completed. Please click <a href="welcome">here</a> to go to the setup wizard.</div>
% else: % else:
<div id="dashboard-no-activity" class="text-muted">There was an error communicating with your Plex Server. <div id="dashboard-no-activity" class="text-muted">There was an error communicating with your Plex Server.
% if _session['user_group'] == 'admin': % if _session['user_group'] == 'admin':
@@ -44,25 +46,16 @@
<h3 class="pull-left">Watch Statistics</h3> <h3 class="pull-left">Watch Statistics</h3>
<div class="button-bar"> <div class="button-bar">
<div class="btn-group pull-left" data-toggle="buttons" id="watch-stats-toggles" style="margin-right: 3px"> <div class="btn-group pull-left" data-toggle="buttons" id="watch-stats-toggles" style="margin-right: 3px">
% if config['home_stats_type'] == 0: <label class="btn btn-dark">
<label class="btn btn-dark active"> <input type="radio" class="watched-stats-toggle" name="watched-stats-type" id="watched-stats-plays" value="plays" autocomplete="off"> Play Count
<input type="radio" class="watched-stats-toggle" name="watched-stats-type" id="watched-stats-plays" value="0" autocomplete="off" checked> Play Count
</label> </label>
<label class="btn btn-dark"> <label class="btn btn-dark">
<input type="radio" class="watched-stats-toggle" name="watched-stats-type" id="watched-stats-duration" value="1" autocomplete="off"> Play Duration <input type="radio" class="watched-stats-toggle" name="watched-stats-type" id="watched-stats-duration" value="duration" autocomplete="off"> Play Duration
</label> </label>
% else:
<label class="btn btn-dark">
<input type="radio" class="watched-stats-toggle" name="watched-stats-type" id="watched-stats-plays" value="0" autocomplete="off"> Play Count
</label>
<label class="btn btn-dark active">
<input type="radio" class="watched-stats-toggle" name="watched-stats-type" id="watched-stats-duration" value="1" autocomplete="off" checked> Play Duration
</label>
% endif
</div> </div>
<div class="input-group pull-left" style="width: 1px; margin-right: 3px" id="watched-stats-days-selection"> <div class="input-group pull-left" style="width: 1px; margin-right: 3px" id="watched-stats-days-selection">
<span class="input-group-addon btn-dark inactive">Last</span> <span class="input-group-addon btn-dark inactive">Last</span>
<input type="number" class="form-control number-input" name="watched-stats-days" id="watched-stats-days" value="${config['home_stats_length']}" min="1" data-default="30" data-toggle="tooltip" title="Min: 1 day" /> <input type="number" class="form-control number-input" name="watched-stats-days" id="watched-stats-days" value="30" min="1" data-default="30" data-toggle="tooltip" title="Min: 1 day" />
<span class="input-group-addon btn-dark inactive">days</span> <span class="input-group-addon btn-dark inactive">days</span>
</div> </div>
</div> </div>
@@ -100,7 +93,7 @@
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<div class="home-padded-header padded-header"> <div class="home-padded-header padded-header">
<h3 class="pull-left">Recently Added</h3> <h3 class="pull-left"><span id="recently-added-xml">Recently Added</span></h3>
<ul class="nav nav-header nav-dashboard pull-right" style="margin-top: -3px;"> <ul class="nav nav-header nav-dashboard pull-right" style="margin-top: -3px;">
<li> <li>
<a href="#" id="recently-added-page-left" class="paginate btn-gray disabled" data-id="+1"><i class="fa fa-lg fa-chevron-left"></i></a> <a href="#" id="recently-added-page-left" class="paginate btn-gray disabled" data-id="+1"><i class="fa fa-lg fa-chevron-left"></i></a>
@@ -111,8 +104,8 @@
</ul> </ul>
<div class="button-bar"> <div class="button-bar">
<div class="btn-group pull-left" data-toggle="buttons" id="recently-added-toggles" style="margin-right: 3px"> <div class="btn-group pull-left" data-toggle="buttons" id="recently-added-toggles" style="margin-right: 3px">
<label class="btn btn-dark active" id="recently-added-label-all"> <label class="btn btn-dark" id="recently-added-label-all">
<input type="radio" name="recently-added-toggle" id="recently-added-toggle-all" value="" autocomplete="off"> All <input type="radio" name="recently-added-toggle" id="recently-added-toggle-all" value="all" autocomplete="off"> All
</label> </label>
<label class="btn btn-dark" id="recently-added-label-movies"> <label class="btn btn-dark" id="recently-added-label-movies">
<input type="radio" name="recently-added-toggle" id="recently-added-toggle-movie" value="movie" autocomplete="off"> Movies <input type="radio" name="recently-added-toggle" id="recently-added-toggle-movie" value="movie" autocomplete="off"> Movies
@@ -121,11 +114,14 @@
<input type="radio" name="recently-added-toggle" id="recently-added-toggle-show" value="show" autocomplete="off"> TV Shows <input type="radio" name="recently-added-toggle" id="recently-added-toggle-show" value="show" autocomplete="off"> TV Shows
</label> </label>
<label class="btn btn-dark" id="recently-added-label-music"> <label class="btn btn-dark" id="recently-added-label-music">
<input type="radio" name="recently-added-toggle" id="recently-added-toggle-music" value="artist" autocomplete="off"> Music <input type="radio" name="recently-added-toggle" id="recently-added-toggle-artist" value="artist" autocomplete="off"> Music
</label>
<label class="btn btn-dark" id="recently-added-label-other_video">
<input type="radio" name="recently-added-toggle" id="recently-added-toggle-other_video" value="other_video" autocomplete="off"> Videos
</label> </label>
</div> </div>
<div class="input-group pull-left" style="width: 1px;" id="recently-added-count-selection"> <div class="input-group pull-left" style="width: 1px;" id="recently-added-count-selection">
<input type="number" class="form-control number-input" name="recently-added-count" id="recently-added-count" value="${config['home_stats_recently_added_count']}" min="1" max="50" data-default="50" data-toggle="tooltip" title="Min: 1 item<br>Max: 50 items" /> <input type="number" class="form-control number-input" name="recently-added-count" id="recently-added-count" value="50" min="1" max="50" data-default="50" data-toggle="tooltip" title="Min: 1 item<br>Max: 50 items" />
<span class="input-group-addon btn-dark inactive">items</span> <span class="input-group-addon btn-dark inactive">items</span>
</div> </div>
</div> </div>
@@ -169,6 +165,7 @@
<div class="modal-body"> <div class="modal-body">
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-danger" data-target="#donate-modal" data-toggle="modal" style="float: left;"><i class="fa fa-fw fa-heart"></i> Donate</button>
<input type="button" class="btn btn-bright" data-dismiss="modal" value="Close"> <input type="button" class="btn btn-bright" data-dismiss="modal" value="Close">
</div> </div>
</div> </div>
@@ -438,7 +435,7 @@
$('#transcode_container-' + key).html(transcode_container); $('#transcode_container-' + key).html(transcode_container);
var video_decision = ''; var video_decision = '';
if (['movie', 'episode', 'clip'].indexOf(s.media_type) > -1 && s.video_decision !== '') { if (['movie', 'episode', 'clip'].indexOf(s.media_type) > -1 && s.stream_video_decision) {
var v_res= ''; var v_res= '';
switch (s.video_resolution.toLowerCase()) { switch (s.video_resolution.toLowerCase()) {
case 'sd': case 'sd':
@@ -476,7 +473,7 @@
$('#video_decision-' + key).html(video_decision); $('#video_decision-' + key).html(video_decision);
var audio_decision = ''; var audio_decision = '';
if (['movie', 'episode', 'clip', 'track'].indexOf(s.media_type) > -1 && s.audio_decision) { if (['movie', 'episode', 'clip', 'track'].indexOf(s.media_type) > -1 && s.stream_audio_decision) {
var a_codec = (s.audio_codec === 'truehd') ? 'TrueHD' : s.audio_codec.toUpperCase(); var a_codec = (s.audio_codec === 'truehd') ? 'TrueHD' : s.audio_codec.toUpperCase();
var sa_codec = (s.stream_audio_codec === 'truehd') ? 'TrueHD' : s.stream_audio_codec.toUpperCase(); var sa_codec = (s.stream_audio_codec === 'truehd') ? 'TrueHD' : s.stream_audio_codec.toUpperCase();
if (s.stream_audio_decision === 'transcode') { if (s.stream_audio_decision === 'transcode') {
@@ -617,7 +614,8 @@
if ($(this).data('state') === 'playing' && $(this).data('view_offset') >= 0) { if ($(this).data('state') === 'playing' && $(this).data('view_offset') >= 0) {
var view_offset = parseInt($(this).data('view_offset')); var view_offset = parseInt($(this).data('view_offset'));
var stream_duration = parseInt($(this).data('stream_duration')); var stream_duration = parseInt($(this).data('stream_duration'));
var progress_percent = Math.min(Math.floor(view_offset / stream_duration * 100) || 100, 100); var progress_percent = Math.floor(view_offset / stream_duration * 100);
progress_percent = (progress_percent >= 0) ? Math.min(progress_percent, 100) : 100;
$(this).width(progress_percent - 3 + '%').html(progress_percent + '%') $(this).width(progress_percent - 3 + '%').html(progress_percent + '%')
.attr('data-original-title', 'Stream Progress ' + progress_percent + '%') .attr('data-original-title', 'Stream Progress ' + progress_percent + '%')
.data('view_offset', Math.min(view_offset + 1000, stream_duration)); .data('view_offset', Math.min(view_offset + 1000, stream_duration));
@@ -722,20 +720,25 @@
}); });
} }
var time_range = $('#watched-stats-days').val(); var stats_type = getLocalStorage('home_stats_type', 'plays');
var stats_type = $('input[name=watched-stats-type]:checked', '#watch-stats-toggles').val(); var time_range = getLocalStorage('home_stats_days', 30);
$('#watched-stats-' + stats_type).prop('checked', true);
$('#watched-stats-' + stats_type).closest('label').addClass('active');
$('#watched-stats-days').val(time_range);
getHomeStats(time_range, stats_type); getHomeStats(time_range, stats_type);
$('input[name=watched-stats-type]').change(function () { $('input[name=watched-stats-type]').change(function () {
stats_type = $(this).filter(':checked').val(); stats_type = $(this).filter(':checked').val();
setLocalStorage('home_stats_type', stats_type);
getHomeStats(time_range, stats_type); getHomeStats(time_range, stats_type);
$.post('set_home_stats_config', { stats_type: stats_type });
}); });
$('#watched-stats-days').change(function () { $('#watched-stats-days').change(function () {
forceMinMax($(this)); forceMinMax($(this));
time_range = $(this).val(); time_range = $(this).val();
setLocalStorage('home_stats_days', time_range);
getHomeStats(time_range, stats_type); getHomeStats(time_range, stats_type);
$.post('set_home_stats_config', { time_range: time_range });
}); });
$('#watched-stats-days').tooltip({ container: 'body', placement: 'top', html: true }); $('#watched-stats-days').tooltip({ container: 'body', placement: 'top', html: true });
@@ -769,7 +772,7 @@
async: true, async: true,
data: { data: {
count: recently_added_count, count: recently_added_count,
type: recently_added_type media_type: recently_added_type
}, },
complete: function (xhr, status) { complete: function (xhr, status) {
$("#recentlyAdded").html(xhr.responseText); $("#recentlyAdded").html(xhr.responseText);
@@ -778,8 +781,14 @@
} }
}); });
} }
var recently_added_count = $('#recently-added-count').val();
var recently_added_type = ''; var recently_added_count = getLocalStorage('home_stats_recently_added_count', 50);
var recently_added_type = getLocalStorage('home_stats_recently_added_type', 'all');;
$('#recently-added-toggle-' + recently_added_type).prop('checked', true);
$('#recently-added-toggle-' + recently_added_type).closest('label').addClass('active');
$('#recently-added-count').val(recently_added_count);
recentlyAdded(recently_added_count, recently_added_type); recentlyAdded(recently_added_count, recently_added_type);
function highlightAddedScrollerButton() { function highlightAddedScrollerButton() {
@@ -833,6 +842,7 @@
$(selected_filter).closest('label').addClass('active'); $(selected_filter).closest('label').addClass('active');
recently_added_type = $(selected_filter).val(); recently_added_type = $(selected_filter).val();
resetScroller(); resetScroller();
setLocalStorage('home_stats_recently_added_type', recently_added_type);
recentlyAdded(recently_added_count, recently_added_type); recentlyAdded(recently_added_count, recently_added_type);
}); });
@@ -840,11 +850,15 @@
forceMinMax($(this)); forceMinMax($(this));
recently_added_count = $(this).val(); recently_added_count = $(this).val();
resetScroller(); resetScroller();
setLocalStorage('home_stats_recently_added_count', recently_added_count);
recentlyAdded(recently_added_count, recently_added_type); recentlyAdded(recently_added_count, recently_added_type);
$.post('set_home_stats_config', { recently_added_count: recently_added_count });
}); });
$('#recently-added-count').tooltip({ container: 'body', placement: 'top', html: true }); $('#recently-added-count').tooltip({ container: 'body', placement: 'top', html: true });
$('#recently-added-xml').on('tripleclick', function () {
openPlexXML('/library/recentlyAdded', false, {'X-Plex-Container-Start': 0, 'X-Plex-Container-Size': recently_added_count});
});
</script> </script>
% endif % endif
% if _session['user_group'] == 'admin' and config['update_show_changelog']: % if _session['user_group'] == 'admin' and config['update_show_changelog']:

View File

@@ -190,12 +190,12 @@ DOCUMENTATION :: END
<li> <li>
<a href="info?rating_key=${child['rating_key']}" id="${child['rating_key']}"> <a href="info?rating_key=${child['rating_key']}" id="${child['rating_key']}">
<div class="item-children-poster"> <div class="item-children-poster">
<div class="item-children-poster-face cover-item style="background-image: url(pms_image_proxy?img=${child['thumb']}&width=300&height=300&fallback=cover);"></div> <div class="item-children-poster-face cover-item" style="background-image: url(pms_image_proxy?img=${child['thumb']}&width=300&height=300&fallback=cover);"></div>
% if _session['user_group'] == 'admin': % if _session['user_group'] == 'admin':
<span class="overlay-refresh-image" title="Refresh image"><i class="fa fa-refresh refresh_pms_image"></i></span> <span class="overlay-refresh-image" title="Refresh image"><i class="fa fa-refresh refresh_pms_image"></i></span>
% endif % endif
</div> </div>
<div class="item-children-instance-text-wrapper album-item"> <div class="item-children-instance-text-wrapper cover-item">
<h3 title="${child['title']}">${child['title']}</h3> <h3 title="${child['title']}">${child['title']}</h3>
</div> </div>
</a> </a>
@@ -219,7 +219,7 @@ DOCUMENTATION :: END
<span class="overlay-refresh-image" title="Refresh image"><i class="fa fa-refresh refresh_pms_image"></i></span> <span class="overlay-refresh-image" title="Refresh image"><i class="fa fa-refresh refresh_pms_image"></i></span>
% endif % endif
</div> </div>
<div class="item-children-instance-text-wrapper album-item"> <div class="item-children-instance-text-wrapper cover-item">
<h3 title="${child['parent_title']}">${child['parent_title']}</h3> <h3 title="${child['parent_title']}">${child['parent_title']}</h3>
<h3 title="${child['title']}">${child['title']}</h3> <h3 title="${child['title']}">${child['title']}</h3>
</div> </div>
@@ -246,11 +246,11 @@ DOCUMENTATION :: END
</div> </div>
</div> </div>
</div> </div>
% if _session['user_group'] == 'admin':
<span class="overlay-refresh-image" title="Refresh image"><i class="fa fa-refresh refresh_pms_image"></i></span>
% endif
</div> </div>
% if _session['user_group'] == 'admin': <div class="item-children-instance-text-wrapper cover-item">
<span class="overlay-refresh-image" title="Refresh image"><i class="fa fa-refresh refresh_pms_image"></i></span>
% endif
<div class="item-children-instance-text-wrapper album-item">
<h3 title="${child['original_title'] or child['grandparent_title']}">${child['original_title'] or child['grandparent_title']}</h3> <h3 title="${child['original_title'] or child['grandparent_title']}">${child['original_title'] or child['grandparent_title']}</h3>
<h3 title="${child['title']}">${child['title']}</h3> <h3 title="${child['title']}">${child['title']}</h3>
<h3 title="${child['parent_title']}" class="text-muted">${child['parent_title']}</h3> <h3 title="${child['parent_title']}" class="text-muted">${child['parent_title']}</h3>

View File

@@ -2,7 +2,7 @@ var hc_plays_by_day_options = {
chart: { chart: {
type: 'line', type: 'line',
backgroundColor: 'rgba(0,0,0,0)', backgroundColor: 'rgba(0,0,0,0)',
renderTo: 'chart_div_plays_by_day' renderTo: 'graph_plays_by_day'
}, },
title: { title: {
text: '' text: ''
@@ -32,6 +32,11 @@ var hc_plays_by_day_options = {
selectHandler(this.category, this.series.name); selectHandler(this.category, this.series.name);
} }
} }
},
events: {
legendItemClick: function() {
setGraphVisibility(this.chart.renderTo.id, this.chart.series, this.name);
}
} }
} }
}, },

View File

@@ -2,17 +2,11 @@ var hc_plays_by_dayofweek_options = {
chart: { chart: {
type: 'column', type: 'column',
backgroundColor: 'rgba(0,0,0,0)', backgroundColor: 'rgba(0,0,0,0)',
renderTo: 'chart_div_plays_by_dayofweek' renderTo: 'graph_plays_by_dayofweek'
}, },
title: { title: {
text: '' text: ''
}, },
plotOptions: {
column: {
pointPadding: 0.2,
borderWidth: 0
}
},
legend: { legend: {
enabled: true, enabled: true,
itemStyle: { itemStyle: {
@@ -56,14 +50,21 @@ var hc_plays_by_dayofweek_options = {
}, },
plotOptions: { plotOptions: {
column: { column: {
borderWidth: 0,
stacking: 'normal', stacking: 'normal',
borderWidth: '0',
dataLabels: { dataLabels: {
enabled: false, enabled: false,
style: { style: {
color: '#000' color: '#000'
} }
} }
},
series: {
events: {
legendItemClick: function () {
setGraphVisibility(this.chart.renderTo.id, this.chart.series, this.name);
}
}
} }
}, },
tooltip: { tooltip: {

View File

@@ -2,17 +2,11 @@ var hc_plays_by_hourofday_options = {
chart: { chart: {
type: 'column', type: 'column',
backgroundColor: 'rgba(0,0,0,0)', backgroundColor: 'rgba(0,0,0,0)',
renderTo: 'chart_div_plays_by_hourofday' renderTo: 'graph_plays_by_hourofday'
}, },
title: { title: {
text: '' text: ''
}, },
plotOptions: {
column: {
pointPadding: 0.2,
borderWidth: 0
}
},
legend: { legend: {
enabled: true, enabled: true,
itemStyle: { itemStyle: {
@@ -56,14 +50,21 @@ var hc_plays_by_hourofday_options = {
}, },
plotOptions: { plotOptions: {
column: { column: {
borderWidth: 0,
stacking: 'normal', stacking: 'normal',
borderWidth: '0',
dataLabels: { dataLabels: {
enabled: false, enabled: false,
style: { style: {
color: '#000' color: '#000'
} }
} }
},
series: {
events: {
legendItemClick: function () {
setGraphVisibility(this.chart.renderTo.id, this.chart.series, this.name);
}
}
} }
}, },
tooltip: { tooltip: {

View File

@@ -2,7 +2,7 @@ var hc_plays_by_month_options = {
chart: { chart: {
type: 'column', type: 'column',
backgroundColor: 'rgba(0,0,0,0)', backgroundColor: 'rgba(0,0,0,0)',
renderTo: 'chart_div_plays_by_month' renderTo: 'graph_plays_by_month'
}, },
title: { title: {
text: '' text: ''
@@ -50,14 +50,21 @@ var hc_plays_by_month_options = {
}, },
plotOptions: { plotOptions: {
column: { column: {
borderWidth: 0,
stacking: 'normal', stacking: 'normal',
borderWidth: '0',
dataLabels: { dataLabels: {
enabled: false, enabled: false,
style: { style: {
color: '#000' color: '#000'
} }
} }
},
series: {
events: {
legendItemClick: function () {
setGraphVisibility(this.chart.renderTo.id, this.chart.series, this.name);
}
}
} }
}, },
tooltip: { tooltip: {

View File

@@ -2,17 +2,11 @@ var hc_plays_by_platform_options = {
chart: { chart: {
type: 'column', type: 'column',
backgroundColor: 'rgba(0,0,0,0)', backgroundColor: 'rgba(0,0,0,0)',
renderTo: 'chart_div_plays_by_platform' renderTo: 'graph_plays_by_platform'
}, },
title: { title: {
text: '' text: ''
}, },
plotOptions: {
column: {
pointPadding: 0.2,
borderWidth: 0
}
},
legend: { legend: {
enabled: true, enabled: true,
itemStyle: { itemStyle: {
@@ -56,14 +50,21 @@ var hc_plays_by_platform_options = {
}, },
plotOptions: { plotOptions: {
column: { column: {
borderWidth: 0,
stacking: 'normal', stacking: 'normal',
borderWidth: '0',
dataLabels: { dataLabels: {
enabled: false, enabled: false,
style: { style: {
color: '#000' color: '#000'
} }
} }
},
series: {
events: {
legendItemClick: function () {
setGraphVisibility(this.chart.renderTo.id, this.chart.series, this.name);
}
}
} }
}, },
tooltip: { tooltip: {

View File

@@ -2,17 +2,11 @@ var hc_plays_by_platform_by_stream_type_options = {
chart: { chart: {
type: 'column', type: 'column',
backgroundColor: 'rgba(0,0,0,0)', backgroundColor: 'rgba(0,0,0,0)',
renderTo: 'chart_div_plays_by_platform_by_stream_type' renderTo: 'graph_plays_by_platform_by_stream_type'
}, },
title: { title: {
text: '' text: ''
}, },
plotOptions: {
column: {
pointPadding: 0.2,
borderWidth: 0
}
},
legend: { legend: {
enabled: true, enabled: true,
itemStyle: { itemStyle: {
@@ -56,14 +50,21 @@ var hc_plays_by_platform_by_stream_type_options = {
}, },
plotOptions: { plotOptions: {
column: { column: {
borderWidth: 0,
stacking: 'normal', stacking: 'normal',
borderWidth: '0',
dataLabels: { dataLabels: {
enabled: false, enabled: false,
style: { style: {
color: '#000' color: '#000'
} }
} }
},
series: {
events: {
legendItemClick: function () {
setGraphVisibility(this.chart.renderTo.id, this.chart.series, this.name);
}
}
} }
}, },
tooltip: { tooltip: {

View File

@@ -2,17 +2,11 @@ var hc_plays_by_source_resolution_options = {
chart: { chart: {
type: 'column', type: 'column',
backgroundColor: 'rgba(0,0,0,0)', backgroundColor: 'rgba(0,0,0,0)',
renderTo: 'chart_div_plays_by_source_resolution' renderTo: 'graph_plays_by_source_resolution'
}, },
title: { title: {
text: '' text: ''
}, },
plotOptions: {
column: {
pointPadding: 0.2,
borderWidth: 0
}
},
legend: { legend: {
enabled: true, enabled: true,
itemStyle: { itemStyle: {
@@ -56,14 +50,21 @@ var hc_plays_by_source_resolution_options = {
}, },
plotOptions: { plotOptions: {
column: { column: {
borderWidth: 0,
stacking: 'normal', stacking: 'normal',
borderWidth: '0',
dataLabels: { dataLabels: {
enabled: false, enabled: false,
style: { style: {
color: '#000' color: '#000'
} }
} }
},
series: {
events: {
legendItemClick: function () {
setGraphVisibility(this.chart.renderTo.id, this.chart.series, this.name);
}
}
} }
}, },
tooltip: { tooltip: {

View File

@@ -2,17 +2,11 @@ var hc_plays_by_stream_resolution_options = {
chart: { chart: {
type: 'column', type: 'column',
backgroundColor: 'rgba(0,0,0,0)', backgroundColor: 'rgba(0,0,0,0)',
renderTo: 'chart_div_plays_by_stream_resolution' renderTo: 'graph_plays_by_stream_resolution'
}, },
title: { title: {
text: '' text: ''
}, },
plotOptions: {
column: {
pointPadding: 0.2,
borderWidth: 0
}
},
legend: { legend: {
enabled: true, enabled: true,
itemStyle: { itemStyle: {
@@ -56,14 +50,21 @@ var hc_plays_by_stream_resolution_options = {
}, },
plotOptions: { plotOptions: {
column: { column: {
borderWidth: 0,
stacking: 'normal', stacking: 'normal',
borderWidth: '0',
dataLabels: { dataLabels: {
enabled: false, enabled: false,
style: { style: {
color: '#000' color: '#000'
} }
} }
},
series: {
events: {
legendItemClick: function () {
setGraphVisibility(this.chart.renderTo.id, this.chart.series, this.name);
}
}
} }
}, },
tooltip: { tooltip: {

View File

@@ -2,7 +2,7 @@ var hc_plays_by_stream_type_options = {
chart: { chart: {
type: 'line', type: 'line',
backgroundColor: 'rgba(0,0,0,0)', backgroundColor: 'rgba(0,0,0,0)',
renderTo: 'chart_div_plays_by_stream_type' renderTo: 'graph_plays_by_stream_type'
}, },
title: { title: {
text: '' text: ''
@@ -32,6 +32,11 @@ var hc_plays_by_stream_type_options = {
selectHandler(this.category, this.series.name); selectHandler(this.category, this.series.name);
} }
} }
},
events: {
legendItemClick: function() {
setGraphVisibility(this.chart.renderTo.id, this.chart.series, this.name);
}
} }
} }
}, },

View File

@@ -2,17 +2,11 @@ var hc_plays_by_user_options = {
chart: { chart: {
type: 'column', type: 'column',
backgroundColor: 'rgba(0,0,0,0)', backgroundColor: 'rgba(0,0,0,0)',
renderTo: 'chart_div_plays_by_user' renderTo: 'graph_plays_by_user'
}, },
title: { title: {
text: '' text: ''
}, },
plotOptions: {
column: {
pointPadding: 0.2,
borderWidth: 0
}
},
legend: { legend: {
enabled: true, enabled: true,
itemStyle: { itemStyle: {
@@ -56,14 +50,21 @@ var hc_plays_by_user_options = {
}, },
plotOptions: { plotOptions: {
column: { column: {
borderWidth: 0,
stacking: 'normal', stacking: 'normal',
borderWidth: '0',
dataLabels: { dataLabels: {
enabled: false, enabled: false,
style: { style: {
color: '#000' color: '#000'
} }
} }
},
series: {
events: {
legendItemClick: function () {
setGraphVisibility(this.chart.renderTo.id, this.chart.series, this.name);
}
}
} }
}, },
tooltip: { tooltip: {

View File

@@ -2,17 +2,11 @@ var hc_plays_by_user_by_stream_type_options = {
chart: { chart: {
type: 'column', type: 'column',
backgroundColor: 'rgba(0,0,0,0)', backgroundColor: 'rgba(0,0,0,0)',
renderTo: 'chart_div_plays_by_user_by_stream_type' renderTo: 'graph_plays_by_user_by_stream_type'
}, },
title: { title: {
text: '' text: ''
}, },
plotOptions: {
column: {
pointPadding: 0.2,
borderWidth: 0
}
},
legend: { legend: {
enabled: true, enabled: true,
itemStyle: { itemStyle: {
@@ -56,14 +50,21 @@ var hc_plays_by_user_by_stream_type_options = {
}, },
plotOptions: { plotOptions: {
column: { column: {
borderWidth: 0,
stacking: 'normal', stacking: 'normal',
borderWidth: '0',
dataLabels: { dataLabels: {
enabled: false, enabled: false,
style: { style: {
color: '#000' color: '#000'
} }
} }
},
series: {
events: {
legendItemClick: function () {
setGraphVisibility(this.chart.renderTo.id, this.chart.series, this.name);
}
}
} }
}, },
tooltip: { tooltip: {

View File

@@ -1,3 +1,45 @@
var p = {
name: 'Unknown',
version: 'Unknown',
os: 'Unknown'
};
if (typeof platform !== 'undefined') {
p.name = platform.name;
p.version = platform.version;
p.os = platform.os.toString();
}
if (['IE', 'Microsoft Edge', 'IE Mobile'].indexOf(p.name) > -1) {
if (!getCookie('browserDismiss')) {
var $browser_warning = $('<div id="browser-warning">' +
'<i class="fa fa-exclamation-circle"></i>&nbsp;' +
'Tautulli does not support Internet Explorer or Microsoft Edge! ' +
'Please use a different browser such as Chrome or Firefox.' +
'<button type="button" class="close"><i class="fa fa-remove"></i></button>' +
'</div>');
$('body').prepend($browser_warning);
var offset = $browser_warning.height();
warningOffset(offset);
$browser_warning.one('click', 'button.close', function () {
$browser_warning.remove();
warningOffset(-offset);
setCookie('browserDismiss', 'true', 7);
});
function warningOffset(offset) {
var navbar = $('.navbar-fixed-top');
if (navbar.length) {
navbar.offset({top: navbar.offset().top + offset});
}
var container = $('.body-container');
if (container.length) {
container.offset({top: container.offset().top + offset});
}
}
}
}
function initConfigCheckbox(elem, toggleElem, reverse) { function initConfigCheckbox(elem, toggleElem, reverse) {
toggleElem = (toggleElem === undefined) ? null : toggleElem; toggleElem = (toggleElem === undefined) ? null : toggleElem;
reverse = (reverse === undefined) ? false : reverse; reverse = (reverse === undefined) ? false : reverse;
@@ -37,7 +79,7 @@ function showMsg(msg, loader, timeout, ms, error) {
} }
var message = $("<div class='msg'>" + msg + "</div>"); var message = $("<div class='msg'>" + msg + "</div>");
if (loader) { if (loader) {
message = $("<div class='msg'><i class='fa fa-refresh fa-spin'></i> " + msg + "</div>"); message = $("<div class='msg'><i class='fa fa-refresh fa-spin'></i>&nbsp; " + msg + "</div>");
feedback.css("padding", "14px 10px"); feedback.css("padding", "14px 10px");
} }
if (error) { if (error) {
@@ -73,9 +115,9 @@ function confirmAjaxCall(url, msg, data, loader_msg, callback) {
var result = $.parseJSON(xhr.responseText); var result = $.parseJSON(xhr.responseText);
var 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>&nbsp; ' + msg, false, true, 5000);
} else { } else {
showMsg('<i class="fa fa-times"></i> ' + msg, false, true, 5000, true); showMsg('<i class="fa fa-times"></i>&nbsp; ' + msg, false, true, 5000, true);
} }
if (typeof callback === "function") { if (typeof callback === "function") {
callback(result); callback(result);
@@ -103,7 +145,7 @@ function doAjaxCall(url, elem, reload, form, showMsg, callback) {
dataString = $(formID).serialize(); dataString = $(formID).serialize();
} }
// Loader Image // Loader Image
var loader = $("<i class='fa fa-refresh fa-spin ajaxLoader-" + url +"></i>"); var loader = $("<div class='msg ajaxLoader-" + url +"'><i class='fa fa-refresh fa-spin'></i>&nbsp; Saving...</div>");
// Data Success Message // Data Success Message
var dataSucces = $(elem).data('success'); var dataSucces = $(elem).data('success');
if (typeof dataSucces === "undefined") { if (typeof dataSucces === "undefined") {
@@ -117,8 +159,8 @@ function doAjaxCall(url, elem, reload, form, showMsg, callback) {
dataError = "There was an error"; dataError = "There was an error";
} }
// Get Success & Error message from inline data, else use standard message // Get Success & Error message from inline data, else use standard message
var succesMsg = $("<div class='msg'><i class='fa fa-check'></i> " + dataSucces + "</div>"); var succesMsg = $("<div class='msg'><i class='fa fa-check'></i>&nbsp; " + dataSucces + "</div>");
var errorMsg = $("<div class='msg'><i class='fa fa-exclamation-triangle'></i> " + dataError + "</div>"); var errorMsg = $("<div class='msg'><i class='fa fa-exclamation-triangle'></i>&nbsp; " + dataError + "</div>");
// Check if checkbox is selected // Check if checkbox is selected
if (form) { if (form) {
if ($('td#select input[type=checkbox]').length > 0 && !$('td#select input[type=checkbox]').is(':checked') || if ($('td#select input[type=checkbox]').length > 0 && !$('td#select input[type=checkbox]').is(':checked') ||
@@ -141,7 +183,7 @@ function doAjaxCall(url, elem, reload, form, showMsg, callback) {
$.ajax({ $.ajax({
url: url, url: url,
data: dataString, data: dataString,
type: 'post', type: 'POST',
beforeSend: function (jqXHR, settings) { beforeSend: function (jqXHR, settings) {
// Start loader etc. // Start loader etc.
feedback.prepend(loader); feedback.prepend(loader);
@@ -187,7 +229,7 @@ function doAjaxCall(url, elem, reload, form, showMsg, callback) {
}, },
complete: function (jqXHR, textStatus) { complete: function (jqXHR, textStatus) {
// Remove loaders and stuff, ajax request is complete! // Remove loaders and stuff, ajax request is complete!
feedback.remove('.ajaxLoader-' + url); $('.ajaxLoader-' + url).remove();
if (typeof callback === "function") { if (typeof callback === "function") {
callback(jqXHR); callback(jqXHR);
} }
@@ -491,26 +533,45 @@ function PopupCenter(url, title, w, h) {
return newWindow; return newWindow;
} }
if (!localStorage.getItem('Tautulli_ClientId')) {
localStorage.setItem('Tautulli_ClientId', uuidv4()); function setLocalStorage(key, value, path) {
if (path !== false) {
key = key + '_' + window.location.pathname;
}
localStorage.setItem(key, value);
}
function getLocalStorage(key, default_value, path) {
if (path !== false) {
key = key + '_' + window.location.pathname;
}
var value = localStorage.getItem(key);
if (value !== null) {
return value
} else if (default_value !== undefined) {
setLocalStorage(key, default_value, path);
return default_value
}
} }
function uuidv4() { function uuidv4() {
return ([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g, c => return ([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g, function(c) {
(c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16) var cryptoObj = window.crypto || window.msCrypto; // for IE 11
) return (c ^ cryptoObj.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16)
});
} }
var x_plex_headers = { function getPlexHeaders() {
'Accept': 'application/json', return {
'X-Plex-Product': 'Tautulli', 'Accept': 'application/json',
'X-Plex-Version': 'Plex OAuth', 'X-Plex-Product': 'Tautulli',
'X-Plex-Client-Identifier': localStorage.getItem('Tautulli_ClientId'), 'X-Plex-Version': 'Plex OAuth',
'X-Plex-Platform': platform.name, 'X-Plex-Client-Identifier': getLocalStorage('Tautulli_ClientID', uuidv4(), false),
'X-Plex-Platform-Version': platform.version, 'X-Plex-Platform': p.name,
'X-Plex-Device': platform.os.toString(), 'X-Plex-Platform-Version': p.version,
'X-Plex-Device-Name': platform.name 'X-Plex-Device': p.os,
}; 'X-Plex-Device-Name': p.name
};
}
var plex_oauth_window = null; var plex_oauth_window = null;
const plex_oauth_loader = '<style>' + const plex_oauth_loader = '<style>' +
@@ -561,6 +622,7 @@ function closePlexOAuthWindow() {
} }
getPlexOAuthPin = function () { getPlexOAuthPin = function () {
var x_plex_headers = getPlexHeaders();
var deferred = $.Deferred(); var deferred = $.Deferred();
$.ajax({ $.ajax({
@@ -568,7 +630,6 @@ getPlexOAuthPin = function () {
type: 'POST', type: 'POST',
headers: x_plex_headers, headers: x_plex_headers,
success: function(data) { success: function(data) {
plex_oauth_window.location = 'https://app.plex.tv/auth/#!?clientID=' + x_plex_headers['X-Plex-Client-Identifier'] + '&code=' + data.code;
deferred.resolve({pin: data.id, code: data.code}); deferred.resolve({pin: data.id, code: data.code});
}, },
error: function() { error: function() {
@@ -585,48 +646,46 @@ function PlexOAuth(success, error, pre) {
if (typeof pre === "function") { if (typeof pre === "function") {
pre() pre()
} }
clearTimeout(polling);
closePlexOAuthWindow(); closePlexOAuthWindow();
plex_oauth_window = PopupCenter('', 'Plex-OAuth', 600, 700); plex_oauth_window = PopupCenter('', 'Plex-OAuth', 600, 700);
$(plex_oauth_window.document.body).html(plex_oauth_loader); $(plex_oauth_window.document.body).html(plex_oauth_loader);
getPlexOAuthPin().then(function (data) { getPlexOAuthPin().then(function (data) {
var x_plex_headers = getPlexHeaders();
const pin = data.pin; const pin = data.pin;
const code = data.code; const code = data.code;
var keep_polling = true;
plex_oauth_window.location = 'https://app.plex.tv/auth/#!?clientID=' + x_plex_headers['X-Plex-Client-Identifier'] + '&code=' + code;
polling = pin;
(function poll() { (function poll() {
polling = setTimeout(function () { $.ajax({
$.ajax({ url: 'https://plex.tv/api/v2/pins/' + pin,
url: 'https://plex.tv/api/v2/pins/' + pin, type: 'GET',
type: 'GET', headers: x_plex_headers,
headers: x_plex_headers, success: function (data) {
success: function (data) { if (data.authToken){
if (data.authToken){ closePlexOAuthWindow();
keep_polling = false; if (typeof success === "function") {
closePlexOAuthWindow(); success(data.authToken)
if (typeof success === "function") {
success(data.authToken)
}
} }
}, }
error: function () { },
keep_polling = false; error: function (jqXHR, textStatus, errorThrown) {
if (textStatus !== "timeout") {
closePlexOAuthWindow(); closePlexOAuthWindow();
if (typeof error === "function") { if (typeof error === "function") {
error() error()
} }
}, }
complete: function () { },
if (keep_polling){ complete: function () {
poll(); if (!plex_oauth_window.closed && polling === pin){
} else { setTimeout(function() {poll()}, 1000);
clearTimeout(polling); }
} },
}, timeout: 10000
timeout: 1000 });
});
}, 1000);
})(); })();
}, function () { }, function () {
closePlexOAuthWindow(); closePlexOAuthWindow();

View File

@@ -24,6 +24,7 @@ history_table_options = {
}, },
"pagingType": "full_numbers", "pagingType": "full_numbers",
"stateSave": true, "stateSave": true,
"stateDuration": 0,
"processing": false, "processing": false,
"serverSide": true, "serverSide": true,
"pageLength": 25, "pageLength": 25,
@@ -289,7 +290,7 @@ history_table_options = {
' (filtered from ' + settings.json.total_duration + ' total)</span>'); ' (filtered from ' + settings.json.total_duration + ' total)</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>&nbsp; Fetching rows...";
showMsg(msg, false, false, 0); showMsg(msg, false, false, 0);
$('[data-toggle="tooltip"]').tooltip('destroy'); $('[data-toggle="tooltip"]').tooltip('destroy');
$('[data-toggle="popover"]').popover('destroy'); $('[data-toggle="popover"]').popover('destroy');

View File

@@ -148,7 +148,7 @@ history_table_modal_options = {
}); });
}, },
"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>&nbsp; Fetching rows...";
showMsg(msg, false, false, 0) showMsg(msg, false, false, 0)
} }
} }

View File

@@ -17,6 +17,7 @@ libraries_list_table_options = {
"pageLength": 25, "pageLength": 25,
"order": [ 2, 'asc'], "order": [ 2, 'asc'],
"stateSave": true, "stateSave": true,
"stateDuration": 0,
"pagingType": "full_numbers", "pagingType": "full_numbers",
"autoWidth": false, "autoWidth": false,
"scrollX": true, "scrollX": true,
@@ -238,7 +239,7 @@ libraries_list_table_options = {
} }
}, },
"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>&nbsp; Fetching rows...";
showMsg(msg, false, false, 0) showMsg(msg, false, false, 0)
}, },
"rowCallback": function (row, rowData) { "rowCallback": function (row, rowData) {

View File

@@ -10,6 +10,7 @@ login_log_table_options = {
"loadingRecords": '<i class="fa fa-refresh fa-spin"></i> Loading items...</div>' "loadingRecords": '<i class="fa fa-refresh fa-spin"></i> Loading items...</div>'
}, },
"stateSave": true, "stateSave": true,
"stateDuration": 0,
"pagingType": "full_numbers", "pagingType": "full_numbers",
"processing": false, "processing": false,
"serverSide": true, "serverSide": true,
@@ -110,7 +111,7 @@ login_log_table_options = {
}, },
"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>&nbsp; Fetching rows...";
showMsg(msg, false, false, 0) showMsg(msg, false, false, 0)
} }
}; };

View File

@@ -6,6 +6,7 @@ var log_table_options = {
"order": [ 0, 'desc'], "order": [ 0, 'desc'],
"pageLength": 50, "pageLength": 50,
"stateSave": true, "stateSave": true,
"stateDuration": 0,
"language": { "language": {
"search": "Search: ", "search": "Search: ",
"lengthMenu": "Show _MENU_ lines per page", "lengthMenu": "Show _MENU_ lines per page",
@@ -39,7 +40,7 @@ var log_table_options = {
$('#ajaxMsg').fadeOut(); $('#ajaxMsg').fadeOut();
}, },
"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>&nbsp; Fetching rows...";
showMsg(msg, false, false, 0) showMsg(msg, false, false, 0)
} }
} }

View File

@@ -25,6 +25,7 @@ media_info_table_options = {
}, },
"pagingType": "full_numbers", "pagingType": "full_numbers",
"stateSave": true, "stateSave": true,
"stateDuration": 0,
"processing": false, "processing": false,
"serverSide": true, "serverSide": true,
"pageLength": 25, "pageLength": 25,
@@ -299,7 +300,7 @@ media_info_table_options = {
' (filtered from ' + humanFileSize(settings.json.total_file_size) + ')</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>&nbsp; Fetching rows...";
showMsg(msg, false, false, 0) showMsg(msg, false, false, 0)
}, },
"rowCallback": function (row, rowData, rowIndex) { "rowCallback": function (row, rowData, rowIndex) {

View File

@@ -6,6 +6,7 @@ newsletter_log_table_options = {
"order": [ 0, 'desc'], "order": [ 0, 'desc'],
"pageLength": 50, "pageLength": 50,
"stateSave": true, "stateSave": true,
"stateDuration": 0,
"language": { "language": {
"search":"Search: ", "search":"Search: ",
"lengthMenu": "Show _MENU_ lines per page", "lengthMenu": "Show _MENU_ lines per page",
@@ -140,7 +141,7 @@ newsletter_log_table_options = {
}); });
}, },
"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>&nbsp; Fetching rows...";
showMsg(msg, false, false, 0) showMsg(msg, false, false, 0)
} }
}; };

View File

@@ -6,6 +6,7 @@ notification_log_table_options = {
"order": [ 0, 'desc'], "order": [ 0, 'desc'],
"pageLength": 50, "pageLength": 50,
"stateSave": true, "stateSave": true,
"stateDuration": 0,
"language": { "language": {
"search":"Search: ", "search":"Search: ",
"lengthMenu": "Show _MENU_ lines per page", "lengthMenu": "Show _MENU_ lines per page",
@@ -110,7 +111,7 @@ notification_log_table_options = {
}); });
}, },
"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>&nbsp; Fetching rows...";
showMsg(msg, false, false, 0) showMsg(msg, false, false, 0)
} }
}; };

View File

@@ -6,6 +6,7 @@ var plex_log_table_options = {
"order": [ 0, 'desc'], "order": [ 0, 'desc'],
"pageLength": 50, "pageLength": 50,
"stateSave": true, "stateSave": true,
"stateDuration": 0,
"language": { "language": {
"search": "Search: ", "search": "Search: ",
"lengthMenu": "Show _MENU_ lines per page", "lengthMenu": "Show _MENU_ lines per page",
@@ -39,7 +40,7 @@ var plex_log_table_options = {
$('#ajaxMsg').fadeOut(); $('#ajaxMsg').fadeOut();
}, },
"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>&nbsp; Fetching rows...";
showMsg(msg, false, false, 0) showMsg(msg, false, false, 0)
} }
} }

View File

@@ -7,6 +7,7 @@ sync_table_options = {
"order": [ [ 0, 'desc'], [ 1, 'asc'], [2, 'asc'] ], "order": [ [ 0, 'desc'], [ 1, 'asc'], [2, 'asc'] ],
"pageLength": 25, "pageLength": 25,
"stateSave": true, "stateSave": true,
"stateDuration": 0,
"language": { "language": {
"search": "Search: ", "search": "Search: ",
"lengthMenu": "Show _MENU_ lines per page", "lengthMenu": "Show _MENU_ lines per page",
@@ -147,7 +148,7 @@ sync_table_options = {
}, },
"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>&nbsp; Fetching rows...";
showMsg(msg, false, false, 0) showMsg(msg, false, false, 0)
}, },
"rowCallback": function (row, rowData, rowIndex) { "rowCallback": function (row, rowData, rowIndex) {

View File

@@ -10,6 +10,7 @@ user_ip_table_options = {
"loadingRecords": '<i class="fa fa-refresh fa-spin"></i> Loading items...</div>' "loadingRecords": '<i class="fa fa-refresh fa-spin"></i> Loading items...</div>'
}, },
"stateSave": true, "stateSave": true,
"stateDuration": 0,
"pagingType": "full_numbers", "pagingType": "full_numbers",
"processing": false, "processing": false,
"serverSide": true, "serverSide": true,
@@ -141,7 +142,7 @@ user_ip_table_options = {
}, },
"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>&nbsp; Fetching rows...";
showMsg(msg, false, false, 0) showMsg(msg, false, false, 0)
} }
} }

View File

@@ -34,6 +34,7 @@ users_list_table_options = {
"pageLength": 25, "pageLength": 25,
"order": [ 2, 'asc'], "order": [ 2, 'asc'],
"stateSave": true, "stateSave": true,
"stateDuration": 0,
"pagingType": "full_numbers", "pagingType": "full_numbers",
"autoWidth": false, "autoWidth": false,
"scrollX": true, "scrollX": true,
@@ -240,7 +241,7 @@ users_list_table_options = {
} }
}, },
"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>&nbsp; Fetching rows...";
showMsg(msg, false, false, 0) showMsg(msg, false, false, 0)
}, },
"rowCallback": function (row, rowData) { "rowCallback": function (row, rowData) {

View File

@@ -12,7 +12,6 @@
<meta name="description" content=""> <meta name="description" content="">
<meta name="author" content=""> <meta name="author" content="">
<link href="${http_root}css/bootstrap3/bootstrap.css" rel="stylesheet"> <link href="${http_root}css/bootstrap3/bootstrap.css" rel="stylesheet">
<link href="${http_root}css/pnotify.custom.min.css" rel="stylesheet" />
<link href="${http_root}css/tautulli.css${cache_param}" rel="stylesheet"> <link href="${http_root}css/tautulli.css${cache_param}" rel="stylesheet">
<link href="${http_root}css/opensans.min.css" rel="stylesheet"> <link href="${http_root}css/opensans.min.css" rel="stylesheet">
<link href="${http_root}css/font-awesome.all.min.css" rel="stylesheet"> <link href="${http_root}css/font-awesome.all.min.css" rel="stylesheet">
@@ -42,7 +41,7 @@
<div class="row"> <div class="row">
<div class="login-container"> <div class="login-container">
<div class="login-logo"> <div class="login-logo">
<img src="${http_root}images/logo-tautulli-100.png" height="100" alt="PlexPy"> <img src="${http_root}images/logo-tautulli-100.png" height="100" alt="Tautulli">
</div> </div>
<div class="row"> <div class="row">
<div class="col-sm-6 col-sm-offset-3"> <div class="col-sm-6 col-sm-offset-3">
@@ -151,6 +150,7 @@
token: token, token: token,
remember_me: remember_me remember_me: remember_me
}; };
var x_plex_headers = getPlexHeaders();
data = $.extend(data, x_plex_headers); data = $.extend(data, x_plex_headers);
$.ajax({ $.ajax({

View File

@@ -20,6 +20,24 @@
</div> </div>
<p class="help-block">Optional: Enter a friendly name for this device. Leave blank for default.</p> <p class="help-block">Optional: Enter a friendly name for this device. Leave blank for default.</p>
</div> </div>
<div class="form-group">
<label for="friendly_name">Device Token</label>
<div class="row">
<div class="col-md-8">
<input type="text" class="form-control" id="device_token" value="${device['device_token']}" size="30" readonly>
</div>
</div>
<p class="help-block">Your app device token.</p>
</div>
<div class="form-group">
<label for="friendly_name">OneSignal Device ID</label>
<div class="row">
<div class="col-md-8">
<input type="text" class="form-control" id="device_id" value="${device['device_id']}" size="30" readonly>
</div>
</div>
<p class="help-block">Your OneSignal device ID for notifications.</p>
</div>
</div> </div>
</div> </div>
</form> </form>

View File

@@ -21,7 +21,7 @@
<div class="row"> <div class="row">
<div class="login-container"> <div class="login-container">
<div class="newsletter-logo"> <div class="newsletter-logo">
<img src="${http_root}images/newsletter/newsletter-header.png" height="100" alt="PlexPy"> <img src="${http_root}images/newsletter/newsletter-header.png" height="100" alt="Tautulli">
</div> </div>
<div class="row"> <div class="row">
<div class="col-sm-6 col-sm-offset-3"> <div class="col-sm-6 col-sm-offset-3">

View File

@@ -173,7 +173,11 @@
<input type="text" class="form-control" id="id_name" name="id_name" value="${newsletter['id_name']}" size="30"> <input type="text" class="form-control" id="id_name" name="id_name" value="${newsletter['id_name']}" size="30">
</div> </div>
</div> </div>
<p class="help-block">Optional: Enter a unique ID name to create a static URL to the last sent scheduled newsletter at <span class="inline-pre">${http_root}newsletter/id/&lt;id_name&gt;</span>. Only letters (a-z), numbers (0-9), underscores (_) and hyphens (-) are allowed. Leave blank to disable.</p> <p class="help-block">
Optional: Enter a unique ID name to create a static URL to the <em>last sent scheduled newsletter</em> at <span class="inline-pre">${http_root}newsletter/id/&lt;id_name&gt;</span>.
Only letters (a-z), numbers (0-9), underscores (_) and hyphens (-) are allowed. Leave blank to disable.<br>
Note: Test newsletters are not considered as scheduled newsletters.
</p>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="friendly_name">Description</label> <label for="friendly_name">Description</label>
@@ -218,6 +222,13 @@
<input type="hidden" id="newsletter_config_formatted" name="newsletter_config_formatted" value="${newsletter['config']['formatted']}"> <input type="hidden" id="newsletter_config_formatted" name="newsletter_config_formatted" value="${newsletter['config']['formatted']}">
</div> </div>
<div class="form-group" id="email_notifier_select"> <div class="form-group" id="email_notifier_select">
<div class="checkbox">
<label>
<input type="checkbox" id="newsletter_config_threaded_checkbox" data-id="newsletter_config_threaded" class="checkboxes" value="1" ${checked(newsletter['config']['threaded'])}> Enable Grouped Email Thread
</label>
<p class="help-block">Enable to group this newsletter together in a single Email thread. Disable to send a new Email for each newsletter.</p>
<input type="hidden" id="newsletter_config_threaded" name="newsletter_config_threaded" value="${newsletter['config']['threaded']}">
</div>
<label for="newsletter_email_notifier_id">Email Notification Agent</label> <label for="newsletter_email_notifier_id">Email Notification Agent</label>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
@@ -766,9 +777,12 @@
// auto resizing textarea for custom notification message body // auto resizing textarea for custom notification message body
$('textarea[data-autoresize]').each(function () { $('textarea[data-autoresize]').each(function () {
var modal_body = $(this).closest('.modal-body');
var offset = this.offsetHeight - this.clientHeight; var offset = this.offsetHeight - this.clientHeight;
var resizeTextarea = function (el) { var resizeTextarea = function (el) {
var modal_offset = modal_body.scrollTop();
$(el).css('height', 'auto').css('height', el.scrollHeight + offset); $(el).css('height', 'auto').css('height', el.scrollHeight + offset);
modal_body.scrollTop(modal_offset);
}; };
$(this).on('focus keyup input', function () { resizeTextarea(this); }).removeAttr('data-autoresize'); $(this).on('focus keyup input', function () { resizeTextarea(this); }).removeAttr('data-autoresize');
}); });

View File

@@ -21,7 +21,13 @@
<li role="presentation" class="active"><a href="#tabs-notifier_config" aria-controls="tabs-notifier_config" role="tab" data-toggle="tab">Configuration</a></li> <li role="presentation" class="active"><a href="#tabs-notifier_config" aria-controls="tabs-notifier_config" role="tab" data-toggle="tab">Configuration</a></li>
<li role="presentation"><a href="#tabs-notify_triggers" aria-controls="tabs-notify_triggers" role="tab" data-toggle="tab">Triggers</a></li> <li role="presentation"><a href="#tabs-notify_triggers" aria-controls="tabs-notify_triggers" role="tab" data-toggle="tab">Triggers</a></li>
<li role="presentation"><a href="#tabs-notify_conditions" aria-controls="tabs-notify_conditions" role="tab" data-toggle="tab">Conditions</a></li> <li role="presentation"><a href="#tabs-notify_conditions" aria-controls="tabs-notify_conditions" role="tab" data-toggle="tab">Conditions</a></li>
<li role="presentation"><a href="#tabs-notify_text" aria-controls="tabs-notify_text" role="tab" data-toggle="tab">${'Arguments' if notifier['agent_name'] == 'scripts' else 'Text'}</a></li> % if notifier['agent_name'] == 'scripts':
<li role="presentation"><a href="#tabs-notify_text" aria-controls="tabs-notify_text" role="tab" data-toggle="tab">Arguments</a></li>
% elif notifier['agent_name'] == 'webhook':
<li role="presentation"><a href="#tabs-notify_text" aria-controls="tabs-notify_text" role="tab" data-toggle="tab">Data</a></li>
% else:
<li role="presentation"><a href="#tabs-notify_text" aria-controls="tabs-notify_text" role="tab" data-toggle="tab">Text</a></li>
% endif
<li role="presentation"><a href="#tabs-test_notifications" aria-controls="tabs-test_notifications" role="tab" data-toggle="tab">Test Notifications</a></li> <li role="presentation"><a href="#tabs-test_notifications" aria-controls="tabs-test_notifications" role="tab" data-toggle="tab">Test Notifications</a></li>
</ul> </ul>
</div> </div>
@@ -142,7 +148,7 @@
<div class="col-md-12"> <div class="col-md-12">
<label>Notification Triggers</label> <label>Notification Triggers</label>
<p class="help-block"> <p class="help-block">
Select items that will trigger a notification for this ${notifier['agent_label']} notifiation agent. Select items that will trigger a notification for this ${notifier['agent_label']} notification agent.
</p> </p>
% for action in available_notification_actions: % for action in available_notification_actions:
<div class="checkbox"> <div class="checkbox">
@@ -184,6 +190,8 @@
<p class="help-block"> <p class="help-block">
% if notifier['agent_name'] == 'scripts': % if notifier['agent_name'] == 'scripts':
Set the custom arguments passed to the script for each type of notification. Set the custom arguments passed to the script for each type of notification.
% elif notifier['agent_name'] == 'webhook':
Set the custom JSON data sent to the webhook for each type of notification.
% else: % else:
Set the custom formatted text for each type of notification. Set the custom formatted text for each type of notification.
% endif % endif
@@ -225,6 +233,32 @@
</ul> </ul>
</li> </li>
% endfor % endfor
% elif notifier['agent_name'] == 'webhook':
% for action in available_notification_actions:
<li>
<div class="link">
<span class="toggle-left"><i class="fa ${action['icon']} fa-fw"></i></span>&nbsp;
${action['label']}
<span class="toggle-right"><i class="fa fa-chevron-down"></i></span>
</div>
<ul class="submenu">
<li>
<div class="form-group">
<label for="${action['name']}_body">JSON Data</label>
<textarea class="form-control" id="${action['name']}_body" name="${action['name']}_body" data-parsley-trigger="change" data-autoresize required>${notifier['notify_text'][action['name']]['body']}</textarea>
<p class="help-block">Set custom JSON data.</p>
</div>
<div class="form-group">
<div class="row">
<div class="col-md-12">
<input type="button" class="btn btn-bright notifier-text-preview" data-action="${action['name']}" value="Preview JSON Data">
</div>
</div>
</div>
</li>
</ul>
</li>
% endfor
% else: % else:
% for action in available_notification_actions: % for action in available_notification_actions:
<li> <li>
@@ -291,6 +325,16 @@
</div> </div>
<p class="help-block">Set custom arguments passed to the script.</p> <p class="help-block">Set custom arguments passed to the script.</p>
</div> </div>
% elif notifier['agent_name'] == 'webhook':
<div class="form-group">
<label for="test_body">JSON Data</label>
<div class="row">
<div class="col-md-12">
<textarea class="form-control" id="test_body" name="test_body" data-autoresize></textarea>
</div>
</div>
<p class="help-block">Set custom JSON data sent to the webhook.</p>
</div>
% else: % else:
<div class="form-group"> <div class="form-group">
<label for="test_subject">Subject Line</label> <label for="test_subject">Subject Line</label>
@@ -305,7 +349,7 @@
<label for="test_body">Message Body</label> <label for="test_body">Message Body</label>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<input class="form-control" type="text" id="test_body" name="test_body" value="Test notification"> <textarea class="form-control" id="test_body" name="test_body" data-autoresize>Test Notification</textarea>
</div> </div>
</div> </div>
<p class="help-block">Set a custom body.</p> <p class="help-block">Set a custom body.</p>
@@ -735,6 +779,7 @@
$.ajax({ $.ajax({
url: 'get_notify_text_preview', url: 'get_notify_text_preview',
type: 'POST',
data: { data: {
notify_action: action, notify_action: action,
subject: subject, subject: subject,
@@ -811,9 +856,12 @@
// auto resizing textarea for custom notification message body // auto resizing textarea for custom notification message body
$('textarea[data-autoresize]').each(function () { $('textarea[data-autoresize]').each(function () {
var modal_body = $(this).closest('.modal-body');
var offset = this.offsetHeight - this.clientHeight; var offset = this.offsetHeight - this.clientHeight;
var resizeTextarea = function (el) { var resizeTextarea = function (el) {
var modal_offset = modal_body.scrollTop();
$(el).css('height', 'auto').css('height', el.scrollHeight + offset); $(el).css('height', 'auto').css('height', el.scrollHeight + offset);
modal_body.scrollTop(modal_offset);
}; };
$(this).on('focus keyup input', function () { resizeTextarea(this); }).removeAttr('data-autoresize'); $(this).on('focus keyup input', function () { resizeTextarea(this); }).removeAttr('data-autoresize');
}); });

View File

@@ -8,8 +8,15 @@
% if text: % if text:
% for item in text: % for item in text:
<div style="padding-bottom: 10px;"> <div style="padding-bottom: 10px;">
<h4>${item['media_type'].capitalize()}</h4> <h4>
${item['media_type'].capitalize()}
% if item['media_type'] != 'server':
<span class="inline-pre">&lt;${item['media_type']}&gt;&lt;/${item['media_type']}&gt;</span> tags
% endif
</h4>
% if agent != 'webhook':
<pre>${item['subject']}</pre> <pre>${item['subject']}</pre>
% endif
% if agent != 'scripts': % if agent != 'scripts':
<pre>${item['body']}</pre> <pre>${item['body']}</pre>
% endif % endif

View File

@@ -0,0 +1,66 @@
<%
import arrow
from plexpy.activity_handler import ACTIVITY_SCHED, schedule_callback
if queue == 'active sessions':
filter_key = 'session_key-'
title_format = '{2} / {1} ({0})'
title_key = title_format.format('Session Key', 'Title', 'User')
description = 'Queue to flush stuck active sessions to the database.'
else:
filter_key = 'rating_key-'
title_format = '{1} ({0})'
title_key = title_format.format('Rating Key', 'Title')
description = 'Queue to flush recently added items to the database and send notifications if enabled.'
scheduled_jobs = [j.id for j in ACTIVITY_SCHED.get_jobs() if j.id.startswith(filter_key)]
%>
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"><i class="fa fa-remove"></i></button>
<h4 class="modal-title">${queue.title()} Queue</h4>
</div>
<div class="modal-body">
<p class="help-block">
${description}
</p>
<table class="activity-queue">
<thead>
<tr>
<th>
${title_key}
</th>
<th>
Next Flush In
</th>
<th>
Next Flush Time
</th>
</tr>
</thead>
<tbody>
% if scheduled_jobs:
% for job in scheduled_jobs:
<%
sched_job = ACTIVITY_SCHED.get_job(job)
next_run_in = arrow.get(sched_job.next_run_time).timestamp - arrow.now().timestamp
%>
<tr>
<td><strong>${title_format.format(*sched_job.args)}</strong></td>
<td>${arrow.get(next_run_in).format('HH:mm:ss')}</td>
<td>${arrow.get(sched_job.next_run_time).format('YYYY-MM-DD HH:mm:ss')}</td>
</tr>
% endfor
% else:
<tr>
<td colspan="3" style="text-align: center;"><i class="fa fa-check"></i>&nbsp; Nothing in the ${queue} queue</td>
</tr>
% endif
</tbody>
</table>
</div>
<div class="modal-footer">
</div>
</div>
</div>

View File

@@ -44,7 +44,13 @@ DOCUMENTATION :: END
</tr> </tr>
% elif job in ('Check for server response', 'Check for active sessions', 'Check for recently added items') and plexpy.WS_CONNECTED: % elif job in ('Check for server response', 'Check for active sessions', 'Check for recently added items') and plexpy.WS_CONNECTED:
<tr> <tr>
% if job == 'Check for active sessions':
<td><a class="queue-modal-link" href="#" data-queue="active sessions">${job}</a></td>
% elif job == 'Check for recently added items':
<td><a class="queue-modal-link" href="#" data-queue="recently added">${job}</a></td>
% else:
<td>${job}</td> <td>${job}</td>
% endif
<td><i class="fa fa-sm fa-fw fa-check"></i> Websocket</td> <td><i class="fa fa-sm fa-fw fa-check"></i> Websocket</td>
<td>N/A</td> <td>N/A</td>
<td>N/A</td> <td>N/A</td>
@@ -61,4 +67,21 @@ DOCUMENTATION :: END
% endif % endif
% endfor % endfor
</tbody> </tbody>
</table> </table>
<script>
$('.queue-modal-link').on('click', function (e) {
e.preventDefault();
$.ajax({
url: 'get_queue_modal',
data: {
queue: $(this).data('queue')
},
cache: false,
async: true,
complete: function(xhr, status) {
$("#queue-modal").html(xhr.responseText);
$('#queue-modal').modal();
}
});
});
</script>

View File

@@ -7,6 +7,9 @@
from plexpy import common, notifiers, newsletters from plexpy import common, notifiers, newsletters
from plexpy.helpers import anon_url, checked from plexpy.helpers import anon_url, checked
docker_setting = 'disabled' if plexpy.DOCKER else ''
docker_msg = '<span class="docker-setting small">(Controlled by Docker Container)</span>' if plexpy.DOCKER else ''
available_notification_agents = sorted(notifiers.available_notification_agents(), key=lambda k: k['label'].lower()) available_notification_agents = sorted(notifiers.available_notification_agents(), key=lambda k: k['label'].lower())
available_newsletter_agents = sorted(newsletters.available_newsletter_agents(), key=lambda k: k['label'].lower()) available_newsletter_agents = sorted(newsletters.available_newsletter_agents(), key=lambda k: k['label'].lower())
%> %>
@@ -33,7 +36,7 @@
<button id="menu_link_show_advanced_settings" class="btn btn-dark"><i class="fa fa-wrench"></i> Show Advanced</button> <button id="menu_link_show_advanced_settings" class="btn btn-dark"><i class="fa fa-wrench"></i> Show Advanced</button>
% endif % endif
% if config['check_github']: % if config['check_github']:
<button id="menu_link_update_check" class="btn btn-dark"><i class="fa fa-arrow-circle-up"></i> Check for Updates</button> <button id="menu_link_update_check" class="btn btn-dark"><i class="fa fa-arrow-alt-circle-up"></i> Check for Updates</button>
% endif % endif
<button id="menu_link_restart" class="btn btn-dark"><i class="fa fa-refresh"></i> Restart</button> <button id="menu_link_restart" class="btn btn-dark"><i class="fa fa-refresh"></i> Restart</button>
<button id="menu_link_shutdown" class="btn btn-dark"><i class="fa fa-power-off"></i> Shutdown</button> <button id="menu_link_shutdown" class="btn btn-dark"><i class="fa fa-power-off"></i> Shutdown</button>
@@ -230,12 +233,12 @@
% if plexpy.INSTALL_TYPE == 'git': % if plexpy.INSTALL_TYPE == 'git':
<div class="form-group advanced-setting"> <div class="form-group advanced-setting">
<label for="git_branch">Git Remote / Branch</label> <label for="git_branch">Git Remote / Branch</label> ${docker_msg | n}
<div class="row"> <div class="row">
<div class="col-md-6"> <div class="col-md-6">
<div class="input-group git-group"> <div class="input-group git-group">
<input type="text" class="form-control" id="git_remote" name="git_remote" value="${config['git_remote']}" data-parsley-trigger="change"> <input type="text" class="form-control" id="git_remote" name="git_remote" value="${config['git_remote']}" data-parsley-trigger="change" ${docker_setting}>
<select class="form-control" id="git_branch" name="git_branch"> <select class="form-control" id="git_branch" name="git_branch" ${docker_setting}>
<% branches = ('master', 'beta', 'nightly') %> <% branches = ('master', 'beta', 'nightly') %>
% for branch in branches: % for branch in branches:
<option value="${branch}" ${'selected' if config['git_branch'] == branch else ''}>${branch}</option> <option value="${branch}" ${'selected' if config['git_branch'] == branch else ''}>${branch}</option>
@@ -245,7 +248,7 @@
% endif % endif
</select> </select>
<span class="input-group-btn"> <span class="input-group-btn">
<button class="btn btn-form" type="button" id="switch_git_branch">Checkout Branch</button> <button class="btn btn-form" type="button" id="switch_git_branch" ${docker_setting}>Checkout Branch</button>
</span> </span>
</div> </div>
</div> </div>
@@ -253,10 +256,10 @@
<p class="help-block">The git tracking remote and branch (default "origin/master"). Select to switch the git branch (requires restart).</p> <p class="help-block">The git tracking remote and branch (default "origin/master"). Select to switch the git branch (requires restart).</p>
</div> </div>
<div class="form-group advanced-setting"> <div class="form-group advanced-setting">
<label for="git_path">Git Path</label> <label for="git_path">Git Path</label> ${docker_msg | n}
<div class="row"> <div class="row">
<div class="col-md-4"> <div class="col-md-4">
<input type="text" class="form-control" id="git_path" name="git_path" value="${config['git_path']}" size="30"> <input type="text" class="form-control" id="git_path" name="git_path" value="${config['git_path']}" size="30" ${docker_setting}>
</div> </div>
</div> </div>
<p class="help-block">Optional: The path to your git environment variable. Leave blank for default.</p> <p class="help-block">Optional: The path to your git environment variable. Leave blank for default.</p>
@@ -430,6 +433,14 @@
</div> </div>
<p class="help-block">Note: Web interface changes require a restart.</p> <p class="help-block">Note: Web interface changes require a restart.</p>
% if os.name == 'nt':
<div class="checkbox">
<label>
<input type="checkbox" class="http-settings" name="win_sys_tray" id="win_sys_tray" value="1" ${config['win_sys_tray']}> Enable System Tray Icon
</label>
<p class="help-block">Show Tautulli shortcut in the system tray.</p>
</div>
% endif
<div class="checkbox"> <div class="checkbox">
<label> <label>
<input type="checkbox" name="launch_browser" id="launch_browser" value="1" ${config['launch_browser']}> Launch Browser on Startup <input type="checkbox" name="launch_browser" id="launch_browser" value="1" ${config['launch_browser']}> Launch Browser on Startup
@@ -437,19 +448,19 @@
<p class="help-block">Launch browser pointed to Tautulli on startup.</p> <p class="help-block">Launch browser pointed to Tautulli on startup.</p>
</div> </div>
<div class="form-group advanced-setting"> <div class="form-group advanced-setting">
<label for="http_host">HTTP Host</label> <label for="http_host">HTTP Host</label> ${docker_msg | n}
<div class="row"> <div class="row">
<div class="col-md-6"> <div class="col-md-6">
<input type="text" class="form-control http-settings" id="http_host" name="http_host" value="${config['http_host']}" data-parsley-trigger="change" required> <input type="text" class="form-control http-settings" id="http_host" name="http_host" value="${config['http_host']}" data-parsley-trigger="change" required ${docker_setting}>
</div> </div>
</div> </div>
<p class="help-block">localhost or an IP address to bind the web server to. Default 0.0.0.0 to bind to all interfaces.</p> <p class="help-block">localhost or an IP address to bind the web server to. Default 0.0.0.0 to bind to all interfaces.</p>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="http_port">HTTP Port</label> <label for="http_port">HTTP Port</label> ${docker_msg | n}
<div class="row"> <div class="row">
<div class="col-md-2"> <div class="col-md-2">
<input type="text" class="form-control http-settings" data-parsley-type="integer" id="http_port" name="http_port" value="${config['http_port']}" data-parsley-trigger="change" data-parsley-errors-container="#http_port_error" required> <input type="text" class="form-control http-settings" data-parsley-type="integer" id="http_port" name="http_port" value="${config['http_port']}" data-parsley-trigger="change" data-parsley-errors-container="#http_port_error" required ${docker_setting}>
</div> </div>
<div id="http_port_error" class="alert alert-danger settings-alert" role="alert"></div> <div id="http_port_error" class="alert alert-danger settings-alert" role="alert"></div>
</div> </div>
@@ -461,7 +472,7 @@
<div class="col-md-8"> <div class="col-md-8">
<input type="text" class="form-control" id="http_base_url" name="http_base_url" value="${config['http_base_url']}" placeholder="http://mydomain.com" data-parsley-trigger="change" data-parsley-pattern="^https?:\/\/\S+$" data-parsley-errors-container="#http_base_url_error" data-parsley-error-message="Invalid URL"> <input type="text" class="form-control" id="http_base_url" name="http_base_url" value="${config['http_base_url']}" placeholder="http://mydomain.com" data-parsley-trigger="change" data-parsley-pattern="^https?:\/\/\S+$" data-parsley-errors-container="#http_base_url_error" data-parsley-error-message="Invalid URL">
</div> </div>
<div id=http_base_url_error" class="alert alert-danger settings-alert" role="alert"></div> <div id="http_base_url_error" class="alert alert-danger settings-alert" role="alert"></div>
</div> </div>
<p class="help-block"> <p class="help-block">
Set your public Tautulli domain for self-hosted notification images and newsletters. (e.g. http://mydomain.com) Set your public Tautulli domain for self-hosted notification images and newsletters. (e.g. http://mydomain.com)
@@ -650,12 +661,20 @@
</div> </div>
<div class="form-group has-feedback" id="pms_ip_group"> <div class="form-group has-feedback" id="pms_ip_group">
<label for="pms_ip">Plex IP Address or Hostname</label> <label for="pms_ip_selectize">Plex IP Address or Hostname</label>
<div class="row"> <div class="row">
<div class="col-md-9" id="selectize-pms-ip-container"> <div class="col-md-9" id="selectize-pms-ip-container">
<div class="input-group"> <div class="input-group">
<select class="form-control pms-settings selectize-pms-ip" id="pms_ip" name="pms_ip" data-parsley-trigger="change" aria-describedby="server-verified" data-parsley-errors-container="#pms_ip_error" required> <select class="form-control pms-settings selectize-pms-ip" id="pms_ip_selectize" data-parsley-trigger="change" aria-describedby="server-verified" data-parsley-errors-container="#pms_ip_error" required>
<option value="${config['pms_ip']}" selected>${config['pms_ip']}</option> <option value="${config['pms_ip']}:${config['pms_port']}"
data-identifier="${config['pms_identifier']}"
data-ip="${config['pms_ip']}"
data-port="${config['pms_port']}"
data-local="${int(not int(config['pms_is_remote']))}"
data-ssl="${config['pms_ssl']}"
data-is_cloud="${config['pms_is_cloud']}"
data-label="${config['pms_name'] or 'Local'}"
selected>${config['pms_ip']}</option>
</select> </select>
<span class="input-group-btn"> <span class="input-group-btn">
<button class="btn btn-form" type="button" id="verify_server_button">Verify Server</button> <button class="btn btn-form" type="button" id="verify_server_button">Verify Server</button>
@@ -738,6 +757,7 @@
</p> </p>
</div> </div>
<input type="hidden" id="pms_ip" name="pms_ip" value="${config['pms_ip']}">
<input type="hidden" id="pms_is_cloud" name="pms_is_cloud" value="${config['pms_is_cloud']}"> <input type="hidden" id="pms_is_cloud" name="pms_is_cloud" value="${config['pms_is_cloud']}">
<input type="checkbox" name="server_changed" id="server_changed" value="1" style="display: none;"> <input type="checkbox" name="server_changed" id="server_changed" value="1" style="display: none;">
@@ -870,7 +890,6 @@
<h3>Current Activity Notifications</h3> <h3>Current Activity Notifications</h3>
</div> </div>
<p class="help-block">Note: Buffer warnings only work on certain Plex clients. Android and Plex Web do not report buffer events accurately or at all.</p>
<div class="form-group"> <div class="form-group">
<label for="buffer_threshold">Buffer Threshold</label> <label for="buffer_threshold">Buffer Threshold</label>
<div class="row"> <div class="row">
@@ -879,7 +898,13 @@
</div> </div>
<div id="buffer_threshold_error" class="alert alert-danger settings-alert" role="alert"></div> <div id="buffer_threshold_error" class="alert alert-danger settings-alert" role="alert"></div>
</div> </div>
<p class="help-block">How many buffer events should we wait before triggering the first warning. Buffer events increment on each monitor ping if play state is buffering. 0 to disable buffer warnings.</p> <p class="help-block">
The number of buffer events required before triggering the first notification.
Buffer events increment on each incoming websocket message if the play state is buffering.
<br>
Note: Buffer warnings only work on certain Plex clients. Some clients can send excessive buffer messages or no messages at all.
This notification may be unreliable and not indicative of a real problem.
</p>
</div> </div>
<div class="form-group advanced-setting"> <div class="form-group advanced-setting">
<label for="buffer_wait">Buffer Wait</label> <label for="buffer_wait">Buffer Wait</label>
@@ -1017,10 +1042,10 @@
<p class="help-block">Optional: Enter the full path to your custom newsletter templates folder. Leave blank for default.</p> <p class="help-block">Optional: Enter the full path to your custom newsletter templates folder. Leave blank for default.</p>
</div> </div>
<div class="form-group advanced-setting"> <div class="form-group advanced-setting">
<label for="newsletter_dir">Newsletter Output Directory</label> <label for="newsletter_dir">Newsletter Output Directory</label> ${docker_msg | n}
<div class="row"> <div class="row">
<div class="col-md-6"> <div class="col-md-6">
<input type="text" class="form-control" id="newsletter_dir" name="newsletter_dir" value="${config['newsletter_dir']}"> <input type="text" class="form-control" id="newsletter_dir" name="newsletter_dir" value="${config['newsletter_dir']}" ${docker_setting}>
</div> </div>
</div> </div>
<p class="help-block">Enter the full path to where newsletter files will be saved.</p> <p class="help-block">Enter the full path to where newsletter files will be saved.</p>
@@ -1216,10 +1241,10 @@
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="log_dir">Log Directory</label> <label for="log_dir">Log Directory</label> ${docker_msg | n}
<div class="row"> <div class="row">
<div class="col-md-6"> <div class="col-md-6">
<input type="text" class="form-control directory-settings" id="log_dir" name="log_dir" value="${config['log_dir']}"> <input type="text" class="form-control directory-settings" id="log_dir" name="log_dir" value="${config['log_dir']}" ${docker_setting}>
<div class="btn-group"> <div class="btn-group">
<button class="btn btn-form" type="button" id="clear_logs">Clear Logs</button> <button class="btn btn-form" type="button" id="clear_logs">Clear Logs</button>
</div> </div>
@@ -1227,10 +1252,10 @@
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="backup_dir">Backup Directory</label> <label for="backup_dir">Backup Directory</label> ${docker_msg | n}
<div class="row"> <div class="row">
<div class="col-md-6"> <div class="col-md-6">
<input type="text" class="form-control directory-settings" id="backup_dir" name="backup_dir" value="${config['backup_dir']}"> <input type="text" class="form-control directory-settings" id="backup_dir" name="backup_dir" value="${config['backup_dir']}" ${docker_setting}>
<div class="btn-group"> <div class="btn-group">
<button class="btn btn-form" type="button" id="backup_config">Backup Config</button> <button class="btn btn-form" type="button" id="backup_config">Backup Config</button>
<button class="btn btn-form" type="button" id="backup_database">Backup Database</button> <button class="btn btn-form" type="button" id="backup_database">Backup Database</button>
@@ -1239,10 +1264,10 @@
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="cache_dir">Cache Directory</label> <label for="cache_dir">Cache Directory</label> ${docker_msg | n}
<div class="row"> <div class="row">
<div class="col-md-6"> <div class="col-md-6">
<input type="text" class="form-control directory-settings" id="cache_dir" name="cache_dir" value="${config['cache_dir']}"> <input type="text" class="form-control directory-settings" id="cache_dir" name="cache_dir" value="${config['cache_dir']}" ${docker_setting}>
<div class="btn-group"> <div class="btn-group">
<button class="btn btn-form" type="button" id="clear_cache">Clear All Cache</button> <button class="btn btn-form" type="button" id="clear_cache">Clear All Cache</button>
<button class="btn btn-form" type="button" id="clear_image_cache">Clear Image Cache</button> <button class="btn btn-form" type="button" id="clear_image_cache">Clear Image Cache</button>
@@ -1291,6 +1316,7 @@
</%def> </%def>
<%def name="modalIncludes()"> <%def name="modalIncludes()">
<div id="queue-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="queue-modal"></div>
<div id="guidelines-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="guidelines-modal"> <div id="guidelines-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="guidelines-modal">
<div class="modal-dialog" role="document"> <div class="modal-dialog" role="document">
<div class="modal-content"> <div class="modal-content">
@@ -1506,7 +1532,7 @@
<div style="padding-bottom: 10px;"> <div style="padding-bottom: 10px;">
<p class="help-block"> <p class="help-block">
All text inside <span class="inline-pre">&lt;show&gt;&lt;/show&gt;</span>/<span class="inline-pre">&lt;season&gt;&lt;/season&gt;</span>/<span class="inline-pre">&lt;episode&gt;&lt;/episode&gt;</span> All text inside <span class="inline-pre">&lt;show&gt;&lt;/show&gt;</span>/<span class="inline-pre">&lt;season&gt;&lt;/season&gt;</span>/<span class="inline-pre">&lt;episode&gt;&lt;/episode&gt;</span>
tags will only be sent when the media type is show/season/episode. tags will only be sent when the media type is show, season, or episode, respectively.
</p> </p>
<p><strong style="color: #fff;">Example:</strong></p> <p><strong style="color: #fff;">Example:</strong></p>
<pre>{show_name}&lt;season&gt; - Season {season_num}&lt;/season&gt;&lt;episode&gt; - S{season_num}E{episode_num} - {episode_name}&lt;/episode&gt; was recently added to Plex.</pre> <pre>{show_name}&lt;season&gt; - Season {season_num}&lt;/season&gt;&lt;episode&gt; - S{season_num}E{episode_num} - {episode_name}&lt;/episode&gt; was recently added to Plex.</pre>
@@ -1517,7 +1543,7 @@
<div> <div>
<p class="help-block"> <p class="help-block">
All text inside <span class="inline-pre">&lt;artist&gt;&lt;/artist&gt;</span>/<span class="inline-pre">&lt;album&gt;&lt;/album&gt;</span>/<span class="inline-pre">&lt;track&gt;&lt;/track&gt;</span> All text inside <span class="inline-pre">&lt;artist&gt;&lt;/artist&gt;</span>/<span class="inline-pre">&lt;album&gt;&lt;/album&gt;</span>/<span class="inline-pre">&lt;track&gt;&lt;/track&gt;</span>
tags will only be sent when the media type is artist/album/track. tags will only be sent when the media type is artist, album, or track, respectively.
</p> </p>
<p><strong style="color: #fff;">Example:</strong></p> <p><strong style="color: #fff;">Example:</strong></p>
<pre>{artist_name}&lt;album&gt; - {album_name}&lt;/album&gt;&lt;track&gt; - {album_name} - {track_name}&lt;/track&gt; was recently added to Plex.</pre> <pre>{artist_name}&lt;album&gt; - {album_name}&lt;/album&gt;&lt;track&gt; - {album_name} - {track_name}&lt;/track&gt; was recently added to Plex.</pre>
@@ -1562,7 +1588,7 @@
<div> <div>
<h4>List Slicing</h4> <h4>List Slicing</h4>
</div> </div>
<div> <div style="padding-bottom: 10px;">
<p class="help-block"> <p class="help-block">
Notification parameters which have a list of items can be sliced with a slice formatter <span class="inline-pre">:[X:Y]</span> to limit the number of items. Notification parameters which have a list of items can be sliced with a slice formatter <span class="inline-pre">:[X:Y]</span> to limit the number of items.
Note: the first item in the list is numbered <span class="inline-pre">0</span>. Note: the first item in the list is numbered <span class="inline-pre">0</span>.
@@ -1573,6 +1599,41 @@
{actors:[2:]} --> Only the 3rd to last actors (Actors: 2, 3, 4, ...) {actors:[2:]} --> Only the 3rd to last actors (Actors: 2, 3, 4, ...)
{actors:[1:5]} --> Only the 2nd to 5th actors (Actors: 1, 2, 3, 4)</pre> {actors:[1:5]} --> Only the 2nd to 5th actors (Actors: 1, 2, 3, 4)</pre>
</div> </div>
<div>
<h4>Prefix and Suffix</h4>
</div>
<div style="padding-bottom: 10px;">
<p class="help-block">
A prefix or a suffix can be added to the notification parameters using <span class="inline-pre">Prefix&lt;</span> and <span class="inline-pre">&gt;Suffix</span>.
If the notification parameter is unavailable, the prefix or suffix will not be displayed.
</p>
<p><strong style="color: #fff;">Example:</strong></p>
<pre>{rating} --> 8.9
{Rating: &lt;rating} --> Rating: 8.9
{rating&gt;/10} --> 8.9/10
{Rating: &lt;rating&gt;/10} --> Rating: 8.9/10</pre>
<p><strong style="color: #fff;">Example with unavailable parameter:</strong></p>
<pre>{rating} -->
Rating: {rating}/10 --> Rating: /10
{Rating: &lt;rating&gt;/10} --> </pre>
</div>
<div>
<h4>Combined</h4>
</div>
<div>
<p class="help-block">
If combining multiple notification text modifiers, the order of the modifiers must be:
</p>
<ol class="help-block">
<li>Prefix</li>
<li>Parameter</li>
<li>Case Modifier</li>
<li>List Slicing</li>
<li>Suffix</li>
</ol>
<p><strong style="color: #fff;">Example:</strong></p>
<pre>{Starring &lt;actors!c:[0]&gt; as the main character.} --> Starring Arnold Schwarzenegger as the main character.</pre>
</div>
</div> </div>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
@@ -1594,7 +1655,7 @@
<div class="modal-body"> <div class="modal-body">
<div> <div>
<p class="help-block"> <p class="help-block">
If the value for a selected parameter cannot be provided, it will display as blank. If the value for a selected parameter is unavailable, it will display as blank.
</p> </p>
% for category in common.NEWSLETTER_PARAMETERS: % for category in common.NEWSLETTER_PARAMETERS:
<table class="notification-params"> <table class="notification-params">
@@ -1920,7 +1981,7 @@ $(document).ready(function() {
$('#menu_link_update_check').click(function() { $('#menu_link_update_check').click(function() {
$(this).html('<i class="fa fa-spin fa-refresh"></i> Checking').prop('disabled', true); $(this).html('<i class="fa fa-spin fa-refresh"></i> Checking').prop('disabled', true);
checkUpdate(function () { checkUpdate(function () {
$('#menu_link_update_check').html('<i class="fa fa-arrow-circle-up"></i> Check for Updates') $('#menu_link_update_check').html('<i class="fa fa-arrow-alt-circle-up"></i> Check for Updates')
.prop('disabled', false); .prop('disabled', false);
}); });
}); });
@@ -2053,7 +2114,7 @@ $(document).ready(function() {
} }
}); });
var $select_pms = $('#pms_ip').selectize({ var $select_pms = $('#pms_ip_selectize').selectize({
createOnBlur: true, createOnBlur: true,
openOnFocus: true, openOnFocus: true,
maxItems: 1, maxItems: 1,
@@ -2064,13 +2125,19 @@ $(document).ready(function() {
dropdownParent: '#selectize-pms-ip-container', dropdownParent: '#selectize-pms-ip-container',
render: { render: {
item: function (item, escape) { item: function (item, escape) {
if (!item.label) {
$.extend(item,
$(this.revertSettings.$children)
.filter('[value="' + item.value + '"]').data()
);
}
var label = item.label || item.value; var label = item.label || item.value;
var caption = item.label ? item.value : null; var caption = item.label ? item.ip : null;
return '<div data-ssl="' + item.httpsRequired + return '<div data-identifier="' + item.clientIdentifier +
'" data-local="' + item.local +
'" data-identifier="' + item.clientIdentifier +
'" data-ip="' + item.ip + '" data-ip="' + item.ip +
'" data-port="' + item.port + '" data-port="' + item.port +
'" data-local="' + item.local +
'" data-ssl="' + item.httpsRequired +
'" data-is_cloud="' + item.is_cloud + '" data-is_cloud="' + item.is_cloud +
'" data-label="' + item.label + '">' + '" data-label="' + item.label + '">' +
'<span class="item-text">' + escape(label) + '</span>' + '<span class="item-text">' + escape(label) + '</span>' +
@@ -2080,11 +2147,11 @@ $(document).ready(function() {
option: function (item, escape) { option: function (item, escape) {
var label = item.label || item.value; var label = item.label || item.value;
var caption = item.label ? item.value : null; var caption = item.label ? item.value : null;
return '<div data-ssl="' + item.httpsRequired + return '<div data-identifier="' + item.clientIdentifier +
'" data-local="' + item.local +
'" data-identifier="' + item.clientIdentifier +
'" data-ip="' + item.ip + '" data-ip="' + item.ip +
'" data-port="' + item.port + '" data-port="' + item.port +
'" data-local="' + item.local +
'" data-ssl="' + item.httpsRequired +
'" data-is_cloud="' + item.is_cloud + '" data-is_cloud="' + item.is_cloud +
'" data-label="' + item.label + '">' + '" data-label="' + item.label + '">' +
escape(label) + escape(label) +
@@ -2095,15 +2162,24 @@ $(document).ready(function() {
create: function(input) { create: function(input) {
return {label: '', value: input}; return {label: '', value: input};
}, },
onInitialize: function () {
var s = this;
this.revertSettings.$children.each(function () {
$.extend(s.options[this.value], $(this).data());
});
},
onChange: function (item) { onChange: function (item) {
var pms_ip_selected = this.getItem(item)[0]; var pms_ip_selected = this.getItem(item)[0];
var identifier = $(pms_ip_selected).data('identifier'); var identifier = $(pms_ip_selected).data('identifier');
var ip = $(pms_ip_selected).data('ip');
var port = $(pms_ip_selected).data('port'); var port = $(pms_ip_selected).data('port');
var local = $(pms_ip_selected).data('local'); var local = $(pms_ip_selected).data('local');
var ssl = $(pms_ip_selected).data('ssl'); var ssl = $(pms_ip_selected).data('ssl');
var is_cloud = $(pms_ip_selected).data('is_cloud'); var is_cloud = $(pms_ip_selected).data('is_cloud');
var value = $(pms_ip_selected).data('value');
$("#pms_identifier").val(identifier !== 'undefined' ? identifier : ''); $("#pms_identifier").val(identifier !== 'undefined' ? identifier : '');
$('#pms_ip').val(ip !== 'undefined' ? ip : value);
$('#pms_port').val(port !== 'undefined' ? port : 32400); $('#pms_port').val(port !== 'undefined' ? port : 32400);
$('#pms_is_remote_checkbox').prop('checked', (local !== 'undefined' && local === 0)); $('#pms_is_remote_checkbox').prop('checked', (local !== 'undefined' && local === 0));
$('#pms_is_remote').val(local !== 'undefined' && local === 0 ? 1 : 0); $('#pms_is_remote').val(local !== 'undefined' && local === 0 ? 1 : 0);
@@ -2128,9 +2204,10 @@ $(document).ready(function() {
}, },
success: function (result) { success: function (result) {
if (result) { if (result) {
var existing_value = $('#pms_ip').val(); var existing_ip = $('#pms_ip').val();
var existing_port = $('#pms_port').val();
result.forEach(function (item) { result.forEach(function (item) {
if (item.value === existing_value) { if (item.ip === existing_ip && item.port === existing_port) {
select_pms.updateOption(item.value, item); select_pms.updateOption(item.value, item);
} else { } else {
select_pms.addOption(item); select_pms.addOption(item);
@@ -2259,6 +2336,7 @@ $(document).ready(function() {
$("#token_verify").html('<i class="fa fa-refresh fa-spin"></i>').fadeIn('fast'); $("#token_verify").html('<i class="fa fa-refresh fa-spin"></i>').fadeIn('fast');
} }
function OAuthSuccessCallback(authToken) { function OAuthSuccessCallback(authToken) {
var x_plex_headers = getPlexHeaders();
$("#pms_token").val(authToken); $("#pms_token").val(authToken);
$("#pms_uuid").val(x_plex_headers['X-Plex-Client-Identifier']); $("#pms_uuid").val(x_plex_headers['X-Plex-Client-Identifier']);
$("#token_verify").html('<i class="fa fa-check"></i>').fadeIn('fast'); $("#token_verify").html('<i class="fa fa-check"></i>').fadeIn('fast');
@@ -2488,8 +2566,10 @@ $(document).ready(function() {
.prop('selected', selected)); .prop('selected', selected));
} }
var download_url = 'https://plex.tv/api/downloads/' + (plex_update_channel === 'plexpass' ? '5' : '1') + '.json?channel=' + plex_update_channel;
$.ajax({ $.ajax({
url: 'https://plex.tv/api/downloads/1.json?channel=' + plex_update_channel, url: download_url,
type: 'GET', type: 'GET',
dataType: 'json', dataType: 'json',
beforeSend: function (xhr) { beforeSend: function (xhr) {

View File

@@ -230,7 +230,7 @@ DOCUMENTATION :: END
<tbody> <tbody>
<tr> <tr>
<td>Codec</td> <td>Codec</td>
<td>${data['stream_subtitle_codec'].upper()}</td> <td>${data['stream_subtitle_codec'].upper() or '-'}</td>
<td>${data['subtitle_codec'].upper()}</td> <td>${data['subtitle_codec'].upper()}</td>
</tr> </tr>
</tbody> </tbody>

View File

@@ -183,6 +183,7 @@ DOCUMENTATION :: END
async: true, async: true,
data: { data: {
query: query_string, query: query_string,
limit: 30,
media_type: '${query["media_type"]}', media_type: '${query["media_type"]}',
season_index: '${query["parent_media_index"]}' season_index: '${query["parent_media_index"]}'
}, },
@@ -203,8 +204,8 @@ DOCUMENTATION :: END
$('#confirm-modal-update').modal(); $('#confirm-modal-update').modal();
$('#confirm-modal-update').one('click', '#confirm-update', function () { $('#confirm-modal-update').one('click', '#confirm-update', function () {
$(this).prop('disabled', true); $(this).prop('disabled', true);
var msg = '<i class="fa fa-refresh fa-spin"></i>&nbspUpdating database...' var msg = '<i class="fa fa-refresh fa-spin"></i>&nbsp; Updating database...';
showMsg(msg, false, false, 0) showMsg(msg, false, false, 0);
$.ajax({ $.ajax({
url: 'update_metadata_details', url: 'update_metadata_details',

View File

@@ -156,17 +156,17 @@ DOCUMENTATION :: END
</div> </div>
% endif % endif
<div class="btn-group" data-toggle="buttons" id="media_type-selection"> <div class="btn-group" data-toggle="buttons" id="media_type-selection">
<label class="btn btn-dark active"> <label class="btn btn-dark">
<input type="radio" name="media_type-filter" id="history-all" value="" autocomplete="off"> All <input type="radio" name="media_type-filter" id="history-all" value="all" autocomplete="off"> All
</label> </label>
<label class="btn btn-dark"> <label class="btn btn-dark">
<input type="radio" name="media_type-filter" id="history-movies" value="movie" autocomplete="off"> Movies <input type="radio" name="media_type-filter" id="history-movie" value="movie" autocomplete="off"> Movies
</label> </label>
<label class="btn btn-dark"> <label class="btn btn-dark">
<input type="radio" name="media_type-filter" id="history-tv_shows" value="episode" autocomplete="off"> TV Shows <input type="radio" name="media_type-filter" id="history-episode" value="episode" autocomplete="off"> TV Shows
</label> </label>
<label class="btn btn-dark"> <label class="btn btn-dark">
<input type="radio" name="media_type-filter" id="history-music" value="track" autocomplete="off"> Music <input type="radio" name="media_type-filter" id="history-track" value="track" autocomplete="off"> Music
</label> </label>
</div> </div>
<div class="btn-group"> <div class="btn-group">
@@ -274,12 +274,12 @@ DOCUMENTATION :: END
<table class="display user_ip_table" id="user_ip_table-UID-${data['user_id']}" width="100%"> <table class="display user_ip_table" id="user_ip_table-UID-${data['user_id']}" width="100%">
<thead> <thead>
<tr> <tr>
<th align="left">Last Seen</th> <th align="left" id="last_seen">Last Seen</th>
<th align="left">IP Address</th> <th align="left" id="ip_address">IP Address</th>
<th align="left">Last Platform</th> <th align="left" id="platform">Last Platform</th>
<th align="left">Last Player</th> <th align="left" id="player">Last Player</th>
<th align="left">Last Played</th> <th align="left" id="last_played">Last Played</th>
<th align="left">Play Count</th> <th align="left" id="play_count">Play Count</th>
</tr> </tr>
</thead> </thead>
</table> </table>
@@ -435,6 +435,7 @@ DOCUMENTATION :: END
selected_filter = $('input[name=media_type-filter]:checked', '#media_type-selection'); selected_filter = $('input[name=media_type-filter]:checked', '#media_type-selection');
$(selected_filter).closest('label').addClass('active'); $(selected_filter).closest('label').addClass('active');
media_type = $(selected_filter).val(); media_type = $(selected_filter).val();
setLocalStorage('user_' + user_id + '-history_media_type', media_type);
history_table.draw(); history_table.draw();
}); });
} }
@@ -494,7 +495,9 @@ DOCUMENTATION :: END
$('a[href="#tabs-history"]').on('shown.bs.tab', function() { $('a[href="#tabs-history"]').on('shown.bs.tab', function() {
if (typeof(history_table) === 'undefined') { if (typeof(history_table) === 'undefined') {
var media_type = null; var media_type = getLocalStorage('user_' + user_id + '-history_media_type', 'all');
$('#history-' + media_type).prop('checked', true);
$('#history-' + media_type).closest('label').addClass('active');
loadHistoryTable(media_type); loadHistoryTable(media_type);
} }
}); });

View File

@@ -52,7 +52,7 @@
<form> <form>
<div class="wizard-card" data-cardname="card1"> <div class="wizard-card" data-cardname="card1">
<div style="float: right;"> <div style="float: right;">
<img src="${http_root}images/logo-tautulli-45.png" height="45" alt="PlexPy"> <img src="${http_root}images/logo-tautulli-45.png" height="45" alt="Tautulli">
</div> </div>
<h3 style="line-height: 50px;">Welcome!</h3> <h3 style="line-height: 50px;">Welcome!</h3>
<div class="wizard-input-section"> <div class="wizard-input-section">
@@ -86,11 +86,21 @@
</p> </p>
</div> </div>
<div class="wizard-input-section"> <div class="wizard-input-section">
<label for="pms_ip">Plex IP or Hostname</label> <label for="pms_ip_selectize">Plex IP Address or Hostname</label>
<div class="row"> <div class="row">
<div class="col-xs-12"> <div class="col-xs-12">
<select class="form-control pms-settings selectize-pms-ip" id="pms_ip" name="pms_ip"> <select class="form-control pms-settings selectize-pms-ip" id="pms_ip_selectize">
<option value="${config['pms_ip']}" selected>${config['pms_ip']}</option> % if config['pms_identifier']:
<option value="${config['pms_ip']}:${config['pms_port']}"
data-identifier="${config['pms_identifier']}"
data-ip="${config['pms_ip']}"
data-port="${config['pms_port']}"
data-local="${int(not int(config['pms_is_remote']))}"
data-ssl="${config['pms_ssl']}"
data-is_cloud="${config['pms_is_cloud']}"
data-label="${config['pms_name'] or 'Local'}"
selected>${config['pms_ip']}</option>
% endif
</select> </select>
</div> </div>
</div> </div>
@@ -120,6 +130,7 @@
</div> </div>
</div> </div>
<input type="hidden" id="pms_valid" data-validate="validatePMSip" value=""> <input type="hidden" id="pms_valid" data-validate="validatePMSip" value="">
<input type="hidden" id="pms_ip" name="pms_ip" value="${config['pms_ip']}">
<input type="hidden" id="pms_is_cloud" name="pms_is_cloud" value="${config['pms_is_cloud']}"> <input type="hidden" id="pms_is_cloud" name="pms_is_cloud" value="${config['pms_is_cloud']}">
<input type="hidden" id="pms_identifier" name="pms_identifier" value="${config['pms_identifier']}"> <input type="hidden" id="pms_identifier" name="pms_identifier" value="${config['pms_identifier']}">
<a class="btn btn-dark" id="verify-plex-server" href="#" role="button">Verify</a> <a class="btn btn-dark" id="verify-plex-server" href="#" role="button">Verify</a>
@@ -314,7 +325,7 @@ $(document).ready(function() {
} }
}); });
var $select_pms = $('#pms_ip').selectize({ var $select_pms = $('#pms_ip_selectize').selectize({
createOnBlur: true, createOnBlur: true,
openOnFocus: true, openOnFocus: true,
maxItems: 1, maxItems: 1,
@@ -324,13 +335,19 @@ $(document).ready(function() {
inputClass: 'form-control selectize-input', inputClass: 'form-control selectize-input',
render: { render: {
item: function (item, escape) { item: function (item, escape) {
if (!item.label) {
$.extend(item,
$(this.revertSettings.$children)
.filter('[value="' + item.value + '"]').data()
);
}
var label = item.label || item.value; var label = item.label || item.value;
var caption = item.label ? item.value : null; var caption = item.label ? item.ip : null;
return '<div data-ssl="' + item.httpsRequired + return '<div data-identifier="' + item.clientIdentifier +
'" data-local="' + item.local +
'" data-identifier="' + item.clientIdentifier +
'" data-ip="' + item.ip + '" data-ip="' + item.ip +
'" data-port="' + item.port + '" data-port="' + item.port +
'" data-local="' + item.local +
'" data-ssl="' + item.httpsRequired +
'" data-is_cloud="' + item.is_cloud + '" data-is_cloud="' + item.is_cloud +
'" data-label="' + item.label + '">' + '" data-label="' + item.label + '">' +
'<span class="item-text">' + escape(label) + '</span>' + '<span class="item-text">' + escape(label) + '</span>' +
@@ -340,11 +357,11 @@ $(document).ready(function() {
option: function (item, escape) { option: function (item, escape) {
var label = item.label || item.value; var label = item.label || item.value;
var caption = item.label ? item.value : null; var caption = item.label ? item.value : null;
return '<div data-ssl="' + item.httpsRequired + return '<div data-identifier="' + item.clientIdentifier +
'" data-local="' + item.local +
'" data-identifier="' + item.clientIdentifier +
'" data-ip="' + item.ip + '" data-ip="' + item.ip +
'" data-port="' + item.port + '" data-port="' + item.port +
'" data-local="' + item.local +
'" data-ssl="' + item.httpsRequired +
'" data-is_cloud="' + item.is_cloud + '" data-is_cloud="' + item.is_cloud +
'" data-label="' + item.label + '">' + '" data-label="' + item.label + '">' +
escape(label) + escape(label) +
@@ -355,18 +372,27 @@ $(document).ready(function() {
create: function(input) { create: function(input) {
return {label: '', value: input}; return {label: '', value: input};
}, },
onInitialize: function () {
var s = this;
this.revertSettings.$children.each(function () {
$.extend(s.options[this.value], $(this).data());
});
},
onChange: function (item) { onChange: function (item) {
var pms_ip_selected = this.getItem(item)[0]; var pms_ip_selected = this.getItem(item)[0];
var identifier = $(pms_ip_selected).data('identifier'); var identifier = $(pms_ip_selected).data('identifier');
var ip = $(pms_ip_selected).data('ip');
var port = $(pms_ip_selected).data('port'); var port = $(pms_ip_selected).data('port');
var local = $(pms_ip_selected).data('local'); var local = $(pms_ip_selected).data('local');
var ssl = $(pms_ip_selected).data('ssl'); var ssl = $(pms_ip_selected).data('ssl');
var is_cloud = $(pms_ip_selected).data('is_cloud'); var is_cloud = $(pms_ip_selected).data('is_cloud');
var value = $(pms_ip_selected).data('value');
$("#pms_valid").val(identifier !== 'undefined' ? 'valid' : ''); $("#pms_valid").val(identifier !== 'undefined' ? 'valid' : '');
$("#pms-verify-status").html(identifier !== 'undefined' ? '<i class="fa fa-check"></i>&nbsp; Server found!' : '').fadeIn('fast'); $("#pms-verify-status").html(identifier !== 'undefined' ? '<i class="fa fa-check"></i>&nbsp; Server found!' : '').fadeIn('fast');
$("#pms_identifier").val(identifier !== 'undefined' ? identifier : ''); $("#pms_identifier").val(identifier !== 'undefined' ? identifier : '');
$('#pms_ip').val(ip !== 'undefined' ? ip : value);
$('#pms_port').val(port !== 'undefined' ? port : 32400); $('#pms_port').val(port !== 'undefined' ? port : 32400);
$('#pms_is_remote_checkbox').prop('checked', (local !== 'undefined' && local === 0)); $('#pms_is_remote_checkbox').prop('checked', (local !== 'undefined' && local === 0));
$('#pms_is_remote').val(local !== 'undefined' && local === 0 ? 1 : 0); $('#pms_is_remote').val(local !== 'undefined' && local === 0 ? 1 : 0);
@@ -399,9 +425,10 @@ $(document).ready(function() {
}, },
success: function (result) { success: function (result) {
if (result) { if (result) {
var existing_value = $('#pms_ip').val(); var existing_ip = $('#pms_ip').val();
var existing_port = $('#pms_port').val();
result.forEach(function (item) { result.forEach(function (item) {
if (item.value === existing_value) { if (item.ip === existing_ip && item.port === existing_port) {
select_pms.updateOption(item.value, item); select_pms.updateOption(item.value, item);
} else { } else {
select_pms.addOption(item); select_pms.addOption(item);

View File

@@ -368,6 +368,7 @@
line-height: 1.2rem; line-height: 1.2rem;
font-size: 0.9rem; font-size: 0.9rem;
padding: 5px; padding: 5px;
max-width: 320px;
} }
.card-info-title a { .card-info-title a {
text-decoration: none; text-decoration: none;
@@ -691,7 +692,7 @@
<img src="${(base_url_image + 'images/libraries/show.png') if base_url_image else 'https://tautulli.com/images/libraries/show.png'}" class="sub-header-icon" width="30" height="30" style="border: none;-ms-interpolation-mode: bicubic;max-width: 100%;height: 30px;width: 30px;vertical-align: middle;margin-right: 5px;margin-bottom: 5px;"> Recently Added TV Shows <img src="${(base_url_image + 'images/libraries/show.png') if base_url_image else 'https://tautulli.com/images/libraries/show.png'}" class="sub-header-icon" width="30" height="30" style="border: none;-ms-interpolation-mode: bicubic;max-width: 100%;height: 30px;width: 30px;vertical-align: middle;margin-right: 5px;margin-bottom: 5px;"> Recently Added TV Shows
</div> </div>
<div class="sub-header-count" style="margin-left: auto;margin-right: auto;font-size: 30px;text-align: center;"> <div class="sub-header-count" style="margin-left: auto;margin-right: auto;font-size: 30px;text-align: center;">
<span class="count" style="color: #E5A00D;">${len(recently_added['show'])}</span> <span class="count-units" style="color: #aaaaaa;font-size: 20px;text-transform: uppercase;">show${'s' if len(recently_added['show']) > 1 else ''}</span> / <span class="count" style="color: #E5A00D;">${len(recently_added['show'])}</span> <span class="count-units" style="color: #aaaaaa;font-size: 20px;text-transform: uppercase;">show${'s' if len(recently_added['show']) > 1 else ''}</span>&nbsp;/&nbsp;
<% total_episodes = sum(season['episode_count'] for show in recently_added['show'] for season in show['season']) %> <% total_episodes = sum(season['episode_count'] for show in recently_added['show'] for season in show['season']) %>
<span class="count" style="color: #E5A00D;">${total_episodes}</span> <span class="count-units" style="color: #aaaaaa;font-size: 20px;text-transform: uppercase;">episode${'s' if total > 1 else ''}</span> <span class="count" style="color: #E5A00D;">${total_episodes}</span> <span class="count-units" style="color: #aaaaaa;font-size: 20px;text-transform: uppercase;">episode${'s' if total > 1 else ''}</span>
</div> </div>
@@ -744,7 +745,7 @@
<td class="card-info-body" style="font-family: 'Open Sans', Helvetica, Arial, sans-serif;font-size: 0.75rem;vertical-align: top;padding: 5px;height: 100%;"> <td class="card-info-body" style="font-family: 'Open Sans', Helvetica, Arial, sans-serif;font-size: 0.75rem;vertical-align: top;padding: 5px;height: 100%;">
<p class="nowrap mb5" style="font-family: 'Open Sans', Helvetica, Arial, sans-serif;font-weight: 400;margin: 0;margin-bottom: 5px;white-space: nowrap;text-overflow: ellipsis;overflow: hidden;max-width: 325px;color: #ffffff;"> <p class="nowrap mb5" style="font-family: 'Open Sans', Helvetica, Arial, sans-serif;font-weight: 400;margin: 0;margin-bottom: 5px;white-space: nowrap;text-overflow: ellipsis;overflow: hidden;max-width: 325px;color: #ffffff;">
% if show['season_count'] > 1: % if show['season_count'] > 1:
<em>${show['season_count']} seasons /</em> <em>${show['season_count']} seasons&nbsp;/&nbsp;</em>
% endif % endif
<% total_show_episodes = sum(s['episode_count'] for s in show['season']) %> <% total_show_episodes = sum(s['episode_count'] for s in show['season']) %>
<em>${total_show_episodes} episode${'s' if total_show_episodes > 1 else ''}</em> <em>${total_show_episodes} episode${'s' if total_show_episodes > 1 else ''}</em>
@@ -952,6 +953,124 @@
</td> </td>
</tr> </tr>
% endif % endif
% if recently_added.get('other_video'):
<tr>
<td class="wrapper" style="font-family: 'Open Sans', Helvetica, Arial, sans-serif;font-size: 14px;vertical-align: top;box-sizing: border-box;padding: 5px;overflow: auto;">
<div class="sub-header-bar" style="margin-left: auto;margin-right: auto;font-size: 30px;text-align: center;width: 200px;border-top: 1px solid #E5A00D;margin-top: 15px;margin-bottom: 25px;"></div>
<div class="sub-header-title" style="margin-left: auto;margin-right: auto;font-size: 30px;text-align: center;font-weight: lighter;">
<img src="${(base_url_image + 'images/libraries/video.png') if base_url_image else 'https://tautulli.com/images/libraries/video.png'}" class="sub-header-icon" width="30" height="30" style="border: none;-ms-interpolation-mode: bicubic;max-width: 100%;height: 30px;width: 30px;vertical-align: middle;margin-right: 5px;margin-bottom: 5px;"> Recently Added Videos
</div>
<div class="sub-header-count" style="margin-left: auto;margin-right: auto;font-size: 30px;text-align: center;">
<span class="count" style="color: #E5A00D;">${len(recently_added['other_video'])}</span> <span class="count-units" style="color: #aaaaaa;font-size: 20px;text-transform: uppercase;">video${'s' if len(recently_added['other_video']) > 1 else ''}</span>
</div>
</td>
</tr>
<tr>
<td style="font-family: 'Open Sans', Helvetica, Arial, sans-serif;font-size: 14px;vertical-align: top;">
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: separate;mso-table-lspace: 0pt;mso-table-rspace: 0pt;width: 100%;">
% for video_a, video_b in grouper(recently_added['other_video'], 2):
<tr>
<td style="font-family: 'Open Sans', Helvetica, Arial, sans-serif;font-size: 14px;vertical-align: top;">
<table border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: separate;mso-table-lspace: 0pt;mso-table-rspace: 0pt;width: 100%;">
<tr>
% for video in (video_a, video_b):
% if video:
% if not video_b:
<td align="center" valign="top" class="card-instance pad" style="font-family: 'Open Sans', Helvetica, Arial, sans-serif;font-size: 12px;vertical-align: top;overflow: hidden;padding: 0 !important;width: 251px !important;min-width: 251px !important;max-width: 251px !important;"></td>
% endif
<td align="center" valign="top" class="card-instance movie" style="font-family: 'Open Sans', Helvetica, Arial, sans-serif;font-size: 12px;vertical-align: top;overflow: hidden;padding: 3px;width: 502px;min-width: 502px;max-width: 502px;height: 233px;">
<table border="0" cellpadding="0" cellspacing="3" width="100%" class="card-background" style="background-image: url(${(base_url_image + video['art_hash']) if base_url_image else video['art_url']});border-collapse: separate;mso-table-lspace: 0pt;mso-table-rspace: 0pt;width: 100%;background-color: #282828;background-position: center;background-size: cover;background-repeat: no-repeat;background-clip: padding-box;border: 1px solid rgba(255,255,255,.1);">
<tr>
<td class="card-poster-container" style="font-family: 'Open Sans', Helvetica, Arial, sans-serif;font-size: 14px;vertical-align: top;width: 152px;min-width: 152px;height: 227px;">
<table border="0" cellpadding="0" cellspacing="0" class="card-poster" style="background-image: url(${(base_url_image + video['thumb_hash']) if base_url_image else video['thumb_url']});border-collapse: separate;mso-table-lspace: 0pt;mso-table-rspace: 0pt;width: 100%;background-color: #3F4245;background-position: center;background-size: cover;background-repeat: no-repeat;background-clip: padding-box;border: 1px solid rgba(255,255,255,.1);">
<tr>
<td style="font-family: 'Open Sans', Helvetica, Arial, sans-serif;font-size: 14px;vertical-align: top;">
<a href="${parameters['pms_web_url']}#!/server/${parameters['pms_identifier']}/details?key=%2Flibrary%2Fmetadata%2F${video['rating_key']}" title="${video['title']}" target="_blank" style="text-decoration: underline;">
<img class="card-poster-overlay" src="${base_url_image + 'images/newsletter/view-on-plex-poster.png' if base_url_image else 'https://tautulli.com/images/newsletter/view-on-plex-poster.png'}" width="150" height="225" style="border: none;-ms-interpolation-mode: bicubic;max-width: 100%;display: block;">
</a>
</td>
</tr>
</table>
</td>
<td class="card-info-container" style="font-family: 'Open Sans', Helvetica, Arial, sans-serif;font-size: 14px;vertical-align: top;padding-left: 4px;text-align: left;height: 227px;">
<table border="0" cellpadding="0" cellspacing="0" class="card-info-container-table" style="border-collapse: separate;mso-table-lspace: 0pt;mso-table-rspace: 0pt;width: 100%;height: 100%;">
<tr>
<td class="card-info-title nowrap" style="font-family: 'Open Sans', Helvetica, Arial, sans-serif;font-size: 0.9rem;vertical-align: top;white-space: nowrap;text-overflow: ellipsis;overflow: hidden;border-bottom: 1px solid rgba(255, 255, 255, .1);line-height: 1.2rem;padding: 5px;max-width: 320px;">
<a href="${parameters['pms_web_url']}#!/server/${parameters['pms_identifier']}/details?key=%2Flibrary%2Fmetadata%2F${video['rating_key']}" title="${video['title']}" target="_blank" style="text-decoration: none;color: #ffffff;">${video['title']}</a>
</td>
</tr>
<tr>
<td class="card-info-body" style="font-family: 'Open Sans', Helvetica, Arial, sans-serif;font-size: 0.75rem;vertical-align: top;padding: 5px;height: 100%;">
% if video['tagline']:
<p class="nowrap mb5" style="font-family: 'Open Sans', Helvetica, Arial, sans-serif;font-weight: 400;margin: 0;margin-bottom: 5px;white-space: nowrap;text-overflow: ellipsis;overflow: hidden;max-width: 325px;color: #ffffff;">
<em>${video['tagline']}</em>
</p>
% endif
<p style="font-family: 'Open Sans', Helvetica, Arial, sans-serif;font-weight: 400;margin: 0;max-width: 325px;color: #ffffff;">
${video['summary'][:450] + (video['summary'][450:] and '...')}
</p>
</td>
</tr>
<tr>
<td class="card-info-footer nowrap" style="font-family: 'Open Sans', Helvetica, Arial, sans-serif;font-size: 0.6rem;vertical-align: top;white-space: nowrap;text-overflow: ellipsis;overflow: hidden;padding-top: 0px;padding-right: 5px;padding-bottom: 5px;padding-left: 5px;">
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: separate;mso-table-lspace: 0pt;mso-table-rspace: 0pt;width: 100%;">
<tr>
<td class="badge-container" style="font-family: 'Open Sans', Helvetica, Arial, sans-serif;font-size: 14px;vertical-align: top;max-width: 260px;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: separate;mso-table-lspace: 0pt;mso-table-rspace: 0pt;width: 100%;">
<tr>
% if video['year']:
<td class="badge" title="${video['year']}" style="font-family: 'Open Sans', Helvetica, Arial, sans-serif;font-size: 11px;vertical-align: middle;display: inline-block;min-width: 10px;margin-right: 4px;padding: 3px 7px;line-height: 1;text-align: center;white-space: nowrap;background-color: rgba(0, 0, 0, .25);border-radius: 2px;text-overflow: ellipsis;overflow: hidden;color: #ffffff;">${video['year']}</td>
% endif
% if video['duration']:
<% duration = int(int(video['duration'])/60000) %>
<td class="badge" title="${duration} mins" style="font-family: 'Open Sans', Helvetica, Arial, sans-serif;font-size: 11px;vertical-align: middle;display: inline-block;min-width: 10px;margin-right: 4px;padding: 3px 7px;line-height: 1;text-align: center;white-space: nowrap;background-color: rgba(0, 0, 0, .25);border-radius: 2px;text-overflow: ellipsis;overflow: hidden;color: #ffffff;">${duration} mins</td>
% endif
% if video['genres']:
% for genre in video['genres'][:]:
<td class="badge" title="${genre}" style="font-family: 'Open Sans', Helvetica, Arial, sans-serif;font-size: 11px;vertical-align: middle;display: inline-block;min-width: 10px;margin-right: 4px;padding: 3px 7px;line-height: 1;text-align: center;white-space: nowrap;background-color: rgba(0, 0, 0, .25);border-radius: 2px;text-overflow: ellipsis;overflow: hidden;color: #ffffff;">${genre}</td>
% endfor
% endif
</tr>
</table>
</td>
% if video['rating']:
<% rating = int(round(float(video['rating']) / 2)) %>
<td class="star-rating-container" title="${int(float(video['rating'])/0.1)}%" align="right" style="font-family: 'Open Sans', Helvetica, Arial, sans-serif;font-size: 14px;vertical-align: top;width: 65px;">
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: separate;mso-table-lspace: 0pt;mso-table-rspace: 0pt;width: 100%;">
<tr>
% for _ in range(rating):
<td class="star-rating full" style="font-family: 'Open Sans', Helvetica, Arial, sans-serif;font-size: 0.8rem;vertical-align: bottom;margin-left: 4px;line-height: 1rem;width: 0.5rem;display: inline-block;color: #E5A00D;">&#9733;</td>
% endfor
% for _ in range(5-rating):
<td class="star-rating empty" style="font-family: 'Open Sans', Helvetica, Arial, sans-serif;font-size: 0.8rem;vertical-align: bottom;margin-left: 4px;line-height: 1rem;width: 0.5rem;display: inline-block;color: #aaaaaa;">&#9734;</td>
% endfor
</tr>
</table>
</td>
% endif
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
% if not video_b:
<td align="center" valign="top" class="card-instance pad" style="font-family: 'Open Sans', Helvetica, Arial, sans-serif;font-size: 12px;vertical-align: top;overflow: hidden;padding: 0 !important;width: 251px !important;min-width: 251px !important;max-width: 251px !important;"></td>
% endif
% endif
% endfor
</tr>
</table>
</td>
</tr>
% endfor
</table>
</td>
</tr>
% endif
<tr> <tr>
<td class="footer" style="font-family: 'Open Sans', Helvetica, Arial, sans-serif;font-size: 12px;vertical-align: top;clear: both;margin-top: 10px;text-align: center;width: 100%;"> <td class="footer" style="font-family: 'Open Sans', Helvetica, Arial, sans-serif;font-size: 12px;vertical-align: top;clear: both;margin-top: 10px;text-align: center;width: 100%;">
<div class="footer-bar" style="margin-left: auto;margin-right: auto;width: 200px;border-top: 1px solid #E5A00D;margin-top: 25px;"></div> <div class="footer-bar" style="margin-left: auto;margin-right: auto;width: 200px;border-top: 1px solid #E5A00D;margin-top: 25px;"></div>

View File

@@ -692,7 +692,7 @@
<img src="${(base_url_image + 'images/libraries/show.png') if base_url_image else 'https://tautulli.com/images/libraries/show.png'}" class="sub-header-icon" width="30" height="30"/> Recently Added TV Shows <img src="${(base_url_image + 'images/libraries/show.png') if base_url_image else 'https://tautulli.com/images/libraries/show.png'}" class="sub-header-icon" width="30" height="30"/> Recently Added TV Shows
</div> </div>
<div class="sub-header-count"> <div class="sub-header-count">
<span class="count">${len(recently_added['show'])}</span> <span class="count-units">show${'s' if len(recently_added['show']) > 1 else ''}</span> / <span class="count">${len(recently_added['show'])}</span> <span class="count-units">show${'s' if len(recently_added['show']) > 1 else ''}</span>&nbsp;/&nbsp;
<% total_episodes = sum(season['episode_count'] for show in recently_added['show'] for season in show['season']) %> <% total_episodes = sum(season['episode_count'] for show in recently_added['show'] for season in show['season']) %>
<span class="count">${total_episodes}</span> <span class="count-units">episode${'s' if total > 1 else ''}</span> <span class="count">${total_episodes}</span> <span class="count-units">episode${'s' if total > 1 else ''}</span>
</div> </div>
@@ -745,7 +745,7 @@
<td class="card-info-body"> <td class="card-info-body">
<p class="nowrap mb5"> <p class="nowrap mb5">
% if show['season_count'] > 1: % if show['season_count'] > 1:
<em>${show['season_count']} seasons /</em> <em>${show['season_count']} seasons&nbsp;/&nbsp;</em>
% endif % endif
<% total_show_episodes = sum(s['episode_count'] for s in show['season']) %> <% total_show_episodes = sum(s['episode_count'] for s in show['season']) %>
<em>${total_show_episodes} episode${'s' if total_show_episodes > 1 else ''}</em> <em>${total_show_episodes} episode${'s' if total_show_episodes > 1 else ''}</em>
@@ -953,6 +953,124 @@
</td> </td>
</tr> </tr>
% endif % endif
% if recently_added.get('other_video'):
<tr>
<td class="wrapper">
<div class="sub-header-bar"></div>
<div class="sub-header-title">
<img src="${(base_url_image + 'images/libraries/video.png') if base_url_image else 'https://tautulli.com/images/libraries/video.png'}" class="sub-header-icon" width="30" height="30"/> Recently Added Videos
</div>
<div class="sub-header-count">
<span class="count">${len(recently_added['other_video'])}</span> <span class="count-units">video${'s' if len(recently_added['other_video']) > 1 else ''}</span>
</div>
</td>
</tr>
<tr>
<td>
<table border="0" cellpadding="0" cellspacing="0">
% for video_a, video_b in grouper(recently_added['other_video'], 2):
<tr>
<td>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
% for video in (video_a, video_b):
% if video:
% if not video_b:
<td align="center" valign="top" class="card-instance pad"></td>
% endif
<td align="center" valign="top" class="card-instance movie">
<table border="0" cellpadding="0" cellspacing="3" width="100%" class="card-background" style="background-image: url(${(base_url_image + video['art_hash']) if base_url_image else video['art_url']});">
<tr>
<td class="card-poster-container">
<table border="0" cellpadding="0" cellspacing="0" class="card-poster" style="background-image: url(${(base_url_image + video['thumb_hash']) if base_url_image else video['thumb_url']})">
<tr>
<td>
<a href="${parameters['pms_web_url']}#!/server/${parameters['pms_identifier']}/details?key=%2Flibrary%2Fmetadata%2F${video['rating_key']}" title="${video['title']}" target="_blank">
<img class="card-poster-overlay" src="${base_url_image + 'images/newsletter/view-on-plex-poster.png' if base_url_image else 'https://tautulli.com/images/newsletter/view-on-plex-poster.png'}" width="150" height="225">
</a>
</td>
</tr>
</table>
</td>
<td class="card-info-container">
<table border="0" cellpadding="0" cellspacing="0" class="card-info-container-table">
<tr>
<td class="card-info-title nowrap">
<a href="${parameters['pms_web_url']}#!/server/${parameters['pms_identifier']}/details?key=%2Flibrary%2Fmetadata%2F${video['rating_key']}" title="${video['title']}" target="_blank">${video['title']}</a>
</td>
</tr>
<tr>
<td class="card-info-body">
% if video['tagline']:
<p class="nowrap mb5">
<em>${video['tagline']}</em>
</p>
% endif
<p>
${video['summary'][:450] + (video['summary'][450:] and '...')}
</p>
</td>
</tr>
<tr>
<td class="card-info-footer nowrap">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td class="badge-container">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
% if video['year']:
<td class="badge" title="${video['year']}">${video['year']}</td>
% endif
% if video['duration']:
<% duration = int(int(video['duration'])/60000) %>
<td class="badge" title="${duration} mins">${duration} mins</td>
% endif
% if video['genres']:
% for genre in video['genres'][:]:
<td class="badge" title="${genre}">${genre}</td>
% endfor
% endif
</tr>
</table>
</td>
% if video['rating']:
<% rating = int(round(float(video['rating']) / 2)) %>
<td class="star-rating-container" title="${int(float(video['rating'])/0.1)}%" align="right">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
% for _ in range(rating):
<td class="star-rating full">&#9733;</td>
% endfor
% for _ in range(5-rating):
<td class="star-rating empty">&#9734;</td>
% endfor
</tr>
</table>
</td>
% endif
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
% if not video_b:
<td align="center" valign="top" class="card-instance pad"></td>
% endif
% endif
% endfor
</tr>
</table>
</td>
</tr>
% endfor
</table>
</td>
</tr>
% endif
<tr> <tr>
<td class="footer"> <td class="footer">
<div class="footer-bar"></div> <div class="footer-bar"></div>

0
init-scripts/init.fedora.centos.service Normal file → Executable file
View File

View File

@@ -4,51 +4,61 @@
# #
# INSTALLATION NOTES # INSTALLATION NOTES
# #
# 1. Rename this file as you want, ensuring that it ends in .service # 1. Copy this file into your systemd service unit directory (often '/lib/systemd/system')
# e.g. 'tautulli.service' # and name it 'tautulli.service' with the following command:
# cp /opt/Tautulli/init-scripts/init.systemd /lib/systemd/system/tautulli.service
# #
# 2. Adjust configuration settings as required. More details in the # 2. Edit the new tautulli.service file with configuration settings as required.
# "CONFIGURATION NOTES" section shown below. # More details in the "CONFIGURATION NOTES" section shown below.
# #
# 3. Copy this file into your systemd service unit directory, which is # 3. Enable boot-time autostart with the following commands:
# often '/lib/systemd/system'.
#
# 4. Enable boot-time autostart with the following commands:
# systemctl daemon-reload # systemctl daemon-reload
# systemctl enable tautulli.service # systemctl enable tautulli.service
# #
# 5. Start now with the following command: # 4. Start now with the following command:
# systemctl start tautulli.service # systemctl start tautulli.service
# #
# CONFIGURATION NOTES # CONFIGURATION NOTES
# #
# - The example settings in this file assume that you will run Tautulli as user: tautulli # - The example settings in this file assume that you will run Tautulli as user: tautulli
# - To create this user and give it ownership of the tautulli directory: # - The example settings in this file assume that Tautulli is installed to: /opt/Tautulli
# sudo adduser --system --no-create-home tautulli #
# sudo chown tautulli:nogroup -R /opt/Tautulli # - To create this user and give it ownership of the Tautulli directory:
# # 1. Create the user:
# - Option names (e.g. ExecStart=, Type=) appear to be case-sensitive) # Ubuntu/Debian: sudo addgroup tautulli && sudo adduser --system --no-create-home tautulli --ingroup tautulli
# CentOS/Fedora: sudo adduser --system --no-create-home tautulli
# 2. Give the user ownership of the Tautulli directory:
# sudo chown tautulli:tautulli -R /opt/Tautulli
# #
# - Adjust ExecStart= to point to: # - Adjust ExecStart= to point to:
# 1. Your Tautulli executable, # 1. Your Tautulli executable
# - Default: /opt/Tautulli/Tautulli.py
# 2. Your config file (recommended is to put it somewhere in /etc) # 2. Your config file (recommended is to put it somewhere in /etc)
# - Default: --config /opt/Tautulli/config.ini
# 3. Your datadir (recommended is to NOT put it in your Tautulli exec dir) # 3. Your datadir (recommended is to NOT put it in your Tautulli exec dir)
# - Default: --datadir /opt/Tautulli
# #
# - Adjust User= and Group= to the user/group you want Tautulli to run as. # - Adjust User= and Group= to the user/group you want Tautulli to run as.
# #
# - WantedBy= specifies which target (i.e. runlevel) to start Tautulli for. # - WantedBy= specifies which target (i.e. runlevel) to start Tautulli for.
# multi-user.target equates to runlevel 3 (multi-user text mode) # multi-user.target equates to runlevel 3 (multi-user text mode)
# graphical.target equates to runlevel 5 (multi-user X11 graphical mode) # graphical.target equates to runlevel 5 (multi-user X11 graphical mode)
[Unit] [Unit]
Description=Tautulli - Stats for Plex Media Server usage Description=Tautulli - Stats for Plex Media Server usage
Wants=network-online.target
After=network-online.target
[Service] [Service]
ExecStart=/opt/Tautulli/Tautulli.py --quiet --daemon --nolaunch --config /opt/Tautulli/config.ini --datadir /opt/Tautulli ExecStart=/opt/Tautulli/Tautulli.py --config /opt/Tautulli/config.ini --datadir /opt/Tautulli --quiet --daemon --nolaunch
GuessMainPID=no GuessMainPID=no
Type=forking Type=forking
User=tautulli User=tautulli
Group=nogroup Group=tautulli
Restart=on-abnormal
RestartSec=5
StartLimitInterval=90
StartLimitBurst=3
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target

View File

@@ -1,127 +0,0 @@
# Copyright (c) 2009 Raymond Hettinger
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
# (the "Software"), to deal in the Software without restriction,
# including without limitation the rights to use, copy, modify, merge,
# publish, distribute, sublicense, and/or sell copies of the Software,
# and to permit persons to whom the Software is furnished to do so,
# subject to the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
from UserDict import DictMixin
class OrderedDict(dict, DictMixin):
def __init__(self, *args, **kwds):
if len(args) > 1:
raise TypeError('expected at most 1 arguments, got %d' % len(args))
try:
self.__end
except AttributeError:
self.clear()
self.update(*args, **kwds)
def clear(self):
self.__end = end = []
end += [None, end, end] # sentinel node for doubly linked list
self.__map = {} # key --> [key, prev, next]
dict.clear(self)
def __setitem__(self, key, value):
if key not in self:
end = self.__end
curr = end[1]
curr[2] = end[1] = self.__map[key] = [key, curr, end]
dict.__setitem__(self, key, value)
def __delitem__(self, key):
dict.__delitem__(self, key)
key, prev, next = self.__map.pop(key)
prev[2] = next
next[1] = prev
def __iter__(self):
end = self.__end
curr = end[2]
while curr is not end:
yield curr[0]
curr = curr[2]
def __reversed__(self):
end = self.__end
curr = end[1]
while curr is not end:
yield curr[0]
curr = curr[1]
def popitem(self, last=True):
if not self:
raise KeyError('dictionary is empty')
if last:
key = reversed(self).next()
else:
key = iter(self).next()
value = self.pop(key)
return key, value
def __reduce__(self):
items = [[k, self[k]] for k in self]
tmp = self.__map, self.__end
del self.__map, self.__end
inst_dict = vars(self).copy()
self.__map, self.__end = tmp
if inst_dict:
return (self.__class__, (items,), inst_dict)
return self.__class__, (items,)
def keys(self):
return list(self)
setdefault = DictMixin.setdefault
update = DictMixin.update
pop = DictMixin.pop
values = DictMixin.values
items = DictMixin.items
iterkeys = DictMixin.iterkeys
itervalues = DictMixin.itervalues
iteritems = DictMixin.iteritems
def __repr__(self):
if not self:
return '%s()' % (self.__class__.__name__,)
return '%s(%r)' % (self.__class__.__name__, self.items())
def copy(self):
return self.__class__(self)
@classmethod
def fromkeys(cls, iterable, value=None):
d = cls()
for key in iterable:
d[key] = value
return d
def __eq__(self, other):
if isinstance(other, OrderedDict):
if len(self) != len(other):
return False
for p, q in zip(self.items(), other.items()):
if p != q:
return False
return True
return dict.__eq__(self, other)
def __ne__(self, other):
return not self == other

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,4 @@
Copyright (c) 2003-2009 Stuart Bishop <stuart@stuartbishop.net> Copyright (c) 2003-2018 Stuart Bishop <stuart@stuartbishop.net>
Permission is hereby granted, free of charge, to any person obtaining a Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"), copy of this software and associated documentation files (the "Software"),

View File

@@ -87,13 +87,13 @@ localized time using the standard ``astimezone()`` method:
Unfortunately using the tzinfo argument of the standard datetime Unfortunately using the tzinfo argument of the standard datetime
constructors ''does not work'' with pytz for many timezones. constructors ''does not work'' with pytz for many timezones.
>>> datetime(2002, 10, 27, 12, 0, 0, tzinfo=amsterdam).strftime(fmt) >>> datetime(2002, 10, 27, 12, 0, 0, tzinfo=amsterdam).strftime(fmt) # /!\ Does not work this way!
'2002-10-27 12:00:00 LMT+0020' '2002-10-27 12:00:00 LMT+0020'
It is safe for timezones without daylight saving transitions though, such It is safe for timezones without daylight saving transitions though, such
as UTC: as UTC:
>>> datetime(2002, 10, 27, 12, 0, 0, tzinfo=pytz.utc).strftime(fmt) >>> datetime(2002, 10, 27, 12, 0, 0, tzinfo=pytz.utc).strftime(fmt) # /!\ Not recommended except for UTC
'2002-10-27 12:00:00 UTC+0000' '2002-10-27 12:00:00 UTC+0000'
The preferred way of dealing with times is to always work in UTC, The preferred way of dealing with times is to always work in UTC,
@@ -134,19 +134,21 @@ section for more details)
>>> dt2.strftime(fmt) >>> dt2.strftime(fmt)
'2002-10-27 01:30:00 EST-0500' '2002-10-27 01:30:00 EST-0500'
Converting between timezones also needs special attention. We also need Converting between timezones is more easily done, using the
to use the ``normalize()`` method to ensure the conversion is correct. standard astimezone method.
>>> utc_dt = utc.localize(datetime.utcfromtimestamp(1143408899)) >>> utc_dt = utc.localize(datetime.utcfromtimestamp(1143408899))
>>> utc_dt.strftime(fmt) >>> utc_dt.strftime(fmt)
'2006-03-26 21:34:59 UTC+0000' '2006-03-26 21:34:59 UTC+0000'
>>> au_tz = timezone('Australia/Sydney') >>> au_tz = timezone('Australia/Sydney')
>>> au_dt = au_tz.normalize(utc_dt.astimezone(au_tz)) >>> au_dt = utc_dt.astimezone(au_tz)
>>> au_dt.strftime(fmt) >>> au_dt.strftime(fmt)
'2006-03-27 08:34:59 AEDT+1100' '2006-03-27 08:34:59 AEDT+1100'
>>> utc_dt2 = utc.normalize(au_dt.astimezone(utc)) >>> utc_dt2 = au_dt.astimezone(utc)
>>> utc_dt2.strftime(fmt) >>> utc_dt2.strftime(fmt)
'2006-03-26 21:34:59 UTC+0000' '2006-03-26 21:34:59 UTC+0000'
>>> utc_dt == utc_dt2
True
You can take shortcuts when dealing with the UTC side of timezone You can take shortcuts when dealing with the UTC side of timezone
conversions. ``normalize()`` and ``localize()`` are not really conversions. ``normalize()`` and ``localize()`` are not really
@@ -178,7 +180,7 @@ parameter to the ``utcoffset()``, ``dst()`` && ``tzname()`` methods.
>>> ambiguous = datetime(2009, 10, 31, 23, 30) >>> ambiguous = datetime(2009, 10, 31, 23, 30)
The ``is_dst`` parameter is ignored for most timestamps. It is only used The ``is_dst`` parameter is ignored for most timestamps. It is only used
during DST transition ambiguous periods to resulve that ambiguity. during DST transition ambiguous periods to resolve that ambiguity.
>>> tz.utcoffset(normal, is_dst=True) >>> tz.utcoffset(normal, is_dst=True)
datetime.timedelta(-1, 77400) datetime.timedelta(-1, 77400)
@@ -261,7 +263,7 @@ pytz custom syntax, the best you can do is make an educated guess:
As you can see, the system has chosen one for you and there is a 50% As you can see, the system has chosen one for you and there is a 50%
chance of it being out by one hour. For some applications, this does chance of it being out by one hour. For some applications, this does
not matter. However, if you are trying to schedule meetings with people not matter. However, if you are trying to schedule meetings with people
in different timezones or analyze log files it is not acceptable. in different timezones or analyze log files it is not acceptable.
The best and simplest solution is to stick with using UTC. The pytz The best and simplest solution is to stick with using UTC. The pytz
package encourages using UTC for internal timezone representation by package encourages using UTC for internal timezone representation by
@@ -472,9 +474,9 @@ True
True True
>>> 'Canada/Eastern' in common_timezones >>> 'Canada/Eastern' in common_timezones
True True
>>> 'US/Pacific-New' in all_timezones >>> 'Australia/Yancowinna' in all_timezones
True True
>>> 'US/Pacific-New' in common_timezones >>> 'Australia/Yancowinna' in common_timezones
False False
Both ``common_timezones`` and ``all_timezones`` are alphabetically Both ``common_timezones`` and ``all_timezones`` are alphabetically
@@ -510,6 +512,15 @@ Europe/Zurich
Europe/Zurich Europe/Zurich
Internationalization - i18n/l10n
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Pytz is an interface to the IANA database, which uses ASCII names. The `Unicode Consortium's Unicode Locales (CLDR) <http://cldr.unicode.org>`_
project provides translations. Thomas Khyn's
`l18n <https://pypi.org/project/l18n/>`_ package can be used to access
these translations from Python.
License License
~~~~~~~ ~~~~~~~
@@ -527,12 +538,13 @@ Latest Versions
This package will be updated after releases of the Olson timezone This package will be updated after releases of the Olson timezone
database. The latest version can be downloaded from the `Python Package database. The latest version can be downloaded from the `Python Package
Index <http://pypi.python.org/pypi/pytz/>`_. The code that is used Index <https://pypi.org/project/pytz/>`_. The code that is used
to generate this distribution is hosted on launchpad.net and available to generate this distribution is hosted on launchpad.net and available
using the `Bazaar version control system <http://bazaar-vcs.org>`_ using git::
using::
bzr branch lp:pytz git clone https://git.launchpad.net/pytz
A mirror on github is also available at https://github.com/stub42/pytz
Announcements of new releases are made on Announcements of new releases are made on
`Launchpad <https://launchpad.net/pytz>`_, and the `Launchpad <https://launchpad.net/pytz>`_, and the
@@ -543,7 +555,7 @@ hosted there.
Bugs, Feature Requests & Patches Bugs, Feature Requests & Patches
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Bugs can be reported using `Launchpad <https://bugs.launchpad.net/pytz>`_. Bugs can be reported using `Launchpad <https://bugs.launchpad.net/pytz>`__.
Issues & Limitations Issues & Limitations

View File

@@ -8,12 +8,25 @@ See the datetime section of the Python Library Reference for information
on how to use these modules. on how to use these modules.
''' '''
import sys
import datetime
import os.path
from pytz.exceptions import AmbiguousTimeError
from pytz.exceptions import InvalidTimeError
from pytz.exceptions import NonExistentTimeError
from pytz.exceptions import UnknownTimeZoneError
from pytz.lazy import LazyDict, LazyList, LazySet
from pytz.tzinfo import unpickler, BaseTzInfo
from pytz.tzfile import build_tzinfo
# The IANA (nee Olson) database is updated several times a year. # The IANA (nee Olson) database is updated several times a year.
OLSON_VERSION = '2016f' OLSON_VERSION = '2018f'
VERSION = '2016.6.1' # Switching to pip compatible version numbering. VERSION = '2018.6' # pip compatible version number.
__version__ = VERSION __version__ = VERSION
OLSEN_VERSION = OLSON_VERSION # Old releases had this misspelling OLSEN_VERSION = OLSON_VERSION # Old releases had this misspelling
__all__ = [ __all__ = [
'timezone', 'utc', 'country_timezones', 'country_names', 'timezone', 'utc', 'country_timezones', 'country_names',
@@ -21,23 +34,11 @@ __all__ = [
'NonExistentTimeError', 'UnknownTimeZoneError', 'NonExistentTimeError', 'UnknownTimeZoneError',
'all_timezones', 'all_timezones_set', 'all_timezones', 'all_timezones_set',
'common_timezones', 'common_timezones_set', 'common_timezones', 'common_timezones_set',
] 'BaseTzInfo',
]
import sys, datetime, os.path, gettext
from pytz.exceptions import AmbiguousTimeError
from pytz.exceptions import InvalidTimeError
from pytz.exceptions import NonExistentTimeError
from pytz.exceptions import UnknownTimeZoneError
from pytz.lazy import LazyDict, LazyList, LazySet
from pytz.tzinfo import unpickler
from pytz.tzfile import build_tzinfo, _byte_string
try: if sys.version_info[0] > 2: # Python 3.x
unicode
except NameError: # Python 3.x
# Python 3.x doesn't have unicode(), making writing code # Python 3.x doesn't have unicode(), making writing code
# for Python 2.3 and Python 3.x a pain. # for Python 2.3 and Python 3.x a pain.
@@ -52,10 +53,13 @@ except NameError: # Python 3.x
... ...
UnicodeEncodeError: ... UnicodeEncodeError: ...
""" """
s.encode('ASCII') # Raise an exception if not ASCII if type(s) == bytes:
return s # But return the original string - not a byte string. s = s.decode('ASCII')
else:
s.encode('ASCII') # Raise an exception if not ASCII
return s # But the string - not a byte string.
else: # Python 2.x else: # Python 2.x
def ascii(s): def ascii(s):
r""" r"""
@@ -76,24 +80,31 @@ def open_resource(name):
Uses the pkg_resources module if available and no standard file Uses the pkg_resources module if available and no standard file
found at the calculated location. found at the calculated location.
It is possible to specify different location for zoneinfo
subdir by using the PYTZ_TZDATADIR environment variable.
""" """
name_parts = name.lstrip('/').split('/') name_parts = name.lstrip('/').split('/')
for part in name_parts: for part in name_parts:
if part == os.path.pardir or os.path.sep in part: if part == os.path.pardir or os.path.sep in part:
raise ValueError('Bad path segment: %r' % part) raise ValueError('Bad path segment: %r' % part)
filename = os.path.join(os.path.dirname(__file__), zoneinfo_dir = os.environ.get('PYTZ_TZDATADIR', None)
'zoneinfo', *name_parts) if zoneinfo_dir is not None:
if not os.path.exists(filename): filename = os.path.join(zoneinfo_dir, *name_parts)
# http://bugs.launchpad.net/bugs/383171 - we avoid using this else:
# unless absolutely necessary to help when a broken version of filename = os.path.join(os.path.dirname(__file__),
# pkg_resources is installed. 'zoneinfo', *name_parts)
try: if not os.path.exists(filename):
from pkg_resources import resource_stream # http://bugs.launchpad.net/bugs/383171 - we avoid using this
except ImportError: # unless absolutely necessary to help when a broken version of
resource_stream = None # pkg_resources is installed.
try:
from pkg_resources import resource_stream
except ImportError:
resource_stream = None
if resource_stream is not None: if resource_stream is not None:
return resource_stream(__name__, 'zoneinfo/' + name) return resource_stream(__name__, 'zoneinfo/' + name)
return open(filename, 'rb') return open(filename, 'rb')
@@ -106,23 +117,9 @@ def resource_exists(name):
return False return False
# Enable this when we get some translations?
# We want an i18n API that is useful to programs using Python's gettext
# module, as well as the Zope3 i18n package. Perhaps we should just provide
# the POT file and translations, and leave it up to callers to make use
# of them.
#
# t = gettext.translation(
# 'pytz', os.path.join(os.path.dirname(__file__), 'locales'),
# fallback=True
# )
# def _(timezone_name):
# """Translate a timezone name using the current locale, returning Unicode"""
# return t.ugettext(timezone_name)
_tzinfo_cache = {} _tzinfo_cache = {}
def timezone(zone): def timezone(zone):
r''' Return a datetime.tzinfo implementation for the given timezone r''' Return a datetime.tzinfo implementation for the given timezone
@@ -192,7 +189,7 @@ ZERO = datetime.timedelta(0)
HOUR = datetime.timedelta(hours=1) HOUR = datetime.timedelta(hours=1)
class UTC(datetime.tzinfo): class UTC(BaseTzInfo):
"""UTC """UTC
Optimized UTC implementation. It unpickles using the single module global Optimized UTC implementation. It unpickles using the single module global
@@ -288,7 +285,6 @@ def _p(*args):
_p.__safe_for_unpickling__ = True _p.__safe_for_unpickling__ = True
class _CountryTimezoneDict(LazyDict): class _CountryTimezoneDict(LazyDict):
"""Map ISO 3166 country code to a list of timezone names commonly used """Map ISO 3166 country code to a list of timezone names commonly used
in that country. in that country.
@@ -374,7 +370,7 @@ country_names = _CountryNameDict()
class _FixedOffset(datetime.tzinfo): class _FixedOffset(datetime.tzinfo):
zone = None # to match the standard pytz API zone = None # to match the standard pytz API
def __init__(self, minutes): def __init__(self, minutes):
if abs(minutes) >= 1440: if abs(minutes) >= 1440:
@@ -412,24 +408,24 @@ class _FixedOffset(datetime.tzinfo):
return dt.astimezone(self) return dt.astimezone(self)
def FixedOffset(offset, _tzinfos = {}): def FixedOffset(offset, _tzinfos={}):
"""return a fixed-offset timezone based off a number of minutes. """return a fixed-offset timezone based off a number of minutes.
>>> one = FixedOffset(-330) >>> one = FixedOffset(-330)
>>> one >>> one
pytz.FixedOffset(-330) pytz.FixedOffset(-330)
>>> one.utcoffset(datetime.datetime.now()) >>> str(one.utcoffset(datetime.datetime.now()))
datetime.timedelta(-1, 66600) '-1 day, 18:30:00'
>>> one.dst(datetime.datetime.now()) >>> str(one.dst(datetime.datetime.now()))
datetime.timedelta(0) '0:00:00'
>>> two = FixedOffset(1380) >>> two = FixedOffset(1380)
>>> two >>> two
pytz.FixedOffset(1380) pytz.FixedOffset(1380)
>>> two.utcoffset(datetime.datetime.now()) >>> str(two.utcoffset(datetime.datetime.now()))
datetime.timedelta(0, 82800) '23:00:00'
>>> two.dst(datetime.datetime.now()) >>> str(two.dst(datetime.datetime.now()))
datetime.timedelta(0) '0:00:00'
The datetime.timedelta must be between the range of -1 and 1 day, The datetime.timedelta must be between the range of -1 and 1 day,
non-inclusive. non-inclusive.
@@ -482,14 +478,13 @@ FixedOffset.__safe_for_unpickling__ = True
def _test(): def _test():
import doctest, os, sys import doctest
sys.path.insert(0, os.pardir) sys.path.insert(0, os.pardir)
import pytz import pytz
return doctest.testmod(pytz) return doctest.testmod(pytz)
if __name__ == '__main__': if __name__ == '__main__':
_test() _test()
all_timezones = \ all_timezones = \
['Africa/Abidjan', ['Africa/Abidjan',
'Africa/Accra', 'Africa/Accra',
@@ -676,6 +671,7 @@ all_timezones = \
'America/Porto_Acre', 'America/Porto_Acre',
'America/Porto_Velho', 'America/Porto_Velho',
'America/Puerto_Rico', 'America/Puerto_Rico',
'America/Punta_Arenas',
'America/Rainy_River', 'America/Rainy_River',
'America/Rankin_Inlet', 'America/Rankin_Inlet',
'America/Recife', 'America/Recife',
@@ -731,6 +727,7 @@ all_timezones = \
'Asia/Aqtobe', 'Asia/Aqtobe',
'Asia/Ashgabat', 'Asia/Ashgabat',
'Asia/Ashkhabad', 'Asia/Ashkhabad',
'Asia/Atyrau',
'Asia/Baghdad', 'Asia/Baghdad',
'Asia/Bahrain', 'Asia/Bahrain',
'Asia/Baku', 'Asia/Baku',
@@ -751,6 +748,7 @@ all_timezones = \
'Asia/Dili', 'Asia/Dili',
'Asia/Dubai', 'Asia/Dubai',
'Asia/Dushanbe', 'Asia/Dushanbe',
'Asia/Famagusta',
'Asia/Gaza', 'Asia/Gaza',
'Asia/Harbin', 'Asia/Harbin',
'Asia/Hebron', 'Asia/Hebron',
@@ -816,6 +814,7 @@ all_timezones = \
'Asia/Vientiane', 'Asia/Vientiane',
'Asia/Vladivostok', 'Asia/Vladivostok',
'Asia/Yakutsk', 'Asia/Yakutsk',
'Asia/Yangon',
'Asia/Yekaterinburg', 'Asia/Yekaterinburg',
'Asia/Yerevan', 'Asia/Yerevan',
'Atlantic/Azores', 'Atlantic/Azores',
@@ -861,7 +860,6 @@ all_timezones = \
'CST6CDT', 'CST6CDT',
'Canada/Atlantic', 'Canada/Atlantic',
'Canada/Central', 'Canada/Central',
'Canada/East-Saskatchewan',
'Canada/Eastern', 'Canada/Eastern',
'Canada/Mountain', 'Canada/Mountain',
'Canada/Newfoundland', 'Canada/Newfoundland',
@@ -955,6 +953,7 @@ all_timezones = \
'Europe/Samara', 'Europe/Samara',
'Europe/San_Marino', 'Europe/San_Marino',
'Europe/Sarajevo', 'Europe/Sarajevo',
'Europe/Saratov',
'Europe/Simferopol', 'Europe/Simferopol',
'Europe/Skopje', 'Europe/Skopje',
'Europe/Sofia', 'Europe/Sofia',
@@ -1072,7 +1071,6 @@ all_timezones = \
'US/Michigan', 'US/Michigan',
'US/Mountain', 'US/Mountain',
'US/Pacific', 'US/Pacific',
'US/Pacific-New',
'US/Samoa', 'US/Samoa',
'UTC', 'UTC',
'Universal', 'Universal',
@@ -1252,6 +1250,7 @@ common_timezones = \
'America/Port_of_Spain', 'America/Port_of_Spain',
'America/Porto_Velho', 'America/Porto_Velho',
'America/Puerto_Rico', 'America/Puerto_Rico',
'America/Punta_Arenas',
'America/Rainy_River', 'America/Rainy_River',
'America/Rankin_Inlet', 'America/Rankin_Inlet',
'America/Recife', 'America/Recife',
@@ -1301,6 +1300,7 @@ common_timezones = \
'Asia/Aqtau', 'Asia/Aqtau',
'Asia/Aqtobe', 'Asia/Aqtobe',
'Asia/Ashgabat', 'Asia/Ashgabat',
'Asia/Atyrau',
'Asia/Baghdad', 'Asia/Baghdad',
'Asia/Bahrain', 'Asia/Bahrain',
'Asia/Baku', 'Asia/Baku',
@@ -1317,6 +1317,7 @@ common_timezones = \
'Asia/Dili', 'Asia/Dili',
'Asia/Dubai', 'Asia/Dubai',
'Asia/Dushanbe', 'Asia/Dushanbe',
'Asia/Famagusta',
'Asia/Gaza', 'Asia/Gaza',
'Asia/Hebron', 'Asia/Hebron',
'Asia/Ho_Chi_Minh', 'Asia/Ho_Chi_Minh',
@@ -1351,7 +1352,6 @@ common_timezones = \
'Asia/Pyongyang', 'Asia/Pyongyang',
'Asia/Qatar', 'Asia/Qatar',
'Asia/Qyzylorda', 'Asia/Qyzylorda',
'Asia/Rangoon',
'Asia/Riyadh', 'Asia/Riyadh',
'Asia/Sakhalin', 'Asia/Sakhalin',
'Asia/Samarkand', 'Asia/Samarkand',
@@ -1372,6 +1372,7 @@ common_timezones = \
'Asia/Vientiane', 'Asia/Vientiane',
'Asia/Vladivostok', 'Asia/Vladivostok',
'Asia/Yakutsk', 'Asia/Yakutsk',
'Asia/Yangon',
'Asia/Yekaterinburg', 'Asia/Yekaterinburg',
'Asia/Yerevan', 'Asia/Yerevan',
'Atlantic/Azores', 'Atlantic/Azores',
@@ -1444,6 +1445,7 @@ common_timezones = \
'Europe/Samara', 'Europe/Samara',
'Europe/San_Marino', 'Europe/San_Marino',
'Europe/Sarajevo', 'Europe/Sarajevo',
'Europe/Saratov',
'Europe/Simferopol', 'Europe/Simferopol',
'Europe/Skopje', 'Europe/Skopje',
'Europe/Sofia', 'Europe/Sofia',
@@ -1489,7 +1491,6 @@ common_timezones = \
'Pacific/Guadalcanal', 'Pacific/Guadalcanal',
'Pacific/Guam', 'Pacific/Guam',
'Pacific/Honolulu', 'Pacific/Honolulu',
'Pacific/Johnston',
'Pacific/Kiritimati', 'Pacific/Kiritimati',
'Pacific/Kosrae', 'Pacific/Kosrae',
'Pacific/Kwajalein', 'Pacific/Kwajalein',

View File

@@ -5,7 +5,7 @@ Custom exceptions raised by pytz.
__all__ = [ __all__ = [
'UnknownTimeZoneError', 'InvalidTimeError', 'AmbiguousTimeError', 'UnknownTimeZoneError', 'InvalidTimeError', 'AmbiguousTimeError',
'NonExistentTimeError', 'NonExistentTimeError',
] ]
class UnknownTimeZoneError(KeyError): class UnknownTimeZoneError(KeyError):

View File

@@ -1,8 +1,11 @@
from threading import RLock from threading import RLock
try: try:
from UserDict import DictMixin from collections.abc import Mapping as DictMixin
except ImportError: except ImportError: # Python < 3.3
from collections import Mapping as DictMixin try:
from UserDict import DictMixin # Python 2
except ImportError: # Python 3.0-3.3
from collections import Mapping as DictMixin
# With lazy loading, we might end up with multiple threads triggering # With lazy loading, we might end up with multiple threads triggering
@@ -13,6 +16,7 @@ _fill_lock = RLock()
class LazyDict(DictMixin): class LazyDict(DictMixin):
"""Dictionary populated on first use.""" """Dictionary populated on first use."""
data = None data = None
def __getitem__(self, key): def __getitem__(self, key):
if self.data is None: if self.data is None:
_fill_lock.acquire() _fill_lock.acquire()

View File

@@ -5,17 +5,28 @@ Used for testing against as they are only correct for the years
''' '''
from datetime import tzinfo, timedelta, datetime from datetime import tzinfo, timedelta, datetime
from pytz import utc, UTC, HOUR, ZERO from pytz import HOUR, ZERO, UTC
__all__ = [
'FixedOffset',
'LocalTimezone',
'USTimeZone',
'Eastern',
'Central',
'Mountain',
'Pacific',
'UTC'
]
# A class building tzinfo objects for fixed-offset time zones. # A class building tzinfo objects for fixed-offset time zones.
# Note that FixedOffset(0, "UTC") is a different way to build a # Note that FixedOffset(0, "UTC") is a different way to build a
# UTC tzinfo object. # UTC tzinfo object.
class FixedOffset(tzinfo): class FixedOffset(tzinfo):
"""Fixed offset in minutes east from UTC.""" """Fixed offset in minutes east from UTC."""
def __init__(self, offset, name): def __init__(self, offset, name):
self.__offset = timedelta(minutes = offset) self.__offset = timedelta(minutes=offset)
self.__name = name self.__name = name
def utcoffset(self, dt): def utcoffset(self, dt):
@@ -27,18 +38,19 @@ class FixedOffset(tzinfo):
def dst(self, dt): def dst(self, dt):
return ZERO return ZERO
# A class capturing the platform's idea of local time.
import time as _time import time as _time
STDOFFSET = timedelta(seconds = -_time.timezone) STDOFFSET = timedelta(seconds=-_time.timezone)
if _time.daylight: if _time.daylight:
DSTOFFSET = timedelta(seconds = -_time.altzone) DSTOFFSET = timedelta(seconds=-_time.altzone)
else: else:
DSTOFFSET = STDOFFSET DSTOFFSET = STDOFFSET
DSTDIFF = DSTOFFSET - STDOFFSET DSTDIFF = DSTOFFSET - STDOFFSET
# A class capturing the platform's idea of local time.
class LocalTimezone(tzinfo): class LocalTimezone(tzinfo):
def utcoffset(self, dt): def utcoffset(self, dt):
@@ -66,7 +78,6 @@ class LocalTimezone(tzinfo):
Local = LocalTimezone() Local = LocalTimezone()
# A complete implementation of current DST rules for major US time zones.
def first_sunday_on_or_after(dt): def first_sunday_on_or_after(dt):
days_to_go = 6 - dt.weekday() days_to_go = 6 - dt.weekday()
@@ -74,12 +85,15 @@ def first_sunday_on_or_after(dt):
dt += timedelta(days_to_go) dt += timedelta(days_to_go)
return dt return dt
# In the US, DST starts at 2am (standard time) on the first Sunday in April. # In the US, DST starts at 2am (standard time) on the first Sunday in April.
DSTSTART = datetime(1, 4, 1, 2) DSTSTART = datetime(1, 4, 1, 2)
# and ends at 2am (DST time; 1am standard time) on the last Sunday of Oct. # and ends at 2am (DST time; 1am standard time) on the last Sunday of Oct.
# which is the first Sunday on or after Oct 25. # which is the first Sunday on or after Oct 25.
DSTEND = datetime(1, 10, 25, 1) DSTEND = datetime(1, 10, 25, 1)
# A complete implementation of current DST rules for major US time zones.
class USTimeZone(tzinfo): class USTimeZone(tzinfo):
def __init__(self, hours, reprname, stdname, dstname): def __init__(self, hours, reprname, stdname, dstname):
@@ -120,8 +134,7 @@ class USTimeZone(tzinfo):
else: else:
return ZERO return ZERO
Eastern = USTimeZone(-5, "Eastern", "EST", "EDT") Eastern = USTimeZone(-5, "Eastern", "EST", "EDT")
Central = USTimeZone(-6, "Central", "CST", "CDT") Central = USTimeZone(-6, "Central", "CST", "CDT")
Mountain = USTimeZone(-7, "Mountain", "MST", "MDT") Mountain = USTimeZone(-7, "Mountain", "MST", "MDT")
Pacific = USTimeZone(-8, "Pacific", "PST", "PDT") Pacific = USTimeZone(-8, "Pacific", "PST", "PDT")

View File

@@ -3,38 +3,37 @@
$Id: tzfile.py,v 1.8 2004/06/03 00:15:24 zenzen Exp $ $Id: tzfile.py,v 1.8 2004/06/03 00:15:24 zenzen Exp $
''' '''
try: from datetime import datetime
from cStringIO import StringIO
except ImportError:
from io import StringIO
from datetime import datetime, timedelta
from struct import unpack, calcsize from struct import unpack, calcsize
from pytz.tzinfo import StaticTzInfo, DstTzInfo, memorized_ttinfo from pytz.tzinfo import StaticTzInfo, DstTzInfo, memorized_ttinfo
from pytz.tzinfo import memorized_datetime, memorized_timedelta 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('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('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'
head_size = calcsize(head_fmt) head_size = calcsize(head_fmt)
(magic, format, ttisgmtcnt, ttisstdcnt,leapcnt, timecnt, (magic, format, ttisgmtcnt, ttisstdcnt, leapcnt, timecnt,
typecnt, charcnt) = unpack(head_fmt, fp.read(head_size)) typecnt, charcnt) = unpack(head_fmt, fp.read(head_size))
# Make sure it is a tzfile(5) file # Make sure it is a tzfile(5) file
assert magic == _byte_string('TZif'), 'Got magic %s' % repr(magic) assert magic == _byte_string('TZif'), 'Got magic %s' % repr(magic)
# Read out the transition times, localtime indices and ttinfo structures. # Read out the transition times, localtime indices and ttinfo structures.
data_fmt = '>%(timecnt)dl %(timecnt)dB %(ttinfo)s %(charcnt)ds' % dict( data_fmt = '>%(timecnt)dl %(timecnt)dB %(ttinfo)s %(charcnt)ds' % dict(
timecnt=timecnt, ttinfo='lBB'*typecnt, charcnt=charcnt) timecnt=timecnt, ttinfo='lBB' * typecnt, charcnt=charcnt)
data_size = calcsize(data_fmt) data_size = calcsize(data_fmt)
data = unpack(data_fmt, fp.read(data_size)) data = unpack(data_fmt, fp.read(data_size))
@@ -53,7 +52,7 @@ def build_tzinfo(zone, fp):
i = 0 i = 0
while i < len(ttinfo_raw): while i < len(ttinfo_raw):
# have we looked up this timezone name yet? # have we looked up this timezone name yet?
tzname_offset = ttinfo_raw[i+2] tzname_offset = ttinfo_raw[i + 2]
if tzname_offset not in tznames: if tzname_offset not in tznames:
nul = tznames_raw.find(_NULL, tzname_offset) nul = tznames_raw.find(_NULL, tzname_offset)
if nul < 0: if nul < 0:
@@ -61,12 +60,12 @@ def build_tzinfo(zone, fp):
tznames[tzname_offset] = _std_string( tznames[tzname_offset] = _std_string(
tznames_raw[tzname_offset:nul]) tznames_raw[tzname_offset:nul])
ttinfo.append((ttinfo_raw[i], ttinfo.append((ttinfo_raw[i],
bool(ttinfo_raw[i+1]), bool(ttinfo_raw[i + 1]),
tznames[tzname_offset])) tznames[tzname_offset]))
i += 3 i += 3
# Now build the timezone object # Now build the timezone object
if len(ttinfo) ==1 or 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,
@@ -91,21 +90,21 @@ def build_tzinfo(zone, fp):
if not inf[1]: if not inf[1]:
dst = 0 dst = 0
else: else:
for j in range(i-1, -1, -1): for j in range(i - 1, -1, -1):
prev_inf = ttinfo[lindexes[j]] prev_inf = ttinfo[lindexes[j]]
if not prev_inf[1]: if not prev_inf[1]:
break break
dst = inf[0] - prev_inf[0] # dst offset dst = inf[0] - prev_inf[0] # dst offset
# Bad dst? Look further. DST > 24 hours happens when # Bad dst? Look further. DST > 24 hours happens when
# a timzone has moved across the international dateline. # a timzone has moved across the international dateline.
if dst <= 0 or dst > 3600*3: if dst <= 0 or dst > 3600 * 3:
for j in range(i+1, len(transitions)): for j in range(i + 1, len(transitions)):
stdinf = ttinfo[lindexes[j]] stdinf = ttinfo[lindexes[j]]
if not stdinf[1]: if not stdinf[1]:
dst = inf[0] - stdinf[0] dst = inf[0] - stdinf[0]
if dst > 0: if dst > 0:
break # Found a useful std time. break # Found a useful std time.
tzname = inf[2] tzname = inf[2]
@@ -129,9 +128,7 @@ if __name__ == '__main__':
from pprint import pprint from pprint import pprint
base = os.path.join(os.path.dirname(__file__), 'zoneinfo') base = os.path.join(os.path.dirname(__file__), 'zoneinfo')
tz = build_tzinfo('Australia/Melbourne', tz = build_tzinfo('Australia/Melbourne',
open(os.path.join(base,'Australia','Melbourne'), 'rb')) open(os.path.join(base, 'Australia', 'Melbourne'), 'rb'))
tz = build_tzinfo('US/Eastern', tz = build_tzinfo('US/Eastern',
open(os.path.join(base,'US','Eastern'), 'rb')) open(os.path.join(base, 'US', 'Eastern'), 'rb'))
pprint(tz._utc_transition_times) pprint(tz._utc_transition_times)
#print tz.asPython(4)
#print tz.transitions_mapping

View File

@@ -13,6 +13,8 @@ from pytz.exceptions import AmbiguousTimeError, NonExistentTimeError
__all__ = [] __all__ = []
_timedelta_cache = {} _timedelta_cache = {}
def memorized_timedelta(seconds): def memorized_timedelta(seconds):
'''Create only one instance of each distinct timedelta''' '''Create only one instance of each distinct timedelta'''
try: try:
@@ -24,6 +26,8 @@ def memorized_timedelta(seconds):
_epoch = datetime.utcfromtimestamp(0) _epoch = datetime.utcfromtimestamp(0)
_datetime_cache = {0: _epoch} _datetime_cache = {0: _epoch}
def memorized_datetime(seconds): def memorized_datetime(seconds):
'''Create only one instance of each distinct datetime''' '''Create only one instance of each distinct datetime'''
try: try:
@@ -36,21 +40,24 @@ def memorized_datetime(seconds):
return dt return dt
_ttinfo_cache = {} _ttinfo_cache = {}
def memorized_ttinfo(*args): def memorized_ttinfo(*args):
'''Create only one instance of each distinct tuple''' '''Create only one instance of each distinct tuple'''
try: try:
return _ttinfo_cache[args] return _ttinfo_cache[args]
except KeyError: except KeyError:
ttinfo = ( ttinfo = (
memorized_timedelta(args[0]), memorized_timedelta(args[0]),
memorized_timedelta(args[1]), memorized_timedelta(args[1]),
args[2] args[2]
) )
_ttinfo_cache[args] = ttinfo _ttinfo_cache[args] = ttinfo
return ttinfo return ttinfo
_notime = memorized_timedelta(0) _notime = memorized_timedelta(0)
def _to_seconds(td): def _to_seconds(td):
'''Convert a timedelta to seconds''' '''Convert a timedelta to seconds'''
return td.seconds + td.days * 24 * 60 * 60 return td.seconds + td.days * 24 * 60 * 60
@@ -154,14 +161,20 @@ class DstTzInfo(BaseTzInfo):
timezone definition. timezone definition.
''' '''
# Overridden in subclass # Overridden in subclass
_utc_transition_times = None # Sorted list of DST transition times in UTC
_transition_info = None # [(utcoffset, dstoffset, tzname)] corresponding # Sorted list of DST transition times, UTC
# to _utc_transition_times entries _utc_transition_times = None
# [(utcoffset, dstoffset, tzname)] corresponding to
# _utc_transition_times entries
_transition_info = None
zone = None zone = None
# Set in __init__ # Set in __init__
_tzinfos = None _tzinfos = None
_dst = None # DST offset _dst = None # DST offset
def __init__(self, _inf=None, _tzinfos=None): def __init__(self, _inf=None, _tzinfos=None):
if _inf: if _inf:
@@ -170,7 +183,8 @@ class DstTzInfo(BaseTzInfo):
else: else:
_tzinfos = {} _tzinfos = {}
self._tzinfos = _tzinfos self._tzinfos = _tzinfos
self._utcoffset, self._dst, self._tzname = self._transition_info[0] self._utcoffset, self._dst, self._tzname = (
self._transition_info[0])
_tzinfos[self._transition_info[0]] = self _tzinfos[self._transition_info[0]] = self
for inf in self._transition_info[1:]: for inf in self._transition_info[1:]:
if inf not in _tzinfos: if inf not in _tzinfos:
@@ -178,8 +192,8 @@ class DstTzInfo(BaseTzInfo):
def fromutc(self, dt): def fromutc(self, dt):
'''See datetime.tzinfo.fromutc''' '''See datetime.tzinfo.fromutc'''
if (dt.tzinfo is not None if (dt.tzinfo is not None and
and getattr(dt.tzinfo, '_tzinfos', None) is not self._tzinfos): getattr(dt.tzinfo, '_tzinfos', None) is not self._tzinfos):
raise ValueError('fromutc: dt.tzinfo is not self') raise ValueError('fromutc: dt.tzinfo is not self')
dt = dt.replace(tzinfo=None) dt = dt.replace(tzinfo=None)
idx = max(0, bisect_right(self._utc_transition_times, dt) - 1) idx = max(0, bisect_right(self._utc_transition_times, dt) - 1)
@@ -337,8 +351,8 @@ class DstTzInfo(BaseTzInfo):
# obtain the correct timezone by winding the clock back. # obtain the correct timezone by winding the clock back.
else: else:
return self.localize( return self.localize(
dt - timedelta(hours=6), is_dst=False) + timedelta(hours=6) dt - timedelta(hours=6),
is_dst=False) + timedelta(hours=6)
# If we get this far, we have multiple possible timezones - this # If we get this far, we have multiple possible timezones - this
# is an ambiguous case occuring during the end-of-DST transition. # is an ambiguous case occuring during the end-of-DST transition.
@@ -351,9 +365,8 @@ class DstTzInfo(BaseTzInfo):
# Filter out the possiblilities that don't match the requested # Filter out the possiblilities that don't match the requested
# is_dst # is_dst
filtered_possible_loc_dt = [ filtered_possible_loc_dt = [
p for p in possible_loc_dt p for p in possible_loc_dt if bool(p.tzinfo._dst) == is_dst
if bool(p.tzinfo._dst) == is_dst ]
]
# Hopefully we only have one possibility left. Return it. # Hopefully we only have one possibility left. Return it.
if len(filtered_possible_loc_dt) == 1: if len(filtered_possible_loc_dt) == 1:
@@ -372,9 +385,10 @@ class DstTzInfo(BaseTzInfo):
# Choose the earliest (by UTC) applicable timezone if is_dst=True # Choose the earliest (by UTC) applicable timezone if is_dst=True
# Choose the latest (by UTC) applicable timezone if is_dst=False # Choose the latest (by UTC) applicable timezone if is_dst=False
# i.e., behave like end-of-DST transition # i.e., behave like end-of-DST transition
dates = {} # utc -> local dates = {} # utc -> local
for local_dt in filtered_possible_loc_dt: for local_dt in filtered_possible_loc_dt:
utc_time = local_dt.replace(tzinfo=None) - local_dt.tzinfo._utcoffset utc_time = (
local_dt.replace(tzinfo=None) - local_dt.tzinfo._utcoffset)
assert utc_time not in dates assert utc_time not in dates
dates[utc_time] = local_dt dates[utc_time] = local_dt
return dates[[min, max][not is_dst](dates)] return dates[[min, max][not is_dst](dates)]
@@ -389,11 +403,11 @@ class DstTzInfo(BaseTzInfo):
>>> tz = timezone('America/St_Johns') >>> tz = timezone('America/St_Johns')
>>> ambiguous = datetime(2009, 10, 31, 23, 30) >>> ambiguous = datetime(2009, 10, 31, 23, 30)
>>> tz.utcoffset(ambiguous, is_dst=False) >>> str(tz.utcoffset(ambiguous, is_dst=False))
datetime.timedelta(-1, 73800) '-1 day, 20:30:00'
>>> tz.utcoffset(ambiguous, is_dst=True) >>> str(tz.utcoffset(ambiguous, is_dst=True))
datetime.timedelta(-1, 77400) '-1 day, 21:30:00'
>>> try: >>> try:
... tz.utcoffset(ambiguous) ... tz.utcoffset(ambiguous)
@@ -421,19 +435,19 @@ class DstTzInfo(BaseTzInfo):
>>> normal = datetime(2009, 9, 1) >>> normal = datetime(2009, 9, 1)
>>> tz.dst(normal) >>> str(tz.dst(normal))
datetime.timedelta(0, 3600) '1:00:00'
>>> tz.dst(normal, is_dst=False) >>> str(tz.dst(normal, is_dst=False))
datetime.timedelta(0, 3600) '1:00:00'
>>> tz.dst(normal, is_dst=True) >>> str(tz.dst(normal, is_dst=True))
datetime.timedelta(0, 3600) '1:00:00'
>>> ambiguous = datetime(2009, 10, 31, 23, 30) >>> ambiguous = datetime(2009, 10, 31, 23, 30)
>>> tz.dst(ambiguous, is_dst=False) >>> str(tz.dst(ambiguous, is_dst=False))
datetime.timedelta(0) '0:00:00'
>>> tz.dst(ambiguous, is_dst=True) >>> str(tz.dst(ambiguous, is_dst=True))
datetime.timedelta(0, 3600) '1:00:00'
>>> try: >>> try:
... tz.dst(ambiguous) ... tz.dst(ambiguous)
... except AmbiguousTimeError: ... except AmbiguousTimeError:
@@ -494,23 +508,22 @@ class DstTzInfo(BaseTzInfo):
dst = 'STD' dst = 'STD'
if self._utcoffset > _notime: if self._utcoffset > _notime:
return '<DstTzInfo %r %s+%s %s>' % ( return '<DstTzInfo %r %s+%s %s>' % (
self.zone, self._tzname, self._utcoffset, dst self.zone, self._tzname, self._utcoffset, dst
) )
else: else:
return '<DstTzInfo %r %s%s %s>' % ( return '<DstTzInfo %r %s%s %s>' % (
self.zone, self._tzname, self._utcoffset, dst self.zone, self._tzname, self._utcoffset, dst
) )
def __reduce__(self): def __reduce__(self):
# Special pickle to zone remains a singleton and to cope with # Special pickle to zone remains a singleton and to cope with
# database changes. # database changes.
return pytz._p, ( return pytz._p, (
self.zone, self.zone,
_to_seconds(self._utcoffset), _to_seconds(self._utcoffset),
_to_seconds(self._dst), _to_seconds(self._dst),
self._tzname self._tzname
) )
def unpickler(zone, utcoffset=None, dstoffset=None, tzname=None): def unpickler(zone, utcoffset=None, dstoffset=None, tzname=None):
@@ -549,8 +562,8 @@ def unpickler(zone, utcoffset=None, dstoffset=None, tzname=None):
# get changed from the initial guess by the database maintainers to # get changed from the initial guess by the database maintainers to
# match reality when this information is discovered. # match reality when this information is discovered.
for localized_tz in tz._tzinfos.values(): for localized_tz in tz._tzinfos.values():
if (localized_tz._utcoffset == utcoffset if (localized_tz._utcoffset == utcoffset and
and localized_tz._dst == dstoffset): localized_tz._dst == dstoffset):
return localized_tz return localized_tz
# This (utcoffset, dstoffset) information has been removed from the # This (utcoffset, dstoffset) information has been removed from the

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