2 Questions - Simple replace, and {minutes} not working

All about user-defined episode / movie / file name format expressions
Post Reply
dipstick
Posts: 6
Joined: 12 Nov 2017, 05:17

2 Questions - Simple replace, and {minutes} not working

Post by dipstick »

Question #1:
I guess I don't understand the syntax of replaceAll. I'm trying to do a simple replace. For example, I want to replace "Science Fiction" with "Sci-Fi".

According to this page, https://www.filebot.net/naming.html, this is the proper syntax:
String.replaceAll(pattern, replacement)

So shouldn't my expression look like this?:
{genres.replaceAll(Science Fiction, Sci-Fi)}

I've also tried this (due to examples I've seen):
{genres.replaceAll(/Science Fiction/, /Sci-Fi/)}
and this:
{genres.replaceAll(/[Science Fiction]/, "Sci-Fi")}
and this:
{genres.replaceAll("Science Fiction", "Sci-Fi")}

The only thing that happens is that genres are completely removed during rename. If I use {genres} by itself, it works perfectly.

Using this expression:
{ny} {minutes} {certification} {rating} {genres.replaceAll(/Science Fiction/, "Sci-Fi")}
Before:
Spaceballs - BDrip multisub x264 bluray (1987)
After:
Spaceballs (1987) PG 6.8

Question #2:
Where are my minutes? {hours} does the same thing. They're just gone.

I've tried this with multiple files. Please excuse my lack of knowledge. I really did search before posting, only to get more confused. Thank you for your help.
Google is your friend. It tells you what to do so you don't have to think. :!:
User avatar
rednoah
The Source
Posts: 22974
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: 2 Questions - Simple replace, and {minutes} not working

Post by rednoah »

1.
{genres} is a List[String] object, so...

Option A: Convert to String so you can call String.replace():

Code: Select all

{genres.toString().replace('Science-Fiction', 'Sci-Fi')}
:arrow: https://docs.oracle.com/javase/9/docs/a ... rSequence-

Option B: Call String.replace() on each String element in the List:

Code: Select all

{genres*.replace('Science Fiction', 'Sci-Fi')}
:arrow: http://docs.groovy-lang.org/next/html/d ... otoperator



2.
{minutes} and {hours} both work. They're based on the same source data, so they'll both work, if one of them can work:
viewtopic.php?f=5&t=4285

If you have trouble with MediaInfo bindings, call filebot -script fn:sysinfo and check if MediaInfo works (and post the output here as well).



:?: Are you using the GUI Format Editor? You'll want to use the GUI Format Editor because it'll give you warning messages and tell you what's not working.



EDIT:

We've been here before. I forgot too. :lol:
viewtopic.php?f=8&t=5474#p31125
:idea: Please read the FAQ and How to Request Help.
dipstick
Posts: 6
Joined: 12 Nov 2017, 05:17

Re: 2 Questions - Simple replace, and {minutes} not working

Post by dipstick »

For question #1, thank you. Of course. Works perfectly now.

For question #2, I don't know how to do what you ask, but when I open MediaInfo in Movie Bindings (for a particular movie), I get this message: "unable to load native library MediaInfo.dll...".

f5, then f5 again produces this info:

Code: Select all

FileBot 4.7.7 (r4678)
JNA Native: java.lang.NoClassDefFoundError: Could not initialize class com.sun.jna.Native
MediaInfo: net.filebot.mediainfo.MediaInfoException: Unable to load x86 (32-bit) native library MediaInfo.dll: Could not initialize class net.filebot.mediainfo.MediaInfoLibrary
7-Zip-JBinding: net.sf.sevenzipjbinding.SevenZipNativeInitializationException: Failed to load 7z-JBinding: no 7-Zip-JBinding in java.library.path
Chromaprint: java.io.IOException: Cannot run program "C:\Users\desig\Downloads\Extracted\Filebot free portable\filebot\fpcalc.exe": CreateProcess error=2, The system cannot find the file specified
Extended Attributes: OK
Unicode Filesystem: OK
Script Bundle: 2018-03-16 (r516)
Groovy: 2.4.7
JRE: Java(TM) SE Runtime Environment 1.8.0_191
JVM: 32-bit Java HotSpot(TM) Client VM
CPU/MEM: 4 Core / 247 MB Max Memory / 150 MB Used Memory
OS: Windows 10 (x86)
Package: PORTABLE
I hope that helps you help me. Any thoughts? Or how exactly do I "call filebot -script fn:sysinfo and check if MediaInfo works"?
Google is your friend. It tells you what to do so you don't have to think. :!:
dipstick
Posts: 6
Joined: 12 Nov 2017, 05:17

Re: 2 Questions - Simple replace, and {minutes} not working

Post by dipstick »

I'm sorry that I forgot about my "replace" issue from a couple years ago, or so. I reinstalled my operating system, and it's obviously been awhile since I've worked with Filebot.

And yes, I'm using the GUI Format Editor.
Google is your friend. It tells you what to do so you don't have to think. :!:
User avatar
rednoah
The Source
Posts: 22974
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: 2 Questions - Simple replace, and {minutes} not working

Post by rednoah »

2.
Some kind of compatibility / setup issue.

The easiest solution is to just used the latest and greatest portable which is self-contained and thus can't have these kinds of compatibility issues anymore:
https://www.filebot.net/#download
:idea: Please read the FAQ and How to Request Help.
dipstick
Posts: 6
Joined: 12 Nov 2017, 05:17

Re: 2 Questions - Simple replace, and {minutes} not working

Post by dipstick »

Thank you for your help and for responding so quickly. I will buy the latest version and see if that solves the issue. I was a little disappointed when I found out Filebot was no longer free with the option to donate, but I had no right. I'm only beginning to scratch the surface, but it's obvious that it's such a great tool. The developer deserves a little something for his effort, time and expense.
Google is your friend. It tells you what to do so you don't have to think. :!:
User avatar
rednoah
The Source
Posts: 22974
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: 2 Questions - Simple replace, and {minutes} not working

Post by rednoah »

You can test and evaluate newer versions without a license, so you can check if MediaInfo is gonna work before making a purchase.
:idea: Please read the FAQ and How to Request Help.
Post Reply