INTERACT FORUM

Please login or register.

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

Author Topic: MCWS - constant FileKey to refer to "current file"  (Read 116 times)

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2805
MCWS - constant FileKey to refer to "current file"
« on: February 17, 2025, 12:48:43 pm »

@Matt

Many MCWS APIs need the target file key to be specified via ?File=12345. In many cases such as in this thread, the user wants to target the current selected file - this requires two calls, one to get the current file key and a second one to execute the command on it. It also requires some sort of coding/script to chain the calls.

Would it be possible to use ?File=-2 to target the current selected file on any MCWS call that takes the File parameter? This is assuming that normal keys are never negative (-1 already means default/unknown). This could also be File=0 if zero is not otherwise a valid key.

If no file is selected, -2 would result in no action / unknown file error, same as -1.
If multiple files are selected... no sure if it should return an error or just use the first selected file.
Logged

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42597
  • Shoes gone again!
Re: MCWS - constant FileKey to refer to "current file"
« Reply #1 on: February 17, 2025, 02:16:14 pm »

How about adding a file type instead?

So to get the image from the selected file:
http://localhost:52199/MCWS/v1/File/GetImage?FileType=Selected&Type=Thumbnail&Format=jpg

Lots of functions use the same file base class.

Thanks.
Logged
Matt Ashland, JRiver Media Center

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2805
Re: MCWS - constant FileKey to refer to "current file"
« Reply #2 on: February 17, 2025, 02:26:58 pm »

Yes, that's a good solution.
Logged

datdude

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2244
Re: MCWS - constant FileKey to refer to "current file"
« Reply #3 on: February 17, 2025, 02:30:56 pm »

This would be great. Thank you Matt!
Logged
"You are not a beautiful or unique snowflake." -  Just a very big snowball
Pages: [1]   Go Up