More > JRiver Media Center 24 for Linux

Command line functions

<< < (2/2)

laba:
Is the list of functions at http://localhost:52199/MCWS/v1/ the only things that can be done with this method or is it possible to hack it to use any of the commands such as MCC_IMPORT_AUTO_RUN_NOW listed at https://wiki.jriver.com/index.php/Media_Center_Core_Commands#Tools ?

I would like to be able to quickly trigger auto-import as in the attached gif. Is there a way to do that with a command?

Thank you.

Matt:

--- Quote from: laba on December 09, 2019, 09:14:55 am ---Is the list of functions at http://localhost:52199/MCWS/v1/ the only things that can be done with this method or is it possible to hack it to use any of the commands such as MCC_IMPORT_AUTO_RUN_NOW listed at https://wiki.jriver.com/index.php/Media_Center_Core_Commands#Tools ?

I would like to be able to quickly trigger auto-import as in the attached gif. Is there a way to do that with a command?

Thank you.

--- End quote ---

If it helps, you can start auto-import with this:
http://localhost:52199/MCWS/v1/Control/MCC?Command=23020

laba:

--- Quote from: Matt on December 09, 2019, 09:32:59 am ---If it helps, you can start auto-import with this:
http://localhost:52199/MCWS/v1/Control/MCC?Command=23020

--- End quote ---

That helps! Brilliant, thank you. That also tells me that the other MCC commands can be used in the same way, in case I find those useful.

For anyone interested, I used the above URL to make a one-click process to run the auto-import. This can be done with any of the other functions too, I assume.

I created a new bash script and saved it in ~/.local/bin with the name jmc-import

That script contains the following code:


--- Code: ---#!/bin/bash

# determine if JRiver Media Center 24 process is running and if so, run auto-import:

if pgrep -x mediacenter24 >/dev/null

then
  echo
  echo "***** JRiver Media Center is running *****"

# trigger JRiver Media Center auto-import and supress output by using the -s flag and sending to /dev/null

  curl -s http://localhost:52199/MCWS/v1/Control/MCC?Command=23020 > /dev/null
  echo
  echo '***** JRiver Media Center auto-import triggered *****'
  echo

else
  echo
  echo "***** JRiver Media Center is not running *****"
  echo

# pop-up error message:

  notify-send --expire-time=3000 'JRiver Media Center' 'IS NOT RUNNING'

fi
--- End code ---

Some of that code is to make it prettier if the script is run in the command line. The pop-up notification is to notify if MC24 isn't running as the auto import won't work if so.


I then created a new desktop file jmc-import.desktop in ~/.local/share/applications and inserted the following:


--- Code: ---#!/usr/bin/env xdg-open

[Desktop Entry]
Version=1.0
Type=Application
Name=jmc-import
Exec=/home/<user>/.local/bin/jmc-import
Icon=/path/to/preferred/icon/import.png
Name[en_GB]=jmc-import
--- End code ---

That puts a clickable desktop shortcut to trigger the script into the applications menu, which I then added to my taskbar favourites next to the MC24 icon so I can trigger the auto-import with a single mouse click.

bob:
Cool, thanks for sharing!

docles:
I try to make it work on a MC28 located on a VPS under ubuntu.

when connected graphically (X-windows) to the VPS, I can launch the Import

Within a command line or a bash, doesn't work.

Any ideas to help ?

Thanks

docles


--- Quote from: laba on December 09, 2019, 11:51:14 am ---That helps! Brilliant, thank you. That also tells me that the other MCC commands can be used in the same way, in case I find those useful.

For anyone interested, I used the above URL to make a one-click process to run the auto-import. This can be done with any of the other functions too, I assume.

I created a new bash script and saved it in ~/.local/bin with the name jmc-import

That script contains the following code:


--- Code: ---#!/bin/bash

# determine if JRiver Media Center 24 process is running and if so, run auto-import:

if pgrep -x mediacenter24 >/dev/null

then
  echo
  echo "***** JRiver Media Center is running *****"

# trigger JRiver Media Center auto-import and supress output by using the -s flag and sending to /dev/null

  curl -s http://localhost:52199/MCWS/v1/Control/MCC?Command=23020 > /dev/null
  echo
  echo '***** JRiver Media Center auto-import triggered *****'
  echo

else
  echo
  echo "***** JRiver Media Center is not running *****"
  echo

# pop-up error message:

  notify-send --expire-time=3000 'JRiver Media Center' 'IS NOT RUNNING'

fi
--- End code ---

Some of that code is to make it prettier if the script is run in the command line. The pop-up notification is to notify if MC24 isn't running as the auto import won't work if so.


I then created a new desktop file jmc-import.desktop in ~/.local/share/applications and inserted the following:


--- Code: ---#!/usr/bin/env xdg-open

[Desktop Entry]
Version=1.0
Type=Application
Name=jmc-import
Exec=/home/<user>/.local/bin/jmc-import
Icon=/path/to/preferred/icon/import.png
Name[en_GB]=jmc-import
--- End code ---

That puts a clickable desktop shortcut to trigger the script into the applications menu, which I then added to my taskbar favourites next to the MC24 icon so I can trigger the auto-import with a single mouse click.

--- End quote ---

Navigation

[0] Message Index

[*] Previous page

Go to full version