Purpose:A simple pair of scripts to allow mp3 players without compilation features to show (Multiple Artists) for the Artist and show the song artist as part of the song name. Manually you would use the Copy Fields function to do this: (see below for field definitions)
Initial:
1. Copy [Artist] -> [Song Artist]
2. Copy [Name] -> [Song Name]
3. Copy [Song Name - Artist] -> [Name]
4. Copy [Album Artist (Auto)] -> [Artist]
*Sync handheld*
Reversal:
1. Copy [Song Artist (Auto)] -> [Artist]
2. Copy [Song Name (Auto)] -> [Name]
This means that for the sync you would have, for example:
Album: Shrek Original Soundtrack
Artist: (Multiple Artists)
Track Names:
Stay Home - Self
I'm a Believer - Smash Mouth
...
Configuration:This script requires a few additional fields to store the extra data:
[Song Artist]: Standard Text Field
[Song Name]: Standard Text Field
[Song Artist (Auto)]: calculated field based on [Song Artist] or [Artist] if [Song Artist] is empty:
if(IsEmpty([Song Artist]),[Artist],[Song Artist])
[Song Name (Auto)]: calculated field based on [Song Name] or [Name] if [Song Name] is empty.
if(IsEmpty([Song Name]),[Name],[Song Name])
[Song Name - Artist]: calculated field to show the song name followed by the artist if the artist and the album artist are different.
if(IsEqual([Artist],[Album Artist (Auto)]),[Song Name (Auto)],[Song Name (Auto)] - [Artist])
Problem:When doing this manually, it is almost instant, because you do the whole library at once, with just the tags taking a while to update.
The script uses a loop to do each file individually, which obviously takes a fair bit longer.
If anyone knows of any way to make the script do the whole lot in one go, please let me know!
Script for Before:using System;
//css_reference MediaCenter.dll;
class Script : MarshalByRefObject
{
public void Init(MediaCenter.MCAutomation mediaCenterInterface)
{
//Search string checks artist against album artist to find all relevant files. Once it has changed the artist to equal album
//artist the file will no longer be found, making the script safe to run twice in a row.
MediaCenter.IMJFilesAutomation files = mediaCenterInterface.Search("[Media Type]=Audio [=IsEqual([Artist], [Album Artist (Auto)])]=[0]");
for (int counter = 0; counter < files.GetNumberFiles() ; ++counter)
{
files.Set(counter,"Song Artist",files.Get(counter,"Artist"));
files.Set(counter,"Song Name",files.Get(counter,"Name"));
files.Set(counter,"Name",files.Get(counter,"Song Name - Artist"));
files.Set(counter,"Artist",files.Get(counter,"Album Artist (Auto)"));
}
}
}
Script for After:using System;
//css_reference MediaCenter.dll;
class Script : MarshalByRefObject
{
public void Init(MediaCenter.MCAutomation mediaCenterInterface)
{
//Search string checks song artist against artist. Should find nothing if the first script hasn't been run.
MediaCenter.IMJFilesAutomation files = mediaCenterInterface.Search("[Media Type]=Audio [=IsEqual([Song Artist (Auto)], [Artist])]=[0]");
for (int counter = 0; counter < files.GetNumberFiles() ; ++counter)
{
files.Set(counter,"Artist",files.Get(counter,"Song Artist (Auto)"));
files.Set(counter,"Name",files.Get(counter,"Song Name (Auto)"));
}
}
}
EDIT: Have updated the scripts to remove some loops so that they go a bit faster...
EDIT2: Have changed the search strings so that only the relevant files are changed to make the scripts go a lot faster...this also gets rid of the problem of destroying your library if the script is run twice in a row, as the search doesn't find any files if this is the case