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

Auto update to v4.0.0 (DSM7.0 only) will break DSM 6.x users #29

Closed MasterSmurf closed 1 year ago

MasterSmurf commented 2 years ago

I really like the script and it was working properly since one or two years. Now, i didn't received the latest Plex Update, because the syno.plexupdate performed an auto-update from v3.0.2 to v.4.0.0 and v4.0.0 is DSM7.0 only...

I'm currently on DSM 6.2.4-25556 Update 6 and I'm not planing to upgrade to DSM7.0 soon. So the syno.plexupdate obviously failed.

I appreciate the DSM7.0 support and I also appreciate the auto-update feature. But it will cause trouble to everyone who is not updating their DSM to the next major update in the meantime (for good reasons).

I just installed v3.0.2 and disabled the auto-update manually in the script. Now it is working again as intended.

michealespinola commented 2 years ago

For the record, I absolutely dislike the way that I handled this. In retrospect, I wish I had implemented something to disable automatic updates from DSM6 - but I very much dislike making configuration changes on other people's systems. I ultimately felt that it would be better for DSM6 users to become self-aware of the changes in the script with errors instead of sitting there thinking everything was working fine when it was actually not.

For the record, DSM7 has been incredibly frustrating to deal with at the scripting level. Some outstanding issues have normalized, and I have managed to make the scripted output from DSM7 a little more manageable. I still have designs to reincorporate DSM6, but I no longer have a DSM6 system to test/verify with - which is why there is the dramatic lack of support with v4 of this script.

I hope this helps make sense of things in that respect. If you are willing to participate, I could certainly use you or someone else's help to test reintegrating DSM6 functionality back into the script. If I am unable to accomplish that, there will be new script features that you won't have access to until you upgrade to DSM7.

FWIW, the next feature being implemented soon is preloading, archiving. and updating playback codecs. Codecs are otherwise only downloaded by the server as needed. This feature will be helpful for situations of network outages or for those that run Plex in a more offline setting. If you don't have access to the internet, play a certain video for the first time, and Plex needs a particular codec for it - you will not be able to playback the video until Plex on-the-fly downloads that codec. The new feature of the script will pre-load all (roughly 29 currently known) codecs. Normally you may only find just a few codecs on a vanilla Plex server with only videos made to a specific standard.

Cheers and sorry for the inconvenience,

war59312 commented 1 year ago

I'm willing and able to test on DSM6, as I have zero plans to update.

I've been using syno.plexupdate.sh v3.0.2 for awhile now and all good, but this morning, it seems to have broken:

SYNO.PLEX UPDATE SCRIPT v3.0.2

 * UNABLE TO CHECK FOR LATEST VERSION OF SCRIPT...

         Script: syno.plexupdate.sh v3.0.2
     Script Dir: /volume1/homes/Will/scripts/bash/plex/syno.plexupdate
    Running Ver: 3.0.2
                 * No new version found.

 * UNABLE TO CHECK FOR LATEST VERSION OF PLEX MEDIA SERVER...

date: invalid date '@'
       Synology: DS1815+-j (x86_64), DSM 6.2.4-25556 Update 6
       Plex Dir: /volume1/Plex/Library/Application Support/Plex Media Server
     Plex Token: [REDACTED]
    Running Ver: 1.29.2.6364
                 * No new version found.

There is in fact a new version, 1.30.0.6442.

The date command on line 65 still works via shell:

Will@nas:~$ date --date "now" +'%s'
1669905195

Tried below, but no luck, same problem.

Change lines:

73:

From:

SPUSGtDate=$(echo $SPUSRelHtm | grep -oP 'relative-time datetime="\K[^"]+')

To:

SPUSGtDate=$(echo $SPUSTagHtm | grep -oP 'released this <relative-time datetime="\K[^"]+')

195:

from:

ChannelUrl=$(echo "https://plex.tv/api/downloads/5.json?channel=plexpass&X-Plex-Token=$PlexOToken")

to:

ChannelUrl=$(echo "https://plex.tv/downloads/latest/5.json?channel=plexpass&X-Plex-Token=$PlexOToken")

michealespinola commented 1 year ago

Thanks, I appreciate the offer to help!

This 'invalid date '@'' glitch is new-ish and seems to affect both DSM 6 and 7 for a still unknown reason. It seems that a reboot clears it, but I have not be able to make any sense of it otherwise, and I still have not experienced it personally. If you are interested, you can look into the last reported instance of the glitch on DSM 7 in issue #35.

That said and seeing you are still on 3.0.2, I recommend manually upgrading to the latest patch that I made for DSM 6, here:

https://github.com/michealespinola/syno.plexupdate/blob/master/Tools/syno.plexupdate-3.1.0-DSM6.sh

michealespinola commented 1 year ago

I'd be curious to know if affected systems had not been rebooted since Daylight Savings Time ended, and if these systems had been observing DST. I'm probably going to make a tracked post about it.

michealespinola commented 1 year ago

@war59312, please let me know if that resolved your issue. I'm trying to track everything I can about this glitch in order to modify the code to avoid it.

war59312 commented 1 year ago

Thank you, my issue ended up being DNS, see:

https://github.com/michealespinola/syno.plexupdate/issues/35#issuecomment-1343005619

Once I fixe the DNS, it works again as expected:

Dear user,

Task Scheduler has completed a scheduled task.

Task: Syno.Plex Update
Start time: Thu, 08 Dec 2022 03:00:02 GMT
Stop time: Thu, 08 Dec 2022 03:00:05 GMT
Current status: 0 (Normal)
Standard output/error:

SYNO.PLEX UPDATE SCRIPT v3.0.2

         Script: [syno.plexupdate.sh](http://syno.plexupdate.sh/) v3.0.2
     Script Dir: /volume1/homes/Will/scripts/bash/plex/syno.plexupdate
    Running Ver: 3.0.2
     Online Ver: 4.1.0
       Released: 2022-12-08 00:00:00-05:00 (0+ days old)
                 * Newer version found!

       Synology: DS1815+-j (x86_64), DSM 6.2.4-25556 Update 6
       Plex Dir: /volume1/Plex/Library/Application Support/Plex Media Server
     Plex Token: fakeOut
    Running Ver: 1.29.2.6364
     Online Ver: 1.29.2.6364 (Public Channel)
       Released: 2022-11-01 08:14:19-04:00 (36+ days old)
                 * No new version found.

From nas
war59312 commented 1 year ago

The 3.1.0 DSM6 version looks good as well. 👍

Dear user,

Task Scheduler has completed a scheduled task.

Task: Syno.Plex Update
Start time: Thu, 08 Dec 2022 11:52:44 GMT
Stop time: Thu, 08 Dec 2022 11:52:46 GMT
Current status: 0 (Normal)
Standard output/error:

SYNO.PLEX UPDATE SCRIPT v3.1.0

         Script: [syno.plexupdate-3.1.0-DSM6.sh](http://syno.plexupdate-3.1.0-dsm6.sh/) v3.1.0
     Script Dir: /volume1/homes/Will/scripts/bash/plex/syno.plexupdate
    Running Ver: 3.1.0
                 * No new version found.

       Synology: DS1815+-j (x86_64), DSM 6.2.4-25556 Update 6
       Plex Dir: /volume1/Plex/Library/Application Support/Plex Media Server
     Plex Token: fakeOut
    Running Ver: 1.29.2.6364
     Online Ver: 1.29.2.6364 (Public Channel)
       Released: 2022-11-01 08:14:19-04:00 (37+ days old)
                 * No new version found.

From nas
war59312 commented 1 year ago

I'd be curious to know if affected systems had not been rebooted since Daylight Savings Time ended, and if these systems had been observing DST. I'm probably going to make a tracked post about it.

That is true in my case. System had not been rebooted in months.

I did try a reboot FYI and no change. Yes, before realized was DNS issue for me.

I recommend adding a check to start of script to verify DNS and Internet Connectivity is working as expected.

See https://github.com/michealespinola/syno.plexupdate/issues/36

war59312 commented 1 year ago

Not sure why or when but noticed with last few runs, it first reports "Current status: 1 (Interrupted)".

Everything still seems just fine.

Dear user,

Task Scheduler has completed a scheduled task.

Task: Syno.Plex Update
Start time: Sat, 28 Jan 2023 03:00:02 GMT
Stop time: Sat, 28 Jan 2023 03:00:50 GMT
Current status: 1 (Interrupted)
Standard output/error:

SYNO.PLEX UPDATE SCRIPT v3.1.0

         Script: [syno.plexupdate-3.1.0-DSM6.sh](http://syno.plexupdate-3.1.0-dsm6.sh/) v3.1.0
     Script Dir: /volume1/homes/Will/scripts/bash/plex/syno.plexupdate
    Running Ver: 3.1.0
                 * No new version found.

       Synology: DS1815+-j (x86_64), DSM 6.2.4-25556 Update 6
       Plex Dir: /volume1/Plex/Library/Application Support/Plex Media Server
     Plex Token: AYMBa5sjSzbxgmWfonvm
    Running Ver: 1.30.1.6562
     Online Ver: 1.30.2.6563 (Public Channel)
       Released: 2023-01-10 15:46:09-05:00 (17+ days old)
                 * Newer version found!

    New Package: PlexMediaServer-1.30.2.6563-3d4dc0cce-x86_64_DSM6.spk
    Package Age: 17+ days old (3+ required for install)

INSTALLING NEW PACKAGE:
----------------------------------------
2023-01-28 03:00:09 URL:https://downloads.plex.tv/plex-media-server-new/1.30.2.6563-3d4dc0cce/synology/PlexMediaServer-1.30.2.6563-3d4dc0cce-x86_64_DSM6.spk [112076800/112076800] -> "/volume1/homes/Will/scripts/bash/plex/syno.plexupdate/Archive/Packages/PlexMediaServer-1.30.2.6563-3d4dc0cce-x86_64_DSM6.spk" [1]
package Plex Media Server stop successfully

/volume1/homes/Will/scripts/bash/plex/syno.plexupdate/Archive/Packages/PlexMediaServer-1.30.2.6563-3d4dc0cce-x86_64_DSM6.spk install successfully

package Plex Media Server start successfully
----------------------------------------

    Update from: 1.30.1.6562
             to: 1.30.2.6563 succeeded!

NEW FEATURES:
----------------------------------------
* (NAS) Add Support for TerraMaster TOS 5 platforms.
* (Scanner) .plexmatch files now support a new match type called "SEE", which allows handling of files where e.g. "302" means episode 2 of season 3 (#13985)
* (Scanner) .plexmatch pattern matching tokens now support setting a maximum length on matches; see the "Match Hinting for TV Series" support article for details (#13985)
* (Scanner) Files named using the uncommon "SEE" format are no longer matched by default; please use the .plexmatch feature to handle these files (#13985)
* (Scanner) Files with names containing a 3- or 4-digit standalone episode number are now matched correctly by default (#13985)
----------------------------------------

FIXED FEATURES:
----------------------------------------
* (DLNA) Corrected DLNA server not starting on NVIDIA Shield (#13340)
* (DVR) DVR schedule is now corrected when the guide updates. (#13217/#12821)
* (DVR) Preview thumbs not being created for DVR recordings (#13943)
* (Library) TV theme music could incorrectly remain on an item after fixing a match (#13933)
* (Library) Unprocessed Add to Library items can crash the server on startup if the original library section no longer exists (#14022)
* (MacOS) Incorrect download progress percentage for updates is passed to the web client (#13992)
* (Metadata) Episodes would not store the year field (#13974)
* (Music) Improve reliability of maintaining original add date when upgrading albums.
* (Music) When replacing exisiting files with new versions, loudness analysis would not trigger on demand (#13897)
* (Network) The server could fail to publish any LAN addresses if a preferred network interface was selected, but was not available (#14001)
* (Pivots) Categories pivot loading time might be slow for larger libraries (#13912)
* (Transcoder) Decoding certain TrueHD audio streams could fail (#14023)
* (Transcoder) Download transcodes consumed slot even after transcode completes (#13987)
* (Versions) Optimized versions of an edition would overwrite any existing version using the same profile (#13746)
* (macOS) Some endpoints could return errors on macOS versions older than 10.15 (#13946)
----------------------------------------
michealespinola commented 1 year ago

Hi Will,

The "Interrupted" status is benign. This is an easy-to-miss caveat for how the script works, and is covered in the 'Known Non-Issues' section of the readme. I'll copy the relevant section here:

  • If the script runs successfully, the DSM Task status will show "Interrupted (1)" and the notification email will state "Current status: 1 (Interrupted)". This exit/error status of (1) is intentionally caused by the script in order to force the DSM to perform an email notification of a successful update (in the form of an interruption/error). The DSM otherwise would only send notifications of failed task events, and notifications of successful Plex updates would not be possible.

Unfortunately, there is no other built-in mechanism that I am aware of that can send a notification email of this kind, and there no way for me to suppress the "Interrupted" status message. The way it works keeps everything as light and as simple as possible without requiring 3rd-party tools.

war59312 commented 1 year ago

Got you, no worries. Much appreciated.