Exposed host methods (INeonRemoteCalls)

These calls are always invoked via the RemoteCalls interface:

host.RemoteCalls.RatingToString(153);

 

  • 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.
  • void CapitalizeAllFields(NeonScriptTrack track)
    Capitalize all text fields for the track using the active capitalization rules.
  • IEnumerable<NeonScriptTrack> TracksInAlbum(NeonScriptAlbum album)
    Returns a list of all tracks from a specific album.
  • IEnumerable<string> SelectFilesFromDialog()
    Lets the user show multiple files via a dialog. Returns the list of selected files.
  • IEnumerable<string> FilesInPlaylist(string playlist)
    Reads an PLS, M3U or M3U8 file and returns the files from the playlist.
  • string RatingToString(int rating)
    Converts a rating value to a string.
  • 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
  • void ExecSql(string sql)
    Executes a SQL command which does not return any data, e.g. UPDATE, INSERT or DELETE.
    Click here to read about the database
  • NeonDataReader GetDataReader(string sql)
    Executes a SQL query which returns data. Typically a SELECT command.
    See below for definition of the NeonDataReader type.
    Click here to read about the database
  • string OpenFile(string title, string filter = "", string defaultExt = "");
    Display a open file dialog
  • void ShowMessage(string message);
    Display a messagebox
  • 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 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
  • 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 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 CalculateMusicKey(string filename);
    Calculates the music key (initial key) for a specific file.
  • 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 DefaultAlbumPicture
    Returns the path to the default album picture.
  • string DefaultArtistPicture
    Returns the path to the default artist picture. 
  • 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. 
  • string HtmlEncode(string inData)
    Returns a HTML encoded string based on the inData.
  • bool ConfirmationDialog(string title) 
    Show a confirmation dialog with the defined title. Returns true or false. 
  • 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 
  • NeonScriptArtist ArtistByName(string name) 
    Returns an NeonScriptArtist for the given name. 
  • NeonScriptArtist ArtistById(int id) 
    Returns an NeonScriptArtist for the given id 
  • 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. 
  • NeonScriptAlbum AlbumById(int id) 
    Returns an specific NeonScriptAlbum for the given id. 
  • 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) 
  • string CalculateAcoustId(string filename) 
    Calculates the AcoustId fingerprint for a specific file. 
  • int CalculateBpm(string filename) 
    Calculates the Bpm for a specific 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) 

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; }

    } 

  

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