kmahon37 / plex-dvr-waker

Plex DVR Waker is a simple command-line tool for waking the computer before the next scheduled recording.
MIT License
8 stars 0 forks source link

[BUG] - Plex DVR Not working - Unable to list up and coming recordings #33

Closed coreyspeed closed 2 years ago

coreyspeed commented 2 years ago

Getting the following error seems to have started around the 25th May, My Scheduled Task's are no longer updating. Shame becuase this was working really well for me.

PS C:\PlexDvrWaker> .\PlexDvrWaker.exe list ERROR: System.FormatException: String '1655481600' was not recognized as a valid DateTime. at System.DateTimeParse.ParseExactMultiple(ReadOnlySpan1 s, String[] formats, DateTimeFormatInfo dtfi, DateTimeStyles style) at System.DateTime.ParseExact(String s, String[] formats, IFormatProvider provider, DateTimeStyles style) at System.Data.SQLite.SQLiteConvert.ToDateTime(String dateText, SQLiteDateFormats format, DateTimeKind kind, String formatString) at System.Data.SQLite.SQLiteConvert.ToDateTime(String dateText) at System.Data.SQLite.SQLiteConvert.ToDateTime(IntPtr ptr, Int32 len) at System.Data.SQLite.SQLite3.GetDateTime(SQLiteStatement stmt, Int32 index) at System.Data.SQLite.SQLiteDataReader.GetDateTime(Int32 i) at PlexDvrWaker.Plex.DataAdapter.LoadEpgInfo() at PlexDvrWaker.Plex.DataAdapter.GetScheduledRecordings() at PlexDvrWaker.Plex.DataAdapter.PrintScheduledRecordings() at PlexDvrWaker.Program.RunList(ListOptions options) at PlexDvrWaker.Program.RunVerb[T](T options, Func2 verbFunc) PS C:\PlexDvrWaker>

coreyspeed commented 2 years ago

Information from Log file

2022-05-24T23:05:17 6600 -------------------------------------------------------------- 2022-05-24T23:05:17 6600 Monitor detected a Plex library file changed: com.plexapp.plugins.library.db 2022-05-24T23:05:17 6600 Monitor start date: 2022-05-20T15:29:47 (4.07:35:29.7783488) 2022-05-24T23:05:17 6600 Monitor triggered: 561 times 2022-05-24T23:05:17 6600 Bundling changes, waiting 5 seconds until next refresh 2022-05-24T23:05:22 6600 Refreshing next wakeup time 2022-05-24T23:05:22 6600 Getting scheduled recordings 2022-05-24T23:05:22 6600 Loading subscriptions 2022-05-24T23:05:22 6600 Subscriptions loaded: 352 2022-05-24T23:05:22 6600 Loading EPG info for subscriptions 2022-05-24T23:05:22 6600 EPG info found: 134 2022-05-24T23:05:22 6600 Removing unschedulable and past items 2022-05-24T23:05:22 6600 Removed items: 220 2022-05-24T23:05:22 6600 Removing previously recorded TV shows 2022-05-24T23:05:22 6600 Removed TV shows: 113 2022-05-24T23:05:22 6600 Removing previously recorded movies 2022-05-24T23:05:22 6600 Removed movies: 0 2022-05-24T23:05:22 6600 Found 19 upcoming scheduled recordings starting at 25/05/2022 19:00:00 2022-05-24T23:05:22 6600 Getting next Plex maintenance time 2022-05-24T23:05:22 6600 Plex maintenance is 11pm to 1am every day 2022-05-24T23:05:22 6600 Next scheduled maintenance time is 25/05/2022 23:00:00 to 25/05/2022 01:00:00 2022-05-24T23:05:22 6600 Creating/updating wakeup task: Plex DVR Waker\DVR wake 2022-05-24T23:05:22 6600 Creating/updating the task 2022-05-24T23:05:22 6600 Wakeup task scheduled for 25/05/2022 18:51:40 2022-05-24T23:06:01 6600 -------------------------------------------------------------- 2022-05-24T23:06:01 6600 Monitor detected a Plex library file changed: com.plexapp.plugins.library.db-wal 2022-05-24T23:06:01 6600 Monitor start date: 2022-05-20T15:29:47 (4.07:36:13.1434896) 2022-05-24T23:06:01 6600 Monitor triggered: 562 times 2022-05-24T23:06:01 6600 Bundling changes, waiting 5 seconds until next refresh 2022-05-24T23:06:06 6600 Refreshing next wakeup time 2022-05-24T23:06:06 6600 Getting scheduled recordings 2022-05-24T23:06:06 6600 Loading subscriptions 2022-05-24T23:06:06 6600 Subscriptions loaded: 352 2022-05-24T23:06:06 6600 Loading EPG info for subscriptions 2022-05-24T23:15:00 12028 -------------------------------------------------------------- 2022-05-24T23:15:00 12028 PlexDvrWaker.exe add-task --offset=500 --task="Plex DVR Waker\DVR sync" --wakeup 2022-05-24T23:15:00 12028 Plex DVR Waker version: 2.1.2 2022-05-24T23:15:00 12028 .Net Core version: 3.1.24 2022-05-24T23:15:00 12028 Using Plex library database file: C:\PLEX\Plex Media Server\Plug-in Support\Databases\com.plexapp.plugins.library.db 2022-05-24T23:15:00 12028 Getting scheduled recordings 2022-05-24T23:15:00 12028 Loading subscriptions 2022-05-24T23:15:00 12028 Subscriptions loaded: 352 2022-05-24T23:15:00 12028 Loading EPG info for subscriptions 2022-05-24T23:15:01 12028 ERROR: System.FormatException: String '1653440400' was not recognized as a valid DateTime. at System.DateTimeParse.ParseExactMultiple(ReadOnlySpan1 s, String[] formats, DateTimeFormatInfo dtfi, DateTimeStyles style) at System.DateTime.ParseExact(String s, String[] formats, IFormatProvider provider, DateTimeStyles style) at System.Data.SQLite.SQLiteConvert.ToDateTime(String dateText, SQLiteDateFormats format, DateTimeKind kind, String formatString) at System.Data.SQLite.SQLiteConvert.ToDateTime(String dateText) at System.Data.SQLite.SQLiteConvert.ToDateTime(IntPtr ptr, Int32 len) at System.Data.SQLite.SQLite3.GetDateTime(SQLiteStatement stmt, Int32 index) at System.Data.SQLite.SQLiteDataReader.GetDateTime(Int32 i) at PlexDvrWaker.Plex.DataAdapter.LoadEpgInfo() at PlexDvrWaker.Plex.DataAdapter.GetScheduledRecordings() at PlexDvrWaker.Plex.DataAdapter.GetNextScheduledRecording() at PlexDvrWaker.Plex.DataAdapter.GetNextScheduledRecordingTime() at PlexDvrWaker.Plex.DataAdapter.GetNextWakeupTime() at PlexDvrWaker.Program.RunAddTask(AddTaskOptions options) at PlexDvrWaker.Program.RunVerb[T](T options, Func2 verbFunc) 2022-05-24T23:15:01 12028 Exit code: 99 (Unknown)

humphreysl commented 2 years ago

I too am having exactly the same issue as @coreyspeed. My issue started on the 28/5/2022.

humphreysl commented 2 years ago

I'm on the latest release 2.1.2.

kmahon37 commented 2 years ago

From the way the error looks and how it failed, it looks like it is an issue with bad data in the Plex EPG database.

kmahon37 commented 2 years ago

Nevermind, I just upgraded to the latest version (1.26.2.5797) and I am now also seeing the same error. Plex may have changed the database schema on us. Just guessing based off the error, but looks like they may have switched from a date to a timestamp data type. I'll need to investigate it further when I have more spare time.

kmahon37 commented 2 years ago

This should now be fixed in v2.1.3. The problem was exactly as I thought. Plex Media Server decided to change their database schema from "datetime" fields to "timestamp" fields.

damianfears commented 2 years ago

Thankyou, fixed mine.

On Tue, 14 June 2022, 11:17 am Kris, @.***> wrote:

This should now be fixed in v2.1.3. The problem is exactly as I thought. Plex Media Server decided to change their database schema from "datetime" fields to "timestamp" fields.

— Reply to this email directly, view it on GitHub https://github.com/kmahon37/plex-dvr-waker/issues/33#issuecomment-1154607200, or unsubscribe https://github.com/notifications/unsubscribe-auth/AARNTWQHCZ3NRARWZITBA7LVO7MUBANCNFSM5YB2KNCA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

humphreysl commented 2 years ago

This should now be fixed in v2.1.3. The problem was exactly as I thought. Plex Media Server decided to change their database schema from "datetime" fields to "timestamp" fields.

That's great thank you. I will test this in the next few days and get back to you. Much appreciated.

humphreysl commented 2 years ago

Apologies in the delay. Been on holiday. I can confirm this has now fixed my issue as well, thank you. Much appreciated.