GuessIt Property Customization

Get help with all aspects of SABnzbd
Forum rules
Help us help you:
  • Are you using the latest stable version of SABnzbd? Downloads page.
  • Tell us what system you run SABnzbd on.
  • Adhere to the forum rules.
  • Do you experience problems during downloading?
    Check your connection in Status and Interface settings window.
    Use Test Server in Config > Servers.
    We will probably ask you to do a test using only basic settings.
  • Do you experience problems during repair or unpacking?
    Enable +Debug logging in the Status and Interface settings window and share the relevant parts of the log here using [ code ] sections.
Post Reply
thunder121
Newbie
Newbie
Posts: 1
Joined: June 14th, 2025, 9:11 am

GuessIt Property Customization

Post by thunder121 »

I'm running v4.5.1 on a windows machine and am using the Sorting function to rename files. I'd like to specify a different property result than what is given by default. (e.g. for property 'video_codec' use "x264" instead of "h.264" as the result used in the function.

options.json in \SABnzbd\guessit\config only has a portion of the patterns & associated results listed. (e.g. has 'audio_codec' patterns listed but not 'video_codec'). I am able to successfully modify the result for patterns listed in options.json but not able to add any which are missing.

I've also tried modifying the yml files under \SABnzbd\guessit\test\rules but this was not successful. I've not been able to find any other GuessIt config or rule files to modify.

Any help is greatly appreciated. Thanks!
User avatar
sander
Release Testers
Release Testers
Posts: 9429
Joined: January 22nd, 2008, 2:22 pm

Re: GuessIt Property Customization

Post by sander »

I'm no expert at all, and I haven't got an answer, but I would start by pure python code.

So:

Code: Select all

$ python3
Python 3.13.3 (main, Apr  8 2025, 19:55:40) [GCC 14.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import guessit

>>> guessit.guessit("Treme.1x03.Right.Place,.Wrong.Time.HDTV.x264-NoTV.avi")
MatchesDict({'title': 'Treme', 'season': 1, 'episode': 3, 'episode_title': 'Right Place, Wrong Time', 'source': 'HDTV', 'video_codec': 'H.264', 'release_group': 'NoTV', 'container': 'avi', 'mimetype': 'video/x-msvideo', 'type': 'episode'})

And you want to change that 'video_codec': 'H.264' to x264 ...?

Code: Select all

>>> i = guessit.guessit("Treme.1x03.Right.Place,.Wrong.Time.HDTV.x264-NoTV.avi")
>>> i
MatchesDict({'title': 'Treme', 'season': 1, 'episode': 3, 'episode_title': 'Right Place, Wrong Time', 'source': 'HDTV', 'video_codec': 'H.264', 'release_group': 'NoTV', 'container': 'avi', 'mimetype': 'video/x-msvideo', 'type': 'episode'})

>>> i = guessit.guessit("Treme.1x03.Right.Place,.Wrong.Time.HDTV.x264-NoTV.avi")
>>> if i['video_codec'] == 'H.264':
...     i['video_codec']='x264'
...      
>>> 
>>> i
MatchesDict({'title': 'Treme', 'season': 1, 'episode': 3, 'episode_title': 'Right Place, Wrong Time', 'source': 'HDTV', 'video_codec': 'x264', 'release_group': 'NoTV', 'container': 'avi', 'mimetype': 'video/x-msvideo', 'type': 'episode'})


If you want that: run SABnzbd from source code, and add a line in SABnzbd, after getting the resul from guessit() ?
Post Reply