Page 1 of 1

[Question] Script to rename [MAC]

Posted: 16 Jan 2013, 10:35
by Qyles
Hello, first of all, Im really sorry if this has been answered yet, but my level of Applescripting is nule so I can't find it.

I have a time capsule as a NAS and a boxee box and a Mac to download torrents. What I already have automated is the following:

1. "TvShows 2" app to automatically download new episodes to transmission. This is able to download new episodes to "Automatic Downloads" folder and organize it by Title folder and season folder.
2. "Folder Sync" app to automatically sync every hour the folder "Automatic Downloads" with my Time capsule folder of "Tv Shows" where boxee is accessing.

The last step I would like to do is to use one of the many programs that are able to run a script every hour. And this script should open filebot and make it rename all the episodes in those folders I synced (however, I would mind if it needs to rename all the "Tv Shows" folder on Time capsule because I have already renamed it all with filebot).

Thank you very much. I hope you can help me.

BTW, I LOVE FILEBOT :lol: :lol:

Re: [Question] Script to rename [MAC]

Posted: 16 Jan 2013, 13:17
by rednoah
IMHO the best way to automate this is to have transmission call filebot for each completed download n. Cleanest solution anyway. Check the "Fully Automated Media Center" posts for that. It'll show u how it works with utorrent but transmission shouldn't be so different.

If u wanna run every hour (maybe easier to set up with extra tools) u have to figure out how filebot couldn't know what's been renamed and what hasn't. Easiest way is to have two folders, eg Completed and Sorted. Process all files in Completed and move to Sorted.

Re: [Question] Script to rename [MAC]

Posted: 16 Jan 2013, 14:43
by Qyles
Thank you very much for your answer,

The problem is that transmission doesnt allow to open an app after the download.

So... why do I have to use transmission and not utorrent? Because I need the torrent to be downloads in the same destination as the .torrent, because the "Tvshows 2" app organizes the tv shows on folders

Any suggests?

Thank you very much indeed

Re: [Question] Script to rename [MAC]

Posted: 16 Jan 2013, 14:47
by rednoah
Are you sure?
https://trac.transmissionbt.com/wiki/Sc ... Completion

I'm not using transmission so you might have to figure out the glue logic yourself. But it can run a bash script and pass in variables. So you just need a bash script that'll take those environment variables and call filebot.

EDIT:
You only need that other tool to grab torrents for new episodes. Everything after that FileBot can handle just fine.

Re: [Question] Script to rename [MAC]

Posted: 17 Jan 2013, 10:49
by Qyles
I found it. It was in a tab I didnt see. Sorry.

As I said, I dont know anything about scripting, could it be possible to you (or to someone) to give me some hints of how to call filebot after a episode is downloaded and rename it? (just rename it, I dont need it to sort episodes or difference if they are movies or tv shows, they are allways gonna be episodes (if not, I'll sort it manually).

Thanks.

Re: [Question] Script to rename [MAC]

Posted: 17 Jan 2013, 11:08
by rednoah
The command would be something like:

Code: Select all

filebot -rename "C:/completed/name.s01e01.avi" --db thetvdb -non-strict
How to replace the path with what transmission passes in you have to figure out yourself. Maybe something like this?

Code: Select all

filebot -rename "$TR_TORRENT_DIR/$TR_TORRENT_NAME" --db thetvdb -non-strict

Re: [Question] Script to rename [MAC]

Posted: 20 Jan 2013, 12:18
by Qyles
Hello again,

I've finally found a way (or I am near). I Hope you can help me again :D

I've done an appliclation with automator with the following;

Code: Select all

/Applications/Filebot.app/Contents/MacOS/filebot -rename /Users/qyles/Torrent/AutomaticD --db thetvdb -non-strict
The only problem is that it says there are not media files (i've tried with other paths and it works if there are media files in the directory, it doesn't search inside the folders.

Is there anyway to tell it to search inside the folders? Thank you very much!!! I'm near!

Re: [Question] Script to rename [MAC]

Posted: 20 Jan 2013, 13:07
by rednoah
Recursive Mode:

Code: Select all

-r

Re: [Question] Script to rename [MAC]

Posted: 20 Jan 2013, 13:28
by Qyles
Thank you very much,

I offer (if you want) to do a tutorial for scripting-fools like me in a new topic so people can do it on a MAC in a really easy way. Just if it interests.

Another little question, if I want it to automatically download subtitles, what do I have to do? Something like this?

Code: Select all

/Applications/Filebot.app/Contents/MacOS/filebot -rename  "$@" --db thetvdb -non-strict --def subtitles=y 
It doesn't work.

"$@" is to call automator variables.

Thank You!

Re: [Question] Script to rename [MAC]

Posted: 20 Jan 2013, 13:58
by rednoah
Sure. A tutorial would be highly appreciated, especially for Mac.

Even with simple cmdline u can do multiple operations:

Code: Select all

-get-subtitles -rename

Re: [Question] Script to rename [MAC]

Posted: 20 Jan 2013, 19:35
by Qyles
Ok, I'll do the tutorial then.

I'm trying to do what I show in the image.

The problem is that it only allow me to get 1 episode and it stops. (in the folder there were more episodes). Any idea?

Thanks!


EDIT. Ok I found another way using -r and simplifying everything.

Re: [Question] Script to rename [MAC]

Posted: 20 Jan 2013, 19:49
by rednoah
You're only passing in 1 video file then. I don't know why but that's how it is.

Pass in a folder and it'll process all files in the folder. You can also pass in multiple file paths.

Re: [Question] Script to rename [MAC]

Posted: 20 Jan 2013, 23:26
by Qyles
Thank you!

I finally did it:

Code: Select all


#Run Filebot to rename Movies
/Applications/Filebot.app/Contents/MacOS/filebot -rename /Users/mama/Torrent/Series --db thetvdb -non-strict -r

#Run Filebot to get subtitles
/Applications/Filebot.app/Contents/MacOS/filebot -get-subtitles /Users/mama/Torrent/Series -r

#Syncronize with Timecapsule excluding .part files
rsync -va --exclude '*.part' /Users/mama/Torrent/Series /Volumes/Data/

#Delete all files but keep directories
find /Users/mama/Torrent/Series -type f -print0 | xargs -0 rm


I only have a problem: the subtitles are downloaded with a *.eng at the end. Anyway to disable that?

Thanks!

Re: [Question] Script to rename [MAC]

Posted: 21 Jan 2013, 02:00
by rednoah
If you download subs first then and then run it through -rename you can define if it should be with or without .eng via the format expression.

Alternatively you can remove all the .eng from filenames in a second step with the fn:replace script:
http://filebot.sourceforge.net/forums/v ... &t=5#p2100

Re: [Question] Script to rename [MAC]

Posted: 26 Jan 2013, 10:58
by Qyles
Hello,

I've been busy so I havent carried on on everything, i just found in your faqs how to send a notification with pushover and configured it. But i would like you to help me a bit more if you can. What I've already done is something like this:

Code: Select all

#Run Filebot to get subtitles
/Applications/Filebot.app/Contents/MacOS/filebot -get-subtitles /Users/mama/Torrent/Series -r

#Run Filebot to rename Movies
/Applications/Filebot.app/Contents/MacOS/filebot -rename /Users/mama/Torrent/Series --db thetvdb -non-strict -r

#Organize in folders and copy to TC
/Applications/Filebot.app/Contents/MacOS/filebot -extract -rename /Users/mama/Torrent/Series --output /Volumes/Data-1/Series --format "{n}/Season {s}/{n} {sxe} {t}" --db thetvdb -non-strict -r

#Send pushover notification
 curl -s \
  -F "token=mytoken" \
  -F "user=myuser" \
  -F "message=All Tvshows have been downloaded and synchronized" \
  https://api.pushover.net/1/messages.json

Just 2 questions:

1. In #Organize in folders and copy to TC already includes the -rename, so it doesnt matter if I remove the #Run Filebot to rename Movies doesn't it?

2. In the pushover notification, I would like to use something like this: Last episode of (FILEBOT VARIABLE) downloaded. Any idea of how to call the name of the tvshows variable? {n}?


thank you very much!!

Re: [Question] Script to rename [MAC]

Posted: 26 Jan 2013, 11:07
by rednoah
1. Looks like it.

2. No. Not in the shell script anyway. You can look into the code snippets and then use filebots rename history to figure out where files where moved.

Re: [Question] Script to rename [MAC]

Posted: 07 Feb 2013, 13:13
by rednoah
Tutorial on how to set up automated processing with Transmission:
http://filebot.sourceforge.net/forums/v ... =215#p3380