ajkis / scripts

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

plexgeneratefolderlist: multiple episodes from same season #12

Closed kaplannn closed 7 years ago

kaplannn commented 7 years ago

I'm using your plexgeneratefolderlist/plexrefreshlist scripts. It's working pretty well so far :)

If i'm downloading a whole season plex there will be multiple same paths in the plex.list

Example:

/local/The 100/Season 3/E1.mkv /local/The 100/Season 3/E2.mkv /local/The 100/Season 3/E3.mkv

will be in list:

/fuse/The 100/Season 3 /fuse/The 100/Season 3 /fuse/The 100/Season 3

so it will scan the season folder as much as it has episodes

Could you add something to avoid multiple season paths? (I'm not an scripter :/)

fuyar commented 7 years ago

"sort -u" or "uniq" should do the trick :)

kaplannn commented 7 years ago

where do i have to put that?

ajkis commented 7 years ago

Fixed it here: https://github.com/ajkis/scripts/commit/acd58941adc61a6e7276d0b6d96eeed49e108334

kaplannn commented 7 years ago

thank you! :)

kaplannn commented 7 years ago

After i add "| sort -u" the script wont be executed anymore....

ajkis commented 7 years ago

I fixed it here: https://github.com/ajkis/scripts/blob/master/plex/plexgeneratefolderlist

The thing is you will need to scan for new folders only and | sort should be added before ).

I suggest you use this script instead: https://github.com/ajkis/scripts/blob/master/plex/plexupdatenew.cron

That one is pretty simple since it will refresh only folders newer then 15 minutes eg less chance for anything to go wrong and you can run on Plex server only.

kaplannn commented 7 years ago

Thank you :)

I used the other script already but the problem was that it took to long to finish the "find" with my big Library...

kaplannn commented 7 years ago

i updated my script like yours. now its like this:

Adding to plex.list: /home/plex/acd/media/tv Adding to plex.list: /home/plex/acd/media/tv/Crazy Ex-Girlfriend Adding to plex.list: /home/plex/acd/media/tv/Crazy Ex-Girlfriend Adding to plex.list: /home/plex/acd/media/tv Adding to plex.list: /home/plex/acd/media/tv/Supergirl

so it will scan my whole tv Library ): and there are still duplicates

kaplannn commented 7 years ago

i found a solution. i added this to the scipt:

sort /home/plex/list/$TimeStamp-plex.list | uniq >> /home/plex/list/$TimeStamp-plex2.list

echo "New plexlist:" | tee -a "$LOGFILE" echo "$(cat /home/plex/list/$TimeStamp-plex2.list)" | tee -a "$LOGFILE"

its not beautiful but it does the job :)

ajkis commented 7 years ago

ah i update it

make it if [[ $task == "/movies/" ]] || [[ $task == "/series/" ]] && [[ $task != "/mnt/unionfs/movies" ]] && [[ $task != "/mnt/unionfs/series" ]] ; then

ajkis commented 7 years ago

I completely remade the generating part so there is no room for errors https://github.com/ajkis/scripts/blob/master/plex/plexgeneratefolderlist

deliverer33 commented 7 years ago

With the latest version, I'm getting the following: Notice the timestamp is missing. I think it's because the variable is set to TIMESTAMP, but referenced as $TimeStamp in the code.

Adding to plex.list: /home/plex/union-acd-upload/tv/Taken (2017)/Season 01 Uploading: -plex.list 2017/04/10 22:17:49 INFO : Encrypted amazon drive root 'encrypted/5a8iuqcn9pcp6kovnvitk512u0': Modify window not supported 2017/04/10 22:17:49 INFO : Encrypted amazon drive root 'encrypted/5a8iuqcn9pcp6kovnvitk512u0': Waiting for checks to finish 2017/04/10 22:17:49 INFO : Encrypted amazon drive root 'encrypted/5a8iuqcn9pcp6kovnvitk512u0': Waiting for transfers to finish 2017/04/10 22:17:49 INFO : -plex.list: Copied (replaced existing)

Here are the contents of -plex.list

more: unknown option -ex.list

Usage: more [options] ...

A file perusal filter for CRT viewing.

Options: -d display help instead of ringing bell -f count logical rather than screen lines -l suppress pause after form feed -c do not scroll, display text and clean line ends -p do not scroll, clean screen and display text -s squeeze multiple blank lines into one -u suppress underlining - the number of lines per screenful + display file beginning from line number +/ display file beginning from search string match -V display version information and exit

For more details see more(1).

hjone72 commented 7 years ago

@deliverer33, the timestamp issue should be fixed here: https://github.com/ajkis/scripts/pull/15#issue-221063642

As for the second issue. You're seeing that message because the filename starts with '-' your text editor thinks that -plex.list is a param you're passing.

deliverer33 commented 7 years ago

correct. It's working fine now.