Export to iTunes

Download and get help for different MediaMonkey Addons.

Moderators: Peke, Gurus

nynaevelan
Posts: 5559
Joined: Wed Feb 07, 2007 11:07 pm
Location: New Jersey, USA
Contact:

Re: Export to iTunes

Post by nynaevelan »

Your scenarios make sense but that is not why I need the playcounts to go to iTunes. I am the main user in our family and as such my use of MM is much more extensive then my son or husband. As such, and because I have a little OCD when it comes to the organization of my music, the main library is mine in MM. But my son has a Mac device, sorry forgot which one, and he prefers using iTunes rather than learn something else. So his syncing and playing is done in iTunes, but if possible I would like for the playcounts to at least match what MM has. There is a script available now that could get the playcounts into iTunes but that is limited to exporting the entire library, which is cumbersome because my library has WMA files, which iTunes does not support and a large portion of my library is not a part of the filter that is my son's music. So I was hoping I would be able to use your script to export his portion of the library to iTunes with the playcounts from MM. I don't know if this is a feature that could be configured to be turned on or off, but it would be nice. After the initial export of the playcounts, then things would be able to work as you've outlined them.
3.2x - Win7 Ultimate (Zen Touch 2 16 GB/Zen 8GB)
Link to Favorite Scripts/Skins

Join Dropbox, the online site to share your files
markstuartwalker
Posts: 931
Joined: Fri Jul 10, 2009 8:10 am
Contact:

Re: Export to iTunes

Post by markstuartwalker »

OK, I see the need now. I did wonder if the recovery of playcounts ought to be a separate script. Perhaps if I did make it so then adding the option to go the other way is obvious. I take it that you would want to simply push all the playcounts from MM into iTunes, overwriting what is there already?

Unfortunately if the playcounts were pushed in this way it would never make sense to recover them back to MM as this would be the second scenario above. The only caveat would be unless you can guarrantee that they were never played in MM, in which case they could be pulled back overwriting (rather than adding) the MM values.

I'll give it some thought.

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
nynaevelan
Posts: 5559
Joined: Wed Feb 07, 2007 11:07 pm
Location: New Jersey, USA
Contact:

Re: Export to iTunes

Post by nynaevelan »

markstuartwalker wrote:OK, I see the need now. I did wonder if the recovery of playcounts ought to be a separate script. Perhaps if I did make it so then adding the option to go the other way is obvious. I take it that you would want to simply push all the playcounts from MM into iTunes, overwriting what is there already?
Yes the preferable method would be to simply push all the playcounts to iTunes. And I am not sure if it wouldn't be best to move this to a separate script because this feature is not something that would be used very often or by very many,except by me of course. :wink:
3.2x - Win7 Ultimate (Zen Touch 2 16 GB/Zen 8GB)
Link to Favorite Scripts/Skins

Join Dropbox, the online site to share your files
markstuartwalker
Posts: 931
Joined: Fri Jul 10, 2009 8:10 am
Contact:

Re: Export to iTunes

Post by markstuartwalker »

nynaevelan wrote:
markstuartwalker wrote:OK, I see the need now. I did wonder if the recovery of playcounts ought to be a separate script. Perhaps if I did make it so then adding the option to go the other way is obvious. I take it that you would want to simply push all the playcounts from MM into iTunes, overwriting what is there already?
Yes the preferable method would be to simply push all the playcounts to iTunes. And I am not sure if it wouldn't be best to move this to a separate script because this feature is not something that would be used very often or by very many,except by me of course. :wink:
After the initial export of the playcounts, then things would be able to work as you've outlined them.
This can only work if the tracks that were exported to iTunes are never played in MM. In that way the recovery back to MM can simply take the maximum of the iTunes and MM playcounts. Will that be OK?

Mark

p.s. 2.10.0 released ....
1. Sync Playlist added in Options (default = Accessible Tracks)
2. Sync&recover via separate menu item
Last edited by markstuartwalker on Tue Sep 29, 2009 11:00 am, edited 1 time in total.
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
nynaevelan
Posts: 5559
Joined: Wed Feb 07, 2007 11:07 pm
Location: New Jersey, USA
Contact:

Re: Export to iTunes

Post by nynaevelan »

Yes that will indeed work.

Nyn
3.2x - Win7 Ultimate (Zen Touch 2 16 GB/Zen 8GB)
Link to Favorite Scripts/Skins

Join Dropbox, the online site to share your files
BMcKiernon

Re: Export to iTunes

Post by BMcKiernon »

Hey Mark,

I've been bollowing this thread for the past few days and have been using the script. Just wanted to express some interest in 2 things:

1) Ability to sync the Last Date Played from iTunes to MM. Like another user had mentioned I use Accurate to perform my ratings and the Last Played Date is important for this. I have a bit of scripting experience and tried to get this working but came across some problems (I think due to the date being saved in julianday format in MM) so maybe you would have more success than me.
2) Ability to sync the ratings from MM to iTunes. Not really a big deal here but would be a cool feature.

Thanks for all your work on this script. It has made it much easier to sync with the iPhone while be able to maintain my library in MM.

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

Re: Export to iTunes

Post by markstuartwalker »

BMcKiernon wrote: 1) Ability to sync the Last Date Played from iTunes to MM. Like another user had mentioned I use Accurate to perform my ratings and the Last Played Date is important for this. I have a bit of scripting experience and tried to get this working but came across some problems (I think due to the date being saved in julianday format in MM) so maybe you would have more success than me.
The next version is now waiting in the wings. I have the Ratings synchronising between MM and iTunes and am now looking at LastPlayed values. I use SQL to update the database (for speed) so things get a bit complicated ... http://www.mediamonkey.com/wiki/index.p ... LastPlayed

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
Contact:

Re: Export to iTunes

Post by markstuartwalker »

I'm having some trouble with this. I have the dates from iTunes but am having trouble to set these into the MM database

Code: Select all

            dim c : c = itTrack.playedCount
            dim d : d = itTrack.PlayedDate

            SDB.Messagebox "date " & cstr(d) , mtWarning , array(mbOK)
            
            ' update the MM played count
            SDB.Database.ExecSQL "UPDATE Songs SET PlayCounter = ( PlayCounter + " & CStr(c) & " ) , LastTimePlayed = julianday(""" & cstr(d) & """)" & where()
I get no errors reported but the LastTimePlayed doesn't appear to get updated.

Any bright DBAs out there?

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
germanjulian
Posts: 46
Joined: Sun Apr 06, 2008 8:43 am
Contact:

Re: Export to iTunes

Post by germanjulian »

not a bright SQL gury but you seem to open the query with a " and then you have multiple " which would indicate a close in my world and also your missing a " at the end... I think.

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

Re: Export to iTunes

Post by markstuartwalker »

germanjulian wrote:not a bright SQL gury but you seem to open the query with a " and then you have multiple " which would indicate a close in my world and also your missing a " at the end... I think.

:oops:
Nope! There are an even number of quotes. The PlayCounts fied gets incremented but the LastPlayed column does not ... or appears not to in MM. I wonder if the julianday() function needs something else ie I may be updating the field but with a number that MM interprets as an illegal date value.
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
Contact:

Re: Export to iTunes

Post by markstuartwalker »

Wooooohoooo!!!!


dim d : d = cdate(itTrack.PlayedDate)
dim dd : dd = datediff("s",cdate("1899 12 30" ),d )/86400
SDB.Database.ExecSQL "UPDATE Songs SET PlayCounter = ( PlayCounter + " & CStr(c) & " ) , LastTimePlayed = " & cstr(dd) & where()

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
Contact:

Re: Export to iTunes

Post by markstuartwalker »

Release 2.11 http://www.mediafire.com/?sharekey=b7ee ... 6e282a0ee8

This enhances more on the Sync Playlist concept that defines the superset of files to be put into iTunes.
* Files are added into the iTunes via sync playlist
* Playlists are added and removed from the the sync list in iTunes as before
* Sync option to recover playcounts and lastplayeddate back from iTunes&iPhone into MM
* Sync option to master ratings either in iTunes or MM

WARNING!!!!!! This is the first release that can actively write back to the MM database. If you value the content of your database then I suggest backing it up before trying this release out.

Finally I'd appreciate some feedback about the terminology and user interface for these new features. They are functional but I wouldn't claim they are as intuitive as they might be.

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
nynaevelan
Posts: 5559
Joined: Wed Feb 07, 2007 11:07 pm
Location: New Jersey, USA
Contact:

Re: Export to iTunes

Post by nynaevelan »

markstuartwalker wrote: * Sync option to recover playcounts and lastplayeddate back from iTunes&iPhone into MM
How do I get the playcounts from itunes????

EDIT: Nevermind idiotic me never thought to go to the Options Sheet. :oops: :oops:

Nyn
3.2x - Win7 Ultimate (Zen Touch 2 16 GB/Zen 8GB)
Link to Favorite Scripts/Skins

Join Dropbox, the online site to share your files
nynaevelan
Posts: 5559
Joined: Wed Feb 07, 2007 11:07 pm
Location: New Jersey, USA
Contact:

Re: Export to iTunes

Post by nynaevelan »

I must be doing something wrong because I can only get the ratings to sync to itunes the first time the track is sent to itunes, if I change the ratings later, it will not update in itunes. And I cannot get playcounts to sync to or from itunes.

Nyn
3.2x - Win7 Ultimate (Zen Touch 2 16 GB/Zen 8GB)
Link to Favorite Scripts/Skins

Join Dropbox, the online site to share your files
markstuartwalker
Posts: 931
Joined: Fri Jul 10, 2009 8:10 am
Contact:

Re: Export to iTunes

Post by markstuartwalker »

The Sync script under Tools/Scripts/Export toiTunes (sync and recover) does

* Addition of new files
* Update of existing files
* Recovery of playcounts from iTunes to MM
* Assignment of last play dates from iTunes to MM
* Assignment of ratings either to MM or iTunes depending which end is considered the master (see options sheet)

On the last point I was faced with a design problem. I can compare the ratings between iTunes and MM, if they are the same then OK. But, if differnent how can I tell which end has changed their value? In the end I simply decided to chose one end that should be considdered the definitive view and assign from that end. A better (but more difficult to implement) alternative was to record the last synced value (somewhere) so that it would be possible to establish which end has changed ... however I would still be faced with a problem if both ends had chnaged the rating to different values.

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
Post Reply