this will work on synology nas?
@MarcoBishero, yes it will. Use the task scheduler to run it on a schedule
Hi Steevo
this is the error that I got:
NasCasa> ./AutoDelete.py
File "./AutoDelete.py", line 68
if Show=="":
^
IndentationError: unexpected indent
NasCasa>
:s
@MarcoBishero,
Python is telling you that you have an unexpected indent on the line shown. If a space or tab was added that would cause this. Also, when copying and pasting the script you might have ended up with incorrect indentation. I would try to add the script to your system again fresh with that in mind.
EDIT: Also, here is the "raw" link for the file. (Use this version:) http://pastebin.com/raw.php?i=GEezTKT3
now this :S
NasCasa> ./AutoDelete.py
File "./AutoDelete.py", line 89
except:
^
SyntaxError: invalid syntax
is ok right?
NasCasa> python -V
Python 2.7.9
@MarcosBishero, that is a similar error. It doesn't like the formatting you are ending up with for some reason. I am using the same script with no errors.
What program are you using to save the file? Try downloading this directly from here: https://www.dropbox.com/s/q5zeuev0hgcza24/PlexAutoDeleteScript-APR2015.py?dl=0 and then upload it to your synology.
is ok right?
NasCasa> python -V
Python 2.7.9
Yes, it is a formatting issue with the script.
I directly downloaded the file to the NAS and doing a vi this is the text:
[...]
## - LogFile (Path to log console info to, if empty then no log file will be made)^M
##^M
####################################################################################^M
####################################################################################^M
^M
PC = ""^M
Host = ""^M
Port = ""^M
SectionList = []^M
IgnoreSections = []^M
Delete = "0"^M
DeleteSimilar = "0"^M
PlexDelete = "0"^M
Move = "0"^M
MoveSimilar = "0"^M
Copy = "0"^M
Shows = []^M
OnDeck = ""^M
[...]
and of course it didn't started.
@MarcosBishero,
The "^M" at the end of each line shouldnt be there. Those are DOS/Windows line-ending characters. Which means some part of your process to get the script on your nas is corrupting the file somehow. Try ssh'ing into your nas, getting to the directory you would like the script to be located, and then running:
wget https://www.dropbox.com/s/q5zeuev0hgcza24/PlexAutoDeleteScript-APR2015.py
That will download the file directly. Then try it again... :D
ok Now it's work!
I used the TimerScheduler to schedule it but I think that is not working (the schedulation).
Should not write the log every time it runs?
What are you using to edit the script file? Most Mac or Linux editor's should be ok, but Notepad on Windows will cause formatting issues like that. I would suggest getting a text editor that won't mess up the formatting like Notepad++ on Windows or you could try using Wordpad and saving the file as Unicode instead of MS-Dos. The best option would be Vim or Nano on Linux if you are comfortable with it.
I did a complete rewrite of the script and I will post it in the next few days.
I used VI!! and I tryed with ultraedit also...but now works...the problem now is the scheduler
from the task scheduler it doesn't work at all neither if I start it directly from there.
Am I missing something?
User: admin
script defined by user: python /volume1/homes/admin/scripts/PlexAutoDelete.py
The "moveSimilar" option is supposed to delete also the directory that contains the video file (same name)?
thx
@MarcoBischero,
You need to put the full path to Python when running as a scheduled task. Type “which python” in terminal. It will probably be: /usr/local/python/bin/python2.7
Replace “python” in your script with that: “/usr/local/python/bin/python2.7”
There is no MoveSimilar option. The DeleteSimilar option will delete files that have a similar name as the video file, but will not delete the folder. This is because movie folders will usually have different naming styles from the video file. This option only works when deleting files. It does not currently move or copy similar named files.
@ngovil21, I did add a MoveSimilar option to the latest version of the script that I posted. It moves similar files in tandem with the move option. I use move instead of delete and also wanted the similar files to move along with the media.
Hey guys, I've been using this for a little while now and I have added some more robust logging that I thought I would share with everyone. All this does is give you a timestamped log for each time the script runs as well as perform cleanup on old logs based on a configurable number of days to keep logs for.
You can get it here: https://drive.google.com/file/d/0B892LgS1VW6-NVNjNVcxZlRrUVE/view?usp=sharing
By default it will keep the logs in a 'logs' folder where the script resides and keep logs for 30 days before deleting them.
No luck... it's not working from task scheduler :( I tryed /usr/bin and the path that you specified, but nothing
@MarcoBishchero, you did install python2 from the synocommunity repo right? What do you get when you type 'which python' via ssh?