diff --git a/CHANGELOG.md b/CHANGELOG.md index 474c778d..446f639b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## v1.3.6 (2016-02-03) + +* Fix: Regression where {duration} not reported in minutes. +* Fix: Proper daemonizing in FreeBSD and FreeNAS init scripts. +* Change: Update readme documentation. + + ## v1.3.5 (2016-02-02) * Fix: Removing unique constraints from database. diff --git a/README.md b/README.md index 56a90ac3..b603a274 100644 --- a/README.md +++ b/README.md @@ -1,121 +1,75 @@ -#PlexPy +# PlexPy [![Join the chat at https://gitter.im/drzoidberg33/plexpy](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/drzoidberg33/plexpy?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) A python based web application for monitoring, analytics and notifications for Plex Media Server (www.plex.tv). -This project is based on code from Headphones (https://github.com/rembo10/headphones) and PlexWatchWeb (https://github.com/ecleese/plexWatchWeb). +This project is based on code from [Headphones](https://github.com/rembo10/headphones) and [PlexWatchWeb](https://github.com/ecleese/plexWatchWeb). -* PlexPy forum thread: https://forums.plex.tv/discussion/169591/plexpy-another-plex-monitoring-program +* PlexPy [forum thread](https://forums.plex.tv/discussion/169591/plexpy-another-plex-monitoring-program) +## Features +* Responsive web design viewable on desktop, tablet and mobile web browsers. +* Themed to complement Plex/Web. +* Easy configuration setup (no separate web server required). +* Monitor current Plex Media Server activity. +* Fully customizable notifications for stream activity and recently added media. +* Top statistics on home page with configurable duration and measurement metric. +* Global watching history with search/filtering & dynamic column sorting. +* Full user list with general information and comparison stats. +* Individual user information including devices IP addresses. +* Complete library statistics and media file information. +* Rich analytics presented using Highcharts graphing. +* Beautiful content information pages. +* Full sync list data on all users syncing items from your library. +* And many more!! -###Support ------------ -* PlexPy Wiki: https://github.com/drzoidberg33/plexpy/wiki +## Installation and Support - -###Features ------------ -* Responsive web design viewable on desktop, tablet and mobile web browsers - -* Themed to complement Plex/Web - -* Easy configuration setup via html form - -* Current Plex Media Server viewing activity including: - * number of current users - * title - * progress - * platform - * user - * state (playing, paused, buffering, etc) - * stream type (direct, transcoded) - * video type & resolution - * audio type & channel count. - -* Top statistics on home page with configurable duration and measurement metric: - * Most watched TV - * Most popular TV - * Most watched Movie - * Most popular Movie - * Most active user - * Most active platform - -* Recently added media and how long ago it was added - -* Global watching history with search/filtering & dynamic column sorting - * date - * user - * platform - * ip address - * title - * stream information details - * start time - * paused duration length - * stop time - * duration length - * watched progress - * show/hide columns - * delete mode - allows deletion of specific history items - -* Full user list with general information and comparison stats - -* Individual user information - * username and gravatar (if available) - * daily, weekly, monthly, all time stats for play count and duration length - * individual platform stats for each user - * public ip address history with last seen date and geo tag location - * recently watched content - * watching history - * synced items - * assign users custom friendly names within PlexPy - * assign users custom avatar URL within PlexPy - * disable history logging per user - * disable notifications per user - * option to purge all history per user. - -* Rich analytics presented using Highcharts graphing - * user-selectable time periods of 30, 90 or 365 days - * daily watch count and duration - * totals by day of week and hours of the day - * totals by top 10 platform - * totals by top 10 users - * detailed breakdown by transcode decision - * source and stream resolutions - * transcode decision counts by user and platform - * total monthly counts - -* Content information pages - * movies (includes watching history) - * tv shows (includes watching history) - * tv seasons - * tv episodes (includes watching history) - -* Full sync list data on all users syncing items from your library - -## Installation and Notes - -* [Installation page](../../wiki/Installation) shows you how to install PlexPy. -* [Usage guide](../../wiki/Usage-guide) introduces you to PlexPy. -* [Troubleshooting page](../../wiki/TroubleShooting) in the wiki can help you with common problems. - -**Issues** can be reported on the GitHub issue tracker considering these rules: - -1. Analyze your log, you just might find the solution yourself! -2. You read the wiki and searched existing issues, but this is not solving your problem. -3. Post the issue with a clear title, description and the HP log and use [proper markdown syntax](https://help.github.com/articles/github-flavored-markdown) to structure your text (code/log in code blocks). -4. Close your issue when it's solved! If you found the solution yourself please comment so that others benefit from it. - -**Feature requests** can be reported on the GitHub issue tracker too: - -1. Search for similar existing 'issues', feature requests can be recognized by the label 'Request'. -2. If a similar Request exists, post a comment (+1, or add a new idea to the existing request), otherwise you can create a new one. - -If you **comply with these rules** you can [post your request/issue](http://github.com/drzoidberg33/plexpy/issues). +* [Installation Guides](https://github.com/drzoidberg33/plexpy/wiki/Installation) shows you how to install PlexPy. +* [FAQs](https://github.com/drzoidberg33/plexpy/wiki/Frequently-Asked-Questions-(FAQ)) in the wiki can help you with common problems. **Support** the project by implementing new features, solving support tickets and provide bug fixes. +## Issues + +##### Many issues can simply be solved by: + +- Making sure you update to the latest version. +- Turning your device off and on again. +- Analyzing your logs, you just might find the solution yourself! +- Using the **search** function to see if this issue has already been reported/solved. +- Checking the [Wiki](https://github.com/drzoidberg33/plexpy/wiki) for +[ [Installation] ](https://github.com/drzoidberg33/plexpy/wiki/Installation) and +[ [FAQs] ](https://github.com/drzoidberg33/plexpy/wiki/Frequently-Asked-Questions-(FAQ)). +- For basic questions try asking on [Gitter](https://gitter.im/drzoidberg33/plexpy) or the [Plex Forums](https://forums.plex.tv/discussion/169591/plexpy-another-plex-monitoring-program) first before opening an issue. + +##### If nothing has worked: + +1. Open a new issue on the GitHub [issue tracker](http://github.com/drzoidberg33/plexpy/issues). +2. Provide a clear title to easily help identify your problem. +3. Use proper [markdown syntax](https://help.github.com/articles/github-flavored-markdown) to structure your post (i.e. code/log in code blocks). +4. Make sure you provide the following information: + - [ ] Branch + - [ ] Version/Commit hash + - [ ] Your operating system and python version + - [ ] What you did? + - [ ] What happened? + - [ ] What you expected? + - [ ] How can we reproduce your issue? + - [ ] What are your (relevant) settings? + - [ ] Include a link to your **FULL** (not just a few lines!) log file that has the error. Please use [Gist](http://gist.github.com) or [Pastebin](http://pastebin.com/). +5. Close your issue when it's solved! If you found the solution yourself please comment so that others benefit from it. + +## Feature Requests + +1. Search for similar existing 'issues', feature requests can be recognized by the blue `enhancement` label. +2. If a similar request exists, post a comment (+1, or add a new idea to the existing request). +3. If no similar requests exist, you can create a new one. +4. Provide a clear title to easily identify the feature request. +5. Tag your feature request with `[Feature Request]` so it can be identified easily. + ## License This is free software under the GPL v3 open source license. Feel free to do with it what you wish, but any modification must be open sourced. A copy of the license is included. -This software includes Highsoft software libraries which you may freely distribute for non-commercial use. Commerical users must licence this software, for more information visit https://shop.highsoft.com/faq/non-commercial#non-commercial-redistribution. +This software includes Highsoft software libraries which you may freely distribute for non-commercial use. Commerical users must licence this software, for more information visit https://shop.highsoft.com/faq/non-commercial#non-commercial-redistribution. \ No newline at end of file diff --git a/init-scripts/init.freebsd b/init-scripts/init.freebsd index 5b84e9d2..3e3a9d90 100755 --- a/init-scripts/init.freebsd +++ b/init-scripts/init.freebsd @@ -38,7 +38,7 @@ status_cmd="${name}_status" stop_cmd="${name}_stop" command="/usr/sbin/daemon" -command_args="-f -p ${plexpy_pid} python ${plexpy_dir}/PlexPy.py ${plexpy_flags} --quiet --nolaunch" +command_args="python2 ${plexpy_dir}/PlexPy.py --daemon --pidfile ${plexpy_pid} --quiet --nolaunch" # Ensure user is root when running this script. if [ `id -u` != "0" ]; then diff --git a/init-scripts/init.freenas b/init-scripts/init.freenas index 62f5d3fc..e2946f2b 100644 --- a/init-scripts/init.freenas +++ b/init-scripts/init.freenas @@ -38,7 +38,7 @@ status_cmd="${name}_status" stop_cmd="${name}_stop" command="/usr/sbin/daemon" -command_args="-f -p ${plexpy_pid} python2 ${plexpy_dir}/PlexPy.py ${plexpy_flags} --quiet --nolaunch" +command_args="python2 ${plexpy_dir}/PlexPy.py --daemon --pidfile ${plexpy_pid} --quiet --nolaunch" # Ensure user is root when running this script. if [ `id -u` != "0" ]; then diff --git a/plexpy/helpers.py b/plexpy/helpers.py index a5d9e2d4..3722d902 100644 --- a/plexpy/helpers.py +++ b/plexpy/helpers.py @@ -378,14 +378,14 @@ def create_https_certificates(ssl_cert, ssl_key): def cast_to_int(s): try: return int(s) - except ValueError: - return -1 + except (ValueError, TypeError): + return 0 def cast_to_float(s): try: return float(s) - except ValueError: - return -1 + except (ValueError, TypeError): + return 0 def convert_xml_to_json(xml): o = xmltodict.parse(xml) diff --git a/plexpy/notification_handler.py b/plexpy/notification_handler.py index 6962c298..0fda82e1 100644 --- a/plexpy/notification_handler.py +++ b/plexpy/notification_handler.py @@ -354,7 +354,7 @@ def build_notify_text(session=None, timeline=None, state=None): if server_times: updated_at = server_times[0]['updated_at'] - server_uptime = helpers.human_duration(int(time.time() - helpers.cast_to_float(updated_at))) + server_uptime = helpers.human_duration(int(time.time() - helpers.cast_to_int(updated_at))) else: logger.error(u"PlexPy NotificationHandler :: Unable to retrieve server uptime.") server_uptime = 'N/A' @@ -448,8 +448,8 @@ def build_notify_text(session=None, timeline=None, state=None): if state != 'play': stream_duration = helpers.convert_seconds_to_minutes( time.time() - - helpers.cast_to_float(session.get('started', 0)) - - helpers.cast_to_float(session.get('paused_counter', 0))) + helpers.cast_to_int(session.get('started', 0)) - + helpers.cast_to_int(session.get('paused_counter', 0))) else: stream_duration = 0 @@ -537,7 +537,7 @@ def build_notify_text(session=None, timeline=None, state=None): 'summary': metadata['summary'], 'tagline': metadata['tagline'], 'rating': metadata['rating'], - 'duration': metadata['duration'], + 'duration': duration, 'section_id': metadata['section_id'], 'rating_key': metadata['rating_key'], 'parent_rating_key': metadata['parent_rating_key'], @@ -742,7 +742,7 @@ def build_server_notify_text(state=None): if server_times: updated_at = server_times[0]['updated_at'] - server_uptime = helpers.human_duration(int(time.time() - helpers.cast_to_float(updated_at))) + server_uptime = helpers.human_duration(int(time.time() - helpers.cast_to_int(updated_at))) else: logger.error(u"PlexPy NotificationHandler :: Unable to retrieve server uptime.") server_uptime = 'N/A' diff --git a/plexpy/version.py b/plexpy/version.py index 67235cab..189a4528 100644 --- a/plexpy/version.py +++ b/plexpy/version.py @@ -1,2 +1,2 @@ PLEXPY_VERSION = "master" -PLEXPY_RELEASE_VERSION = "1.3.5" +PLEXPY_RELEASE_VERSION = "1.3.6"