Rename Extensions

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
Freyr
Posts: 2
Joined: 17 Mar 2013, 13:29

Rename Extensions

Post by Freyr »

Hi everyone,

i use filebot to sort my torrents to a NAS drive. In addition i Run an Samsung Smart TV which uses the drive via DLNA to play the series.

Unfortunately the SmartTV isnt that smart and doesnt play series with certain extensions... Funny but if i rename the Files extension to .avi instead of some "unknown" format it plays them very well :D ...

How can i modify the amc.groovy script, so that it always changes all video format extensions to .avi ??? I know its a dirty solution, but it works always for my tv.



I tried to look into the code but iam stuck. Could it be that i need to remove the "without extension" and then afterwards make a string replace search?

Code: Select all

EPISODE VS MOVIE (IF NOT CLEAR)
	if (tvs && mov) {
		def norm = { s -> s.ascii().lower().space(' ') }
		def dn = norm(guessMovieFolder(f)?.name ?: '')
		def fn = norm(f.nameWithoutExtension)   <-- ????
		def sn = norm(tvs)
		def mn = norm(mov.name)
User avatar
rednoah
The Source
Posts: 22899
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Rename Extensions

Post by rednoah »

Nope, that piece of code that's just part of the detection logic.

In the GUI you could do it by switching to to Extension Override mode and just hard-coding .avi in the format. In the CLI you can't override the extension.

You can always use the path replace script though:
http://www.filebot.net/forums/viewtopic ... &t=5#p2100

e.g.

Code: Select all

filebot -script fn:replace --def "e=mkv$" "r=avi" /path/to/files
:idea: Please read the FAQ and How to Request Help.
Freyr
Posts: 2
Joined: 17 Mar 2013, 13:29

Re: Rename Extensions

Post by Freyr »

thx this works for me :-)
Fr0ntier3
Posts: 6
Joined: 14 Mar 2020, 09:32

Re: Rename Extensions

Post by Fr0ntier3 »

I know this is 7 years old now, but I can't find anything about this and the replace script is no longer in the github directory. I'd really like to use filebot through synology but I need it to rename everything to .avi and not end up being .mp4.avi

Is there any way to do this without having to use the GUI?

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

Re: Rename Extensions

Post by rednoah »

Yes. Standard Unix tools like find and mv will get the job done:
https://unix.stackexchange.com/a/19656/78608


:!: Changing file extensions is generally a bad idea, unless somebody else changed them in the first place and you now need to fix them, but that just further underscores the point.
:idea: Please read the FAQ and How to Request Help.
Fr0ntier3
Posts: 6
Joined: 14 Mar 2020, 09:32

Re: Rename Extensions

Post by Fr0ntier3 »

Thank you, I will give that try.

Is there by chance a post somewhere that explains how/where to use these types of commands?
User avatar
rednoah
The Source
Posts: 22899
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Rename Extensions

Post by rednoah »

Well, it's a fundamental, so you will find an infinite number of tutorials on the internet:
https://www.wikihow.com/Use-Bash
:idea: Please read the FAQ and How to Request Help.
Fr0ntier3
Posts: 6
Joined: 14 Mar 2020, 09:32

Re: Rename Extensions

Post by Fr0ntier3 »

Thanks again!
Post Reply