INTERACT FORUM

Please login or register.

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

Author Topic: Syncing play statistics and ratings from android back to JRiver  (Read 17045 times)

e-head

  • World Citizen
  • ***
  • Posts: 121

After researching a bit, I'm stunned this is as difficult as it is on android. No wonder Apple is killing the market... everything works seemlessly.

For android it seems like it would be as simple as programming a desktop app and an android app that can talk to each other.

So... MC is a great desktop app, and you already have Gizmo for android. I think it's time for you guys to take up the challenge! Just think, you could offer the first true Windows Desktop/mobile alternative to iTunes, and all you have to do is modify Gizmo so it can sync with JRiver and play locally stored files (and report back what it played, of course).

The streaming is great but not everyone has an unlimited 3G account.
;)

If a solution to this already exists, could someone point me in the right direction? I just want my ratings and play statistics to sync from my android to J River so the smart playlists will automatically update correctly (like they do with my old iPod). God forbid I actually end up having to switch back to Apple devices and iTunes, but syncing play stats is a must for me. I just don't have the time to hand select stuff for syncing... I need a rotation system.

If someone could prevent me from having to drink the poison I'd greatly appreciate it!
Logged

wig

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 750
Re: Syncing play statistics and ratings from android back to JRiver
« Reply #1 on: July 08, 2012, 07:25:01 am »


If a solution to this already exists, could someone point me in the right direction? I just want my ratings and play statistics to sync from my android to J River so the smart playlists will automatically update correctly (like they do with my old iPod). God forbid I actually end up having to switch back to Apple devices and iTunes, but syncing play stats is a must for me. I just don't have the time to hand select stuff for syncing... I need a rotation system.


The last.fm app on my phone can upload or 'scrobble' play stats to their database, even songs played by the stock android music player.

It would great if Gizmo could 'scrobble' play stats to a JRiver server.
Logged

e-head

  • World Citizen
  • ***
  • Posts: 121
Re: Syncing play statistics and ratings from android back to JRiver
« Reply #2 on: July 08, 2012, 09:11:34 am »

It would great if Gizmo could 'scrobble' play stats to a JRiver server.

Yeah, or at least update the JRiver database when you connect your android device.

I've seen some stuff on the web about using PlayerPro + some scripts + MM manager. And apparently you can use iSyncr and iTunes. I'd prefer to use J River though, as I think it's the best music manager out there.

I think the problem is none of the Windows music managers have an android player (aside from Gizmo), and they don't want to code up something that relies on a third party android player. The PlayerPro guy is trying though... he's practically begging Windows sync programs to use the play statistics his program logs (play counts, etc...). I think it might actually work with Songbird.

I hate to say it, but Apple just seems to have everyone trumped in the portable arena. Not just their devices, but the seemless integration.

Not to get on a soapbox, but with android being an open platform, their really isn't any excuse. I understand J River washing it's hands of Apple devices, and other vendors that are not open, but anybody can code up their own android player, and have it sync back just the way they want. If it's too much trouble updating tags, just have it log play stats and ratings to a file, then have the manager software read this log file in and update the database.
Logged

JimH

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 72444
  • Where did I put my teeth?
Re: Syncing play statistics and ratings from android back to JRiver
« Reply #3 on: July 08, 2012, 09:53:19 am »

Yeah, or at least update the JRiver database when you connect your android device.
Not to get on a soapbox, but with android being an open platform, their really isn't any excuse. I understand J River washing it's hands of Apple devices, and other vendors that are not open, but anybody can code up their own android player, and have it sync back just the way they want. If it's too much trouble updating tags, just have it log play stats and ratings to a file, then have the manager software read this log file in and update the database.
If you're playing tracks on Gizmo, they should get scrobbled from the server when a connection last.fm is made.
Logged

e-head

  • World Citizen
  • ***
  • Posts: 121
Re: Syncing play statistics and ratings from android back to JRiver
« Reply #4 on: July 19, 2012, 05:49:36 pm »

Well, this PlayerPro actually stores play statistics in one of 2 file formats (iWunes or DongBird) in it's directory on the android device, and I'm thinking somebody could write a script for use in the Script Plugin to update the J River database.

This is going to be my project as soon as I get some free time, but if somebody else wants to do it that would be awesome.
;)
Logged

e-head

  • World Citizen
  • ***
  • Posts: 121
Re: Syncing play statistics and ratings from android back to JRiver
« Reply #5 on: July 21, 2012, 01:59:31 pm »

Well, I finally got around to trying Gizmo, and I must say it's great.

Now, if only I had an unlimited data account. Still... it's nice around the apartment, or when I'm on wifi at a cafe.

Anyway, you guys just need to update it so it plays tracks that have been synced locally to the device... and report those play statistics back to J River, of course. Then we can all safely put our iPod's away for good.
;)
Logged

ShirazD

  • Regular Member
  • Recent member
  • *
  • Posts: 34
  • nothing more to say...
Re: Syncing play statistics and ratings from android back to JRiver
« Reply #6 on: July 30, 2012, 10:46:34 pm »

^^^ what e-head says. ratings and last played are two things i want to be able to sync in both directions with android (whatever player works) and j river. in lieue of this, i'm actually having to consider switching to xbmc after being on j river for about 15 years now.
Logged

butvk

  • Member
  • *
  • Posts: 3
Re: Syncing play statistics and ratings from android back to JRiver
« Reply #7 on: July 31, 2013, 05:13:15 am »

Hi all, im new to the forums, but I love jriver and already bought 3 or 4 licenses.

I recently changed from iphone to android phone and also gotten myself an issue as header states. Havent found more recent posts on the issue, so here it comes..

Was anyone able to find a solution to the subject or the only solution is to switch to the player which has dedicated android app?
Thanks a lot
Logged

e-head

  • World Citizen
  • ***
  • Posts: 121
Re: Syncing play statistics and ratings from android back to JRiver
« Reply #8 on: September 07, 2013, 07:01:54 am »

I wrote up a script that can be used with the Scripting Plugin that grabs your last played from last.fm and updates your JRiver database. Kind of indirect, but I can probably post it if anyone is interested.
Logged

butvk

  • Member
  • *
  • Posts: 3
Re: Syncing play statistics and ratings from android back to JRiver
« Reply #9 on: September 09, 2013, 06:54:36 am »

Can it transfer rating? If so I would be very much interested
Logged

wig

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 750
Re: Syncing play statistics and ratings from android back to JRiver
« Reply #10 on: September 09, 2013, 07:00:03 am »

I wrote up a script that can be used with the Scripting Plugin that grabs your last played from last.fm and updates your JRiver database. Kind of indirect, but I can probably post it if anyone is interested.

I'd like to see that!
Logged

e-head

  • World Citizen
  • ***
  • Posts: 121
Re: Syncing play statistics and ratings from android back to JRiver
« Reply #11 on: September 09, 2013, 09:30:20 pm »

Trying to figure out the best way to make this available.

I found this file upload site that doesn't require registration:
http://wikisend.com/download/982240/lastfm_2_jriver.zip

Not sure how annoying that is... probably want to have your pop up blocker installed.

Anyway, this is what's involved:

1) install last.fm scrobbler on phone or device.
2) install a player on the device that can use the scrobbler.
3) install Mr. Chris's scripting plugin in JRiver (I may have that name wrong).
4) create a new script and copy the contents of the script.txt file from the zip above into it.
5) copy the two .dll files I included in that zip into the script directory. on my computer the directory is (C:\Program Files (x86)\J River\Media Center 18\Plugins\Script Plugin\Scripts)

6) change the user name in the script (look for this line:  RecentTrack[] recentTracks = lfm.getRecentTracks("e-head", numTracks) )... change to your name, not e-head, unless you want to update your database w/ my plays.
;)


I think that's it. Let me know if it works out for you.
Logged

wig

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 750
Re: Syncing play statistics and ratings from android back to JRiver
« Reply #12 on: September 11, 2013, 03:56:27 pm »

I'm having problems with this step
4) create a new script and copy the contents of the script.txt file from the zip above into it.

JRiver doesn't have file permission access to the folder area (Windows 7). What's the easier way to correct this?
Logged

e-head

  • World Citizen
  • ***
  • Posts: 121
Re: Syncing play statistics and ratings from android back to JRiver
« Reply #13 on: September 11, 2013, 05:31:49 pm »

Hey wig,

If you have the scripting plugin installed... have you tried creating a new script (Services & Plug Ins section)? If so, you'll probably need to copy and paste the contents of that script.txt file into it, and not just copy it over.

You run it by clicking the "Run Script" button at the bottom.

Come to think of it... I think I ran into the same thing...

Try right clicking the below folder -> pick Security tab. Add yourself with modify permissions. Or whatever account you run J River under.

C:\Program Files (x86)\J River\Media Center 18\Plugins\Script Plugin\Scripts
Logged

wig

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 750
Re: Syncing play statistics and ratings from android back to JRiver
« Reply #14 on: September 12, 2013, 07:02:32 am »

I think I have everything installed, but it doesn't appear to be working.

Here the script I'm using, updated for my profile (cmatlick)

Code: [Select]
using System;
using System.Windows.Forms;
using Ehead.LastFmAPI;
//css_reference MediaCenter.dll;

class Script : MarshalByRefObject
{
    public void Init(MediaCenter.MCAutomation mediaCenterInterface)
    {
                // Number of Tracks to Retrieve
                string numTracks = "100";
                
                // Here we reach out to Last.fm
                LastFM lfm = new LastFM();
                RecentTrack[] recentTracks = lfm.getRecentTracks("cmatlick", numTracks);
                Console.WriteLine("Grabbing last " + numTracks + " played tracks from last.fm");
                
                foreach (RecentTrack track in recentTracks)
                {  
                    // Make sure we have a date
                    if(track.Date == null) continue;
                    
                        DateTime lastPlayed = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
                        lastPlayed = lastPlayed.AddSeconds(Int64.Parse(track.Date));
                        lastPlayed = lastPlayed.ToLocalTime();
                        
                    
                    //See if we can find the track in JRiver
                    string searchString = "[Artist]=\"" + track.Artist + "\" [Name]=\"" + track.Name + "\" [Album]=\"" + track.Album + '"';
                    MediaCenter.IMJFilesAutomation localTracks = mediaCenterInterface.Search(searchString);  

                    for(int i = 0; i < localTracks.GetNumberFiles(); i++)
                    {
                        MediaCenter.IMJFileAutomation localTrack = localTracks.GetFile(i);
                        Int64 localTrackTime = localTrack.LastPlayed;
                        Int64 remoteTrackTime = Int64.Parse(track.Date);
                        if(remoteTrackTime > (localTrackTime + 3600))
                        {  
                           localTrack.LastPlayed = (int) remoteTrackTime;
                           Console.WriteLine("Updating " + track.Artist + " - " + track.Name + " - " + track.Album + " (" + lastPlayed.ToString() + ")\t\t");
                        }
                        else
                        {
                        }
                        
                    }
                    
                }
                Console.WriteLine("Finished");
    }
}

When I run the script, I see:

Compiling Script...
Script Compiled Successfully!
Running Script...
Grabbing last 100 played tracks from last.fm
Finished
Script Completed Successfully

However, the play counts of my last 100 tracks aren't updated to reflect my last.fm stats.

Any ideas what's going wrong?

I love this feature, btw. I really hope to make it work.

(edit) - What I'd REALLY like to see is the ability to right-click on a track in JRiver and choose 'update play count from last.fm' from the menu. 
Logged

e-head

  • World Citizen
  • ***
  • Posts: 121
Re: Syncing play statistics and ratings from android back to JRiver
« Reply #15 on: September 12, 2013, 02:00:49 pm »

Hey wig,

I'd try a couple of things to try and debug this...


Change the outer most loop so it prints each track it grabs from last.fm, just to make sure it's actually grabbing them properly:

foreach (RecentTrack track in recentTracks)
{
Console.WriteLine("Updating " + track.Artist + " - " + track.Name + " - " + track.Date);


This will print out the tracks it's fetching from last.fm.

One possible snafu that I've discovered is... last.fm will sometimes correct the artist name for tracks. You can disable this in your last.fm settings, which is probably a good idea if you're going to be using this. Of course, it only renames the occational track so that's probalby not it.


Do that just to make sure you are getting something back from last.fm.
Of course, I'd recommend checking your last.fm page to see what tracks you have on there.

The script doesn't update the songs last played time if it's earlier than what's in the j. river database.

Come to think of it... I need to fix the script to update the play count! Right now it only updates the time.

I'll test this when I get home, but I think this is what needs to be added:
localTrack.PlayCounter = localTrack.PlayCounter + 1;

So... change the inner loop to this:

                        if(remoteTrackTime > (localTrackTime + 3600))
                        { 
                           localTrack.PlayCounter = localTrack.PlayCounter + 1;
                           localTrack.LastPlayed = (int) remoteTrackTime;
                           Console.WriteLine("Updating " + track.Artist + " - " + track.Name + " - " + track.Album + " (" + lastPlayed.ToString() + ")\t\t");
                        }


Anyway... give all that a whirl and let me know what happens.

What may be happening now is your last played is getting updated but not the play count.
Logged

wig

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 750
Re: Syncing play statistics and ratings from android back to JRiver
« Reply #16 on: September 13, 2013, 08:11:45 am »


Anyway... give all that a whirl and let me know what happens.

What may be happening now is your last played is getting updated but not the play count.


The new code works! Play counts are now being updated. This is very cool.

My next question: Instead of adding 1 to the track counter, can the script be modified to replace the local track play count with the last.fm track play count? I've been scrobbling nearly all my music for the last 8 years, and my last.fm play counts are much more accurate than my JRiver ones.

Logged

e-head

  • World Citizen
  • ***
  • Posts: 121
Re: Syncing play statistics and ratings from android back to JRiver
« Reply #17 on: September 14, 2013, 07:08:25 am »

Yeah, this should be possible, but... I think you can only get the last 200 tracks max from last.fm at a time.

I sort of want to do the reverse... update my last.fm with my JRiver. Ideally it would be nice to be able to do both. Last.fm won't let you "scrobble" songs with an old time stamp, unfortunately. e.g., scrobble a song you listened to a month ago.

Anyway... I'll have to look into it, but what you want is something right after the last played time is updated:

This can be removed, btw. I think I was using it in debuggin:
                        else
                        {
                        }

Replace that with something along the lines of:
if (track.Plays < localTrack.NumberOfPlays) track.setPlayCount(localTrack.NumberOfPlays);

Of course, that won't work, cause I just made up those properties and function calls. When I get a chance I'll look in the documentation.
Logged

wig

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 750
Re: Syncing play statistics and ratings from android back to JRiver
« Reply #18 on: September 14, 2013, 08:01:16 am »

Yeah, this should be possible, but... I think you can only get the last 200 tracks max from last.fm at a time.

I sort of want to do the reverse... update my last.fm with my JRiver. Ideally it would be nice to be able to do both. Last.fm won't let you "scrobble" songs with an old time stamp, unfortunately. e.g., scrobble a song you listened to a month ago.

Anyway... I'll have to look into it, but what you want is something right after the last played time is updated:


Yeah, or something like this

http://build.last.fm/item/452, that would update the entire library at once.

Quote

This can be removed, btw. I think I was using it in debuggin:
                        else
                        {
                        }

Replace that with something along the lines of:
if (track.Plays < localTrack.NumberOfPlays) track.setPlayCount(localTrack.NumberOfPlays);

Of course, that won't work, cause I just made up those properties and function calls. When I get a chance I'll look in the documentation.

This is great. I do some manually updating of playcounts for my favorite tracks, but it's tedious work.
Logged

brookb

  • Regular Member
  • Recent member
  • *
  • Posts: 31
  • Yep, I'm a music loving geek.  :-)
Re: Syncing play statistics and ratings from android back to JRiver
« Reply #19 on: October 04, 2013, 04:26:12 pm »

Please re-post the E-Head Last.FM sync script.

I'm late at looking at this thread, but it covers what I've been wanting to do for a long time:  Sync the JRiver database with statistics from items I've played locally on a stand-alone player or on my Android phone.  I use JRiver to upload to my Android phone, and then use the Player Pro app to play the files locally on the phone.

I don't like using cellular bandwidth to stream music, so unfortunately Gizmo is out.  I like to transfer music to my devices and listen locally.  But then, I want to update JRiver statistics on the main server to show I've listened to those songs.

I'd try the script provided by e-head on here, and use last.FM to sync between my Android phone JRiver on my computer.  Unfortunately, the link e-head provided is no longer active.  Can e-head (or someone else) please provide that download again?  I'd suggest that it be posted to build.last.fm where lots of last.fm related tools reside.

Or if there's some other method of syncing local playback statistics from ANY Android player  back to my JRiver server, that would be great.  It could involve using Last.FM, or could be another method, such as post-processing statistics gathered locally on my Android phone. 

Thanks,
Logged

wig

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 750
Re: Syncing play statistics and ratings from android back to JRiver
« Reply #20 on: October 06, 2013, 07:22:37 am »


Replace that with something along the lines of:
if (track.Plays < localTrack.NumberOfPlays) track.setPlayCount(localTrack.NumberOfPlays);

Of course, that won't work, cause I just made up those properties and function calls. When I get a chance I'll look in the documentation.

Where can I find that documentation, e-head? I think I could modify your script successfully if I had that info.
Logged

wig

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 750
Re: Syncing play statistics and ratings from android back to JRiver
« Reply #21 on: November 07, 2013, 09:55:30 am »

*bump

e-head are you still around?

Does anyone know where to find the last.fm documentation for making these type of scripts?

Basically I want to take this piece
Code: [Select]
if(remoteTrackTime > (localTrackTime + 3600))
                        { 
                           localTrack.PlayCounter = localTrack.PlayCounter + 1;
                           localTrack.LastPlayed = (int) remoteTrackTime;
                           Console.WriteLine("Updating " + track.Artist + " - " + track.Name + " - " + track.Album + " (" + lastPlayed.ToString() + ")\t\t");
                        }

And modify is so that localTrack.PlayCounter = remoteTrack.PlayCounter (except I tried that and remoteTrack.PlayCounter doesn't appear to be a valid parameter).



Logged

e-head

  • World Citizen
  • ***
  • Posts: 121
Re: Syncing play statistics and ratings from android back to JRiver
« Reply #22 on: December 28, 2013, 11:19:05 am »

Hey, sorry for not seeing this earlier.

I re-uploaded it here:
http://wikisend.com/download/169066/lastfm_2_jriver.zip

Brook, I went to that other site. I get the impression they need/like to look over the app/script before accepting it. They may get back with me.


wig, last.fm's API is here:
http://www.last.fm/api

I looked it over, and, I'm pretty sure it's impossible to add played songs to last.fm. I wanted to create a sort of j.river 2 last.fm script, or just a "sync" script, but it looks like they don't allow this. My guess is they are afraid it might be used by fans or band members to artificially increase the popularity of their songs!

As for syncing ratings... as far as I can tell last.fm just has a "favorite" or nothing. It should be possible to map this favorite setting to 4 or 5 stars in J. river, and it looks like it would be possible to go the other way too... that is, mark all songs w/ a greater than 4 rating in j. river as favorites on last.fm.

BTW... I've found that this script works better if you turn off last.fm's auto-correct feature, which automatically corrects the names of artists, albums and songs. Google around and you should be able to find where to do this.
Logged

IMGrant

  • Recent member
  • *
  • Posts: 14
Re: Syncing play statistics and ratings from android back to JRiver
« Reply #23 on: January 05, 2014, 02:48:10 pm »

Great script. I'm trying to edit it so that it updates the absolute track count, rather than just incrementing it by one.
It looks like the library.getTracks method from Last.fm is what's needed - the user.getRecentTracks method doesn't include the playcount attribute.
I have added a routine to the Ehead.LastFmAPI.cs source, but I don't know how to compile it into a dll to then use in a script - any tips?

I tried the command
Code: [Select]
csc.exe /target:library /link:CookComputing.XmlRpcV2.dll Ehead.LastFmAPI.cs
but it gave me an error:

Code: [Select]
CookComputing.XmlRpcV2.dll: error CS1759: Cannot embed interop types from assembly
        'c:\Users\ian_000\Downloads\lastfm_2_jriver\CookComputing.XmlRpcV2.dll' because it is missing either the
        'ImportedFromTypeLibAttribute' attribute or the 'PrimaryInteropAssemblyAttribute' attribute
CookComputing.XmlRpcV2.dll: error CS1747: Cannot embed interop types from assembly
        'c:\Users\ian_000\Downloads\lastfm_2_jriver\CookComputing.XmlRpcV2.dll' because it is missing the
        'GuidAttribute' attribute

How can I compile the DLL?
Logged

IMGrant

  • Recent member
  • *
  • Posts: 14
Re: Syncing play statistics and ratings from android back to JRiver
« Reply #24 on: January 07, 2014, 07:56:48 am »

I worked out I needed to use /reference:CookComputing.XmlRpcV2.dll not /link, but the resulting DLL won't load in JRiver, it complains about not being able to find the file, even though it exists.

Oh well, anyway, I managed to make my scripts work by just including the source for the namespace for the DLL code directly in the script. I've made three scripts, one that syncs play counts, one that syncs last played dates, and one that create a playlist of loved tracks. I've put them on github if anyone is interested:

http://github.com/imgrant/Last.fm2JRiver

Hope someone else finds them of use!
Logged

garymclellan

  • Member
  • *
  • Posts: 2
Re: Syncing play statistics and ratings from android back to JRiver
« Reply #25 on: June 02, 2014, 03:05:44 pm »

IMgrant, don't know how I missed these scripts before but look like exactly what I need to sync up my jriver to my last.fm play count!    Got it all setup, ran it, seems to compile ok and get the data from last.fm but then it throws an execution failure on running the script - any clue as to what it could be from the log below? 

Is there a minimum version of jriver i need to be running?  I'm on windows 7, still running 18.0.212.  Also probably worth mentioning that to get the script to go past the compile steps I had to have two copies of the CookComputing.XmlRpcV2.dll file in my scripts folder (second one named CookComputing.XmlRpc.dll).

Quote
Compiling Script...
Script Compiled Successfully!
Running Script...
Fetching library tracks for user 'garymclellan' from Last.fm ...
Fetching page 1 (200 tracks per page) ...
Total number of pages to fetch: 104
Fetching page 2 (of 104) ...
Fetching page 3 (of 104) ...
.......
Fetching page 103 (of 104) ...
Fetching page 104 (of 104) ...
Matching tracks from Last.fm to tracks in JRiver Media Center ...

Failure Running Script :-
Exception has been thrown by the target of an invocation.

 The Failure Occured
 In Class Object mscorlib
 when calling Method System.Object _InvokeMethodFast(System.Object, System.Object[], System.SignatureStruct ByRef, System.Reflection.MethodAttributes, System.RuntimeTypeHandle)
 
 The following Inner Exception was causedSystem.Runtime.Remoting.RemotingException: Object '/2352d352_ef1b_43af_bea7_e326c151f8c0/omka_eaqktjxenvwkkk4e3nt_7.rem' has been disconnected or does not exist at the server.

Server stack trace:
   at System.Runtime.Remoting.Channels.ChannelServices.CheckDisconnectedOrCreateWellK nownObject(IMessage msg)
   at System.Runtime.Remoting.Channels.ChannelServices.SyncDispatchMessage(IMessage msg)

Exception rethrown at
  • :

   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   at MediaCenter.IMJAutomation.Search(String strString)
   at Script.Init(MCAutomation mediaCenterInterface) in c:\Program Files\J River\Media Center 12\Plugins\Script Plugin\Scripts\LastfmPlayCount2JRiver.cs:line 29
 
 Everything that follows forms the stack Trace:


Server stack trace:
   at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
   at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
   at System.Type.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, CultureInfo culture)
   at CSScriptLibrary.AsmBrowser.Invoke(Object obj, String methodName, Object[] list)
   at CSScriptLibrary.AsmRemoteBrowser.Invoke(Object obj, String methodName, Object[] list)
   at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
   at System.Runtime.Remoting.Messaging.StackBuilderSink.PrivateProcessMessage(RuntimeMethodHandle md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
   at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)

Exception rethrown at
  • :

   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   at CSScriptLibrary.IAsmBrowser.Invoke(Object obj, String methodName, Object[] list)
   at CSScriptLibrary.AsmHelper.InvokeInst(Object obj, String methodName, Object[] list)
   at ScriptRunner.ScriptRunner.Main(String[] args)
Logged

milehigh

  • Regular Member
  • World Citizen
  • ***
  • Posts: 109
  • nothing more to say...
Re: Syncing play statistics and ratings from android back to JRiver
« Reply #26 on: October 31, 2014, 06:28:48 pm »

Hi,

I was also very interested in this but got to the same point as Gary and basically the same error.

IMGRANT - hoping you are still around and can help!  I also sent you a PM.

Fetching page 55 (of 55) ...
Matching tracks from Last.fm to tracks in JRiver Media Center ...

Failure Running Script :-
Exception has been thrown by the target of an invocation.

 The Failure Occured
 In Class Object mscorlib
 when calling Method System.Object _InvokeMethodFast(System.Object, System.Object[], System.SignatureStruct ByRef, System.Reflection.MethodAttributes, System.RuntimeTypeHandle)
 
 The following Inner Exception was causedSystem.Runtime.Remoting.RemotingException: Object '/f89183fc_4fc9_4107_b895_e384141e15a8/txrxjnai9yfa0lnosfqfhaiu_7.rem' has been disconnected or does not exist at the server.

Server stack trace:
   at System.Runtime.Remoting.Channels.ChannelServices.CheckDisconnectedOrCreateWellK nownObject(IMessage msg)
   at System.Runtime.Remoting.Channels.ChannelServices.SyncDispatchMessage(IMessage msg)

Exception rethrown at
  • :

   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   at MediaCenter.IMJAutomation.Search(String strString)
   at Script.Init(MCAutomation mediaCenterInterface) in c:\Program Files (x86)\J River\Media Center 18\Plugins\Script Plugin\Scripts\lastfm playcount.cs:line 28
 
 Everything that follows forms the stack Trace:


Server stack trace:
   at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
   at System.Type.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, CultureInfo culture)
   at CSScriptLibrary.AsmBrowser.Invoke(Object obj, String methodName, Object[] list)
   at CSScriptLibrary.AsmRemoteBrowser.Invoke(Object obj, String methodName, Object[] list)
   at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
   at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)

Exception rethrown at
  • :

   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   at CSScriptLibrary.IAsmBrowser.Invoke(Object obj, String methodName, Object[] list)
   at CSScriptLibrary.AsmHelper.InvokeInst(Object obj, String methodName, Object[] list)
   at ScriptRunner.ScriptRunner.Main(String[] args)
Logged

IMGrant

  • Recent member
  • *
  • Posts: 14
Re: Syncing play statistics and ratings from android back to JRiver
« Reply #27 on: November 03, 2014, 07:42:21 am »

Hi,

I'm not sure, but I think the problem might be fetching too much information from last.fm. Try reducing the number of songs to fetch and see if that solves the problem, it did for other users.
Logged

garymclellan

  • Member
  • *
  • Posts: 2
Re: Syncing play statistics and ratings from android back to JRiver
« Reply #28 on: November 08, 2014, 05:09:26 am »

Yeah sorry I should have posted back in here.  I reduced the number of pages to 50 and it works for me - the odd exception still happens but on the whole it works.

I also added a small check in the code, around line 34, so it would only update playcount if last fm count was greater than the jriver count.   

Code: [Select]
if (track.PlayCount>localTrack.PlayCounter) {     //line added here - check if local play count is already greater, dont change playcount if it is
           Console.WriteLine("Updating " + track.Artist + " - " + track.Name + " - " + track.Album + " (Local play count: " + localTrack.PlayCounter + " Last.fm play count: " + track.PlayCount + ")\t\t");
           localTrack.PlayCounter = track.PlayCount;
        }
Logged
Pages: [1]   Go Up