INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: How to remove several strings from [Name]?  (Read 1668 times)

MrHaugen

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 3774
How to remove several strings from [Name]?
« on: April 10, 2012, 04:54:20 pm »

I was inspired by this Movie Trailer support thread, and did exactly as Thomas suggested.
http://yabb.jriver.com/interact/index.php?topic=71027.0

Only problem now is that the downloaded Trailers contains much rubbish in the file name, so MC have problem sometimes to get meta data for this.

Here are some examples of file names:
The Five-Year Engagement (Theatrical Trailer).mov
Prometheus (Teaser Trailer).mov

What I would like is to strip all of the " (Theatrical Trailer)" and " (Teaser Trailer)" from the "Name" field upon import.
I've gotten as far as removing the first one, but I can't manage to combine two of this expressions to remove " (Teaser Trailer)" as well. How do I combine more search values?

replace([Name],/ /(Theatrical Trailer/),)
Logged
- I may not always believe what I'm saying

221bBS

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 703
Re: How to remove several strings from [Name]?
« Reply #1 on: April 10, 2012, 05:59:06 pm »

try

Code: [Select]
ListItem([Name],0,/ /()
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: How to remove several strings from [Name]?
« Reply #2 on: April 10, 2012, 06:15:31 pm »

In case there are other items in parens, you can be more selective:

  Regex([Name], /#^(.+?)( \(.+ Trailer\))?$#/, 1)

will strip only items that look like:

   stuff (morestuff Trailer)

and the parenthetical stuff is only removed at the end of [Name] of it contains Trailer.
Logged
The opinions I express represent my own folly.

MrHaugen

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 3774
Re: How to remove several strings from [Name]?
« Reply #3 on: April 11, 2012, 07:57:20 am »

Thanks! This works very well for a library field with an expression. But how should this be applied at import?

I've tried to add these two in auto import options now:

Name: Regex([Name], /#^(.+?)( \(.+ Trailer\))?$#/, 1)
Media Sub Type: Trailer

The "Name" field are updated correctly, but the Media Sub Type are not applied. Anyone know why?
Logged
- I may not always believe what I'm saying

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: How to remove several strings from [Name]?
« Reply #4 on: April 11, 2012, 11:32:42 am »

If I'm reading correctly, you're saying that you used the rule as an Auto-Import rule, and it works correctly for Name.  But you also have a Media Sub Type rule that just sets the name to Trailer but that rule does not fire/work?

Reading further into this... Since you can't assign two fields in one rule (bummer, and makes simple things harder), you'd probably want the same basic rule twice, once to use for cleaning Name, once for use in setting Media Sub Type.

So, you could use something like:

Name:               ifelse(Regex([Name], /#^(.+?)( \(.+ Trailer\))?$#/), [R1])
Media Sub Type: ifelse(Regex([Name], /#^(.+?)( \(.+ Trailer\))?$#/), Trailer)
Logged
The opinions I express represent my own folly.

MrHaugen

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 3774
Re: How to remove several strings from [Name]?
« Reply #5 on: April 11, 2012, 01:01:16 pm »

Hmmm. It looks like Media Sub Type set to "Trailer" does not work at all.... I tested is with just this option now. Media Sub Type: Trailer
Have anyone else tested this? I'm wondering if there is a bug here. I'm at build 123.
Logged
- I may not always believe what I'm saying

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: How to remove several strings from [Name]?
« Reply #6 on: April 11, 2012, 07:09:49 pm »

I added the quick test Media Sub Type auto-import rule:

  if(isequal([File Type], wmv),Trailer,)

to my Testing folder's auto-import configuration, and copied a wmv file to that directory, and ran auto-import.  Media Sub Type was set to Trailer.
Logged
The opinions I express represent my own folly.

MrHaugen

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 3774
Re: How to remove several strings from [Name]?
« Reply #7 on: April 12, 2012, 04:04:02 pm »

That don't work either. What the heck is going on :o Have to investigate more this weekend.
Logged
- I may not always believe what I'm saying

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: How to remove several strings from [Name]?
« Reply #8 on: April 12, 2012, 04:28:52 pm »

Remember, the auto-import rules only fire for tracks not in any of the databases.
Logged
The opinions I express represent my own folly.

MrHaugen

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 3774
Re: How to remove several strings from [Name]?
« Reply #9 on: April 12, 2012, 04:48:03 pm »

I know. Newly copied trailer files (mov) without any sidecar files what so ever. Auto import with only the simplest "Media Sub Type" set to "Trailer" will not even trigger, no matter what. Files are imported, but they are set to Unknown for the Media Sub Type.

There are some fishy latency and hang problems when I enter the Auto Import options. I think I need to restart my server. Will report back when I've tested some more.

*Edit*
It looks like a restart solved some strange problems with imports. Trailer was now tagged on two test files. I think I'm all good now. Thanks for the help, and sorry for the extra trouble. Normally I would not mind restarting my machines, but a Virtual Host with several virtual guests is often a pain to reboot :)
Logged
- I may not always believe what I'm saying
Pages: [1]   Go Up