XBMC Rename Button

I currently have a button setup to rename files in XBMC format as follow:

@set var={dlgstring|Enter The Season Number:|01} Rename FILEINFO NUMBER 01 BY 1 TO "{parent2}.S{$var}E[#].{ext}"

This works well enough, but I would prefer to get the season number from the parent folder, rather than asking for it in a dialog.

If the folder is named Season 1 to 9 eg. season 3, the script should add a zero in front of the number eg. showname.S03EXX

Can this be done?

Just for more information....

The second parent folder is always the show name and the 1st parent is the season folder
eg. D:\TV Shows\24\Season 9


Seeing that nobody is responding, let me then ask....Is this even possible?

Okay, it is possible. I will post the solution here once I have refined it.

The script can be downloaded from this thread:

[url]TV Episode XBMC Renamer]