Editing
MJFileAutomation
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
MJFileAutomation - object for dealing with a single file ==Functions== ===MJPlaylistsAutomation * GetPlaylists()=== '''Description:''' returns an [[MJPlaylistsAutomation]] interface containing the collection of playlists that the given file is in<br> '''Return Value:''' [[MJPlaylistsAutomation]] interface ===string GetImageFile(MJImageFileFlags nImageFileFlag)=== '''Description:''' gets the filename of an image associated with the file<br> '''Parameters:''' * '''nImageFileFlag''': ** IMAGEFILE_DISPLAY - display image (tag or database) (uses MJ logo if file doesn't have an image) ** IMAGEFILE_IN_DATABASE - database image ** IMAGEFILE_IN_FILE - tag image (stored inside of file) ** IMAGEFILE_THUMBNAIL_SMALL, IMAGEFILE_THUMBNAIL_MEDIUM, IMAGEFILE_THUMBNAIL_LARGE - small, medium, and large thumbnail images for the file ** IMAGEFILE_DISPLAY_NO_DEFAULT - like IMAGEFILE_DISPLAY except that it won't return the logo when there is no art ** IMAGEFILE_DISPLAY_NO_DEFAULT_STANDARD_JPEG - like IMAGEFILE_DISPLAY_NO_DEFAULT except that it always returns a standard (non-progressive) JPEG ** IMAGEFILE_THUMBNAIL_BINARY - all three thumbnails stored in a single file. Used by Library Server. Note: Do not delete the files returned by this function. Media Center will do any necessary cleanup. Also, subsequent calls may return the same filename (if a temp file is being used) so you must load / cache the image instead of caching the filenames. '''Return Value:''' a filename of the image file ===string SetImageFile(string strImageFile, MJImageFileFlags nImageFileFlag)=== '''Description:''' sets the image for the file<br> '''Parameters:''' * '''strImageFile''': filename of the image * '''nImageFileFlag''': ** IMAGEFILE_IN_DATABASE - database image<br>''Image is saved in DB and in file (maybe this depends on the used JRMC settings). However the image file is not saved to the folder set in the options (e.g. with track or in a special cover image folder). This has to be done with separate code.'' ** IMAGEFILE_IN_FILE - tag image (stored inside of file)<br>''This doesn't seem to work as images are not saved to the file.'' '''Return Value (bool):''' false (0) on failure, true (non-zero) on success ===string GetFormattedFileSize()=== '''Description:''' gets the display friendly file size<br> '''Return Value:''' a string representing the file size (i.e. "23.434 MB") ===string GetFormattedFileDate()=== '''Description:''' gets the display friendly file date / time<br> '''Return Value:''' a string representing the file date / time (i.e. "2/30/2002 8:01 PM") ===string GetFormattedDuration()=== '''Description:''' gets the display friendly duration<br> '''Return Value:''' a string representing the duration (i.e. "3:04") ===string GetFormattedLastPlayed()=== '''Description:''' gets the display friendly last played date / time<br> '''Return Value:''' a string representing the duration (i.e. "2/30/2002 8:01 PM") ===string GetAvailableFilename()=== '''Description:''' returns the filename in the format that's available to the system, so that files on a removable device get returned, for example, as "D:\1.mp3" instead of "(0xF43EA231):\1.mp3"<br> '''Return Value:''' a string representing the filename ===string GetFilenameEx(int, int)=== '''Return Value:''' a string representing the filename ===boolean SaveToTag()=== '''Description:''' Forces Media Center to save the file information to the tag.<br> '''Return Value:''' 0 - failed, 1 - success. ===string Get(string strField, boolean bFormatted)=== '''Description:''' generic function to get value for the specified field.<br> '''Parameters:''' * '''strField''': name of the field (e.g. Artist, Album...) * '''bFormatted''': determines whether the return value should be formatted. '''Return Value:''' value of the field ===boolean Set(string strField, string strValue)=== '''Description:''' generic function to set value for the specified field.<br> '''Parameters:''' * '''strField''': name of the field (e.g. Artist, Album...) * '''strValue''': new value of the field '''Return Value:''' 0 - failed, 1 - success. ===MJFilesAutomation * GetAlbumFiles()=== '''Description:''' returns an [[MJFilesAutomation]] interface containing the list of files which belong to the same album (use to expand after an album group)<br> '''Return Value:''' [[MJFilesAutomation]] interface ===int GetKey()=== '''Description:''' Gets the key of the file<br> '''Return Value:''' the key ===boolean DeleteFile(long hwndParent)=== '''Description:''' Deletes the file (with confirmation)<br> '''Parameters:''' * '''hwndParent''': The handle of the parent window or null '''Return Value:''' nonzero on success, zero on failure ===boolean RotateImage(long nDegrees)=== '''Description:''' If the file is a JPEG, rotate the image<br> '''Parameters:''' * '''nDegrees''': How much to rotate '''Return Value:''' TRUE ===string GetFilledTemplate(string strTemplate)=== '''Description:''' Evaluates an expresion for the file and returns the result<br> '''Parameters:''' * '''strTemplate''': the expression '''Return Value:''' the result ===boolean SilentDeleteFile()=== '''Description:''' Deletes the file (no confirmation). Remark: This rather removes the file from the database, but does not delete the file on disc.<br> '''Return Value:''' nonzero on success, zero on failure ===void UpdatePlaybackStats(long nPlays)=== '''Description:''' Increases the file playcount by nPlays and sets the last played time to now<br> '''Parameters:''' * '''nPlays''': number of times the file was played ===boolean SaveInfoToExternalFile(string strFilename)=== '''Description:''' Save the database information (cover art and fields) for the file to an external file<br> '''Parameters:''' * '''strFilename''': the name of the external file '''Return Value:''' TRUE ===boolean UpdateFromFile(boolean bForce, boolean bOnlyNewFields)=== '''Description:''' Updates the fields from the file<br> '''Parameters:''' * '''bForce''': if true, force the update, otherwise only update if the file has changed * '''bOnlyNewFields''': Only change fields that are new '''Return Value:''' TRUE only if the file was updated ===void UpdateDBLocation(long nAppendDBLocations, long nRemoveDBLocations)=== '''Description:''' Select which portions of the database the file appears in<br> '''Parameters:''' * '''nAppendDBLocations''': Which portions to add the file to. Value is a bitwise OR of ** DB_LOCATION_INVALID ** DB_LOCATION_MAIN ** DB_LOCATION_PLAYING_NOW ** DB_LOCATION_CD ** DB_LOCATION_EXPLORER ** DB_LOCATION_UNASSIGNED ** DB_LOCATION ** DB_LOCATION_FILE_TRANSFER ** DB_LOCATION_HANDHELD ** DB_LOCATION_GROUPING ** DB_LOCATION_REMOVED ** DB_LOCATION_DOWNLOADING ** DB_LOCATION_PODCAST_FEED * '''nRemoveDBLocations''': Which portions to remove the file from, same value as nAppendDBLocations ===boolean SetNoDirty(string strField, string strValue)=== '''Description:''' Change a file's field without marking it as dirty<br> '''Parameters:''' * '''strField''': the field name * '''strValue''': the field value '''Return Value:''' nonzero on success, zero on failure ==Properties== ===string Filename() (read / write)=== '''Description:''' the filename (i.e. "c:\Music\Good Song.mp3")<br> ===string Artist() (read / write)=== '''Description:''' the artist (i.e. "Metallica")<br> ===string Album() (read / write)=== '''Description:''' the album (i.e. "ReLoad")<br> ===string Name() (read / write)=== '''Description:''' the name of the track (i.e. "Unforgiven II")<br> ===number Filesize() (read / write)=== '''Description:''' the filesize in bytes<br> ===number Duration() (read / write)=== '''Description:''' the file duration in seconds<br> ===string Genre() (read / write)=== '''Description:''' the genre (i.e. "Rock")<br> ===number Year() (read / write)=== '''Description:''' the year (i.e. 1997)<br> ===string Comment() (read / write)=== '''Description:''' the comment<br> ===number Bitrate() (read / write)=== '''Description:''' the bitrate (i.e. 128 kbps)<br> ===number Tracknumber() (read / write)=== '''Description:''' the track number (i.e. 4)<br> ===number Filedate() (read / write)=== '''Description:''' the file's date (seconds past 1970)<br> ===string Custom1() (read / write)=== '''Description:''' the MJ-specific "Custom1" field<br> ===string Custom2() (read / write)=== '''Description:''' the MJ-specific "Custom2" field<br> ===string Custom3() (read / write)=== '''Description:''' the MJ-specific "Custom3" field<br> ===number PlayCounter() (read / write)=== '''Description:''' the number of times the track has been played in Media Center<br> ===number LastPlayed() (read / write)=== '''Description:''' the date the file was last played in Media Center (seconds past 1970)<br> ===number Rating() (read / write)=== '''Description:''' the rating (MJ-specific) (note: 0 = ?, otherwise 1-5)<br> ===string Filetype() (read / write)=== '''Description:''' the extension of the file (used by MJ to choose playback plugins, etc.) (i.e. "mp3")<br> ===string Lyrics() (read / write)=== '''Description:''' the lyrics<br> ===string Notes() (read / write)=== '''Description:''' the notes<br> ===string AlbumArtist() (read / write)=== '''Description:''' the album artist (auto) ''(to get the real field value of album artist use: <tt>Get("Album Artist", false)</tt>)''<br> [[Category:COM Automation]]
Summary:
Please note that all contributions to wiki.jriver.com may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Wiki.jriver.com:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Page
Discussion
English
Views
Read
Edit
View history
More
Search
Navigation
Interact Forum
Main Page
User Manual
Community portal
Recent changes
Tools
What links here
Related changes
Special pages
Page information