Request: Better Instructions to setup Post Processing
-
- Posts: 6
- Joined: Mon Sep 01, 2014 10:39 am
Re: Request: Better Instructions to setup Post Processing
Thanks a lot! I will play around with my personal script. I want Mylar to upload my downloads to Onedrive, so I can read offline on my Surface RT.
-
- Posts: 6
- Joined: Mon Sep 01, 2014 10:39 am
Re: Request: Better Instructions to setup Post Processing
Ok, I'm not skilled in Python at all and my programming/scripting skills are quite basic. I can get around bash, so I made a script to pass the variables I needed to bash. I added the path in the settings, it's executable, I checked the post-post-processing box and nothing happens. In the logs I can't seem to find it starting and well.. I'm a bit lost.
These are the permissions:
-rwxr-xr-x 1 mylar mylar 119 Sep 3 19:09 mylar-script.py
This is my script:
EDIT:
Here is a screenshot of my settings.
My debug logs never mention the word script, while the sourcecode mentions logging.
Also, should I move this to troubleshooting? It starts to look like it.
These are the permissions:
-rwxr-xr-x 1 mylar mylar 119 Sep 3 19:09 mylar-script.py
This is my script:
Code: Select all
from __main__ import *
import os
import subprocess
subprocess.call(["/srv/scrappers/mylar-script.sh", folderp, filen])
Here is a screenshot of my settings.
My debug logs never mention the word script, while the sourcecode mentions logging.
Also, should I move this to troubleshooting? It starts to look like it.
- evilhero
- Site Admin
- Posts: 2883
- Joined: Sat Apr 20, 2013 3:43 pm
- Contact:
Re: Request: Better Instructions to setup Post Processing
You can't reference the variable names referenced in Mylar outside of Mylar..
You probably want something like this:
You probably want something like this:
Code: Select all
Import sys
print sys.argv[1] #nzb name
print sys.argv[2] #nzbn folder
print sys.argv[3] #new filename
subprocess.call....(use the sys.argv[1], etc to pass to your script)
-
- Posts: 6
- Joined: Mon Sep 01, 2014 10:39 am
Re: Request: Better Instructions to setup Post Processing
Everything is working great now! I shoved my bash script right into mylar and picked up the right parameters!
This is the script btw, but it's hardcoded and it can probably be better, but it works.
Thanks a lot for the help and mylar in general!
This is the script btw, but it's hardcoded and it can probably be better, but it works.
Code: Select all
#!/bin/bash
filep="$4"
folderp=$(dirname "$filep")
if [[ $folderp == /srv/media/comics/* ]] ; then
onedrivep="Comics/${folderp:18}"
i=1
while [[ $i > 0 ]] ; do
folder=$(echo "$onedrivep" | cut -d \/ -f "$i")
if [[ "$folder" ]] ; then
if [[ "$mkdirp" ]] ; then
mkdirp="$mkdirp/$folder"
else
mkdirp="$folder"
fi
onedrive-cli mkdir "$mkdirp"
let i++
else
i=0
fi
done
onedrive-cli put "$filep" "$onedrivep"
fi