MediaMonkey iTunes plugin (d_itunes4.dll)

Download and get help for different MediaMonkey for Windows 4 Addons.

Moderators: Peke, Gurus

markstuartwalker
Posts: 931
Joined: Fri Jul 10, 2009 8:10 am

Re: MediaMonkey iTunes device plugin (d_itunes.dll)

Post by markstuartwalker »

AlexB wrote:The create folder option doesn't seem to work. I did an erase itunes database and then clean sync and got this error:
I've glanced at the code and replicated the problem. It is because you have no MM folder defined in the configuration, root folders need to be created in iTunes a little differently. As a workaround, put the default <MM> folder back in.

I'll work the fix into the next release.
Windows 7,8 / Ubuntu 13.10 / Mavericks 10.9 / iOS 7.1 / iTunes 11.1
iTunes plugin (d_itunes & itunes4) http://www.mediamonkey.com/forum/viewto ... =2&t=45713
Running MM under Mac OS X with Wine http://www.mediamonkey.com/forum/viewto ... =4&t=58507
markstuartwalker
Posts: 931
Joined: Fri Jul 10, 2009 8:10 am

Re: MediaMonkey iTunes device plugin (d_itunes.dll)

Post by markstuartwalker »

New version

29/3/2010
* Exception raised while updating series number
* Duplicate track IDs trapped for tss and tracks
30/3/2010
* Additional checks and retries after track addition. Caters for locked tracks when volume leveling in iTunes.
* TrackCache and Tss counts reports at end
31/3/2010
* Logging on exceptions made standard routine (level 2)
* Refinement of locked track retries and more thorough testing
* Configuration GUI expanded 0=Ignore,1=Flatten,2=Create
* createFolderInfolder enhanced to allow creation in the source root
Windows 7,8 / Ubuntu 13.10 / Mavericks 10.9 / iOS 7.1 / iTunes 11.1
iTunes plugin (d_itunes & itunes4) http://www.mediamonkey.com/forum/viewto ... =2&t=45713
Running MM under Mac OS X with Wine http://www.mediamonkey.com/forum/viewto ... =4&t=58507
AlexB

Re: MediaMonkey iTunes device plugin (d_itunes.dll)

Post by AlexB »

that did the trick, thank you so much!
markstuartwalker
Posts: 931
Joined: Fri Jul 10, 2009 8:10 am

Re: MediaMonkey iTunes device plugin (d_itunes.dll)

Post by markstuartwalker »

I am thinking about adding some new functionality.

Would it be useful to allow playlists CREATED on iTunes to be sync'd back to MM? this would include Genius and those created by the remote app.

If I get a strong response then I'll work on it.

Mark
Windows 7,8 / Ubuntu 13.10 / Mavericks 10.9 / iOS 7.1 / iTunes 11.1
iTunes plugin (d_itunes & itunes4) http://www.mediamonkey.com/forum/viewto ... =2&t=45713
Running MM under Mac OS X with Wine http://www.mediamonkey.com/forum/viewto ... =4&t=58507
treponem
Posts: 52
Joined: Sat Jan 12, 2008 9:54 am

Re: MediaMonkey iTunes device plugin (d_itunes.dll)

Post by treponem »

Hi Mark

Your plugin is working great, I'm just testing the folder functions :D

I'm using AutoRate to do the ratings for MM. I've noticed that the ratings in itunes end with 4 1/2 stars, no 5 star tracks are stored in itunes although the song is rated 5 in MM. Debug says nothing abaout this.

Syncing back playlists from itunes is not that useful for me, apart from the playlist. I personally use LastfmDJ and noticed that the results to Genius differ only slightly; Genius has only a more limited range regarding non-mainstream artists :(
Musicfan145
Posts: 7
Joined: Fri Apr 02, 2010 10:03 am

Re: MediaMonkey iTunes device plugin (d_itunes.dll)

Post by Musicfan145 »

I'd very much like to have playlist synchronization with iTunes!
markstuartwalker
Posts: 931
Joined: Fri Jul 10, 2009 8:10 am

Re: MediaMonkey iTunes device plugin (d_itunes.dll)

Post by markstuartwalker »

treponem wrote: I'm using AutoRate to do the ratings for MM. I've noticed that the ratings in itunes end with 4 1/2 stars, no 5 star tracks are stored in itunes although the song is rated 5 in MM. Debug says nothing abaout this.
Hmmm, curious .....

MM and iTunes do treat ratings slightly differently. MM uses -1 to 100 and iTunes uses scale 0 to 100 to represent the star ratings that we use on the screen. Other that this starting offset they are assigned directly. I use the two function below to convert to MM and to iTunes.

Code: Select all

function syncToMmRating(itRating: integer): integer;
begin
  if itRating <= 0 then
    Result := -1
  else
    if itRating>100 then
      Result:=100
    else
      Result := itRating;
end;

function syncToItRating(mmRating: integer): integer;
begin
  if mmRating < 0 then
    Result := 0
  else
    if mmRating>100 then
      Result:=100
    else
      Result := mmRating;
end;
And this procedure checks for differences in ratings and assigns updates, again you can see no changes in scale.

Code: Select all

procedure syncRatings(
  itTrack: IITFileOrCDTrack;
  itTrackCached : TitTrack;
  tss: Ttss);
var
  r: integer;
begin
  // has mm track changed ratings?
  r := tss.trackRating;
  if (r <> tss.Rating) then
  begin
    // update iTunes and tss
    Log.text(2,'syncRatings from MM'+inttostr(r), tss.TrackTitle);
    itTrack.Rating := syncToItRating(r);
    tss.Rating := r;
    tss.DateUploaded := SysUtils.now;
    tss.updateDB:=true;
  end
  else
  begin
    // has itunes changed ratings?
    r := syncToMmRating(itTrackCached.Rating);
    if (r <> tss.Rating) then
    begin
      // update MM and tss
      Log.text(2,'syncRatings from iTunes'+inttostr(r), tss.TrackTitle);
      tss.Rating := r;
      tss.trackRating := r;
      tss.DateUploaded := SysUtils.now;
      tss.updateDB:=true;
      tss.trackupdateDB:=true;
    end
  end
end;
I have exclusively use the stars in the GUIs to rate my music and found no errors in the mappings either way. It may be that your usage of AutoRate calculates values not on the 6 star rating thresholds (0,20,40,60,80,100) and consequently their values are shown as 4.5. By running with debug=2 and looking for the debug ratings messages (see code above) you can get to see the numeric values behind the ratings. Alternatively, if you're a SQL man have a look at the DeviceTracks table rating column.

Let me know if you can spot anything erroneous.

Cheers
Mark
Windows 7,8 / Ubuntu 13.10 / Mavericks 10.9 / iOS 7.1 / iTunes 11.1
iTunes plugin (d_itunes & itunes4) http://www.mediamonkey.com/forum/viewto ... =2&t=45713
Running MM under Mac OS X with Wine http://www.mediamonkey.com/forum/viewto ... =4&t=58507
markstuartwalker
Posts: 931
Joined: Fri Jul 10, 2009 8:10 am

Re: MediaMonkey iTunes device plugin (d_itunes.dll)

Post by markstuartwalker »

BTW .... iTunes 9.1.0.79 works fine with this plugin.
Windows 7,8 / Ubuntu 13.10 / Mavericks 10.9 / iOS 7.1 / iTunes 11.1
iTunes plugin (d_itunes & itunes4) http://www.mediamonkey.com/forum/viewto ... =2&t=45713
Running MM under Mac OS X with Wine http://www.mediamonkey.com/forum/viewto ... =4&t=58507
treponem
Posts: 52
Joined: Sat Jan 12, 2008 9:54 am

Re: MediaMonkey iTunes device plugin (d_itunes.dll)

Post by treponem »

Yes, itunes 9.1 also works here.
I've reinstalled and cleared Autorate cause I have problems when switching back the regional settings. The log shows the songs as following:

Code: Select all

[528] iTunes Plugin 12:11:55 118 Added to Cache Frances Farmer Will Have Her Revenge on Seattle
[528] iTunes Plugin 12:11:55 syncID3tag from 10077
[528] iTunes Plugin 12:11:55 getSongDataByID 10077
[528] iTunes Plugin 12:11:55 getSongDataByID done
[528] iTunes Plugin 12:11:55 syncID3tag done
[528] iTunes Plugin 12:11:55 10077 update DEVICETRACKS set  DEVICEPATH='10077.mp3',PLAYCOUNT=2,RATING=59,UPLOADTIME='40273,508283669' where IDTRACK=10077 and IDDEVICE=86
[528] iTunes Plugin 12:11:55 119 Added to Cache Dumb
[528] iTunes Plugin 12:11:55 syncRatings from MM69 Dumb
[528] iTunes Plugin 12:11:56 10078 update DEVICETRACKS set  DEVICEPATH='10078.mp3',PLAYCOUNT=4,RATING=69,UPLOADTIME='40273,5082941204' where IDTRACK=10078 and IDDEVICE=86
[528] iTunes Plugin 12:11:57 120 Added to Cache Very Ape
[528] iTunes Plugin 12:11:57 121 Added to Cache Milk It
[528] iTunes Plugin 12:11:57 syncRatings from MM69 Milk It
[528] iTunes Plugin 12:11:57 10080 update DEVICETRACKS set  DEVICEPATH='10080.mp3',PLAYCOUNT=4,RATING=69,UPLOADTIME='40273,5083099074' where IDTRACK=10080 and IDDEVICE=86
[528] iTunes Plugin 12:11:58 122 Added to Cache Pennyroyal Tea
[528] iTunes Plugin 12:11:58 syncID3tag from 10081
[528] iTunes Plugin 12:11:58 getSongDataByID 10081
[528] iTunes Plugin 12:11:58 getSongDataByID done
[528] iTunes Plugin 12:11:58 syncID3tag done
[528] iTunes Plugin 12:11:58 10081 update DEVICETRACKS set  DEVICEPATH='10081.mp3',PLAYCOUNT=21,RATING=99,UPLOADTIME='40273,5083191088' where IDTRACK=10081 and IDDEVICE=86
[528] iTunes Plugin 12:11:58 123 Added to Cache Radio Friendly Unit Shifter
[528] iTunes Plugin 12:11:58 124 Added to Cache Tourette's
[528] iTunes Plugin 12:11:58 syncID3tag from 10083
[528] iTunes Plugin 12:11:58 getSongDataByID 10083
[528] iTunes Plugin 12:11:58 getSongDataByID done
[528] iTunes Plugin 12:11:58 syncID3tag done
Somehow all the 5* ratings became 99 instead of 100, the other ratings also seemed to be subtracted by 1. I will check Autorate, but I thought I checked everything by now. Thanks.

Edit:
I checked the AutoRate thread, here's what I found:
Some technical informations about that: Ratings in MM are from 0-100. Manual ratings have ratings like 100 (=5 stars), 90 (=4.5 stars), 80 (=4 stars) and so on. My script is only able to write ratings like 99 instead of 100 which will also be shown like a 5 star songs. 89 (instead 90) for 4.5stars, 79 (instead 80) for 4 stars. Like this the script can distinguish between manual ratings and autoratings and manual ratings are protected. (For BasedRatings the script even uses ratings like 98, 88, 78 but that's not important at that point). So now it would be interesting which ratings they have because if they have ratings like 100, 90 then they aren't rated by the script. If there are rated with other ratings they are rated by the script - and that would mean that there's still a little bug somewhere.
So itunes can't interpret the 99 rating as 100. Could you add an exception so that all the #9 ratings get +1 ? This could do the trick for Autorate. Thanks again for your great work!
markstuartwalker
Posts: 931
Joined: Fri Jul 10, 2009 8:10 am

Re: MediaMonkey iTunes device plugin (d_itunes.dll)

Post by markstuartwalker »

treponem wrote: So itunes can't interpret the 99 rating as 100. Could you add an exception so that all the #9 ratings get +1 ? This could do the trick for Autorate. Thanks again for your great work!
I'm forming the view that the fault is inside Autorate, why can't it evaluate to 100?
What does MM show when rating=99? 4.5* or 5*?

Mark
Windows 7,8 / Ubuntu 13.10 / Mavericks 10.9 / iOS 7.1 / iTunes 11.1
iTunes plugin (d_itunes & itunes4) http://www.mediamonkey.com/forum/viewto ... =2&t=45713
Running MM under Mac OS X with Wine http://www.mediamonkey.com/forum/viewto ... =4&t=58507
Bex
Posts: 6316
Joined: Fri May 21, 2004 5:44 am
Location: Sweden

Re: MediaMonkey iTunes device plugin (d_itunes.dll)

Post by Bex »

I believe AutoRateAccurate needs to alter the rating to achieve some of its functionality but I also think other applications write "nonstandard" values to the rating. Here's a table which shows how MM displays the rating based on the value. Perhaps it's best that you implement the same logic in your plugin? I've done so in my Duplicate script.
-1 - -1= -1 -> <Unknown>
0 - 5= 0 -> Bomb
6 - 15= 10 -> 0.5 Stars
16 - 25= 20 -> 1 Stars
26 - 35= 30 -> 1.5 Stars
36 - 45= 40 -> 2 Stars
46 - 55= 50 -> 2.5 Stars
56 - 65= 60 -> 3 Stars
66 - 75= 70 -> 3.5 Stars
76 - 85= 80 -> 4 Stars
86 - 95= 90 -> 4.5 Stars
96 -100=100 -> 5 Stars
treponem
Posts: 52
Joined: Sat Jan 12, 2008 9:54 am

Re: MediaMonkey iTunes device plugin (d_itunes.dll)

Post by treponem »

MM shows the 5 stars when rating = '99'. I think itunes is pretty intolerant regarding +/- 1.
I noticed that when only 5-6 songs had a 5 star rating in itunes. They were the only manually rated songs in MM & synced with '100'.
markstuartwalker
Posts: 931
Joined: Fri Jul 10, 2009 8:10 am

Re: MediaMonkey iTunes device plugin (d_itunes.dll)

Post by markstuartwalker »

Well, there are some problems here. i could map the ratings into iTunes as

Code: Select all

MM rating -> MM stars -> itunes stars -> iTunes rating
which would ensure that the stars representation on the two systems would be equivalent.

But this means that the numerical values of the MM rating and iTunes ratings become disassociated so I'd have to implement the same indirectness within the synchronisation procedure (I'm a bit paranoid about performance at that procedure). The one caveat is that changes in numeric ratings won't get moved over unless thet change is sufficient to change the star rating, and even when it does the numeric rating at the other side will not be identical.

I'll introduce a table mmToitRating[0..100] to do fast lookups ...

Code: Select all

for i:=0 to 5 do mmToitRating[i]=0;
for i:=6 to 15 do mmToitRating[i]=10;
for i:=16 to 25 do mmToitRating[i]=20;
for i:=26 to 35 do mmToitRating[i]=30;
for i:=36 to 45 do mmToitRating[i]=40;
for i:=46 to 55 do mmToitRating[i]=50;
for i:=56 to 65 do mmToitRating[i]=60;
for i:=66 to 75 do mmToitRating[i]=70;
for i:=76 to 85 do mmToitRating[i]=80;
for i:=86 to 95 do mmToitRating[i]=90;
for i:=96 to 100 do mmToitRating[i]=100;
Which will allow code like this

Code: Select all

itTrack.Rating:=mmToitRating[mmTrack.Rating];
Which ought to do the trick ... along with some reverse equivalent to itTommRating[].

Mark
Windows 7,8 / Ubuntu 13.10 / Mavericks 10.9 / iOS 7.1 / iTunes 11.1
iTunes plugin (d_itunes & itunes4) http://www.mediamonkey.com/forum/viewto ... =2&t=45713
Running MM under Mac OS X with Wine http://www.mediamonkey.com/forum/viewto ... =4&t=58507
markstuartwalker
Posts: 931
Joined: Fri Jul 10, 2009 8:10 am

Re: MediaMonkey iTunes device plugin (d_itunes.dll)

Post by markstuartwalker »

Well, it's a bit rushed but try this ...

31/3/2010
* Logging on exceptions made standard routine (level 2)
* Refinement of locked track retries and more thorough testing
* Configuration GUI expanded 0=Ignore,1=Flatten,2=Create
* createFolderInfolder enhanced to allow creation in the source root
1/4/2010
* iTunes Smart playlists are ignored during playlist scanning so there is no attempt to delete
* Previously excluded playlists re-included (iTunes U, Genius etc). Prior change allows this to be OK now.
* Tested with iTunes 9.1.0.79
* New COM type library v1.13 which accommodates the SpecialKind enumerations for iTunes U, Genius etc.
* All playlists scanned properly when in "create folders" mode
* Reused playists are named zzzOldName so that the right one can be recycled in createfolders mode
7/4/2010
* Manual sync of tracks should bounce for pre-existing tracks i.e. UploadTrack checks for track version before uploading.
* Handle ratings stars according to lookup tables to make 96 to 100 = 5 stars
* Duplicate track indices which are discovered in scanning are deleted

Mark
Windows 7,8 / Ubuntu 13.10 / Mavericks 10.9 / iOS 7.1 / iTunes 11.1
iTunes plugin (d_itunes & itunes4) http://www.mediamonkey.com/forum/viewto ... =2&t=45713
Running MM under Mac OS X with Wine http://www.mediamonkey.com/forum/viewto ... =4&t=58507
treponem
Posts: 52
Joined: Sat Jan 12, 2008 9:54 am

Re: MediaMonkey iTunes device plugin (d_itunes.dll)

Post by treponem »

Thanks again for your work. The ratings seem to work fine, but after first sync the plugin sees the new itunes rating e.g. 80 as changed and updates the MM 79 rating. AutoRate thinks that these songs have been manually rated and retags them - till next sync...
Post Reply