Button script to go from emby file path to source file

I would like to make a button which can go to emby file source folder. Currently I am using a button to run a python script to do the job. I would like to know if there is a better way to do this. (eg. how to write python code directly in dopus (@script python) or how to write the same function by using vbs or jscript)

path shows in emby server.

since I store the file in NAS, somehow the file path is different as it in file explorer.
The real folder path is : Z:\Videos\Movies\Weathering With You

I have to convert the path into correct format in order to go to the file source folder.

The current way of archiving my goal is I wrote a simply dopus button to run the python code which I wrote to convert the file path and then the opus helps me to go to the file destination.

dopus button:

python code:

import pyperclip

emby_filepath = pyperclip.paste()

# remove any bad character in path
rep_string = ["\n"]
for rep in rep_string:
    temp = emby_filepath.replace(rep, '-')
    emby_filepath = temp
index = emby_filepath.rindex("/")

# change the file path into folder path
if "." in emby_filepath[index:]:
    index = emby_filepath.rindex("/")
    emby_filepath = emby_filepath[:index]

# reformat folder path
if "/volume2/Volumn2/" in emby_filepath:
    emby_filepath = emby_filepath.replace("/volume2/Volumn2/", "Y:/")
elif "/volume1/Volumn1/" in emby_filepath:
    emby_filepath = emby_filepath.replace("/volume1/Volumn1/", "Z:/")

elif "/Volumn2/" in emby_filepath:
    emby_filepath = emby_filepath.replace("/Volumn2/", "Y:/")
elif "/Volumn1/" in emby_filepath:
    emby_filepath = emby_filepath.replace("/Volumn1/", "Z:/")

# save the path into clipboard

Please let me know if you have a better solution to do the same thing. I am really enjoy of using dopus, I would like to learn more coding about how to make some useful buttons.

Using JScript (JavaScript, more or less) or VBScript would be easiest. You could then make a button or hotkey which applies a find & replace (or regex if you need something more complicated) on the path and then goes to the result.