# 0.2.1
    * new format option '{streamtype_extended}' -- includes the Audio/Video decision: "Direct Play" or "Audio:copy Video:transcode"
    * cleanup ipv6 comptable ipv4 address
    * twitter fixes (API change) h/t @RaginBajin

# 0.2.0
    *  fix logic for grouping table ( important fix -- data could be incorrect prior to version 0.2.0 )
    * when version changes, the DB will auto upgrade/backup

# 0.1.9
    * grouped table was not using the right paused field (paused_counter) -- fixes paused display in plexWatch/Web
    * EMAIL now requires Net::SMTPS -- Net::SMTP::TLS is junk (deprecated/abandoned)

# 0.1.8
    * Windows EMAIL fix: TLS/SSL authentication is now supported
    * EMAIL notifications now requires Net::SMTPS ( windows is built in )

# 0.1.7
    * --recently_added allow users to specify specific sections ( more info: --recently_added )
    * --exclude_user will mute a notification, but still be logged to the DB. useful for plexWeb/Watch
    * --recently_added empty notifications: skip item if scanner is still processing ( we will come back to it later )
    * speedup: do not autovaccum on every run
    * recreate grouped table daily. Any changes made to config.pl will reflect within 24 hours ( or just call --backup )

# 0.1.6
    * DB update: switch from xml to json for config storage

# 0.1.5
    * DB update: include config in DB for plexWatch/Web

# 0.1.4
    * added config table for plexWatch/Web - or - any other external apps wanted to parse the config
    * Added grouped table for plexWatch/Web - or - any other external apps needing to query for a grouped output
    * Twitter now works for windows
    * Linux and Windows branches are now on the same code base (dev merged in 0.1.1, now master up to date)

# 0.1.3-dev
    * added config table for plexWatch/Web - or - any other external apps wanted to parse the config

# 0.1.2-dev
    * Added grouped table for plexWatch/Web - or - any other external apps needing to query for a grouped output

# 0.1.1-dev
    * Twitter now works for windows
    * Linux and Windows branches (dev) are now on the same code base.

# 0.1.0 - Final
    * NEW: Email provider ( NonAuth, Auth, TLS/SSL supported) requires Net::SMTP::TLS
            centos: yum install perl\(Net::SMTP::TLS\)
            debian: apt-get install libnet-smtp-tls-perl
            other: cpan install MIME::Lite
    * NEW: paused/resumed state and time are now accounted for
    * NEW: paused/resumed push types enabled - push_paused, pushed_resumed added to each provider
    * NEW: you can override 'alert_format' per provider ( check out the EMAIL provider for an example )
    * FIX: watched duration corrected going forward (accounts for paused content and can be overridden with $count_paused )
            paused/resumed states have allowed this to work
    * FIX: Redundant titles are now fixed         - Title/Application also will always show {user} unless overridden in config.pl
            $appname is no longer used and replaced with {user} -- {user} if used even if config.pl has $appname ( no need to update config.pl )
            before:  title: "plexWatch watched" msg: "user watched title etc...."
             after:  title: "{user} watched"    msg: "title etc...."
    * FIX: --test_notify will not print options to test ( and they actually correspond to the right notification type now!)
    * FIX: do not print backup info every time --debug is called
    * FIX: duration watched when video is paused, then stopped
    * FIX: XML UTF-8 decoding/encoding ( only seemd to affect FC18 )
    * FIX: Accent marks/umlauts are allowed
    * Screenshots added to screenshots folder for iOS and Windows


# 0.0.20-dev
# * NEW: Email provider ( NonAuth, Auth, TLS/SSL supported) requires Net::SMTP::TLS
#  	  centos: yum install perl\(Net::SMTP::TLS\)
#  	  debian: apt-get install libnet-smtp-tls-perl
#  	  other: cpan install MIME::Lite
# * NEW: paused/resumed state and time are now accounted for
# * NEW: paused/resumed push types enabled - push_paused, pushed_resumed added to each provider
# * NEW: you can override 'alert_format' per provider ( check out the EMAIL provider for an example )
# * FIX: watched duration corrected going forward (accounts for paused content and can be overridden with $count_paused )
#         paused/resumed states have allowed this to work
# * FIX: Redundant titles are now fixed 	- Title/Application also will always show {user} unless overridden in config.pl
#         $appname is no longer used and replaced with {user} -- {user} if used even if config.pl has $appname ( no need to update config.pl )
#         before:  title: "plexWatch watched" msg: "user watched title etc...."
#          after:  title: "{user} watched"    msg: "title etc...."
# * FIX: --test_notify will not print options to test ( and they actually correspond to the right notification type now!)
# * FIX: do not print backup info every time --debug is called
# * Screenshots added to screenshots folder for iOS and Windows



# 0.0.19
# * added options for logging IP_Address of client
#      * enable this in config.pl with the $server_log, $log_client_ip (enable $debug_logging to see what matched )
#      -- format_options: {ip_address}
#      -- REQUIRES perl module File::ReadBackwards - to conserve memory)
#      -- Requires parsing of PMS log file. $server_log in config.pl
#      -- log file searched in reverse order for most recent line (File::ReadBackwards)
#      -- match on itemID+machineIdentifier -or- machineIdentifier
#      -- fallback to only itemID (ratingKey) 
	      * Will sleep 5 seconds before searching -- allows PMS to log to it log file before we try again.
#             * Could match wrong IP if multiple clients watch the same itemID.
#	      * mainly for clients in 'List of networks that are allowed without auth' *only time I have seen this
# * Added SSL support (port 32443)
# * friendly name now allows for user+platform(title) (example in config.pl-dist)
# * $debug_logging added to config.pl ( still need to add more debug logging though )
# * Variables allowed in 'application' for prowl,pushover & 'from' for boxcar
# * Fix: AM/PM for OSX (non GNU) 
# * Fix: --watching now calls --notify before it shows now playing content. Fixes issue when content hasn't been logged as started/stopped
# * Fix: allows season/episode fields to be empty for 'show'
# * Fix: Do not update XML in DB if the XML is not valid
# * Fix: --watched: {percent_complete} -- use the last viewOffset instead of the first.
# * Fix: --watched: always display a 100% watched show/movie. I.E.  show two lines: if user completes show1 (100%), then restarts said show and stops at < 90% on the same day (advanced config)
# * Fix: --watched: do NOT group shows together IF hours between start of the same show is > 3 hours. (advanced config)
# * 'application' => $appname removed from boxcar ( not used ) 'from' is the equivalent
# * advanced config options available. View README. (Mainly to not convolute the config more than it already is)
# * README: updated instructions to NOT call sudo before running the script. This way the DB is not owned by root and can be run by the 'normal' user.


# 0.0.18
#
# * MyPlex Login Token: The script can now be ran from any computer.
#	-- Specify a $myPlex_user and $myPlex_pass in config.pl
#       -- Will only retrieve a token from my.plexapp.com if the PMS server returns a 401 (authorization required)
# * format_options update/new:
#    -- {streamtype} [T|D] for Transcoded/Direct
#    -- {transcoded} [1|0] for Transcoded/Direct
#    -- {percent_complete} - percent of video watched ( not dependent on time watched, but where progress of video/length.
#    -- {state} - playing/paused/buffering
#    -- {progress} - exact time spot the user is at  (I.E. "15 minutes" )
# * XML is now updated on every run -- allows us to view current state of content ( i.e. paused, playing, percent_completed, etc)
# * CheckLock fixed: script can NOT to be ran multiple times at once (fixed repeat notifications when providers are offline)
# * Provider notifications: timeout is now 20 seconds instead of 3 minutes (we should not wait 3 minutes to reach a provider!)
# * Backup SQLite DB
#    -- automatically happens daily, weekly and monthly
#    -- force Daily backup with --backup
# * Fixed: GNTP ProviderEnabled check was broken -- if one was enabled, all were enabled"
# * Fixed: 'Wide character in send at' errors

# 0.0.17
# * GNTP: Provider added.
#       -- Supports multiple destinations.
#	-- Currently tested with Growl For Windows as I don't have OSX available. Need to test with others
#	-- install centos ( yum install perl\(Data::UUID\) , cpan Growl::GNTP )   -- CPAN install failed until I installed perl\(Data::UUID\)
#	-- install Ubuntu ( cpan Growl::GNTP )
# * --recently_added allows comma separated list. --recently_added=movie,show   ( preferred way if you are running multiple cron jobs for RA )
#      -- fixes some SQLite lock issues by running it once
#      -- fixes out of order content when running shows/movies
# * fixed --test_notify=  -- now works with =start, =stop, =recently_added
# * cleanup of empty variables for notification: stripping "[]" from alert.
# * excluding length of video from notification when Plex API doesn't return length: (00 min)
# * spell check - cleaned up :)
# * cleanup of unitialized values

# 0.0.16
# * rate limiting: provide mechanisms to back off notifications if provider fails (mainly due to --recently_added)
#     -- twitter: no api for writes. If we receive 403, we assume user hit daily limits (unknown hourly limit). Do not process additional notification until next run.
#     -- boxcar: on failure -- back of the rest of alerts for provider until next run
#     -- prowl: on failure -- back of the rest of alerts for provider until next run
#     -- growl: on failure -- back of the rest of alerts for provider until next run
#     -- pushover: on failure -- back of the rest of alerts for provider until next run
# * --recently_added: 25 results per section created (multiple sections of same type: two sections with type 'shows' = 50 results )
# * --recently_added: SKIP notifications for a video if the addedDate is older than 1 day
# * --recently_added: process backlog (failed alerts) of recently added ( if notification failed and more videos were added before we could notify, keep trying -- but only for 2 days)
# * test_notify=recently_added  -- option to test notification for recently added content (verify provider even works)
# * config.pl: $notify_started and $notify_stopped deprecated: use per provider settings globally (i.e. push_watched, push_watching)
# * recently_added: bugfix - failed when a section only has 1 video.
# * titles added to notifications ( change titles per type in config.pl $push_titles ) prowl, growl, pushover, boxcar, twitter supported
# * Default titles can be changed globally in config.pl ($push_titles)

# 0.0.15
# * added recently_added=[movie,show]  -- notify on recently added items to PMS
# * Twitter added as a provider
    -  requires Net::Twitter::Lite::WithAPIv1_1  ( install with: 'cpan Net::Twitter::Lite::WithAPIv1_1' )
    -  requires Net::OAuth >= 0.28  ( install with: 'cpan Net::OAuth' )
    -  twitter OAUTH required - create a new app @ https://dev.twitter.com/apps
     -- make sure to set set ApplicationType to read/write
# *  config.pl: added  push_watched => 1, push_watching => 1, push_recently_added => 1 to all providers. Enable to disable specific notify types
# * --exclude_user added to all functions. You can specify --exclude_user multiple times.. i.e --exclude_user=user1 --exclude_user=otherUsername
# * Boxcar added as provider
#   - All you need is a registered account on boxcar (valid email)
#   - If enabled, this script with register your boxcar account to the plexWatch service -- simple right?
# * Twitter/OAuth modules ONLY required if you enable twitter (Net::Twitter::Lite::WithAPIv1_1 , Net::OAuth)
# * removed module WWW::Curl::Easy (replaced with LWP which is more standard)
# * removed module URI::Escape (using my own subroutine)
# * --version added -- easier to debug

# 0.0.14
# * --watched -- join the same show title in one line if it was watched into the next day. 
#	I.E. Movie1 watched from 11pm - 1am:  would normally show two lines.. 1 from 11pm-11:59pm and 2 from 12am-1am. Now it will just show one
#

# 0.0.13
# * duration_exact change to durationrr (time precision will be in minutes)
# * --stats time precision will still be seconds
# * formatting options added
#   {time_left}   :: time left until video is done. works only on --watching 
#   - {length}    :: length of video (works for any)
#   - {progress} :: current time watched in video
# * --stats can be used by itself now. No longer required to have --watched
# * Growl added to config.pl -- requires GrowlNotify from http://growl.info/downloads

# 0.0.12
# * code cleanup - merge same routines in sub (&FriendlyName)
# * alert cleanup - easier to update alert format when needed (and more standardized)
   -- $alert_format added to config options (unique for stop and start)
   -- can override on cli with --format_stop="..." and --format_start="..."
   -- list available format options with --format_options
# * cli --watching --watched format can now be edited by the user or specified on the cli
# * config options moved into config.pl -- should be easier to upgrade version without having to edit the Perl script each time
# * config.pl-dist is included --- one must edit and copy it to config.pl
# * File::Basename required -- to load config.pl

# 0.0.11
# * Season/Episode appended to alert.
# * fixed bug in '-watching' cli options. friendly name fixed.

# 0.0.10
# * '-stats' option added to '-watched' - show total watched time per user -- total time and per day
# * '-user' option added to '-watched' and '-watching' -- limit output to a specific user
# * $user_display hash ref added to config - you can now show a 'friendly' username instead of the users email address [excluding @domain.tld]
# * platform title used if exists over platform. I.E. Chrome - Plex/Web (Chrome) will not show 'Plex/Web (Chrome)' -- it was redundant. Roku will still be Roku
# * log file is now hard coded to $data_dir/plexWatch.log instead of $data_dir/$appname.log. Allows users to change $appname to anything or nothing for notification

# 0.0.9
# * -watched will now show the accumulated duration (if a video has been started/stopped multiple time on the same day)
# * -nogrouping added as an option to -watched. It will show the same video multiple times if it has been started/stopped on the same day)

# 0.0.8
# * file locking was broking - multiple copies could run at the same time
# * failed attempts to retrieve xml status could result in false stopped notifications and dupes
# * timeout was way too long any possibly indefinite for sessions status. now 20 seconds.
# -- this might fix the dupe stopped notifications.

# 0.0.7
# * added 'on platform' for alert - i.e. user is watching: movie name on Roku'
# * fixed alerts for prowl when movie has a colon. It was discarding anything after the first colon.

# 0.0.6
# * fixed pushover notifications -- actually include the alert!

# 0.0.5
# info: little bugs, nothing major
#
# * updated Perl doc
# * fixed --show_xml to actually show url when no options are given
# * README.md - Fix install instructions and supply yum/apt-get Perl module howto

# 0.0.4
# * added data_dir in config. Defaults to /opt/plexWeb/ -- this way the script can be run from any location.

# 0.0.3
# * new requirement: Time::ParseDate
# * date ranges for -watched (-start, -stop)
# * specify human date ranges -- Time::ParseDate -- today, yesterday, last week

# 0.0.2;
# * new requirement: use Getopt::Long, Pod::Usage, Fcntl qw(:flock), Fcntl qw(:flock)
# * modified DB insert - using Placeholders and Bind Values
# * added 'xml column' to db - if any info is need later or for easier debugging
# * changed stopped from a boolean to actual epoch - used for duration of watched
# * changed sub InitialzeDB (now initDB) and added initDBtable - ability to add/modify column definitions when needed
# * added use Time::Duration -- duration for watched status
# * verify all content has been notified if nothing is playing
# * added lock just in case via Fcntl qw(:flock)
# * new options: added ability to use cli options via get::opt 
#  - added --watched 
#  - added --watching
#  - added --help
#  - added --show_xml
#  - added --debug
#  - added --notify

# 0.0.1:
# * initial release