Kodi Community Forum
Kodi's regex engine? - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: General Support (https://forum.kodi.tv/forumdisplay.php?fid=111)
+---- Forum: OS independent / Other (https://forum.kodi.tv/forumdisplay.php?fid=228)
+---- Thread: Kodi's regex engine? (/showthread.php?tid=344657)



Kodi's regex engine? - muddysteel - 2019-06-13

Hi - I'm a noob with Kodi, but not with regex.  I am looking to re-organize my exiting video library to better conform with Kodi's naming conventions.

Is Kodi's re engine based on its own RE engine, Python's engine, or some other RE engine?

Based on a tip from @Karellen, I started using the https://kodi.wiki/view/HOW-TO:Create_Video_Library which led me to reviewing the underlying regex patterns involved. That led to the https://kodi.wiki/view/RegEx_tutorial which led me to my post.

Thanks!

P.S. I've stopped short of downloading Kodi's source as it's just one more thing let me  .. HEY - SQUIRREL!


RE: Kodi's regex engine? - Klojum - 2019-06-13

Plenty of people are using Kodi without any regex-added instructions when it comes to scraping your media collection into Kodi's libraries.
Good, clean folder/file naming is by far the best first step for that. So, what would you need regex for?


RE: Kodi's regex engine? - muddysteel - 2019-06-13

Sorry - was not asking for a need to use regex.  I'm just putting my feet on the ground on how Kodi works and was deciphering existing regex associated with scraping filenames (before doing lookups for additional info).

"Good, clean folder/file naming" is my goal.  I've used Myth for sometime with Makemkv to rip 400+ discs and several TV shows.   Living room viewing was done from a WDLive, which was retired in favor of Kodi.

Renaming those to match that Kodi expects is best suited for scripting; using regex is the key on my end.  I'm taking baby steps:  LiSt a directory's contents, and then with GVIM (and its RE engine, strikingly different from Perl, Java, MS, etc.), surround existing names with 'mv file1 something_kodi_expects'.

Not a ton to do manually once I get the gist of things.  Like I wrote, a Kodi NOOB.

In any case, I was lazy and should have simply looked at Kodi's source to sort the RE engine question out..

Hope that clarifies my ask..
 
(2019-06-13, 20:42)Klojum Wrote: Plenty of people are using Kodi without any regex-added instructions when it comes to scraping your media collection into Kodi's libraries.
Good, clean folder/file naming is by far the best first step for that. So, what would you need regex for?



RE: Kodi's regex engine? - muddysteel - 2019-06-13

And to answer my own question: Looks to be a Kodi'zed (or XBMC'd) PCRE (Perl Compatible Regex Engine).  Not sure the differences, but not a big deal since it's not used outside of Kodi.. Wink

Thanks again!
 
(2019-06-13, 21:52)muddysteel Wrote: Sorry - was not asking for a need to use regex.  I'm just putting my feet on the ground on how Kodi works and was deciphering existing regex associated with scraping filenames (before doing lookups for additional info).

"Good, clean folder/file naming" is my goal.  I've used Myth for sometime with Makemkv to rip 400+ discs and several TV shows.   Living room viewing was done from a WDLive, which was retired in favor of Kodi.

Renaming those to match that Kodi expects is best suited for scripting; using regex is the key on my end.  I'm taking baby steps:  LiSt a directory's contents, and then with GVIM (and its RE engine, strikingly different from Perl, Java, MS, etc.), surround existing names with 'mv file1 something_kodi_expects'.

Not a ton to do manually once I get the gist of things.  Like I wrote, a Kodi NOOB.

In any case, I was lazy and should have simply looked at Kodi's source to sort the RE engine question out..

Hope that clarifies my ask..
 
(2019-06-13, 20:42)Klojum Wrote: Plenty of people are using Kodi without any regex-added instructions when it comes to scraping your media collection into Kodi's libraries.
Good, clean folder/file naming is by far the best first step for that. So, what would you need regex for?



RE: Kodi's regex engine? - ashlar - 2019-06-13

(2019-06-13, 21:52)muddysteel Wrote: Sorry - was not asking for a need to use regex.  I'm just putting my feet on the ground on how Kodi works and was deciphering existing regex associated with scraping filenames (before doing lookups for additional info).

"Good, clean folder/file naming" is my goal.  I've used Myth for sometime with Makemkv to rip 400+ discs and several TV shows.   Living room viewing was done from a WDLive, which was retired in favor of Kodi.
It's easy.

For movies I place each movie in a folder named MovieTitle (Year).WhateverYouWant.extension

Example:

Blade Runner (1982).BluRay.1080P.H264.DTS.mkv

And in the scraper you pick the option "Movies are in separate folders that match the movie title". This way you can have subtitles inside, posters, whatever you want.

For TV Shows, I have one folder per series and inside all the episodes (without season folders), named EpisodeTitle.SxxExx.WhateverYouWant.extension.

The wiki explains this quite clearly, anyway: https://kodi.wiki/view/Naming_video_files


RE: Kodi's regex engine? - wsnipex - 2019-06-14

as you already found it's vanilla PCRE 8.42. The 3 patches are only needed to make it work on some embedded platforms.


RE: Kodi's regex engine? - RockerC - 2019-06-14

https://kodi.wiki/view/Naming_video_files


RE: Kodi's regex engine? - muddysteel - 2019-06-14

Thanks to the community for the help/pointers!

As I shared, my journey started out with an existing (large) library of video files (mostly MKV flavored).  Once I was cued into the file naming conventions expected by Kodi (AND the fact you need to differentiate between Movies vs. TV Shows!), I'm left with an in-place re-naming project.

Future RIPs / conversions will follow the Kodi best-practices.  I'll be toying around with multi-disc movies and/or TV shows (e.g., knit into one file, leave as separate files, etc) to sort out what's best for me...

Kodi's a great suite with tons of tailorability - my hat is off to the community/contributors!

I'll be leaning into bits-and-pieces to help round out what I think can use the help..