michealespinola / syno.plexupdate

A script to automagically update Plex Media Server on Synology NAS
GNU General Public License v3.0
273 stars 23 forks source link

date: invalid date #26

Closed g6nhu closed 2 years ago

g6nhu commented 2 years ago

This may not be considered important because it's on 3.0.2

For the last couple of days I've been getting this error

Task Scheduler has completed a scheduled task.

Task: Update Plex
Start time: Sun, 22 May 2022 01:10:02 GMT
Stop time: Sun, 22 May 2022 01:10:04 GMT
Current status: 0 (Normal)
Standard output/error:

SYNO.PLEX UPDATE SCRIPT v3.0.2

*date: invalid date
'2022-05-03T03:17:19Z\n2022-05-03T03:09:22Z\n2022-05-03T03:09:22Z'
/volume1/Scripts/syno.plexupdate.sh: line 75: (1653178203-)/86400:
syntax error: operand expected (error token is ")/86400")
Script: syno.plexupdate.sh v3.0.2
Script Dir: /volume1/Scripts
Running Ver: 3.0.2
Online Ver: 4.0.0
date: invalid date '@'
Released: (+ days old)
* Newer version found!*

Synology: DS1019+ (x86_64), DSM 6.2.4-25556 Update 0
Plex Dir:
Plex Token:
Running Ver: 1.26.1.5798
Online Ver: 1.26.1.5798 (Public Channel)
Released: 2022-05-11 10:42:02+01:00 (10+ days old)
* No new version found.

There's no error in the actual Plex update section, this is just checking the script itself.

I'm not going to update to V4 because I'm staying on DSM6. However I'm a little concerned that this date error could happen on the Plex update section itself.

Thanks.

loicdugay commented 2 years ago

Same here with 4.0.0

SYNO.PLEX UPDATE SCRIPT v4.0.0

date: invalid date ‘2022-05-03T03:17:19Z\n2022-05-03T03:09:22Z\n2022-05-03T03:09:22Z’
syno.plexupdate.sh: line 75: (1653328624-)/86400: syntax error: operand expected (error token is ")/86400")
         Script: syno.plexupdate.sh v4.0.0
     Script Dir: [CENSURE]
    Running Ver: 4.0.0
     Online Ver: 4.0.0
date: invalid date ‘@’
       Released:  (+ days old)
                 * No new version found.

       Synology: DS720+ (x86_64), DSM 7.1-42661 Update 1
       Plex Dir: [CENSURE]
     Plex Token: [CENSURE] (NEVER POST OR SHARE THIS)
    Running Ver: 1.26.1.5798
     Online Ver: 1.26.1.5798 (Public Channel)
       Released: 2022-05-11 11:42:02+02:00 (12+ days old)
                 * No new version found.
michealespinola commented 2 years ago

I can also verify that this is happening. I am looking into it, thank you for bringing it to my attention.

michealespinola commented 2 years ago

This may not be considered important because it's on 3.0.2

@g6nhu I absolutely consider this important if something broke.

It looks like something has happened to affect the slurp of the script's github link to check for updates. I will need to bang on this a bit to see what has changed.

ytsejam1138 commented 2 years ago

Issue is still present. Script won't update automatically from 4.0.0 to 4.0.2

date: invalid date '2022-07-01T13:04:21Z\n2022-07-01T13:03:28Z\n2022-07-01T13:03:28Z' syno.plexupdate.sh: line 75: (1656688289-)/86400: syntax error: operand expected (error token is ")/86400") Script: syno.plexupdate.sh v4.0.0 Script Dir: /volume1/homes/ytsejam/scripts Running Ver: 4.0.0 Online Ver: 4.0.2 date: invalid date '@' Released: (+ days old)

michealespinola commented 2 years ago

@ytsejam1138, because of the nature of this bug in that version, and that the datestamp for the script update is invalid, you will have to update the script manually.

g6nhu commented 2 years ago

Is there a fix for those of us running 3.0.2 who are unable to upgrade to 4.0.x due to being on DSM6 please?

michealespinola commented 2 years ago

Note: All of the 4.x.x code is currently for DSM7 only. If you are running DSM6 and have "SelfUpdate=1" enabled in your config.ini file - you should disable it. 3.0.2 is currently the last version that supports DSM6.

If you want to fix the scrape error for version 3.0.2, you should be able to replace the codeblock titled "# SCRAPE GITHUB FOR UPDATE INFO", with the current code in 4.0.2 (lines 67-80):

https://github.com/michealespinola/syno.plexupdate/blob/master/syno.plexupdate.sh#L67-L80 https://github.com/michealespinola/syno.plexupdate/blob/v4.0.2/syno.plexupdate.sh#L67-L80

Please let me know how this works for you. I unfortunately don't have a DSM6 to test with - but I truly don't like the idea of leaving it unsupported or throwing an error because of a change on the GitHub website. I will continue to do what I can to support you.

Also note: I have re-worked this bit of code further by utilizing more unified json requests instead of the previous html scraping (that introduced the bug), which will be released in version 4.1.0. I am continuing to make efforts to simplify the code and make it more generic to be backward compatible with DSM6. I don't have DSM6 testers, so this is something that I admittedly lose track of because its not on my dashboard.

michealespinola commented 2 years ago

In case you or others aren't aware, DSM7 introduced significant alterations to the DSM6 that directly affected the location of the Plex Media Server directory as well as how package controls (start/stop/install) work and output information. I was ill prepared for the change.

g6nhu commented 2 years ago

If you want to fix the scrape error for version 3.0.2, you should be able to replace the codeblock titled "# SCRAPE GITHUB FOR UPDATE INFO", with the current code in 4.0.2 (lines 67-80):

https://github.com/michealespinola/syno.plexupdate/blob/master/syno.plexupdate.sh#L67-L80

Apologies, I've been on holiday so this is the first chance I've had to look at this.

I'm just looking to try this now but do you mean lines 67-86 because 67-80 doesn't appear to be a complete codeblock?

michealespinola commented 2 years ago

My apologies as well. I should have linked to a tagged blob of the code block instead of the master. The code had been updated since I replied with that link, so the lines have shifted at bit. The correct link referencing v4.0.2 should have been this:

https://github.com/michealespinola/syno.plexupdate/blob/v4.0.2/syno.plexupdate.sh#L67-L80

Even though the latest version of the codeblock has additional code/features, it will not be applicable to the version of the script you are still running – so you should use the codeblock from v4.0.2.

Please let me know if it resolves the error you are still seeing.

g6nhu commented 2 years ago

Bingo!

Dear user,

Task Scheduler has completed a scheduled task.

Task: Update Plex
Start time: Sun, 24 Jul 2022 21:51:02 GMT
Stop time: Sun, 24 Jul 2022 21:51:04 GMT
Current status: 0 (Normal)
Standard output/error:

SYNO.PLEX UPDATE SCRIPT v3.0.2

        Script: syno.plexupdate.sh v3.0.2
    Script Dir: /volume1/Scripts
   Running Ver: 3.0.2
                * No new version found.

      Synology: DS1019+ (x86_64), DSM 6.2.4-25556 Update 0
      Plex Dir: /volume1/Plex/Library/Application Support/Plex Media Server
    Plex Token:
   Running Ver: 1.27.2.5929
    Online Ver: 1.27.2.5929 (Public Channel)
      Released: 2022-06-27 19:21:16+01:00 (27+ days old)
                * No new version found.

From NAS

That's better, no more error. Thank you 👍

michealespinola commented 2 years ago

Awesome, glad to hear it! This makes me feel a lot better about how I hopefully will be making the script backward compatible to DSM6 soon.