INTERACT FORUM

Please login or register.

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

Author Topic: Auto Import Apply Fill Properties from Filename  (Read 3522 times)

benn600

  • Citizen of the Universe
  • *****
  • Posts: 3849
  • Living: Santa Monica CA Hometown: Cedar Rapids IA
Auto Import Apply Fill Properties from Filename
« on: December 23, 2012, 12:45:30 pm »

Now that I see auto import allows writing field values to files, is there a way to use Fill Properties from Filename?  This is the only tool I know of in MC that will apply the proper fields I need.  For Video Clips I use this format:

Video/Clips/[Grouping]/[Artist]

Then I get two levels of categorization.
Logged

syndromeofadown

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 812
Re: Auto Import Apply Fill Properties from Filename
« Reply #1 on: December 23, 2012, 02:24:08 pm »

I use tag on import for all my videos. Mr C kindly wrote the expressions i needed. You can see here:
http://yabb.jriver.com/interact/index.php?topic=69439.msg471131#msg471131
I have since refined the expressions and my views. Here is my most current:
Code: [Select]
Regex for tag on import:

[Media Type] If(IsEqual([File Type],iso,8),Video,[Media Type])

[*Video Type] regex([Filename],/#\\Video\\(.+?)\\(TV Show|Movie|Music|Home Video|Adult)\\(.+?)\\(.+?)\s+\((.+)_(\d{1,4})\)\\(.+?)_#/,1)

[$Media Sub Type] regex([Filename],/#\\Video\\(.+?)\\(TV Show|Movie|Music|Home Video|Adult)\\(.+?)\\(.+?)\s+\((.+)_(\d{1,4})\)\\(.+?)_#/,2)

[$Artist] regex([Filename],/#\\Video\\(.+?)\\(Music|Home Video|Adult)\\(.+?)\\(.+?)\s+\((.+)_(\d{1,4})\)\\(.+?)_#/,3)

[$Series] IfElse(math(isequal([Media Sub Type],Adult,1)|isequal([Media Sub Type],Home Video,1)),regex([Filename],/#\\Video\\(.+?)\\(Home Video|Adult)\\(.+?)\\(.+?)\s+\((.+)_(\d{1,4})\)\\(.+?)_#/,4),math(isequal([Media Sub Type],TV Show,)|isequal([Media Sub Type],Movie,1)),regex([Filename],/#\\Video\\(.+?)\\(TV Show|Movie)\\(.+?)\\(.+?)\s+\((.+)_(\d{1,4})\)\\(.+?)_#/,3),1,Something Went Wrong With Series)

[$Season] regex([Filename],/#\\Video\\(.+?)\\(TV Show)\\(.+?)\\(.+?)\s+\((.+)_(\d{1,4})\)\\(.+?)_#/,4)
[$Name] regex([Filename],/#\\Video\\(.+?)\\(Movie|Music)\\(.+?)\\(.+?)\s+\((.+)_(\d{1,4})\)\\(.+?)_#/,4)

[$Genre] regex([Filename],/#\\Video\\(.+?)\\(TV Show|Movie|Music|Home Video|Adult)\\(.+?)\\(.+?)\s+\((.+)_(\d{1,4})\)\\(.+?)_#/,5)

[$Year] regex([Filename],/#\\Video\\(.+?)\\(TV Show|Movie|Music|Home Video|Adult)\\(.+?)\\(.+?)\s+\((.+)_(\d{1,4})\)\\(.+?)_#/,6)

[$Episode] regex([Filename],/#\\Video\\(.+?)\\(TV Show)\\(.+?)\\(.+?)\s+\((.+)_(\d{1,4})\)\\(.+?)_#/,7)
[*Installment] regex([Filename],/#\\Video\\(.+?)\\(Movie|Music|Home Video|Adult)\\(.+?)\\(.+?)\s+\((.+)_(\d{1,4})\)\\(.+?)_#/,7)

[$Album] IfElse(IsEqual([Media Sub Type],Movie,8),If(IsEqual([Series],- No Series,8),,[Series] -/ )[Name] If(IsEqual([Installment],Disc,8),Replace([Installment],Disc 1,),),IsEqual([Media Sub Type],Music,8),[Artist] - [Name] If(IsEqual([Installment],Disc,8),Replace([Installment],Disc 1,),),IsEqual([Media Sub Type],TV Show,8),[Series] - [Season] If(IsEqual([Episode],Disc,8),[Episode],),IsEqual([Media Sub Type],Adult,8),[Name],IsEqual([Media Sub Type],Home Video,8),[Artist] - [Name],1,Something Went Wrong With Album)

[*AlbumSorting] If(isequal([Media Sub Type],Movie,1),if(isequal([Series],- No Series,8),[Album],[Series]),[Album])
                For sorting album thumbnails in pane view(view by: this - Date). its just shows album for everything but movies in series where is instead shows [series].

[*Name (With Series)] If(isequal([Media Sub Type],Movie,1),replace(replace(replace(replace(replace(replace(replace(replace(replace([Album], Disc 1,), Disc 2,), Disc 3,), Disc 4,), Disc 5,), Disc 6,), Disc 7,), Disc 8,), Disc 9,),)
                For Viewing movies in pane (Takes "disc" our of album)

What you are asking for is a lot simpler than the pile of code above.

I can think of 2 ways to accomplish what you are asking.
1) Regex like mine above only simpler. or
2) Use a consistent folder structure and build a list out of your filenames.

For 1 you could try:
[Grouping] = regex([Filename],/#\\Video\\Clips\\(.+?)\\(.+?)\\#/,1)
[Artist] = regex([Filename],/#\\Video\\Clips\\(.+?)\\(.+?)\\#/,2)

For 2 you can try :
[Grouping] = listitem([Filename (path)],4,\)
[Artist] = listitem([Filename (path)],5,\)
* you will have to play around with these 2 expressions to get the correct list items.
   try replacing the 4 and 5 with 3 and 4, or 5 and 6, etc until you get the correct values.

Im no expert at this stuff. What i have explained should get you started though.
I'm sure someone else has some helpful advice to add.

If you post some full file names/paths of the videos you are dealing with it would make it easier to help.

Good Luck

Logged

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Auto Import Apply Fill Properties from Filename
« Reply #2 on: December 24, 2012, 03:22:09 pm »

I don't think you even need that anymore.  There's an expression in MC now that'll split a string using an arbitrary character.  Split the [Filename] on the "/" character and you should be good to go.
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

syndromeofadown

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 812
Re: Auto Import Apply Fill Properties from Filename
« Reply #3 on: December 24, 2012, 05:43:51 pm »

Quote
There's an expression in MC now that'll split a string using an arbitrary character.  Split the [Filename] on the "/" character and you should be good to go.

I think i explained that above as a second option
Quote
For 2 you can try :
[Grouping] = listitem([Filename (path)],4,\)
[Artist] = listitem([Filename (path)],5,\)
* you will have to play around with these 2 expressions to get the correct list items.
   try replacing the 4 and 5 with 3 and 4, or 5 and 6, etc until you get the correct values.

It will get values from the file name using "\" as the delimiter
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Auto Import Apply Fill Properties from Filename
« Reply #4 on: December 24, 2012, 05:49:04 pm »

There's also FileFolder().

See the examples.
Logged
The opinions I express represent my own folly.

benn600

  • Citizen of the Universe
  • *****
  • Posts: 3849
  • Living: Santa Monica CA Hometown: Cedar Rapids IA
Re: Auto Import Apply Fill Properties from Filename
« Reply #5 on: December 25, 2012, 07:48:31 am »

Thank you so much syndromeofadown!  Yes, these are working perfectly!  I don't ask for much regarding tags, usually just one or two levels of consolidation so these are all I need.  I keep my folder structures organized enough and only import media in this stringent layout.  Only recently I started keeping Clips in Media Center--I used to only keep complete discs and left any music videos or whatnot in plain files to manual access with VLC or something.  Of course now I have a way to retrieve them via a Clips view, which works very well.

[Grouping] = listitem([Filename (path)],6,\)
[Artist] = listitem([Filename (path)],7,\)
Logged

benn600

  • Citizen of the Universe
  • *****
  • Posts: 3849
  • Living: Santa Monica CA Hometown: Cedar Rapids IA
Re: Auto Import Apply Fill Properties from Filename
« Reply #6 on: December 25, 2012, 07:54:13 am »

I have a couple more thoughts.  I do apply Series, Season, and Disc as well for Series.  Although I just now combined all my imports into one statement so I no longer have a separate import statement to put tags to apply.  The format is, simply, "[Series] [Season].[Disc]"

I think getting the function correct would be no problem except then it would run for my Features, Home, Music, Special discs as well.  Series is easily in the next position (which doesn't exist for the other types of content, it is just the file name).

\\Server\Video\DVD\Series\[Series]\[Series] [Season].[Disc]\VIDEO_TS\*.*
Logged

syndromeofadown

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 812
Re: Auto Import Apply Fill Properties from Filename
« Reply #7 on: December 25, 2012, 12:28:11 pm »

Quote
[Grouping] = listitem([Filename (path)],6,\)
[Artist] = listitem([Filename (path)],7,\)
This works by getting entire folder names. Very simple.

Quote
\\Server\Video\DVD\Series\[Series]\[Series] [Season].[Disc]\VIDEO_TS\*.*
This folder structure now has multiple values in folder names. Not as simple, but not a problem.
This is when you have to start using regex(like my expressions i posted).

For Simplicity i use the same folder structure for all video.
This way i can use the same regex expression for all video types and only have to
setup tag on import once for each hard drive i have.
If you look at my expressions i posted above you will see that it is basically the same thing over and over.

I use series for movies and when they have no series they are in a folder called \- No Series\ to keep things consistent.
Here is my folder structure for dvds, blu-rays, and other video shown with tv show fields
Note I have an underscore near the end of my filenames to keep consistency between bd, dvd, and other video.

Video\[Video Type]\[Media Sub Type]\[Series]\[Season] ([Genre]_[Year])\[Episode]_\VIDEO_TS
Video\[Video Type]\[Media Sub Type]\[Series]\[Season] ([Genre]_[Year])\[Episode]_\BDMV
Video\[Video Type]\[Media Sub Type]\[Series]\[Season] ([Genre]_[Year])\[Episode]_

If no one else jumps in i should have some extra time tomorrow to help with a new expression for you.

Logged

benn600

  • Citizen of the Universe
  • *****
  • Posts: 3849
  • Living: Santa Monica CA Hometown: Cedar Rapids IA
Re: Auto Import Apply Fill Properties from Filename
« Reply #8 on: December 25, 2012, 01:12:41 pm »

That is quite clever.  I was keeping folder structures as clean as I thought I could but you are right, the same principle can be applied a few more times.  I'm going to take another look at my folder structures and see if I can make some of this work to my benefit.  It would be amazing if all tags were applied automatically from the files I add.  It is such as hassle to add files and then have to update them in the Media Center interface.  It's amazing to add them and see them show up effortlessly--assuming I name/place the files correctly--which is not a problem.

Thanks again syndromeofadown!
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Auto Import Apply Fill Properties from Filename
« Reply #9 on: December 25, 2012, 02:39:27 pm »

\\Server\Video\DVD\Series\[Series]\[Series] [Season].[Disc]\VIDEO_TS\*.*

Merry Christmas.

Two questions:

  1) is the [Series] value guaranteed to be exactly the same in the above template?
  2) what are all your possible [Season] terms?

Since you have [Series] and [Season] just separated by a space character, either breaking this apart may be ambiguous depending upon your answers to 1 and 2.
Logged
The opinions I express represent my own folly.

benn600

  • Citizen of the Universe
  • *****
  • Posts: 3849
  • Living: Santa Monica CA Hometown: Cedar Rapids IA
Re: Auto Import Apply Fill Properties from Filename
« Reply #10 on: January 02, 2013, 12:22:40 pm »

Series is always a clean representation of the series name.  So "Simpsons" or "Family Guy" and it is the same in both instances of [Series].  The full name is:

Series\Simpsons\Simpsons 11.1\VIDEO_TS
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Auto Import Apply Fill Properties from Filename
« Reply #11 on: January 02, 2013, 12:42:20 pm »

For your use case, I'd create a conditional expression, one side that works on your Series, the other on your Features, Home, Music, Special discs.  These could key off your Series folder.  This will allow you to use one expression you can paste into each auto-tag rule, only requiring trivial alterations to grab the appropriate tag.

Ask if you'd like help constructing it.
Logged
The opinions I express represent my own folly.

benn600

  • Citizen of the Universe
  • *****
  • Posts: 3849
  • Living: Santa Monica CA Hometown: Cedar Rapids IA
Re: Auto Import Apply Fill Properties from Filename
« Reply #12 on: January 09, 2013, 11:37:42 pm »

I would appreciate help writing the strings I need, thanks.  Will I need to split the import statements into multiple?  My current commands:

\\ALCOHOL\Beryllium\Video\DVD\[Grouping]
Grouping = listitem([Filename (path)],6,\)

\\ALCOHOL\Beryllium\Video\Clips\[Grouping]\[Artist]
Grouping = listitem([Filename (path)],6,\)
Artist = listitem([Filename (path)],7,\)

If I am not mistaken, the only part I am missing from this is DVD Series do not also get [Series] set, but this should only be set if [Grouping]=='Series' -- otherwise it is not a Series and that folder structure position will merely contain the DVD name.

\\ALCOHOL\Beryllium\Video\DVD\Features\Movie Name\VIDEO_TS\*.*
\\ALCOHOL\Beryllium\Video\DVD\Series\[Series]\[Series] [Series #].[Disc #]\VIDEO_TS\*.*

Thoughts?
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Auto Import Apply Fill Properties from Filename
« Reply #13 on: January 10, 2013, 11:54:45 am »

This might be a good way to go about it.

ifelse(
   Regex([filename (path)], /#ALCOHOL\\Beryllium\\Video\\DVD\\Series\\([^\\]+)\\(.*?)\s+(\d+)\.(\d+)#/), [R1],
   Regex([filename (path)], /#ALCOHOL\\Beryllium\\Video\\DVD\\Features\\([^\\]+)#/), [R1]
)

The [R1] is the first occurrence of [Series].  Change it to [R2] to use the Series name from the second listing of [Series], or [R3] to use the Series # (assumed to be one or more numbers), and [R4] to use the [Disc #].  The second Regex's [R1] is the Movie Name when the path contains Features.

You could use isequal() and listitem(), but you'll end up having to do more work to break apart [Series] [Series #].[Disc #].  If you don't need that, and only want the Series or Movie Name:

ifelse(
   isequal([filename (path)], \Series\, 7), listitem([Filename (path)],7,\),
   isequal([filename (path)], \Features\, 7), listitem([Filename (path)],7,\)
)
Logged
The opinions I express represent my own folly.
Pages: [1]   Go Up