ajkis / scripts

Ajki's scripts & guides
https://ajkis.github.io/scripts/
324 stars 91 forks source link

Quick question about plexupdatenew.cron #20

Closed ghost closed 7 years ago

ghost commented 7 years ago

This seems to get some of the stuff, but for TV shows especially I will notice that it will not update it, when a new episode has been added. Am I missing something? My gut is telling me this is because its adding to the second folder in there, (aka the season folder) so the TV Show folder doesn't get modified. Is there a way to correct this?

hjone72 commented 7 years ago

-mindepth = 2 on the script. So it should look for folders underneath your show root /mnt/cloud/series/x/season x. Have a look here and here.

If you were running the most recent version https://github.com/ajkis/scripts/commit/4eaf975aa500021b7154158602fb037505d00093 there was an issue with a parameter. See #21

ghost commented 7 years ago

it was already 2. hmm gonna try 3

hjone72 commented 7 years ago

@SuperGaco Using the default variables that are set in the script: TVLIBRARY="/mnt/cloud/series/"

A mindepth of 2 means that find will only return folders that are 2 levels deeper... for example; /mnt/cloud/series/Breaking Bad/Season 1 The folder breaking bad is 1 level deep. season 1 is 2 levels deep.

Could you please post the output of the following command. Please adjust it to your paths: find /mnt/cloud/series/ -mindepth 2 -type d -cmin -60 -print this should return all folders that are two levels deep and newer than 60 minutes.

ghost commented 7 years ago

OK so it is finding the proper folders, but when I run the script the scanner doesn't work.

ghost commented 7 years ago

but then again the script is using cnewer not cmin

hjone72 commented 7 years ago

@SuperGaco is it outputting anything?

ghost commented 7 years ago

when i run the script? 25.04.2017 18:40:30 PLEX SCAN FOLDERS MODIFIED AFTER: Tue Apr 25 18:32:27 EDT 20 17 25.04.2017 18:41:03 Movies scanned in 33 seconds

Scaning TV at: /Server/TV Shows 25.04.2017 18:42:53 Series scanned in 110 seconds 25.04.2017 18:42:53 Scan completed in 143 seconds

ghost commented 7 years ago

when i ran the command you gave me: find "/Server/TV Shows" -mindepth 2 -type d -cmin -60 /Server/TV Shows/Frasier/Season 9

hjone72 commented 7 years ago

@SuperGaco the command I gave you was to just give you an example of what was happening.

ghost commented 7 years ago

Should I remove the lastrunfile stuff? It seems its whats borking it up

hjone72 commented 7 years ago

@SuperGaco I suspect that there isn't actually anything for the scanner to scan that is newer than Tue Apr 25 18:32:27 EDT 20 17.

ghost commented 7 years ago

there is, I'm testing it. I added it to test

hjone72 commented 7 years ago

No, I wouldn't remove it, it is a really neat way to track your changes while reducing the amount of scanning. It will work GREAT going forward. Give me 5 minutes I'll make a little script that will catch you up.

ghost commented 7 years ago

Thank you

hjone72 commented 7 years ago

@SuperGaco could you post your /home/plex/logs/plexrefreshnew.cron.log please?

ghost commented 7 years ago

for the record this is what I"m using for the TV show stuff, since it was giving me an error before find "$TVLIBRARY" -mindepth 2 -type d -cnewer $LASTRUNFILE -exec \

ghost commented 7 years ago

25.04.2017 15:15:36 Movies scanned in 39 seconds

25.04.2017 15:15:36 Series scanned in 0 seconds 25.04.2017 15:15:36 Scan completed in 39 seconds 25.04.2017 15:18:55 Movies scanned in 0 seconds

25.04.2017 15:18:55 Series scanned in 0 seconds 25.04.2017 15:18:55 Scan completed in 0 seconds 25.04.2017 15:19:18 Movies scanned in 0 seconds

25.04.2017 15:21:39 Series scanned in 141 seconds 25.04.2017 15:21:39 Scan completed in 141 seconds 25.04.2017 15:22:54 Movies scanned in 35 seconds

25.04.2017 15:22:55 Series scanned in 1 seconds 25.04.2017 15:22:55 Scan completed in 36 seconds 25.04.2017 15:30:34 Movies scanned in 33 seconds

25.04.2017 15:32:30 Series scanned in 116 seconds 25.04.2017 15:32:30 Scan completed in 149 seconds 25.04.2017 15:40:02 Movies scanned in 38 seconds

25.04.2017 15:41:59 Series scanned in 117 seconds 25.04.2017 15:41:59 Scan completed in 155 seconds 25.04.2017 16:00:42 Movies scanned in 41 seconds

25.04.2017 16:02:09 Series scanned in 87 seconds 25.04.2017 16:02:09 Scan completed in 128 seconds 25.04.2017 16:31:07 Movies scanned in 66 seconds

25.04.2017 16:33:09 Series scanned in 122 seconds 25.04.2017 16:33:09 Scan completed in 188 seconds 25.04.2017 17:00:37 Movies scanned in 36 seconds

25.04.2017 17:02:42 Series scanned in 125 seconds 25.04.2017 17:02:42 Scan completed in 161 seconds 25.04.2017 17:30:34 Movies scanned in 33 seconds

25.04.2017 17:32:31 Series scanned in 117 seconds 25.04.2017 17:32:31 Scan completed in 150 seconds 25.04.2017 18:00:52 Movies scanned in 51 seconds

25.04.2017 18:02:56 Series scanned in 124 seconds 25.04.2017 18:02:56 Scan completed in 175 seconds 25.04.2017 18:30:34 Movies scanned in 33 seconds

25.04.2017 18:32:27 Series scanned in 113 seconds 25.04.2017 18:32:27 Scan completed in 146 seconds 25.04.2017 18:41:03 Movies scanned in 33 seconds

25.04.2017 18:42:53 Series scanned in 110 seconds 25.04.2017 18:42:53 Scan completed in 143 seconds

ghost commented 7 years ago

I only put the log in today since it was working perfectly beforehand

hjone72 commented 7 years ago

@SuperGaco try this: https://github.com/hjone72/plexScripts/commit/5f0e6664b9e8fbc8914b23d5b502a7cbc7355f4e

Please delete "/home/plex/.cache/lastrunfile" before running

Just a quick explanation: This will check for the LASTRUNFILE, if it doesn't exist it will look for files newer than 60 minutes old. At the end of the script it will create the LASTRUNFILE and start using the new code. In essence this will use the old method once then start using the newer method. Running it the first time will bring in all the things you might not have already scanned, the second time will probably return nothing.

ghost commented 7 years ago

Yeah it seems to be working now, its adding a bunch of stuff I put in there for testing. Will this continue to work in the future? As in I can leave the script as is, and it will scan in my media?

hjone72 commented 7 years ago

It should continue to work. The changes I made should only be used the once, if you run the script again it will scan nothing. Change a file now then run the script again, it should run on just that one file.

ghost commented 7 years ago

So I should change the script back again to what it was before? Or is it fine how it is?

hjone72 commented 7 years ago

It can stay permanently like that... but test that it is working as expected.

ghost commented 7 years ago

Yeah planning on it. Thank so much for you help and patience.