Media item class

Track

Hierarchy (view full)

Constructors

Properties

Methods

Events

Constructors

Properties

actor: string

Undocumented

actors: string

Gets/sets actors.

album: string

Gets/sets album.

albumArtist: string

Gets/sets albumArtist.

allAddonsReaded: boolean

Undocumented

artist: string

Gets/sets artist.

artworkModified_UTC: number

Undocumented

asJSON: string

Gets the object as serialized JSON string. Or sets serialized JSON (to fill this object's metadata by the metadata included within the JSON)

author: string

Gets/sets author aka composer.

autoTagState: number

Undocumented

bitrate: number

Gets/sets bitrate.

bpm: number

Gets/sets BPM (beats per minute).

bps: number

Undocumented

cacheStatus: number

Undocumented

commentShort: string

Gets shortened version of the track comment, max 200 characters, shortened with ellipses. Read-only. To get/set the full comment, use getCommentAsync and setCommentAsync.

composer: string

Gets/sets author aka composer.

conductor: string

Gets/sets conductor.

copyright: string

Undocumented

coverList: CoverList

Undocumented

cuePath: string

Undocumented

custom1: string

Gets/sets custom1 field.

custom10: string

Gets/sets custom10 field.

custom2: string

Gets/sets custom2 field.

custom3: string

Gets/sets custom3 field.

custom4: string

Gets/sets custom4 field.

custom5: string

Gets/sets custom5 field.

custom6: string

Gets/sets custom6 field.

custom7: string

Gets/sets custom7 field.

custom8: string

Gets/sets custom8 field.

custom9: string

Gets/sets custom9 field.

date: number

Gets/sets date.

  • The first 4 digits are the year, the next 2 are the month, and the next 2 are the day. For example: 20110000 is the year 2011 without a month and day, and 20110410 is April 4, 2011.
  • -1 is considered an empty date. -2 is allowed as a special value for grouping tracks, but all other negative numbers are changed to -1.

Setting date automatically updates year, month, and day.

dateAdded: number

Gets/sets dateAdded DateTime property (when the file has been added to library).

Use e.g.

track.dateAdded = app.utils.timestamp2DateTime( 'YYYY-MM-DD HH:MM:SS' );

or

track.dateAdded = app.utils.timestamp2DateTime( new Date().toISOString());

or

track.dateAdded = new Date();
dateAdded_UTC: number

Gets/sets dateAdded DateTime property (when the file has been added to library).

Use e.g.

track.dateAdded_UTC = app.utils.timestamp2DateTime( 'YYYY-MM-DD HH:MM:SS' );

or

track.dateAdded_UTC = app.utils.timestamp2DateTime( new Date().toISOString());

or

track.dateAdded_UTC = new Date();
day: number

Gets/sets day. Automatically updated by date.

deleted: boolean

Set to true after deletion so that 'change' event is called and item is removed from UI lists.

dimensions: string

Undocumented

director: string

Undocumented

dirtyModified: boolean

Undocumented

discNumber: string

Gets/sets discNumber.

discNumberInt: number

Undocumented

dontNotify: boolean

Undocumented

encoder: string

Undocumented

episodeNumber: string

Gets/sets episode number.

extendedTagsShort: string

Read-only shortened version of extendedTags, as JSON. To get the full tags, use getExtendedTagsAsync()

fileLength: number

Gets/sets fileLength in bytes.

fileModified: number

Gets/sets fileModified DateTime property.

Use e.g.

track.fileModified = app.utils.timestamp2DateTime( 'YYYY-MM-DD HH:MM:SS' );

or

track.fileModified_UTC = app.utils.timestamp2DateTime( new Date().toISOString());
fileModified_UTC: number

Gets/sets fileModified DateTime property.

Use e.g.

track.fileModified = app.utils.timestamp2DateTime( 'YYYY-MM-DD HH:MM:SS' );

or

track.fileModified_UTC = app.utils.timestamp2DateTime( new Date().toISOString());
fileType: string

Undocumented

filename: string

Undocumented

frameRate: number

Undocumented

frameRateStr: string

Undocumented

frequency: number

Gets/sets frequency/Sample rate in hz.

genre: string

Gets/sets genre.

groupDesc: string

Gets/sets grouping.

height: number

Undocumented

id: number

Gets integer id of the object

idColl: number

Undocumented

idMedia: number

Undocumented

idPlaylistSong: number

Undocumented

idalbum: number

Undocumented

idsong: number

Gets/sets ID as is in database (Songs.ID).

initialKey: string

Undocumented

involvedPeople: string

Gets/sets involvedPeople.

isObservable: boolean

Whether this object can be listened (e.g. for 'change' event)

isPlaying: boolean

Gets whether this media is currently playing

isStatusBarSource: boolean

Is source for status bar informations.

isVideo: boolean

Gets whether this media item is video

isYoutubeVideo: boolean

Undocumented

isntInDB: boolean

Undocumented

isrc: string

Undocumented

language: string

Undocumented

lastTimePlayed: number

Gets/sets lastTimePlayed DateTime property (when the file has been last time played).

Use e.g.

track.lastTimePlayed = app.utils.timestamp2DateTime( 'YYYY-MM-DD HH:MM:SS' );

or

track.lastTimePlayed_UTC = app.utils.timestamp2DateTime( new Date().toISOString());
lastTimePlayed_UTC: number

Gets/sets lastTimePlayed DateTime property (when the file has been last time played).

Use e.g.

track.lastTimePlayed = app.utils.timestamp2DateTime( 'YYYY-MM-DD HH:MM:SS' );

or

track.lastTimePlayed_UTC = app.utils.timestamp2DateTime( new Date().toISOString());
lastTimeSkipped: number

Gets/sets lastTimeSkipped DateTime property (when the file has been last time skipped).

Use e.g.

track.lastTimeSkipped = app.utils.timestamp2DateTime( 'YYYY-MM-DD HH:MM:SS' );

or

track.lastTimeSkipped_UTC = app.utils.timestamp2DateTime( new Date().toISOString());
lastTimeSkipped_UTC: number

Gets/sets lastTimePlayed DateTime property (when the file has been last time played).

Use e.g.

track.lastTimeSkipped = app.utils.timestamp2DateTime( 'YYYY-MM-DD HH:MM:SS' );

or

track.lastTimeSkipped_UTC = app.utils.timestamp2DateTime( new Date().toISOString());
listsModif: boolean

Undocumented

longTextLoaded: boolean

Undocumented

lyricist: string

Gets/sets lyricist.

lyricsSearched: boolean

Undocumented

lyricsShort: string

Undocumented

maxSample: number

Undocumented

mediaLabel: string

Undocumented

mediaSN: number

Undocumented

mimeType: string

Undocumented

modified: boolean

Undocumented

month: number

Gets/sets month. Automatically updated by date.

mood: string

Gets/sets mood.

needsDBReload: boolean

Set to true once some changes in DB were made externally (to refresh the data)

newlyScanned: boolean

Undocumented

normalizeAlbum: number

Undocumented

normalizeTrack: number

Undocumented

objectType: string

Gets the object type as string

occasion: string

Gets/sets occasion.

organizedPath: string

Undocumented

origArtist: string

Gets/sets original artist.

origDate: number

Gets/sets original date.

  • When read, the first 4 digits are the year, the next 2 are the month, and the next 2 are the day. For example: 20110000 is the year 2011 without a month and day, and 20110410 is April 4, 2011.
  • -1 is considered an empty date. -2 is allowed as a special value for grouping tracks, but all other negative numbers are changed to -1.

Setting origDate automatically updates origYear, origMonth, and origDay.

origDay: number

Gets/sets original day. Automatically updated by origDate.

origLyricist: string

Undocumented

origMonth: number

Gets/sets original month. Automatically updated by origDate.

origTitle: string

Gets/sets original album title.

origYear: number

Gets/sets original year. Automatically updated by origDate.

originalPath: string

Undocumented

parentalRating: string

Undocumented

path: string

Gets/sets file path.

percentPlayed: number

Undocumented

persistentID: string

Gets persistent id of the object

playCounter: number

Gets/sets played #.

playLength: number

gets true playLength in milliseconds (startTime / stopTime taken into account)

playbackPos: number

Undocumented

playlistSongOrder: number

Undocumented

producer: string

Gets/sets producer.

publisher: string

Gets/sets publisher.

quality: string

Gets/sets quality.

rating: number

Gets/sets rating.

  • Any integer is allowed, but only -1 to 100 have significance.
  • The number of stars is equal to the rating divided by 20. -1 is an empty/unknown rating, 0 is 0 stars (or a "bomb"), 50 is 2.5 stars, and 100 is 5 stars.
seasonNumber: string

Gets/sets season number.

seekable: boolean

Undocumented

skipCount: number

Gets/sets skipped #.

songLength: number

Gets/sets songLength in milliseconds.

startTime: number

Gets/sets startTime in milliseconds.

statusInfo: Promise<any>

Undocumented

stereo: number

Undocumented

stopTime: number

Gets/sets stopTime in milliseconds.

subtitle: string

Undocumented

summary: string

Gets/sets summary.

supportPin: boolean

Whether object support pin to pinned list

sync_id: string

Undocumented

tempo: string

Gets/sets tempo.

temporaryOrder: number

Undocumented

title: string

Gets/sets title of this media item.

trackModified: number

Undocumented

trackModified_UTC: number

Undocumented

trackNumber: string

Gets/sets track number.

trackNumberInt: number

Undocumented

trackType: TrackType

Undocumented

trackTypeStr: string

Undocumented

trackTypeStringId: string

Undocumented

vbr: boolean

Undocumented

volumeLeveling: number

Undocumented

webSource: string

Undocumented

width: number

Undocumented

year: number

Gets/sets year. Automatically updated by date.

Methods

  • Adds new cover for this track

    Parameters

    • filename: string

      full path to the image file

    Returns Promise<any>

  • Adds metadata from another track. Does not override values, i.e. assigns only fields that are currently empty

    Parameters

    Returns void

  • Add new external list associated with object.

    Parameters

    • linkType: string

      Type of a link

    • linkInfo: string

      Link information (like release or releaseGroup for musicbrainz link)

    • link: string

      Link string

    Returns Promise<any>

  • Parameters

    Returns Promise<any>

    Undocumented

  • Assigns metadata from another track

    Parameters

    Returns void

  • Lock object to update state. Events are not called when in update state.

    Returns void

  • Updates the object every X ms when called periodically. Useful e.g. when filling lists. Can be used only in the update lock! (i.e. between beginUpdate/endUpdate)

    Parameters

    • interval: number

    Returns void

  • Saves this track into database (and tag -- based on user's settings)

    Promise is fulfilled when action is completed.

    Parameters

    • Optional params: {
          forceSaveToDB?: boolean;
          tagModified?: boolean;
      }
      • Optional forceSaveToDB?: boolean

        if true, then also the new files (not in db yet) are saved, default = false

      • Optional tagModified?: boolean

        if false, the metadata is not written to the file tag, default = true

    Returns Promise<void>

  • Parameters

    Returns Promise<any>

    Undocumented

  • Unlock object from update state. beginUpdate and endUpdate must be in pair. When endUpdate is called, change event is called.

    Returns boolean

  • Get track additional informations (like webArtist, webCopyright etc)

    Returns Promise<any>

  • Returns album class

    Returns Promise<any>

  • Parameters

    • Rest ...params: any[]

    Returns Promise<any>

    Undocumented

  • Parameters

    • dimX: number
    • dimY: number

    Returns string

    Undocumented

  • Returns boolean

    Undocumented

  • Gets class name of the object.

    Returns string

  • Gets full comment field asynchronously. The full lyrics, comment, and extendedTags are not loaded in memory until needed to improve memory usage and performance.

    commentShort is synchronous but only returns up to the first 200 characters.

    track.getCommentAsync().then(function (comment) {
    // ...
    })

    // or, inside an async function:
    let comment = await track.getCommentAsync();

    Returns Promise<string>

  • Returns string

    Deprecated

    Use getCommentAsync instead.

  • Gets full extendedTags field asynchronously. The full lyrics, comment, and extendedTags are not loaded in memory until needed to improve memory usage and performance.

    extendedTagsShort is synchronous but only returns up to the first 200 characters.

    track.getExtendedTagsAsync().then(function (extendedTags) {
    // ...
    })

    // or, inside an async function:
    let extendedTags = await track.getExtendedTagsAsync();

    Returns Promise<string>

  • Returns Cover

    Undocumented

  • Parameters

    • DimX: number
    • DimY: number

    Returns string

    Undocumented

  • Returns boolean

    Undocumented

  • Get external link associated with the object. All link identifiers are (updated list is available in consts.js) : var LINK_MUSICBRAINZ = 'musicbrainz', LINK_ACOUSTID = 'acoustid', LINK_TVDB = 'tvdb', LINK_MAZE = 'maze', LINK_IMDB = 'imdb', LINK_WIKI = 'wiki', LINK_ECHOPRINT = 'echoprint', LINK_MOVIEDB = 'moviedb', LINK_DISCOGS = 'discogs';

    Parameters

    • Rest ...params: any[]

    Returns ExternalLinksList

  • Gets full lyrics field asynchronously. The full lyrics, comment, and extendedTags are not loaded in memory until needed to improve memory usage and performance.

    lyricsShort is synchronous but only returns up to the first 200 characters.

    track.getLyricsAsync().then(function (lyrics) {
    // ...
    })

    // or, inside an async function:
    let lyrics = await track.getLyricsAsync();

    Returns Promise<string>

  • Returns string

    Deprecated

    Use getLyricsAsync instead.

  • Parameters

    • ruleType: string

    Returns boolean

    Undocumented

  • Gets temporary copy of this track (track has same data, but isn't updated across UI or in DB etc.).

    Parameters

    • Rest ...params: any[]

    Returns Track

  • Returns link to cached image thumbnail of the nearest specified size

    Parameters

    • Rest ...params: any[]

    Returns number

  • Parameters

    • Rest ...params: any[]

    Returns Promise<any>

    Undocumented

  • Returns Promise<any>

    Undocumented

  • Adds new cover for this track

    Parameters

    • filename: string

      full path to the image file

    • position: number

    Returns Promise<any>

  • To check whether the file is accessible

    Returns Promise<any>

  • Parameters

    • column: string

    Returns boolean

    Undocumented

  • Parameters

    • id: number

    Returns boolean

    Undocumented

  • Object is pinned in pinned list

    Returns Promise<any>

  • Parameters

    Returns boolean

    Undocumented

  • Parameters

    Returns number

    Undocumented

  • Parameters

    • groupName: string

    Returns string

    Undocumented

  • Parameters

    • keepPictureDataLoaded: boolean
    • useDatabaseOnly: boolean

    Returns CoverList

    Undocumented

  • Loads cover list for this track

    Parameters

    • Rest ...params: any[]

    Returns CoverList

  • Call defined method with locked data so user can access them.

    Parameters

    • func: (() => any)

      Method to call

        • (): any
        • Returns any

    Returns void

  • Parameters

    • Rest ...params: any[]

    Returns number

    Undocumented

  • Notifies that the object was changed (e.g. to force visual update etc.)

    Parameters

    • Rest ...params: any[]

    Returns void

  • Returns void

    Undocumented

  • Remove external link from object.

    Parameters

    • Rest ...params: any[]

    Returns Promise<any>

  • Returns void

    Undocumented

  • Sets the comment field asynchronously.

    track.setCommentAsync(myComment).then(function () {
    // ...
    })

    // or, inside an async function:
    await track.setCommentAsync(myComment);

    Parameters

    • value: string

    Returns Promise<void>

  • Parameters

    Returns void

    Undocumented

  • Sets the extendedTags field asynchronously. Must be in a JSON-formatted string.

    track.setExtendedTagsAsync(myTagsJSON).then(function () {
    // ...
    })

    // or, inside an async function:
    await track.setExtendedTagsAsync(myTagsJSON);

    Parameters

    • value: string

    Returns Promise<void>

  • Sets the lyrics field asynchronously.

    track.setLyricsAsync(myLyrics).then(function () {
    // ...
    })

    // or, inside an async function:
    await track.setLyricsAsync(myLyrics);

    Parameters

    • Rest ...params: any[]

    Returns Promise<void>

  • Parameters

    • id: number
    • value: boolean

    Returns void

    Undocumented

  • Set object is pinned in pinned list.

    Parameters

    • pinned: boolean

      Object is pinned

    • collID: number

      ID of collection where object is pinned

    Returns void

  • Returns string

    Undocumented

  • Returns void

    Undocumented

  • Returns void

    Undocumented

Events

event_change: ((changeType, ...additionalArgs) => void)

Event is called when object is somehow changed

See App.listen

Type declaration

    • (changeType, ...additionalArgs): void
    • Parameters

      • changeType: string

        additional change type (can have values like 'tracklist', 'deleted', 'title' or undefined)

      • Rest ...additionalArgs: any[]

      Returns void

Example

app.listen(object, 'change', (changeType) => {  });
event_destroying: (() => void)

Event is called when object is going to destroy

See App.listen

Type declaration

    • (): void
    • Returns void

event_statuschange: (() => void)

Event is called when status info of the object is changed

See App.listen

Type declaration

    • (): void
    • Returns void