Welcome to Tesla Motors Club
Discuss Tesla's Model S, Model 3, Model X, Model Y, Cybertruck, Roadster and More.
Register

Easy iTunes playlist syncing for Tesla USB flash drive

This site may earn commission on affiliate links.
  1. Thanks once again to Lee, Reputation Point added, and others nudged to do the same. Until a better way is found to appreciate this work.
  2. It looks like XLD by itself will rip a CD to FLAC (if someone wants a USB of a few albums, wants the high quality, but is not worried about playlists)? Anyone use it stand-alone? I'd downloaded an "AudioConverterPro" for Mac but haven't even installed.

I do like my tunes, symphonies, dubs, hoedowns, barbershops, etc. and in the car is when I have a chance to enjoy music - but have so many CDs that it will be a project to do it all. With Lee's scripting effort to automate it, and a quiet mobile "listening lab" (Back Warmer Included) to play it in, I'm actually glad I haven't ripped my CD collection to iTunes yet.
Sometimes procrastination ROCKS!

Rick
 
I just ran the script, and now have only a single track error rather than the 100+ I had before. And I can verify that my target folder has pretty much all the music I expect... well, I suspect that there's one track missing but I haven't compared the source playlists and the target folder to figure out which one.

Sometimes re-running the sync will correct any errors. Time Machine seems to interfere with the sync operation, not certain why. And Applescript error trapping is not the most robust (nor are my programming skills :) )

I'm glad it's working better!

- - - Updated - - -

  1. Thanks once again to Lee, Reputation Point added, and others nudged to do the same. Until a better way is found to appreciate this work
Rick

Rick,

Thanks much! And I agree that the Tesla is the one place I can listen to whatever I want, and as loud (or soft) as I want... Nice.

Lee
 
I think I figured out which track didn't sync error-free: The Beatles' 1 album, in the edition I purchased from iTunes, has an extra "track" that has some kind of value-add stuff in it. Rather than a type of "Purchased AAC audio file", it has a type of, "iTunes LP". I didn't really need it in my playlist anyway, so I just deleted it.

Life is good.

Thanks!

Alan
 
I've released a new version of my utility. Latest can always be found at TeslaTunes Latest Release or linked from the project page at Tesla Tunes

Here are the release notes:
Playlist and 16/20/24 bps alac->flac support

In addition to the already existing folder copy/conversion capability, this release adds playlist synchronization functionality. This is done by allowing the user to select one or more playlists from their iTunes library, then the utility will copy any tracks playable on the Model S into individual playlist folders, each named after the selected playlists. The folders will all be placed in a folder called "Playlists" at the selected destination directory. Inside each individual playlist folder, the tracks will be named such that the playlist order is preserved, for example xx-songname-artist-album.extension, such as "07-Last Train Home-Pat Metheny-One Quiet Night.flac" Note that this release does not include the "genre hack" that TMC's majorlance's AppleScript utility does. Also note we chose different naming and directory structure conventions for the files, so be aware of that if you want to try both out.

The naming and directory structure I've used means that songs can be played in order and can be repeated in a playlist as well as included in multiple playlists, but also means that a separate copy will be made for each, since the Model S doesn't actually support playlist formats.

The folder copying functionality can be used in addition to or instead of playlist functionality, and can be used even if iTunes is not used by the user, since it is file based and not tied specifically to iTunes. To avoid directory clutter making it difficult to find any playlists, in addition to all the selected playlists being put into a "Playlists" folder, all music library/folder copy/conversions will be placed in a "Music" folder that is created at the selected destination. Note this was not done in the previous release, so you may want to either change your destination directory to be one level up, or create a "Music" folder at the destination yourself, and move your existing copy into it to avoid making an extra copy of your library.

Support for 20 and 24 bit per sample Apple lossless to FLAC lossless conversion has been added to the existing 16bps support.

Up next, in upcoming releases:
* "The Genre hack"
* Playlist selection popup decluttering and "prettification"

A little further out:
* Better reporting and a detail progress view to show what's actually happening during the copying and conversion process
* update checking


996f674e-e16f-11e4-9666-761f3347bfb1.png

I'd like feedback from anyone that finds this useful, in particular anything that gets in the way of easier use and, given the limitations of the Model S in regards to playlists, whether the structure I do putting the playlists into individual folders and naming the playlist tracks to preserve order is useful vs. a longer mangled name and flat structure in combination with MajorLance's genre hack. I'm considering at least putting an option in to do the genre hack, but still think keeping the structure and naming as I'm doing them is more useful since it preserves playlist item order and keeps things more organized. Also, let me know if there are any playlist/track filenames that cause issues. I'm "sanitizing" the filenames, since they are created from track metadata and could contain illegal characters, but so far most everything I've come across actually works fine, including parenthesis, brackets, etc.

Reminder, I wrote this for my own use to get the job done, for me and my library. I've tested it more than I would a one-off script or something, but still minimally compared to what I would a commercial project. If it breaks, you get to keep both halves.
That said, I'd like to make it better and more useful, and certainly want to fix any problems, so let me know.
 
You use the play by folder option in the S. This will let you play the playlist in order, or you can use shuffle with it.

As I understand it, the only functionality of the genre hack is because album art was, for some reason, not showing up as consistently from the play by folder choice. In my experience, album art is flaky regardless :/

Looking at adding the genre thing now though, as a checkbox option. I'll be pushing a new build soon regardless, because I discovered I had some library items named starting with an underscore, and the current release had code in it that skipped directories starting with a '.' or a '_'. I'm not sure what I was thinking when I did that, but I'm sure it made sense at the time :)
 
Last edited:
Things went easier than I feared, and I think I now have the option "Set playlist items' genre to playlist name", aka the genre hack, implemented.
I did this while sitting in a waiting room, so can't test with my library at the moment, but should be able to later tonight. If things work well, I'll bundle up another release tonight.
 
ra-san,

Great job. I plan on testing this weekend. The song names in my script consisted of a combination of playlist/artist/album/song/genre plus the unique identifier in iTunes. If anyone of those were changed in iTunes, the song would be replaced by the updated copy. I included the unique identifier to help when I de-duped songs using a third party app (in may case, Song Sergeant) which would sometimes replace a file with better audio quality but keep the original tags. This helped force a re-sync as the identifier changed. Only mention this as a method to force a new copy (you're application may have a different approach?).

I'd keep the folder/playlist setup as it really doesn't matter unless you're using folder view, in which case you'll want it.

Also glad to see the higher bit rate support. I think that songs from HDTracks.com or PonoWorld.com in higher sample rates and that have been remastered, do sound better than standard lossless files. And storage is cheap!
 
running the program now. will probably take all night, so hopefully my morning commute will be my first in over a year with my library.

i think the advantage of the genre/playlist swapping is that you don't have to go through all the artist folders to get to the playlist you want.

i'm pretty excited. thanks for driving each other to create a great solution.
 
In mine, it's a simple existence check. I don't check modification dates or anything like that. I didn't figure the use case of getting better versions of songs you already have with the exact same name, album, etc. was something that ws very likely, vs. the mod date on the source being updated for some other unimportant reason, which would then mean I'd be doing unnecessary copies. Only way to force new copies is to delete or change the destination.

I'd be interested to know if "smarter" checking for whether or not to copy is something that would be useful for people. Same with deleting items no longer in the source but in the destination - I don't do that and specifically didn't want to in the case of my whole library copy. But for playlists I currently will delete items deleted from a playlist (figure that's probably a common use case). I don't currently delete whole playlists at the destination that are no longer in the source - I've mixed feelings about it. It's not hard to manually delete them, and didn't want to delete folders someone may have added manually

I kind of saw things, based on my usage pattern, as being you'd copy a bunch of stuff the first time you used it, then after that it'd mostly be quick updates to grab the new media you've acquired, and you'd probably just start it and (since all your selections from last time are reloaded) hit do it. Done. I didn't attempt to handle the cases of updating already existing media, or deleting media you don't want copied over any more. Figured it's unlikely to happen, and in the rare occasion it does, scrap the destination and redo it all overnight. That doesn't work if it's not rare though. Open to feedback.

I do kind of wonder what would be best to do next though. My thoughts right now are, in addition to any bug fixes that are needed:
* fix the playlist view look - some mismatched backgrounds and such, just cosmetic
* make it so you can click anywhere on the line to select the playlist
* autoupdate notification
* detail progress view, sort of like you can click the Safari or iTunes progress/disclosure button and pop up a list of operations and status
* playlist folder management, as in if you deselect a playlist, it'll remove it from the destination playlist folder - feature or misfeature? Looking for feedback.
< pause to regroup and consider what to change>
* windows version
* linux version

Not sure how useful a windows version will be (much less a linux version). How many people actually use apple lossless on windows and also own a Model S and care enough to bother with something like this. If you don't use Apple Lossless, not really sure what someone would really be looking for in a utility that doesn't already exist in one of the many available. For Linux, I'd expect even fewer use Apple Lossless (probably already do FLAC directly), installed base lower, and otherwise same comments as Windows applies.
Are there Windows users out there just pining for something specific in a util like this? If so, what?

- - - Updated - - -

running the program now. will probably take all night, so hopefully my morning commute will be my first in over a year with my library.

i think the advantage of the genre/playlist swapping is that you don't have to go through all the artist folders to get to the playlist you want.

i'm pretty excited. thanks for driving each other to create a great solution.

You won't have to go through all the artist folders the way I do it now (and you should clean up the destination to match the new way, if you've ran the first couple versions). There's a playlist folder, and in it are the individual playlist folders (and only them - all music from the folder/library copy is under the Music folder). Inside each playlist folder is a flat directory structure, no subfolders, and each filename has a numeric start, with enough digits to make sure the sort order is maintained (1 digit if <10 items, 2 if <100, etc.). From that folder view you can play your "playlist" in order, or you can hit shuffle. There's no digging around further, from that view. I don't really see anything the genre thing adds except possibly better album art handling - but I know that can be a big thing to people.
 
pretty happy with the results. moved about 9000 files last night.

i was going to pop on here with a few questions, but i think you already answered them.

I was going to suggest having the genre hack remove the genres from songs that were not part of a playlist, but i see your folder solution takes care of that. i guess i might even stop using the genre hack then, but i'll have to think about that.

also, i am not sure how the tesla catalogs things, but will it find songs regardless of the file structure for the song view? the reason i ask is I am not sure if i am supposed to have a music folder and then the artist stuff in that folder or get rid of the music folder.

feedback on playlist management: if i unselect a playlist, i would want ti removed since it takes up space.

feature request: can the playlist select list show playlists int eh same order as itunes. it seemed random to me.

Again, very happy to have found a solution after a year of thinking i had to find a way to add bluetooth to my old ipod.

thanks again.


wouldnt the windows users benefit from the playlist structure? isnt that what this is really about? playlists? i had very few music files that couldnt be moved over because of format, but that it because msot of my library is not lossless.
 
also, i am not sure how the tesla catalogs things, but will it find songs regardless of the file structure for the song view? the reason i ask is I am not sure if i am supposed to have a music folder and then the artist stuff in that folder or get rid of the music folder.

You don't need to (but can) have the Music folder if you are just using playlists. Can uncheck that top option altogether. I can see why someone would want to have a separate drive for playlists vs. the whole library since the S will go through all files on the drive, leading to showing duplicates (perhaps lots of copies of a song, if it's in the library plus multiple playlists) if you browse via the normal artists or songs type functionality.

feedback on playlist management: if i unselect a playlist, i would want ti removed since it takes up space.

feature request: can the playlist select list show playlists int eh same order as itunes. it seemed random to me.
Thanks for the feedback. RE: playlist order - yeah, not sure what's going on with that. I build the tree in the same order Apple's iTunes framework code gives me the info.
Prettying up that list, including fixing the ordering if possible and removing unexpected playlists generated behind the scenes by iTunes is on my todo list.

Again, very happy to have found a solution after a year of thinking i had to find a way to add bluetooth to my old ipod.

thanks again.


wouldnt the windows users benefit from the playlist structure? isnt that what this is really about? playlists? i had very few music files that couldnt be moved over because of format, but that it because msot of my library is not lossless.
Glad it's looking useful to you. Probably right about the playlist part - but would expect non iTunes playlists to be more important.
 
Running majorlance's applescript for the first time.

Created the Tesla playlist folder and 2 playlist within it. Only 8 songs total in my entire library just as a test. I'm getting this error after choosing destination folder:

error "Can’t get item 1 of {}." number -1728 from item 1 of {}
 
ny888,

Sounds like a timeout error. Or you may not be running Yosemite which my script requires for progress reporting (I did post an alternative in this thread for pre-Yosemite users). Regardless, ra-sans application (also detailed within this thread) is a more robust Objective C application that he's recently updated to include pseudo playlist capabilities (as my script did) by changing the genre to the playlist name. I've been out of town since the update but it sounds like a winner. You should try it and see if you still have errors.

My initial goal was to automate a manual process that basically replicated syncing an iPod to iTunes within the limitations of the Tesla Media player (specifically it doesn't recognize playlists, go figure). The work-around was to change the genre to the playlist name.... instant playlist on the Tesla. The only downside to this approach is that you have multiple songs (one for each time it's in a playlist). My personal solution was to have another USB flash drive with just the songs in the "Tesla" playlist folder (I also wrote a script for this) that kept the genre and other song attributes intact... so you could play back by genre or artist, album, etc. Storage is cheap.

So... try out ra-san's app. From what he's posted, I think it will meet both needs. My personal preference is that it syncs (adds and deletes) the flash drive like your iPhone or iPod does (hint to ra-san ;) but I'm just one user). An Objective C app vs. an Applescript (as I wrote) will be more robust- ultimately a better solution.

Regardless, we're much closer to having a "sync and forget it" solution for the Tesla. :)

Lee
(majorlance)
 
I ran sa-sans's app and it looks like it worked. It was only 2 playlist and 8 songs and took a long time. Could it be because it's writing to USB as well as my files are on a NAS drive?

What's a long time, in rough terms? Did you look at the USB afterwards and see all the files there, and only the files you expected?

For reference, when I run it on my library, which is on a NAS too, a few TB USB drive hanging off an Apple Time Capsule, and send it to my USB attached portable hard drive I use for the car, my scan rate for determining what to actually copy or convert is double digit tracks per second. The copy/convert rate is something like a song every half second to two seconds, depending on length and whether it is a copy or a conversion.

I did use an old 4GB flash USB fob for testing the other night and noticed it was probably 10 times slower than the normal drive I use in the car, so the speed of the USB device can make major differences. My laptop was a mid 2010 MacBook Pro, and doesn't even have usb3, so I expect things are much faster on a newer machine with a fast usb3 fob or drive.
If you aren't getting reasonable performance, try a known fast different USB drive to compare. If you see any errors or things that don't make sense, let me know.