INTERACT FORUM

Please login or register.

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

Author Topic: Expression language saved me a ton of time.....  (Read 971 times)

antenna

  • Galactic Citizen
  • ****
  • Posts: 448
Expression language saved me a ton of time.....
« on: October 13, 2018, 12:55:37 pm »


I recently added over a hundred titles to the video portion of my library.  The Name field of the files being imported had the format:

     Series Name - Episode Name (112 2017-06-11_2300)

where 112 is the season (1) and episode (12), and the rest of the numbers are the date and time of recording.

For the purposes of metadata in the library, I am interested in the series and episode names, but I also want the season and episode numbers.

I could go through and manually enter the data in the grid ("details") view, but a few dozen titles would take too much time.

So.... I started reading about Media Center's expressions language and found the regex function.

I highlighted all of the newly imported video files, and entered the following into the Custom field in the Tag sidebar:

    =regex([Name], /#^.*?\((\d+)#/, 1)

In the above example, the expression places 112 in the Custom field.

Then it is just a matter of using the Left and Mid functions to move the proper values to the Season and Episode.

What would have been probably an hour or so (maybe longer) of manual data editing, was reduced to just a few minutes of learning the expression syntax and running the expressions to updated the fields.

It certainly is very nice to have some real and very flexible capability "behind the scenes" in Media Center!
Logged
=========
Vinyl: Shure V15VxMR, Shure VN5MR stylus, VPI Scout turntable
Shellac: Shure M91, Shure N75-3 stylus,  Dual 1218 turntable

Apt Holman preamp (updated), Benchmark Media ADC-1, Benchmark Media DAC-1, Carver TFM-45 power amp (updated), Original Acoustic Research AR-9 speakers (LF surrounds replaced), Sennheiser HD590 headphones

RD James

  • Citizen of the Universe
  • *****
  • Posts: 1871
Re: Expression language saved me a ton of time.....
« Reply #1 on: October 13, 2018, 12:59:01 pm »

For what it's worth, there are also "fill properties from filename" and "fill track numbers from list order" tools.
Logged

antenna

  • Galactic Citizen
  • ****
  • Posts: 448
Re: Expression language saved me a ton of time.....
« Reply #2 on: October 13, 2018, 01:13:54 pm »


Thanks, I'll check those out.  I'm still relatively new to MC, and I'm finding there's a lot of depth of functionality to explore.   :)
Logged
=========
Vinyl: Shure V15VxMR, Shure VN5MR stylus, VPI Scout turntable
Shellac: Shure M91, Shure N75-3 stylus,  Dual 1218 turntable

Apt Holman preamp (updated), Benchmark Media ADC-1, Benchmark Media DAC-1, Carver TFM-45 power amp (updated), Original Acoustic Research AR-9 speakers (LF surrounds replaced), Sennheiser HD590 headphones

antenna

  • Galactic Citizen
  • ****
  • Posts: 448
Re: Expression language saved me a ton of time.....
« Reply #3 on: October 13, 2018, 04:46:43 pm »

For what it's worth, there are also "fill properties from filename" and "fill track numbers from list order" tools.

I tried the "fill properties from filename" option, and that got me to the same point as the regex did, but a bit simpler to use.

I still used the left() and mid() functions to fill in the season and episode numbers.   The "fill track numbers from list order" might have worked for what I needed, but the left() and mid() functions are quite easy to use.

Thanks again for the tip.
Logged
=========
Vinyl: Shure V15VxMR, Shure VN5MR stylus, VPI Scout turntable
Shellac: Shure M91, Shure N75-3 stylus,  Dual 1218 turntable

Apt Holman preamp (updated), Benchmark Media ADC-1, Benchmark Media DAC-1, Carver TFM-45 power amp (updated), Original Acoustic Research AR-9 speakers (LF surrounds replaced), Sennheiser HD590 headphones

RoderickGI

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 8186
Re: Expression language saved me a ton of time.....
« Reply #4 on: October 13, 2018, 07:17:58 pm »

Well done.

For future reference, if MC knows the Series and Episode names, and the program is listed on TheTVDB, the MC "Get Movie & TV Info..." function will find the correct program and update the Library with the Season and Episode numbers, Description, etc. MC used to rely on having the Season and Episode numbers for the lookup, but that was changed quite some time ago.

CARNAC, the MC functionality which reads the file name on import and "guesses" what it is, can usually get the Series and Episode names correct, if they are structured into the file name. If not the "fill properties from filename" can usually fix that, using a template if necessary.

Next time you have a bunch of files in the above situation, test the "Get Movie & TV Info..." function on just one file without running your above fix, and see if it works for you. If so, just run it on all files at once. Done.
Logged
What specific version of MC you are running:MC27.0.27 @ Oct 27, 2020 and updating regularly Jim!                        MC Release Notes: https://wiki.jriver.com/index.php/Release_Notes
What OS(s) and Version you are running:     Windows 10 Pro 64bit Version 2004 (OS Build 19041.572).
The JRMark score of the PC with an issue:    JRMark (version 26.0.52 64 bit): 3419
Important relevant info about your environment:     
  Using the HTPC as a MC Server & a Workstation as a MC Client plus some DLNA clients.
  Running JRiver for Android, JRemote2, Gizmo, & MO 4Media on a Sony Xperia XZ Premium Android 9.
  Playing video out to a Sony 65" TV connected via HDMI, playing digital audio out via motherboard sound card, PCIe TV tuner

antenna

  • Galactic Citizen
  • ****
  • Posts: 448
Re: Expression language saved me a ton of time.....
« Reply #5 on: October 15, 2018, 11:56:55 am »

...For future reference, if MC knows the Series and Episode names, and the program is listed on TheTVDB, the MC "Get Movie & TV Info..." function will find the correct program and update the Library with the Season and Episode numbers, Description, etc. MC used to rely on having the Season and Episode numbers for the lookup, but that was changed quite some time ago.
...

I had a chance to use the "Get Movie & TV Info..." tool.  Wow, that is very good! 

The info it provides looks to be a lot more accurate than the series-name/episode-title/etc metadata info that is used by my source.  It cleaned up a lot of junk metadata in the videos I tested it on.  I especially like the program info paragraph and the appropriate "cover image" for each episode.

Thanks for that pointer!
Logged
=========
Vinyl: Shure V15VxMR, Shure VN5MR stylus, VPI Scout turntable
Shellac: Shure M91, Shure N75-3 stylus,  Dual 1218 turntable

Apt Holman preamp (updated), Benchmark Media ADC-1, Benchmark Media DAC-1, Carver TFM-45 power amp (updated), Original Acoustic Research AR-9 speakers (LF surrounds replaced), Sennheiser HD590 headphones

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8014
Re: Expression language saved me a ton of time.....
« Reply #6 on: October 16, 2018, 08:15:23 am »

The expression language is extremely powerful that's for sure.  You can save yourself lots of time and get things just the way you want them without a lot of manual effort.

The Get Movie and TV info is also quite amazing; especially paired with Carnac and the prompting when it can't find an exact match.  When compared to another *extremely* popular home media solution, MC is clearly miles ahead in this regard.  With the other you have to name your files *exactly* as expected, or it just doesn't work.  I could go on, but I'll just leave it at that.

MC, in my opinion, is still easily the most powerful and most configurable media solution I've seen.

Brian.
Logged
Pages: [1]   Go Up