MJFilesAutomation

From JRiverWiki
Jump to: navigation, search

represents a collection of files

Functions

number GetNumberFiles()

Description: returns the number of files contained in the collection
Return Value: number of files

void Sort()

Description: sorts the list of files using user selected sorting scheme.

MJFileAutomation * GetFile(number nFile)

Description: gets the MJFileAutomation interface for the given file index
Parameters:

  • nFile: the index of the file to retrieve (0 to GetNumberFiles() - 1)

Return Value: MJFileAutomation interface

void Play()

Description: plays the list of files

void PlayOrShow()

Description: decides whether to play or show the list of files. If the list contains only image files then show command will be used, otherwise this function will use play command.

boolean AlbumGroup(boolean bSort, boolean bGroupIfOneAlbum)

Description: groups the list of files by album. If this function is used, the collection of files will contain one file from each album, which can be expanded using the MJFileAutomation::GetAlbumFiles(...) call.
Parameters:

  • bSort: sort the list of files after grouping
  • bGroupIfOneAlbum: instructs the function whether to group by album if the list contains only one album.

Return Value: if grouping by album is possible, the function will return true, otherwise false.

void AddFile(string strFilename)

Description: Add the file to the collection
Parameters:

  • strFilename: the name of the file to add

void AddFileByKey(number nKey)

Description: Add the file to the collection
Parameters:

  • nKey: the key of the file to add

boolean RemoveFile(number nIndex)

Description: Remove the file from the collection
Parameters:

  • nIndex: the number of the file to remove

Return Value: true only if the file was removed

void RemoveAll()

Description: Remove all files from the collection

string Analyze(string strWhat)

Description: Analyze the files for information, currently size or duration is supported
Parameters:

  • strWhat: size or duration

Return Value: the size or duration, or "-1" if it couldn't be computed

void MoveToTop(number nIndex)

Description: moves the specified file to the top position
Parameters:

  • nIndex: the number of the file to move

void Shuffle()

Description: shuffles the order of the collection

void Set(number nIndex, string strField, string strValue)

Description: Changes the field of the specified file to a new value
Parameters:

  • nIndex: the position of the file in the collection
  • strField: the name of the field to change
  • strValue: the new value

number AddNewFile()

  • Description: Adds a new file to the end of the collection
  • Return Value: non-zero only if a new file was added

number AddExistingFile(IDispatch *pdispFiles, long nIndex, nInsertIndex)

Description: Add a file from another MJFilesAutomation object
Parameters:

  • pdispFiles: the IDispatch of the other MJFilesAutomation
  • nIndex: the position of the file in the other object
  • nInsertIndex: the position to insert at

Return Value: The position it was inserted at, or -1 if unable to insert

string Get(number nIndex, string strField)

Description: Get the value of a field for the specified file
Parameters:

  • nIndex: the position of the file in the collection
  • strField: the name of the field

Return Value: The value of the field

number Save(string strFilename, string strType, number nFlags)

Description: Save the files as a playlist, either m3u or mpl format
Parameters:

  • strFilename: The name of the playlist file
  • strType: "m3u" or "mpl"
  • nFlags: For m3u, if nFlags & 0x1, then use relative paths

Return Value: Nonzero on success, zero on failure

void Filter(string strSearchString)

Description: Remove all files in the collection not meeting the criteria in strSearchString
Parameters:

  • strSearchString: a Media Center search

void AddFileOverwriteExistingInfo(string strFilename)

Description: Add the file to the collection, overwriting the old information if it exists.
Parameters:

  • strFilename: the name of the file

Properties

number Position() (read / write)

Description: the index of the selected file. When starting playback, the selected file will get played. Other interfaces and functions may also honor the position. Note that the position will be preserved through shuffles, removes, and other MJFiles functions. (-1 means no file is selected)