IMetadbHandle
This will be used in the examples below:
var handle = fb.GetFocusItem();
Note
In real world code, you should alaways check the return
values from methods like fb.GetFocusItem and
fb.GetNowPlaying are not null
.
Properties
Requires foobar2000 2.0 . |
FileCreated | number |
read | The number of seconds since 00:00:00 Thursday, 1 January 1970 UTC. |
FileSize | number |
read | ||
LastModified | number |
read | The number of seconds since 00:00:00 Thursday, 1 January 1970 UTC. | |
Length | number |
read | ||
Path | string |
read | ||
RawPath | string |
read | ||
SubSong | number |
read |
Example
console.log(handle.Path); // D:\SomeSong.flac
console.log(handle.RawPath); // file://D:\SomeSong.flac
console.log(handle.FileCreated); // 1659753717
console.log(utils.TimestampToDateString(handle.FileCreated)); // 2022-08-06 03:41:57
Methods
Compare(handle)
#
Arguments | ||
---|---|---|
handle | IMetadbHandle |
Returns a boolean
value.
Example
if (handle.Compare(handle2)) {
// do something
}
Dispose()
#
No return value.
GetAlbumArt([art_id, want_stub])
#
Arguments | ||
---|---|---|
art_id | AlbumArtId | Default 0 . |
want_stub | boolean |
Default true . |
Returns an IJSImage instance or null
on failure.
Note
This method can return album art from certain radio streams
if the requested type is Front
. Use on_playback_dynamic_info_track
to get notified of stream artwork changes.
Example
var image = handle.GetAlbumArt();
if (image != null) {
// The path is now a property of the image.
console.log(image.Path);
}
GetAlbumArtAsync(window_id[, art_id, want_stub])
#
Arguments | ||
---|---|---|
window_id | window.ID | |
art_id | AlbumArtId | Default 0 . |
want_stub | boolean |
Default true . |
Use in conjunction with on_get_album_art_done.
GetAlbumArtEmbedded([art_id])
#
Arguments | ||
---|---|---|
art_id | AlbumArtId | Default 0 . |
Returns an IJSimage instance or null
on failure.
GetFileInfo([full_info])
#
Arguments | ||
---|---|---|
full_info | boolean |
Default false . Ignored if running foobar2000 2.0 . |
Returns an IFileInfo instance.
When using foobar2000 1.x
and full_info
you can retrieve over-sized
tags like LYRICS
which are usually hidden with the period character for
performance reasons. full_info
is ignored on foobar2000
2.0
because
it returns over-sized tags by default.
IsInLibrary()
#
Returns a boolean
value.
ShowAlbumArtViewer([art_id, want_stub])
#
Arguments | ||
---|---|---|
art_id | AlbumArtId | Default 0 . |
want_stub | boolean |
Default true . |
No return value.