New to filebot automation, looking for help

Support for Windows users
Post Reply
sloppyfrenzy
Posts: 7
Joined: 22 May 2015, 02:47

New to filebot automation, looking for help

Post by sloppyfrenzy »

I just discovered that filebot can do automation, unfortunately I'm not that great with coding. Ideally, I'd want a script to run when a file was finished downloading (I have that part figured out) that would go to the downloaded file path, rename it, and move it to the correct place in my media file structure where Plex would pick it up and add it to my library.

Here's an example...

My completed files go to M:\Media\Completed

My movies are in M:\Media\Movies\Movie Name Folder\Movie Name File

My TV Shows are in M:\TV Shows\TV Show Name\Season #\Episode File

I'd like a script to run that would grab it from the completed folder, rename it, and put it in the appropriate folder depending on what it is, creating the folders if necessary.

Is this something Filebot can do?

I'm running v4.5.6 and Java SE Runtime Env 1.8.0_31

Thanks!
User avatar
rednoah
The Source
Posts: 22995
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: New to filebot automation, looking for help

Post by rednoah »

That sounds like the most basic of usage. Which point exactly isn't covered by the existing docs?

Here:
http://www.filebot.net/cli.html

And here:
viewtopic.php?f=4&t=215#p1561
:idea: Please read the FAQ and How to Request Help.
sloppyfrenzy
Posts: 7
Joined: 22 May 2015, 02:47

Re: New to filebot automation, looking for help

Post by sloppyfrenzy »

Thanks for the reply. I'm happy to know that it's very basic. To me it seems a little complex, but again I'm no programmer.

Without spending a lot of time looking through it all what's missing is probably the part about how Filebot determines if it's a TV Show of a Movie and creates the correct folder structure in the right place. I was looking through the code last night and it just seemed a little intimidating. I'm sure if I take my time I can figure it out. I'm thinking my biggest hurdle will be what I said above about how it determines where it goes.
User avatar
rednoah
The Source
Posts: 22995
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: New to filebot automation, looking for help

Post by rednoah »

If you use simple -rename calls you decided if it's a movie are a tv series by passing --db TheMovieDB or --db TheTVDB. If you use the amc script you get auto-detection for that. Either way, there's no need to look at the code, the Java/Groovy code that is, you'll still need to have a basic grasp of how to use the console.
:idea: Please read the FAQ and How to Request Help.
sloppyfrenzy
Posts: 7
Joined: 22 May 2015, 02:47

Re: New to filebot automation, looking for help

Post by sloppyfrenzy »

I got renaming to work pretty well. I also tried the sorty script but get this error...

Code: Select all

C:\Program Files\FileBot>filebot -script fn:sorty
ConnectException: Connection refused: connect
java.net.ConnectException: Connection refused: connect
        at net.filebot.cli.ScriptShellBaseClass.telnet(ScriptShellBaseClass.java
:288)
        at Script1$_run_closure7.doCall(Script1.groovy:56)
        at Script1.run(Script1.groovy:55)
        at net.filebot.cli.ScriptShell.evaluate(ScriptShell.java:61)
        at net.filebot.cli.ScriptShell.runScript(ScriptShell.java:82)
        at net.filebot.cli.ArgumentProcessor.process(ArgumentProcessor.java:112)

        at net.filebot.Main.main(Main.java:169)
Failure (°_°)
I customized the script a little at the beginning of it for my media structure...

Code: Select all

// PERSONALIZED SETTINGS
def episodeDir    = '''M:/Completed/TV Shows''' as File
def episodeFormat = '''M:/TV Shows/{n}/{"Season ${s.pad(2)}"}/{n} - {s00e00} - {t}'''
def movieDir      = '''M:/Completed/Movies''' as File
def movieFormat   = '''M:/Movies/{n}/{n} ({y}){" CD$pi"}'''
Is there more customizing I need to do in sorty? I think I have the renaming part down, now for the moving the files to the correct folders.

Thanks for the help so far, almost there...
User avatar
rednoah
The Source
Posts: 22995
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: New to filebot automation, looking for help

Post by rednoah »

How about you remove the telnet part? Or make sure XBMC is listening?
https://github.com/filebot/scripts/blob ... groovy#L56

PS: Most people are just using the amc script with a few cmdline options instead of cranking out their own scripts nowadays.
:idea: Please read the FAQ and How to Request Help.
sloppyfrenzy
Posts: 7
Joined: 22 May 2015, 02:47

Re: New to filebot automation, looking for help

Post by sloppyfrenzy »

Looks like I got it all to work, renaming, moving, and deleted the leftovers.

One final issue, not really related to filebot... I'm using qbittorrent because it's light compared to what utorrent has become. When a torrent is finished downloading the script runs, but can't rename the folder\files because they're locked by the torrent program. Is there a way to unlock the file (or not have it seed automatically when done downloading, I think that'd solve my issue), or remove it from qbittorrent prior to running the script? I've checked the options, but haven't found anything related.

If not, is there a better torrent program I should be using? It would need to work with a sock5 proxy.

EDIT: It works for some files, but others seem to be locked while seeding. Workaround is to stop the download and run the script manually.

Thanks!
User avatar
rednoah
The Source
Posts: 22995
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: New to filebot automation, looking for help

Post by rednoah »

Nope. The --action MOVE is not supported in these kinds of setup.

You should use --action HARDLINK instead, or copy if necessary.
:idea: Please read the FAQ and How to Request Help.
sloppyfrenzy
Posts: 7
Joined: 22 May 2015, 02:47

Re: New to filebot automation, looking for help

Post by sloppyfrenzy »

Ok, thanks.

I'm not using any --action right now. What does hardlink do differently than move or copy?

This is what I'm using now. I'll add the --action hardlink and see what happens.

Code: Select all

filebot -script fn:amc "M:\Completed" --output "M:" -non-strict

filebot -script fn:cleaner "M:\Completed"
EDIT: I ran the script with hardlink on a test file in the Completed folder. It worked normally, but left a copy of the file in Completed. Is that expected?
User avatar
rednoah
The Source
Posts: 22995
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: New to filebot automation, looking for help

Post by rednoah »

1)
You can't move files since you can't modify or delete that are being accessed by another program. Besides, you shouldn't and you don't have to.

2)
If you want to know what a "hardlink" is I recommend asking the internet => http://lmgtfy.com/?q=What+is+a+hard+link%3F
:idea: Please read the FAQ and How to Request Help.
sloppyfrenzy
Posts: 7
Joined: 22 May 2015, 02:47

Re: New to filebot automation, looking for help

Post by sloppyfrenzy »

1) Normally, yes you're right, but obviously I can because it works for some; I've watched it. Besides, I should and I want to. Why would I want duplicate files in two different folders taking up disk space? They aren't exactly small files, and they add up. Moving the files also removes the ability to seed, which I don't like doing anyway. Sure, I could go in there and delete them manually, but it's called AUTOMATION for a reason. File gets downloaded, renamed, MOVED, and added to plex without me touching a thing. According to someone here that was "the most basic of usage".

2) You don't have to be a jackass about it. It was an honest question from someone who doesn't know Java or Filebot. Most people aren't as "gifted" as you are when it comes to coding. A simple explanation would've been nice and probably just as fast as creating and pasting that link. Besides, I was "asking the internet". What's this forum if not the internet?
User avatar
rednoah
The Source
Posts: 22995
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: New to filebot automation, looking for help

Post by rednoah »

It's an honest question that has been answered on the Internet countless times. You're not the first nor the last person to ask.
Why would I want duplicate files in two different folders taking up disk space? They aren't exactly small files, and they add up.
So here I'm not sure if you decided on being offended instead of looking it up, or if you just didn't understand.

Files are hardlinks. Copying a file means physically copying the data and creating a new hardlink. Copying a hardlinks means creating a new hardlink to the same data. So you'll end up with two files that are one and the same, i.e. the physical data on disk exists only once.
Image

I can't help you with not being able to delete files that are being seeded. That's something that torrent clients don't allow by design.
:idea: Please read the FAQ and How to Request Help.
sloppyfrenzy
Posts: 7
Joined: 22 May 2015, 02:47

Re: New to filebot automation, looking for help

Post by sloppyfrenzy »

Thank you to answering my question. I wasn't offended, just annoyed. I hate it when people pull the "why don't you ask the internet?" routine because that's exactly what I was doing. Anyway, that makes sense.

Also, so far I seemed to have found a way to move the data without manually stopping the torrent. I put a "timeout 5" at the beginning of the batch script to wait 5 seconds before trying the rename and move. So far I'm 5 for 5 without it failing to move and cleanup. The torrent program then sees the files are no longer there and changes the downloads to a "completed" status and stops trying to seed.
Post Reply