Exposed host methods (INeonRemoteCalls)

These calls are always invoked via the RemoteCalls interface:

host.RemoteCalls.RatingToString(153);

 

Pictures

  • void ClearAttachedPicturesFromFiles(IEnumerable<NeonScriptTrack> tracks);
    Removes all attached pictures from all files in the list passed in the tracks parameter.
    Note: This method will apply changes directly to the tracks in the list, therefore you should not invoke this method in a loop that commits changes.
  • void ClearAttachedPictures(NeonScriptTrack track);
    Removes all attached pictures from the specific track. Changes needs to be commited through the CommitAlChanges method.
  • void SaveAlbumPictureToTags(NeonScriptAlbum album, bool overwrite);
    Applies the assigned album picture from the album parameter to all tracks from the album. Note: This method applies the result directly to the tags.
  • void ResizeAndSaveAlbumPictureToTags(NeonScriptAlbum album, bool overwrite, int width, int height, bool keepAspect);
    Applies the assigned album picture from the album parameter to all tracks from the album and applies resizing and scaling. Note: This methid applies the result directly to the tags.
  • void SaveArtistPictureToTags(NeonScriptArtist artist, bool overwrite);
    Applies the assigned artist picture from the artist parameter to all tracks from the artist. Note: This method applies the result directly to the tags.
  • void ResizeAndSaveArtistPictureToTags(NeonScriptArtist artist, bool overwrite, int width, int height, bool keepAspect);
    Applies the assigned artist picture from the artist parameter to all tracks from the artist and applies resizing and scaling. Note: This method applies the result directly to the tags.
  • string DefaultAlbumPicture
    Returns the path to the default album picture.
  • string DefaultArtistPicture 
    Returns the path to the default artist picture. 

Album collections

  • void RemoveAlbumsFromCollection(IEnumerable<NeonScriptAlbum> albums, NeonScriptAlbumCollection collection);
    Removes a list of albums from a specific collection.
  • void RemoveAlbumFromCollection(NeonScriptAlbum album, NeonScriptAlbumCollection collection);
    Removes a specific album from a specific collection.
  • void AddAlbumsToCollection(IEnumerable<NeonScriptAlbum> albums, NeonScriptAlbumCollection collection);
    Adds a list of albums to a specific collection.
  • void AddAlbumToCollection(NeonScriptAlbum album, NeonScriptAlbumCollection collection);
    Adds a specific album to a specific collection.
  • IEnumerable<NeonScriptAlbumCollection> AlbumCollections { get; }
    Returns all available album collections.

Albums

  • IEnumerable<NeonScriptTrack> TracksInAlbum(NeonScriptAlbum album)
    Returns a list of all tracks from a specific album.
  • NeonScriptAlbum AlbumById(int id) 
    Returns an specific NeonScriptAlbum for the given id. 

Artists
  • NeonScriptArtist ArtistByName(string name) 
    Returns an NeonScriptArtist for the given name. 
  • NeonScriptArtist ArtistById(int id) 
    Returns an NeonScriptArtist for the given id 


Tracks/Files/Tags

  • void CapitalizeAllFields(NeonScriptTrack track)
    Capitalize all text fields for the track using the active capitalization rules.
  • NeonScriptTrack TrackFromFilename(string filename);
    Returns a databse track by its full filename. 
  • void SaveTags(NeonScriptTrack track);
    Saves the track tags to the file.
  • void CommitAllChanges(IEnumerable<NeonScriptTrack> tracks) 
    Commits all changes in the input tracks collection to tags and the database. If the flag IgnoreChanges is set to true for a specific track, the changes for this specific track will not be applied. (Default value is false) 
  • void RenameFiles(IEnumerable<NeonScriptTrack> tracks, IEnumerable<string> newFilenames) 
    Renames the list of sourcefiles in the tracks object, with the new names defined in the string list, newFilenames. Files will be renamed on disk and updated in the database. 
  • void RenameFile(NeonScriptTrack track, string newFilename) 
    Rename a specific file. Please note that this call is not efficient to perform on a large batchjob, since the database will be updated after each request to this call. 
  • string TagToFilename(NeonScriptTrack track, string template) 
    Returns a string with a new filename rendered using the TagToFilename engine, based on the templating system.  
  • string TagToFilename(NeonScriptTrack track, string template) 
    Returns a string rendered through the TagToFileName engine, without path, filename and extension. 
  • string Capitalize(string inData, int mode)  
    Capitalize a string using one of the following modes: 
    • 1 = Sentence capitalization 
    • 2 = Word capitalization 
    • 3 = Uppercase 
    • 4 = Lowercase 
    • 5 = User defined (per field) 

Playlists

  • NeonScriptPlaylistFolder CreatePlaylistFolder(string name, NeonScriptPlaylistFolder parentFolder = null)
    Creates a playlist folder in a specific parent folder. If no parent folder is specified it will be created in the root folder.
  • IEnumerable<NeonScriptPlaylistFolder> PlaylistFolders { get; }
    Returns all playlist folders
  • void AddToPlaylist(NeonScriptPlaylist playlist, IEnumerable<NeonScriptTrack> tracks);
    Add a list of tracks to a playlist
  • void AddToPlaylist(NeonScriptPlaylist playlist, NeonScriptTrack track);
    Add a single track to a playlist
  • void DeletePlaylist(NeonScriptPlaylist playlist);
    Deletes a playlist
  • NeonScriptPlaylist CreatePlaylist(string name, NeonScriptPlaylistFolder parentFolder = null)
    Creates a new playlist in a specific folder. If no folder is specified it will be placed in the root.
  • IEnumerable<NeonScriptTrack> TracksInPlaylist(NeonScriptPlaylist playlist)
    Returns a all tracks contained in a specific playlist
    IEnumerable<NeonScriptPlaylist> Playlists { get; }
    Returns all playlists
  • IEnumerable<string> FilesInPlaylist(string playlist)
    Reads an PLS, M3U or M3U8 file and returns the files from the playlist.
  • void ExportPlaylist(ScriptExportPlaylistType playlistType, string filename, bool relativePath, IEnumerable<NeonScriptTrack> tracks);
    Exports the tracks to a playlist specified by the playlistType. The result will be saved as filename, relative path defines if the tracks sould use relative or absolute paths.
    Playlist types can be one of the following:
    • ScriptExportPlaylistType.M3U 
    • ScriptExportPlaylistType.M3U8 
    • ScriptExportPlaylistType.PLS 


Delete tags

  • void DeleteSpecificTags(IEnumerable<NeonScriptTrack> tracks, ScriptTagDeleteTypes[] tagTypes)  
    Delete specific tags for the list of files. This method is more efficient than deleting tags per file since the database will only be updated once the operation is completed. Only tags of the specific types defined in tagTypes will be deleted.  
  • void DeleteSpecificTagsForFile(NeonScriptTrack track, ScriptTagDeleteTypes[] tagTypes) 
    Delete specific tags for a specific file. Only tags of the specific types defined in tagTypes will be deleted. 
  • void DeleteAllTags(IEnumerable<NeonScriptTrack> tracks) 
    Delete all tags for the list of files. This method is more efficient than deleting tags per file since the database will only be updated once the operation is completed. 
  • void DeleteAllTagsForFile(NeonScriptTrack track)
    Delete all tags for a specific file 


Dialogs
  • IEnumerable<string> SelectFilesFromDialog()
    Lets the user show multiple files via a dialog. Returns the list of selected files.
  • string OpenFile(string title, string filter = "", string defaultExt = "");
    Display a open file dialog
  • void ShowMessage(string message);
    Display a messagebox
  • string InputDialog(string title)
    Shows an input dialog with the defined title. Returns the string entered by the end-user or an empty string if Cancel were pressed.
  • string SelectItemFromList(IEnumerable<string> contents, int selectedIndex);
    Let the user select a specific item from a list. The list is populated with data from the contents parameter. It is possible to pre-select an entry by setting the selectedIndex parameter. 
  • string SelectFolder(string filter = "", string defaultExt = "") ;
    Let’s the user select a folder. If no folder is selected, an empty string is returned. The parametes are optional and controls the filter and the default extension in the dialog. 
  • bool ConfirmationDialog(string title) 
    Show a confirmation dialog with the defined title. Returns true or false. 
  • string SelectFile() 
    Shows a dialog which lets you select a specific filename. Useful for creating an input filename used for saving operations. If no choice is made, an empty string is returned. 

Remote playback

  • void Play(int index);
    Play a specific index in the Play queue
  • void Pause();
    Pause/Resume playback
  • void Resume();
    Resume the playback
  • void Next();
    Change to the next entry in the Play queue
  • void Previous();
    Change to the previous entry in the Play queue
  • NeonScriptTrack ActiveTrack { get; }
    Returns the active track in the Play queue
  • double CurrentPosition { get; }
    Returns the current position of the track playing in milliseconds
  • void SetPosition(double newPosition);
    Set a new position in the currently playing track in milliseconds
  • IEnumerable<NeonScriptTrack> TracksInPlayQueue();
    Returns all tracks in the Play queue as a list
  • NeonPlayerState PlayerState { get; }
    Returns the playing state:
    • 0 = Undefined
    • 1 = Playing
    • 2 = Paused
    • 3 = Stopped
  • void Stop();
    Stop the playback.
  • double Duration { get; }
    Returns the duration in miliseconds for the currently playing track
  • void EnqueueAndPlay(IEnumerable<NeonScriptTrack> tracks);
    Queues the tracks in the list and plays the first
  • void EnqueueNext(IEnumerable<NeonScriptTrack> tracks);
    Queues the tracks in the list after the currently playing track
  • void EnqueueLast(IEnumerable<NeonScriptTrack> tracks);
    Queues the tracks in the list after the last manually queued track in the play queue.
  • int ActivePlayQueueIndex { get; }
    Returns the active index in the Play queue
  • bool AutoEnqueueActive { get; }
    Returns true if the auto enqueue is active
  • void SetAutoEnqueue(bool active);
    Change the state of Auto enqueue
  • bool CrossfadeActive { get; }
    Returns true if crossfade is active
  • void SetCrossfade(bool active);
    Change the state of the crossfader
  • int PlayerVolume { get; set; }
    Returns the current volume level (0-255)
  • void RateCurrentTrack(int newRating);
    Rate the currently playing track
  • void SetCurrentTrackAsFavourite(bool isFavourite);
    Set/unset if the currently playing track should be a favourite or not
  • bool CanPlayPrevious { get; }
    Returns true if it is possible to proceed to a prior track in the Play queue
  • bool CanPlayNext { get; }
    Returns true if it is possible to advanced to the next track in the Play queue
  • void SetPlayerVolume(int newVolume); 
    Change the current output level (0-255)
  • bool UsingLightTheme { get; }
    Returns true if the light theme is active
  • int DownsizeRating(int rating);
    Downsize a rating value from tags (0-255) to a scale ranging from 0-10 (10 = 5, 9 = 4.5, 8 = 4 and so on)
  • int UpsizeRating(int rating);
    Upsize a rating value from the range 0-10 to a tag compatible value (0-255)
  • bool GetBooleanValue(string key);
    Gets a stored value as a boolean value
  • void SetBooleanValue(string key, bool value);
    Sets a stored value as a boolean value by key
  • int GetIntValue(string key);
    Gets a stored value as an integer value
  • void SetIntValue(string key, int value);
    Sets a stored value as an integer value by key
  • string GetStringValue(string key);
    Gets a stored value as an string
  • void SetStringValue(string key, string value);
    Sets a stored value as an string value by key

Miscellaneous
  • void ImportAlbumReviewsFromHelium11();
    Imports album reviews from a Helium 11 database.
  • string RatingToString(int rating)
    Converts a rating value to a string.
  • void UpdateFiletype(string sourceFile, string newFile)
    Updates one entry in the database by the sourceFile parameter to the newFile parameter. This method can be used to update an entry from one file-type to another, for example MP3 to FLAC. During the update tags will be converted from the sourceFile to the newFile. All statistical data will be preserved.
  • void FilenameToTag(IEnumerable<NeonScriptTrack> tracks, string template)
    Populates the tracks with data returned from the filename to tag system, based on the input template. If the template is empty, the best match will automatically be used.
  • string CalculateMusicKey(string filename);
    Calculates the music key (initial key) for a specific file.
  • string HtmlEncode(string inData) 
    Returns a HTML encoded string based on the inData.
  • string CalculateAcoustId(string filename) 
    Calculates the AcoustId fingerprint for a specific file. 
  • int CalculateBpm(string filename) 
    Calculates the Bpm for a specific file. 

Database


Exposed database methods (INeonScriptDatabase)

These calls are always invoked via the Database interface:

 

host.Database.AddFiles(...)

 

  • void AddFiles(List<string> filesToAdd)
    Adds the list of files to the database. 
  • IEnumerable<NeonScriptAlbum> Albums
    Returns a list of all albums in the database 
  • IEnumerable<NeonScriptArtist> Artists
    Returns a list of all artists in the database 
  • string Database.SuggestedAlbumPath(NeonScriptAlbum album, bool fromFile)
    Returns the suggested album path according to Helium's album rules. If fromFile is true, the path will be calculated based on the actual (first) file from the album to give more precise results.
  • void Database.UpdateAlbumPath(NeonScriptAlbum album, string newPath)
    Updates the album path for the given album
  • void Database.UpdateAlbumPicture(NeonScriptAlbum album, string filename)
    Updates the album picture for the given album
  • void Database.UpdateArtistPicture(NeonScriptArtist artist, string filename)
    Updates the artist picture for the given artist.



Exposed methods on INeonScriptHost

These calls are invoked directly against the host object:

 

host.UpdateProgress("my status");

 

  • void UpdateProgress(string status);
    Updates the text in the statusbar with the text sent to the method as an argument.
  • IEnumerable<NeonScriptTrack> Tracks 
    C
    ontains a collection of the selected tracks 
  • IEnumerable<NeonScriptTrack> DistinctTracks
    Returns the disctinct files from the selection. If the selection contains subtracks, then a specific subtrack will only occur once in this list whereas it will occur multiple times in the Tracks method.
  • IEnumerable<NeonScriptAlbum> Albums { get; }
    Returns a collection of albums shown in the actual view.
  • IEnumerable<NeonScriptArtist> Artists { get; }
    Returns a collection of artists shown in the actual view.
  • string Database.QuotedString(string data)
    Returns an escaped string used for SQL queries
  • int Database.ActiveUserId { get; }
    Returns the active user id for the logged in user.
  • string ReturnMessage { get; set; }
    Set a custom exit message

Definition of ScriptTagDeleteTypes

  • Id3v
  • Id3v2, 
  • Apev2 
  • Vorbis 
  • WMA 
  • M4A 
  • Lyrics3 
  • WAV 

Definition of NeonScriptAlbumCollection

    public class NeonScriptAlbumCollection
    {
        public int CollectionId { get; set; }
        public string CollectionName { get; set; }
    }

 

Definition of NeonScriptArtist 

    public class NeonScriptArtist
    {
        public string ArtistName { get; set; }
        public int ArtistId { get; set; }
        public string Country { get; set; }
        public int CountryId { get; set; }
        public string ArtistSortOrder { get; set; }
        public string ArtistPicturePath { get; set; }
        public int Formed { get; set; }
        public int Disbanded { get; set; }
        public string ArtistUrl { get; set; }
        public string BornName { get; set; }
        public bool IsArtist { get; set; }
        public int TotalItems { get; set; }
        public byte Rating { get; set; }
        public bool IsFavourite { get; }
        public string Biography { get; set; }
        public bool IsChanged { get; set; }
        public string ArtistImage { get; set; }
    } 

   

Definition of NeonScriptAlbum

  

    public class NeonScriptAlbum
    {
        public string AlbumArtist { get; set; }
        public string AggregatedAlbumName { get; set; }
        public string AlbumPath { get; set; }
        public int AlbumId { get; set; }
        public string AlbumSortOrder { get; set; }
        public string AlbumSubtitle { get; set; }
        public string AlbumPicturePath { get; set; }
        public string AlbumLabel { get; set; }
        public int TotalItems { get; set; }
        public int TotalLength { get; set; }
        public int TotalSize { get; set; }
        public byte ReleaseType { get; set; }
        public int ReleaseYear { get; set; }
        public string PartOfSeries { get; set; }
        public int TotalCds { get; set; }
        public string ArtistSortOrder { get; set; }
        public DateTime AddedDate { get; set; }
        public string AlbumVersion { get; set; }
        public int RecordingYear { get; set; }
        public byte Rating { get; set; }
        public bool IsFavourite { get; }
        public bool IsVA { get; set; }
        public string AlbumImage { get; set; }
    } 

  

Definition of NeonScriptTrack

  

    public class NeonScriptTrack
    {
        public int Rating { get; set; }
        public bool IsFavourite { get; }
        public int DetailId { get; set; }
        public int AlbumId { get; set; }
        public string Artist { get; set; }
        public string Album { get; set; }
        public string Title { get; set; }
        public string Genre { get; set; }
        public string Filename { get; set; }
        public string Path { get; set; }
        public string Subtitle { get; set; }
        public string Remix { get; set; }
        public int RecordingYear { get; set; }
        public int Songlength { get; set; }
        public int Filesize { get; set; }

        private int _bpm;
        public int Bpm
        {
            get {return _bpm;}
            set
            {
                _bpm = value;
            }
        }
        public int Tags { get; set; }
        public int CurrentTrack { get; set; }
        public int TotalTracks { get; set; }
        public int CurrentCd { get; set; }
        public int TotalCds { get; set; }
        public int VbrCbr { get; set; }
        public int Bitrate { get; set; }
        public int Frequency { get; set; }
        public string Tempo { get; set; }
        public string Mood { get; set; }
        public string Preference { get; set; }
        public string Situation { get; set; }
        public string ArtistSortOrder { get; set; }
        public string TitleSortOrder { get; set; }
        public string AlbumSortOrder { get; set; }
        public int ItemType { get; set; }
        public string Comment { get; set; }
        public string Composer { get; set; }
        public string Copyright { get; set; }
        public string EncodedBy { get; set; }
        public string Media { get; set; }
        public string Produced { get; set; }
        public string Publisher { get; set; }
        public int ReleaseYear { get; set; }
        public string SoftwareSettings { get; set; }
        public string Lyricist { get; set; }
        public string AlbumSubtitle { get; set; }
        public string Language { get; set; }
        public string OrgArtist { get; set; }
        public string OrgTitle { get; set; }
        public string OrgLyricist { get; set; }
        public int OrgYear { get; set; }
        public int Pics { get; set; }
        public string BandOrchestra { get; set; }
        public string Conductor { get; set; }
        public int ParentDetailId { get; set; }
        public bool MixMaster { get; set; }
        public int SongOffset { get; set; }
        public int ParentCurrentTrack { get; set; }
        public string AlbumArtist { get; set; }
        public string Custom1 { get; set; }
        public string Custom2 { get; set; }
        public string Custom3 { get; set; }
        public string Custom4 { get; set; }
        public string Custom5 { get; set; }
        public string Custom6 { get; set; }
        public string Custom7 { get; set; }
        public string Custom8 { get; set; }
        public string Custom9 { get; set; }
        public string Custom10 { get; set; }
        public int Obscure { get; set; }
        public string Isrc { get; set; }
        public string InitialKey { get; set; }
        public int PlayCounter { get; set; }
        public string FullFilename
        {
            get { return System.IO.Path.Combine(Path, Filename); }
        }
        public string AcoustId { get; set; }
        public bool IgnoreChanges { get; set; }
        public string AlbumArtistSortOrder { get; set; }
        public double AlbumGain { get; set; }
        public double TrackGain { get; set; }
        public string AlbumVersion { get; set; }
        public string FileTypeString { get; set; }
        public string PartOfSeries { get; set; }
  public bool ClearPictures { get; set; }
        public string Lyrics { get; set; }
        public string Grouping { get; set; }
        public int Quality { get; set; }
        public string Biography { get; set; }
        public string CatalogNumber { get; set; }

    } 

  

Definition of NeonDataReader

NeonDataReader is a result type which will contain information about the result from a SQL query.
The class is defined like this:

 

public class NeonDataReader
{
    public int NumberOfRows => Rows.Count;
    public List<NeonDataRow> Rows { get; set; }
}

 

Iterate Rows to access per-field data.


NeonDataRow

NeonDataRow is defined like this:

 

public class NeonDataRow
{
    public int FieldCount => Fields.Count;
    public List<object> Fields { get; set; }
}

 

Iterate the list of fields or access them via an indexer to field specific data. Please note that the list contains untyped data so depending on which fields you have selected, you need to cast them to a specific type to get the proper result.


Example

 

SELECT tblArtists.ArtistName, tblArtists.TotalItems 
FROM tblArtists 
WHERE tblArtists.ArtistName LIKE 'A%'

 
In this query two items per row will be returned. The first item is a string and the second is an integer.

To work with them via a script you will need to cast them for example like in the snippet below:

 

var line = string.Format("{0}, items: {1}", (string)row.Fields[0], (int)row.Fields[1]);

 
Click here to read about the database