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

PlexUpdateLibrary - Folder Modified Date doesnt change but file does. Questions on pulling just folder from the find command. #24

Open
ml3000 opened this issue Apr 27, 2017 · 10 comments

Comments

@ml3000
Copy link

ml3000 commented Apr 27, 2017

In my Google Drive the folder Modified date isnt changing but the file is.
I can change the depth to 3 and I can grab the changed file that way but how would I pull out just the directory to put that into a log file to get scanned by plex?

Im not very familiar with scripting so I apologize.

--file does not look like it works for plex

@hjone72
Copy link
Contributor

hjone72 commented Apr 27, 2017

--file does not work. It has been confirmed by many forum posts.

If you have a look at this script here: https://github.com/ajkis/scripts/blob/master/plex/plexupdatenew.cron it should find folders that have had files updated within them.

@ml3000
Copy link
Author

ml3000 commented Apr 27, 2017

Thats what I am using.

My modified date on the Season folder does not change within Google Drive. Only the file changes within the folder. I do not know why.

So using a depth of 3 I can grab a file because of the modified date on the file being newer than the last run.

My question is, is there a way of instead of echo'ing the depth of 3 to a log file. Can I echo a depth of 2 with the Season folder instead. Like pull out the actual file name from the string which is being echo'd

@hjone72
Copy link
Contributor

hjone72 commented Apr 27, 2017

Here is a small snippet that should do what you're after.

readarray -t FILES < <(find "/mnt/cloud/media/tv_shows" -mindepth 2 -type f)
for value in "${FILES[@]}"; do
        echo "$value" # Full file and path.
        echo `dirname "${value}"` # Folder up to the last '/'
        echo `basename "${value}"` # File name only.
done

@ghost
Copy link

ghost commented Apr 28, 2017

I'm still having trouble with it, it seems that rclone doesnt set folder mtime correctly.

@ajkis
Copy link
Owner

ajkis commented Apr 28, 2017

`>Here is a small snippet that should do what you're after.

If you search for files and strip dirname you will need to generate new array and remove duplicates, since otherwise if you have Season 01/Ep1 `Season 01/Ep2 Season 01/Ep3 the same folder will be scanned 3 times instead of only once.

@hjone72
Copy link
Contributor

hjone72 commented Apr 29, 2017

I don't agree that the best way to approach this is scanning a cloud directory to find changes. In my solution I am building a list of files based on my local directory, then scanning those folders. Local only hangs around for 1 or 2 days so there isn't that much overlap. By building the folder list from your local directory you aren't putting any load on the cloud services and you still get full access to all mtime ctime ect that some cloud services/mounting software may not support correctly.

@ajkis
Copy link
Owner

ajkis commented Apr 29, 2017

@hjone72 yes I agree and i made scripts for that kind of refresh eg it will only scan exact folders you uploaded:
https://github.com/ajkis/scripts/blob/master/plex/plexgeneratefolderlist
https://github.com/ajkis/scripts/blob/master/plex/plexrefreshfolderlist

@ajkis
Copy link
Owner

ajkis commented Apr 29, 2017

@ml3000 I completely changed how script works now.
https://github.com/ajkis/scripts/blob/master/plex/plexupdatenewfolders.sh

Instead of checking for new/modifies folders the script will check for new/modified files ( since some clouds do not modify folder dates when content in them changes )

Building the array with unique folder names before running Plex Scan, since that one takes long time and uploads during those may be missed.

@ml3000
Copy link
Author

ml3000 commented Apr 30, 2017

@ajkis Hey, did you delete the script that you linked to above? Thanks

@ml3000 ml3000 closed this as completed Apr 30, 2017
@ml3000 ml3000 reopened this Apr 30, 2017
@ajkis
Copy link
Owner

ajkis commented May 1, 2017

ajkis Hey, did you delete the script that you linked to above? Thanks

no just renames some scripts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants