Phil Meyer;223494 Wrote: 
> So, now I'm thinking it would be good to sync between SlimServer and
> iTunes, such that ratings are shared between SlimServer and my iPod.
> 
> What are my options?  

NOTE!!!!!
BEFORE YOU START, MAKE SURE YOU HAVE A COMPLETE BACKUP OF THE TRACKSTAT
DATA AND YOUR ITUNES LIBRARY FILES

To my knowledge you have three options regarding integration of ratings
between iTunes and TrackStat.

1. The built-in iTunes plugin
=============================
Supports one way import of ratings from iTunes to SlimServer. If you
are using TrackStat you should be aware of that TrackStat will ignore
the imported ratings for songs that already have a rating in TrackStat.
If a song don't have a rating in TrackStat, TrackStat will use the
rating imported from iTunes. So basically changed ratings will be
ignored while new ratings will work with TrackStat. There is no way to
get any ratings changed in SlimServer back to iTunes using the built-in
iTunes plugin.

2. The iTunes Update plugin
===========================
This is great as long as your filenames are the same in iTunes and
SlimServer. This means that it will work great for mp3, aac, apple
lossless but won't work for flac. It makes it possible to set ratings
in SlimServer and export these changed ratings to iTunes. If I remember
correctly it can also read ratings from iTunes for the currently playing
song. It has two modes:
- Direct mode: Writes/reads ratings to iTunes directly when they are
changed/read in SlimServer
- Log mode: Writes any changed ratings to a text file which later must
be imported into iTunes using a separate perl script.
The direct mode requires that iTunes is installed on the same computer
as SlimServer. Log mode makes it possible to have SlimServer and iTunes
on different computers as long as the file path is the same. I think the
log mode now also supports to write a changed rating on a FLAC file to a
MP3/AAC file in iTunes with the same name and path but different file
extension, but I'm not completely sure. If you like a two way
import/export of ratings, I think you will also need to use one of the
other options for the import since iTunes Update doesn't have any way
to import ratings from iTunes to SlimServer. It can only read the
rating in iTunes for the currently played track.

3. The TrackStat plugin
=======================
Supports rating integration in tree different variations:
- Ratings changed in SlimServer can be written to a text file and this
text file can be imported to iTunes using a separate perl script.
Pretty much the same as the "log mode" in the iTunes Update plugin.
- A global import where all ratings in iTunes are imported to
SlimServer
- A global export where all ratings in SlimServer are written to a text
file which then can be imported into iTunes using the separate perl
script.
In contrast to the other options, TrackStat has a path and extension
mapping mechanism which makes it possible to store the music library in
different main directories in iTunes and SlimServer and also to have
different extensions. This means that you can have a FLAC library in
SlimServer where music is stored in /mnt/music on a Linux computer and
using iTunes on a Windows computer where you have the same library in
MP3 format stored under C:\Users\xxx\My Documents\My Music.

The global export/import has no logic to avoid overwrites of ratings,
both will overwrite any ratings previous set. So you will have to
decide who is the master. I think the only way you are going to get a
working two way integration is to use iTunes as the master. You can
then do as follows:

1. 
Do a one time global import/export to make sure your iTunes and
SlimServer ratings are synchronized. You will need to decide if you
want to use the iTunes or TrackStat ratings. If you decide to use the
iTunes ratings and do a global import in TrackStat, it will overwrite
any previously set ratings in TrackStat. Unrated tracks in iTunes will
not overwrite rated tracks in TrackStat.

2.
If you did an import in step 1, it is a good idea to do an export now.
This will make sure any tracks rated in SlimServer which is not rated
in iTunes, will get the correct rating also in iTunes.

3.
Configure TrackStat to write changed ratings dynamically to a text
file.

4.
At regular interval run the perl script bundled with TrackStat to
export changed ratings in TrackStat into iTunes.

5.
At regular interval do a global import to get the ratings changed on
the iPod/iTunes back into SlimServer/TrackStat. Remember to execute
step 4 just before.

Phil Meyer;223494 Wrote: 
> 1. When importing from the designated iTunes music library xml file to
> SlimServer, what happens if SlimServer/TrackStat already has statistics
> for the songs being imported?  Probably not a big deal, as once I've set
> a rating in either place, I probably won't be changing it.  I just want
> to know what will happen before I try it!
> 
> I believe the iTunes stats will overwrite the Trackstat ratings
> (presumably only for songs that have ratings in iTunes).
> First of all, I feel that I haven't completely tested this logic, so
before you start make sure you have a backup of the TrackStat data. But
this is how it is supposed to work.

Ratings will be overwritten when doing an import, the exception is that
unrated tracks in iTunes won't overwrite the ratings for rated tracks in
TrackStat/SlimServer.

For play counts and last played time there is some logic:
- If the play count is higher in SlimServer/TrackStat, the play count
and last played time will not be overwritten during the import
- If the last played time is higher in SlimServer/TrackStat, the last
played time will not be overwritten during the import
- If the track never has been played in iTunes, there is no play count
and last played time data available in the import and the previously
statistics in TrackStat/SlimServer will remain.
- If none of the above applies, the previous play count and last played
time in TrackStat/SlimServer will be overwritten during the import.

Phil Meyer;223494 Wrote: 
> 2. What happens with the playcounts?  Is it possible that an import from
> iTunes could cause the playcount within SlimServer to be reduced (songs
> played more frequently in SlimServer than in iTunes since the stats
> were exported from Slimserver).  If this is the case, is it not
> possible to find the last played time for both ends, and use the stats
> from that source?  Maybe it would even be possible to consider
> SlimServer to be the master, and remember the playcount before sync
> with iTunes and compare when importing, thus incrementing playcount in
> trackstat by the difference.Se answer on question 1. TrackStat doesn't 
> remember when you did the
last export to iTunes so using SlimServer as master will be hard. If
you want a working two way integration I think your best chance is by
using iTunes as master as described in the first part of my answer.

Phil Meyer;223494 Wrote: 
> 3. If I import stats from iTunes for the mp3 copies of flac files, does
> the import convert the stats to the appropriate flac source in
> SlimServer?  TrackStat seems to do this translation on export, but what
> about importing?The path and extension conversion will work on both import 
> and export. 
In the latest TrackStat release there is an extra check during the
import:
- If a track with the extension used in iTunes exist on the disk when
doing the import, no extension conversion will be done.

I think this extra logic might get you into trouble for the MP3 files
that have a FLAC version in SlimServer but the MP3 version is still
accessible on the disc from SlimServer.
I'll put an entry to the wish list to make an option to turn this logic
completely off.

Phil Meyer;223494 Wrote: 
> 4. How does the export to iTunes work?  I guess I need to do a one-off
> complete export, followed by dynamic incremental exports (does this
> export happen as each track is played, or periodically?).
The incremental export will add an entry to a text file each time a
track is played or a rating is changed through TrackStat. You have to
run the bundled perl script manually at regular intervals to get the
ratings and statistics into iTunes.

Phil Meyer;223494 Wrote: 
> 5. TrackStat plugin config says that it will write to a file, and then
> some perl scripts need to be run to apply the changes to iTunes. 
> Is/Can this be automatic?  Is there any way to do an automatic import
> from iTunes (eg. when iTunes is run, or my iPod is connected)?The perl script 
> is actually taken from the iTunes Update plugin with a
small modification to support the global export from TrackStat.

It seems like it can take an extra parameter, so if you run it like
this it will do an import and sleep for an hour and do an import again
and sleep and ...:
perl.exe iTunesUpdateWin.pl C:\xxx\TrackStat_iTunes_Hist.txt 3600

I've never tested this myself, so if it doesn't work, let me know.

==============
As a side note to all this. I'm currently trying to completely get rid
of iTunes since the only thing I'm using it for is the iPod
synchronization. The result of this is that sometime in the near future
the following will be available:
- Statistics import/export to Amarok (Linux application that supports
iPod synchronization)
- An iPod plugin which makes it possible to configure which SlimServer
music to synchronize with the iPod and setup smart playlists for the
iPod directly from SlimServer. The synchronization part will be based
on GNUpod. The primary goal for the plugin is Linux, but if it doesn't
get too complicated and there is an interest I might make a Windows
version too. It might even work out of the box on Windows, I'm not
completely sure which limitations GNUpod has on the target platform
yet.


-- 
erland

Erland Isaksson
'My homepage' (http://erland.homeip.net) 'My download page'
(http://erland.homeip.net/download)
(Developer of 'TrackStat, SQLPlayList, DynamicPlayList, Custom Browse,
Custom Scan,  Custom Skip, Multi Library and RandomPlayList plugins'
(http://wiki.erland.homeip.net/index.php/Category:SlimServer))
------------------------------------------------------------------------
erland's Profile: http://forums.slimdevices.com/member.php?userid=3124
View this thread: http://forums.slimdevices.com/showthread.php?t=37986

_______________________________________________
plugins mailing list
[email protected]
http://lists.slimdevices.com/lists/listinfo/plugins

Reply via email to