INTERACT FORUM

Please login or register.

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

Author Topic: Plugin enabling interaction with TIDAL  (Read 4539 times)

teodorom

  • Junior Woodchuck
  • **
  • Posts: 71
Plugin enabling interaction with TIDAL
« on: June 27, 2017, 09:56:39 am »

Hi,
I was successful in creating "MyPlugin" for JRMC22 in
  • MS Visual Studio 2017
  • \Microsoft.NET\Framework\v4.0.30319
  • Windows 10
I have simply added a button that displays a message box.
Attaching the process Media Center 22, I can debug too ! ;D
At this point I would like to complete the project, that is
  • Logon to TIDAL (no, it's not TIDAL, but let me use a name familiar to you); I'm able to do it, in the same way as I displayed a message box
  • Capture the "copy to clipboard" event (generated by TIDAL): by this way I can get the AlbumID
  • Given the AlbumID, I know how to get the album metadata and how to load the track list into the "Playing Now" section
  • Capture the play event (generated by JRMC22) of a track, so that I can fill the "Filename" with the address of the stream and then the track can be played
Can I do all that from inside the plugin ?
I'm doing that since the rendering of the stream made by MC is far superior, and then I can use the DSP inside MC.
Ah ! the name of the plugin will be TINR ("This Is Not ROON").
Thanks
Logged

teodorom

  • Junior Woodchuck
  • **
  • Posts: 71
Re: Plugin enabling interaction with TIDAL
« Reply #1 on: June 28, 2017, 03:11:01 pm »

I have to admit that a better C#/.NET programmer than me could have (much) less difficulties than me but ...
In the Plugin SDK sample I have
        public void Init ( MediaJukebox.MJAutomation mediaCenterReference )
        {   
            try
            {                 
                this.mediaCenterReference = mediaCenterReference;
            }
            catch (Exception e)
                    {
                              this.Enabled = false;
            }
        }
While in the code found @ https://wiki.jriver.com/index.php/Programming_Plugins_in_C I read:
public void Init ( MediaCenter.MCAutomation mcRef )
{
    try
    {
        this.mcRef = mcRef;
        // This tells MC to also call our MJEvent method
        this.mcRef.FireMJEvent += new IMJAutomationEvents_FireMJEventEventHandler ( MJEvent );   
    }
    catch (Exception e)
    {
        errorHandler ( e );
    }
I guess that this is the piece of code that could allow me to capture the "Play" event, but since I don't know the object model, I'm lost.
Any developer ?
Thanks
Logged

teodorom

  • Junior Woodchuck
  • **
  • Posts: 71
Re: Plugin enabling interaction with TIDAL
« Reply #2 on: June 29, 2017, 08:52:46 am »

Hi all (mainly to the developers).
Crashing my head I was able to have in my plugin the code depicted in htps://wiki.jriver.com/index.php/Programming_Plugins_in_C, so now I see in the Debug pane the events raised by MC.
Unfortunately the result is very deceiving.
When I press "Play" on an album I see
MJEvent type: MCCommand MCC: NOTIFY_PLAYLIST_FILES_CHANGED 636665472
MJEvent type: MCCommand MCC: NOTIFY_TRACK_CHANGE 0
MJEvent type: MCCommand MCC: NOTIFY_PLAYERSTATE_CHANGE 0
MJEvent type: MCCommand MCC: NOTIFY_VOLUME_CHANGED 0
MJEvent type: MCCommand MCC: NOTIFY_TRACK_CHANGE 0
MJEvent type: MCCommand MCC: NOTIFY_PLAYERSTATE_CHANGE 0

Let me guess that "636665472" is some internal ID used by MC.
Unfortunately, when I jump to the next (or any other) track, I see
MJEvent type: MCCommand MCC: NOTIFY_PLAYERSTATE_CHANGE 0
MJEvent type: MCCommand MCC: NOTIFY_VOLUME_CHANGED 0
MJEvent type: MCCommand MCC: NOTIFY_TRACK_CHANGE 0
MJEvent type: MCCommand MCC: NOTIFY_PLAYERSTATE_CHANGE 0
MJEvent type: MCCommand MCC: NOTIFY_PLAYERSTATE_CHANGE 0
MJEvent type: MCCommand MCC: NOTIFY_PLAYERSTATE_CHANGE 0

The ability of getting some ID of the track that's playing is crucial to my project (a "showstopper", if you want).
Please help !!!
Thanks
Logged

JimH

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 71341
  • Where did I put my teeth?
Re: Plugin enabling interaction with TIDAL
« Reply #3 on: June 29, 2017, 09:45:23 am »

Have you found the documentation on the Developer page?  A link is at the bottom of this page.
Logged

teodorom

  • Junior Woodchuck
  • **
  • Posts: 71
Re: Plugin enabling interaction with TIDAL
« Reply #4 on: June 29, 2017, 09:54:26 am »

Yes, it was this way that I discovered https://wiki.jriver.com/index.php/Programming_Plugins_in_C#.Net.
Information is buried somewhere, I guess ...
Thanks
Logged

teodorom

  • Junior Woodchuck
  • **
  • Posts: 71
Re: Plugin enabling interaction with TIDAL
« Reply #5 on: June 29, 2017, 01:15:46 pm »

Crashing my head I have realized that the "s3", available when the
private void MJEvent(String s1, String s2, String s3)
fires, is not an internal ID: apart being quite always 0, it always changes.
No clue of the meaning in the documentation.
So, I tried another way. I wrote:
MediaCenter.IMJCurPlaylistAutomation curPlaylist = mcRef.GetCurPlaylist();
The object curPlaylist does (quite well) its job, try:
curPlaylist.RemoveAllFiles();
The
MediaCenter.IMJFileAutomation nextFile = mcRef.GetFileByKey(curPlaylist.GetNextFile());
seems promising.
But nextFile is empty!
Debug.WriteLine(nextFile.Album);
Finally: how can I get the Key of the NextFile in the curPlayList ?


Thanks
Logged

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 41926
  • Shoes gone again!
Re: Plugin enabling interaction with TIDAL
« Reply #6 on: June 29, 2017, 01:34:35 pm »

curPlaylist.GetNextFile() returns an index in the current playlist.

So you probably need to do curPlaylist.GetFile(curPlaylist.GetNextFile()).

Hope that gets you going :)
Logged
Matt Ashland, JRiver Media Center

teodorom

  • Junior Woodchuck
  • **
  • Posts: 71
Re: Plugin enabling interaction with TIDAL
« Reply #7 on: June 29, 2017, 01:43:56 pm »

This works:
MediaCenter.IMJFileAutomation currFile = curPlaylist.GetFile(1);
Debug.WriteLine(currFile.GetKey());
MediaCenter.IMJFileAutomation nextFile = mcRef.GetFileByKey(currFile.GetKey());
Debug.WriteLine(nextFile.Album);

The "key" is currFile.GetKey().
Thanks
Logged
Pages: [1]   Go Up