Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue updating plex with DSM6 #48

Closed
tomscaper opened this issue Aug 21, 2024 · 5 comments
Closed

Issue updating plex with DSM6 #48

tomscaper opened this issue Aug 21, 2024 · 5 comments
Assignees
Labels
bug Something isn't working DSM6 Synology DSM 6

Comments

@tomscaper
Copy link
Contributor

Apologies if i sound a novice as i am one, but i am using version 3.1.0 as i am still on DSM6. And notice some issues with getting an error
when using https://github.com/michealespinola/syno.plexupdate/blob/master/Tools/syno.plexupdate-3.1.0-DSM6.sh, plex wasn't updating automatically, i manually updated it.

When i checked the output of the script I was getting the following error

SYNO.PLEX UPDATE SCRIPT v3.1.0

         Script:syno.plexupdate.sh v3.1.0
     Script Dir: DIRECTORY REMOVED
    Running Ver: 3.1.0
                 * No new version found.


jq: error (at <stdin>:1): Cannot iterate over null (null)
date: invalid date '@null'

       Synology: DS1019+ (x86_64), DSM 6.2.4-25556 Update 7
       Plex Dir: DIRECTORY REMOVED
     Plex Token: REMOVED
    Running Ver: 1.40.5.8897
     Online Ver: 1.40.5.8897 (Beta Channel)
       Released: 2024-08-20 16:51:24+01:00 (1+ days old)
                 * No new version found.

Particularly this part.

jq: error (at <stdin>:1): Cannot iterate over null (null)
date: invalid date '@null'

Looking at the 3.1.0 script

# SCRAPE PLEX FOR UPDATE INFO
DistroJson=$(curl -m $NetTimeout -L -s $ChannelUrl)
if [ "$?" -eq "0" ]; then
  NewVersion=$(echo $DistroJson | jq                                -r '.nas.Synology.version')
  NewVersion=$(echo $NewVersion | grep -oP '^.+?(?=\-)')
  NewVerDate=$(echo $DistroJson | jq                                -r '.nas.Synology.release_date')
  NewVerAddd=$(echo $DistroJson | jq                                -r '.nas.Synology.items_added')
  NewVerFixd=$(echo $DistroJson | jq                                -r '.nas.Synology.items_fixed')
  NewDwnlUrl=$(echo $DistroJson | jq --arg ArchFamily "$ArchFamily" -r '.nas.Synology.releases[] | select(.build == "linux-"+$ArchFamily) | .url'); NewPackage="${NewDwnlUrl##*/}"
  # CALCULATE NEW PACKAGE AGE FROM RELEASE DATE
  PackageAge=$((($TodaysDate-$NewVerDate)/86400))
else
  printf " %s\n" "* UNABLE TO CHECK FOR LATEST VERSION OF PLEX MEDIA SERVER..."
  printf "\n"
  ExitStatus=1
fi

I think that the data at https://plex.tv/api/downloads/5.json data might have changed
As its showing as NAS."Synology (DSM 6)".version/release_date/etc or NAS."Synology (DSM 7)".version/release_date/etc

I altered the 3.1.0 and the errors in between disappeared.

# SCRAPE PLEX FOR UPDATE INFO
DistroJson=$(curl -m $NetTimeout -L -s $ChannelUrl)
if [ "$?" -eq "0" ]; then
  NewVersion=$(echo $DistroJson | jq                                -r '.nas["Synology (DSM 6)"].version')
  NewVersion=$(echo $NewVersion | grep -oP '^.+?(?=\-)')
  NewVerDate=$(echo $DistroJson | jq                                -r '.nas["Synology (DSM 6)"].release_date')
  NewVerAddd=$(echo $DistroJson | jq                                -r '.nas["Synology (DSM 6)"].items_added')
  NewVerFixd=$(echo $DistroJson | jq                                -r '.nas["Synology (DSM 6)"].items_fixed')
  NewDwnlUrl=$(echo $DistroJson | jq --arg ArchFamily "$ArchFamily" -r '.nas["Synology (DSM 6)"].releases[] | select(.build == "linux-"+$ArchFamily) | .url'); NewPackage="${NewDwnlUrl##*/}"
  # CALCULATE NEW PACKAGE AGE FROM RELEASE DATE
  PackageAge=$((($TodaysDate-$NewVerDate)/86400))
else
  printf " %s\n" "* UNABLE TO CHECK FOR LATEST VERSION OF PLEX MEDIA SERVER..."
  printf "\n"
  ExitStatus=1
fi

I don't know exactly fully what it all does but i wondered if the way the data held at https://plex.tv/api/downloads/5.json might have caused it to compare the versions incorrectly and that caused the fail to update or see the update was available.

@tomscaper
Copy link
Contributor Author

my bad was already noticed in #46 would have saved myself a few hours if i checked closed issues

@michealespinola
Copy link
Owner

No worries and thank you for submitting a pull request. I'll be able to review it later tonight or tomorrow at the latest. I don't use DMS 6, so I'm likely to just rubber stamp it. If you'd like to work together to integrate DSM 6 functionality into the main script, I'm more than happy to work with you to do that as well.

Cheers and thanks!

@michealespinola michealespinola self-assigned this Aug 26, 2024
@michealespinola michealespinola added bug Something isn't working DSM6 Synology DSM 6 labels Aug 26, 2024
@tomscaper
Copy link
Contributor Author

thank you, im pretty much a novice at all of this, and was my first time with the pull request so i wasnt sure exactly how it all worked, i managed to get it all working, so i thought id have a go.

@michealespinola
Copy link
Owner

I'm a bit of a GitHub newbie myself, so as far as I'm concerned, you did great.

Just as a heads-up, with changes that I am likely going to have to implement because of DSM 7.2.2, this will likely be a start to begin back-integrating DSM 6 into the main code. I don't personally run DSM 6 on any of my devices anymore, so I can't personally test any DSM 6 work that I integrate. If you want to be a tester, let me know and I'll loop you in.

@michealespinola
Copy link
Owner

Updated DSM6 code can be found here from now on:

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working DSM6 Synology DSM 6
Projects
None yet
Development

No branches or pull requests

2 participants