Skip to content

Commit

Permalink
- Implemented channel logos for the metadata grid in Details
Browse files Browse the repository at this point in the history
  * Self-designed channel logos for all channel configurations will be displayed
  * Two logo variants are available: logo only and text with logo
  * Channel logo options can be found in top menu Options > Details > Metadata grid > Show channel logo
  * Remapped foobar's default channel string output to an improved version
  * Channel metadata is now a default entry in the metadata grid
  • Loading branch information
TT-ReBORN committed Dec 17, 2023
1 parent 6887b81 commit c08ae27
Show file tree
Hide file tree
Showing 47 changed files with 137 additions and 7 deletions.
Binary file modified profile/configuration/foo_ui_columns.dll.cfg
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 6 additions & 1 deletion profile/georgia-reborn/scripts/Base/gr-defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// * Website: https://github.com/TT-ReBORN/Georgia-ReBORN * //
// * Version: 3.0-DEV * //
// * Dev. started: 2017-12-22 * //
// * Last change: 2023-12-15 * //
// * Last change: 2023-12-17 * //
/////////////////////////////////////////////////////////////////////////////


Expand Down Expand Up @@ -1139,6 +1139,8 @@ const themeDetailsDefaults = {
showGridReleaseFlags_artwork: 'logo',
showGridCodecLogo_default: 'logo',
showGridCodecLogo_artwork: 'logo',
showGridChannelLogo_default: 'logo',
showGridChannelLogo_artwork: 'logo',
noDiscArtBg: true,
labelArtOnBg: false
};
Expand Down Expand Up @@ -1175,6 +1177,8 @@ const themeDetailsComments = {
showGridReleaseFlags_artwork: 'Values: false, logo, textlogo - Options > Details > Metadata grid > Show release country flags - when Artwork layout is active',
showGridCodecLogo_default: 'Values: false, logo, textlogo - Options > Details > Metadata grid > Show codec logo - when Default layout is active',
showGridCodecLogo_artwork: 'Values: false, logo, textlogo - Options > Details > Metadata grid > Show codec logo - when Artwork layout is active',
showGridChannelLogo_default: 'Values: false, logo, textlogo - Options > Details > Metadata grid > Show channel logo - when Default layout is active',
showGridChannelLogo_artwork: 'Values: false, logo, textlogo - Options > Details > Metadata grid > Show channel logo - when Artwork layout is active',
noDiscArtBg: 'Values: true, false - Options > Details > Background > Show full background when no disc art',
labelArtOnBg: 'Values: true, false - Options > Details > Background > Show label art on background'
};
Expand Down Expand Up @@ -1211,6 +1215,7 @@ const defaultMetadataGrid = [
{ label: 'Style', val: '[$meta_sep(style, \u00B7 )]' },
{ label: 'Release', val: '[%release%]' },
{ label: 'Codec', val: '[%codec%]' },
{ label: 'Channels', val: '[%channels%]' },
{ label: 'Source', val: '[%codec_profile%$if(%__bitspersample%, \u00B7 )]$if($strcmp(%__encoding%,lossless),%__bitspersample% bit)$ifgreater(%samplerate%,44100,$if($if2(%codec_profile%,%__bitspersample%), \u00B7 )$div(%samplerate%,1000)$replace($insert($right($div(%samplerate%,100),1),.,0),.0,) kHz,)[ \u00B7 $if3(%media%,%mediatype%,%media type%)]' },
{ label: 'Data', val: '%__bitrate% kbps \u00B7 $div(%filesize%,1048576).$num($div($mul($mod(%filesize%,1048576),10),1048576),0) MB' },
{ label: 'Added', val: '[$if2(%added_enhanced%,%added%)]', age: true },
Expand Down
40 changes: 39 additions & 1 deletion profile/georgia-reborn/scripts/Base/gr-main-functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// * Website: https://github.com/TT-ReBORN/Georgia-ReBORN * //
// * Version: 3.0-DEV * //
// * Dev. started: 2017-12-22 * //
// * Last change: 2023-12-16 * //
// * Last change: 2023-12-17 * //
/////////////////////////////////////////////////////////////////////////////


Expand Down Expand Up @@ -3050,6 +3050,44 @@ function loadCodecLogo() {
}


/**
* Loads the channel logo of the now playing track, displayed in the metadata grid in Details.
*/
function loadChannelLogo() {
const channels = $('%channels%');
const type =
(pref.layout === 'default' && pref.showGridChannelLogo_default === 'textlogo' ||
pref.layout === 'artwork' && pref.showGridChannelLogo_artwork === 'textlogo') ? '_text' : '';

const lightBg = new Color(col.detailsText).brightness < 140;
const bw = lightBg ? 'black' : 'white';

paths.channelLogo10Mono = `${imagesPath}channels/10_mono${type}-${bw}.png`;
paths.channelLogo20Stereo = `${imagesPath}channels/20_stereo${type}-${bw}.png`;
paths.channelLogo30Center = `${imagesPath}channels/30_center${type}-${bw}.png`;
paths.channelLogo40Quad = `${imagesPath}channels/40_quad${type}-${bw}.png`;
paths.channelLogo50Surr = `${imagesPath}channels/50_surround${type}-${bw}.png`;
paths.channelLogo51Surr = `${imagesPath}channels/51_surround${type}-${bw}.png`;
paths.channelLogo61Surr = `${imagesPath}channels/61_surround${type}-${bw}.png`;
paths.channelLogo71Surr = `${imagesPath}channels/71_surround${type}-${bw}.png`;
paths.channelLogo91Surr = `${imagesPath}channels/91_surround${type}-${bw}.png`;
paths.channelLogo111Surr = `${imagesPath}channels/111_surround${type}-${bw}.png`;

switch (true) {
case channels === 'mono': channelLogo = gdi.Image(paths.channelLogo10Mono); break;
case channels === 'stereo': channelLogo = gdi.Image(paths.channelLogo20Stereo); break;
case channels === '3ch': channelLogo = gdi.Image(paths.channelLogo30Center); break;
case channels === '4ch': channelLogo = gdi.Image(paths.channelLogo40Quad); break;
case channels === '5ch': channelLogo = gdi.Image(paths.channelLogo50Surr); break;
case channels === '6ch': channelLogo = gdi.Image(paths.channelLogo51Surr); break;
case channels === '7ch': channelLogo = gdi.Image(paths.channelLogo61Surr); break;
case channels === '8ch': channelLogo = gdi.Image(paths.channelLogo71Surr); break;
case channels === '10ch': channelLogo = gdi.Image(paths.channelLogo91Surr); break;
case channels === '12ch': channelLogo = gdi.Image(paths.channelLogo111Surr); break;
}
}


/**
* Loads the release country flags, displayed in the metadata grid in Details.
*/
Expand Down
56 changes: 54 additions & 2 deletions profile/georgia-reborn/scripts/Base/gr-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// * Website: https://github.com/TT-ReBORN/Georgia-ReBORN * //
// * Version: 3.0-DEV * //
// * Dev. started: 2017-12-22 * //
// * Last change: 2023-12-15 * //
// * Last change: 2023-12-17 * //
/////////////////////////////////////////////////////////////////////////////


Expand Down Expand Up @@ -309,6 +309,7 @@ function drawDetailsMetadataGrid(gr) {
const showGridTimeline = pref[`showGridTimeline_${pref.layout}`];
const showGridArtistFlags = pref[`showGridArtistFlags_${pref.layout}`];
const showGridReleaseFlags = pref[`showGridReleaseFlags_${pref.layout}`];
const showGridChannelLogo = pref[`showGridChannelLogo_${pref.layout}`];
const showGridCodecLogo = pref[`showGridCodecLogo_${pref.layout}`];

// * DETAILS METADATA GRID * //
Expand Down Expand Up @@ -461,6 +462,7 @@ function drawDetailsMetadataGrid(gr) {
let showLastFmImage = false;
let showReleaseFlagImage = false;
let showGridCodecLogoImage = false;
let showGridChannelLogoImage = false;
let dropShadow = false;
let grid_val_col = col.detailsText;

Expand Down Expand Up @@ -489,6 +491,45 @@ function drawDetailsMetadataGrid(gr) {
showGridCodecLogoImage = showGridCodecLogo;
break;
}
case 'Channels': {
const channels = $('%channels%');
const textLogo =
pref.layout === 'default' && pref.showGridChannelLogo_default === 'textlogo' ||
pref.layout === 'artwork' && pref.showGridChannelLogo_artwork === 'textlogo';
const noLogo =
pref.layout === 'default' && pref.showGridChannelLogo_default === false ||
pref.layout === 'artwork' && pref.showGridChannelLogo_artwork === false;
const textLogoString = {
'3ch': 'Center',
'4ch': 'Quad',
'5ch': 'Surround',
'6ch': 'Surround',
'7ch': 'Surround',
'8ch': 'Surround',
'10ch': 'Surround',
'12ch': 'Surround'
};
const noLogoString = {
'mono': '1 \u00B7 Mono',
'stereo': '2 \u00B7 Stereo',
'3ch': '3 \u00B7 Center',
'4ch': '4 \u00B7 Quad',
'5ch': '5 \u00B7 Surround',
'6ch': '6 \u00B7 Surround',
'7ch': '7 \u00B7 Surround',
'8ch': '8 \u00B7 Surround',
'10ch': '10 \u00B7 Surround',
'12ch': '12 \u00B7 Surround'
};
// * Remap foobar's org. channel strings
if (textLogo && textLogoString[channels]) {
value = textLogoString[channels];
} else if (noLogo && noLogoString[channels]) {
value = noLogoString[channels];
}
showGridChannelLogoImage = showGridChannelLogo;
break;
}
default:
break;
}
Expand All @@ -500,8 +541,10 @@ function drawDetailsMetadataGrid(gr) {
const valFontSize = pref[`gridValueFontSize_${pref.layout}`] + SCALE(1);
const showReleaseFlagOnly = pref[`showGridReleaseFlags_${pref.layout}`] === 'logo';
const showCodecLogoOnly = pref[`showGridCodecLogo_${pref.layout}`] === 'logo';
const showChannelLogoOnly = pref[`showGridChannelLogo_${pref.layout}`] === 'logo';
const flag = showReleaseFlagOnly && key === 'Rel. Country';
const codec = showCodecLogoOnly && key === 'Codec';
const channels = showChannelLogoOnly && key === 'Channels';
const ratingLinux = detectWine && key === 'Rating';

// * Apply better anti-aliasing on smaller font sizes in HD res
Expand All @@ -514,7 +557,7 @@ function drawDetailsMetadataGrid(gr) {
gr.DrawString(value, grid_val_ft, col.darkAccent_50, Math.round(col2Left - borderWidth), Math.round(gridTop - borderWidth), col2Width + (ratingLinux ? SCALE(20) : 0), cellHeight, StringFormat(0, 0, 4));
}
gr.DrawString(key, grid_key_ft, col.detailsText, marginLeft, Math.round(gridTop), col1Width, cellHeight, g_string_format.trim_ellipsis_char);
gr.DrawString(flag || codec ? '' : value, grid_val_ft, grid_val_col, col2Left, Math.round(gridTop), col2Width + (ratingLinux ? SCALE(20) : 0), cellHeight, StringFormat(0, 0, 4));
gr.DrawString(flag || codec || channels ? '' : value, grid_val_ft, grid_val_col, col2Left, Math.round(gridTop), col2Width + (ratingLinux ? SCALE(20) : 0), cellHeight, StringFormat(0, 0, 4));

// * Last.fm logo
if (playCountVerifiedByLastFm && showLastFmImage) {
Expand Down Expand Up @@ -546,6 +589,15 @@ function drawDetailsMetadataGrid(gr) {
Math.round(codecLogo.Width * heightRatio), cellHeight - 4, 0, 0, codecLogo.Width, codecLogo.Height);
}
}
// * Channel logo
if (showGridChannelLogoImage) {
loadChannelLogo();
const heightRatio = channelLogo != null ? (cellHeight - 4) / channelLogo.Height : '';
if (channelLogo != null && (!showChannelLogoOnly ? txtRec.Width + SCALE(8) : 0) + Math.round(channelLogo.Width * heightRatio) < col2Width) {
gr.DrawImage(channelLogo, showChannelLogoOnly && key === 'Channels' ? col2Left : col2Left + txtRec.Width + SCALE(8), gridTop - 1,
Math.round(channelLogo.Width * heightRatio), cellHeight - 4, 0, 0, channelLogo.Width, channelLogo.Height);
}
}
gridTop += cellHeight + 5;
}
}
Expand Down
14 changes: 13 additions & 1 deletion profile/georgia-reborn/scripts/Base/gr-menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// * Website: https://github.com/TT-ReBORN/Georgia-ReBORN * //
// * Version: 3.0-DEV * //
// * Dev. started: 2017-12-22 * //
// * Last change: 2023-12-15 * //
// * Last change: 2023-12-17 * //
/////////////////////////////////////////////////////////////////////////////


Expand Down Expand Up @@ -2303,6 +2303,18 @@ function detailsOptions(menu, context_menu) {
});
detailsShowCodecLogoMenu.appendTo(detailsMetadataGridMenu);

// * SHOW CHANNEL LOGO IN DETAILS * //
const detailsShowChannelLogoMenu = new Menu('Show channel logo');
detailsShowChannelLogoMenu.createRadioSubMenu('Default', ['Disabled', 'Logo', 'Text + Logo'], pref.showGridChannelLogo_default, [false, 'logo', 'textlogo'], type => {
pref.showGridChannelLogo_default = type;
repaintWindow();
});
detailsShowChannelLogoMenu.createRadioSubMenu('Artwork', ['Disabled', 'Logo', 'Text + Logo'], pref.showGridChannelLogo_artwork, [false, 'logo', 'textlogo'], type => {
pref.showGridChannelLogo_artwork = type;
repaintWindow();
});
detailsShowChannelLogoMenu.appendTo(detailsMetadataGridMenu);

// * EDIT METADATA GRID IN DETAILS * //
if (fb.IsPlaying) {
detailsMetadataGridMenu.addSeparator();
Expand Down
23 changes: 22 additions & 1 deletion profile/georgia-reborn/scripts/Base/gr-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// * Website: https://github.com/TT-ReBORN/Georgia-ReBORN * //
// * Version: 3.0-DEV * //
// * Dev. started: 2017-12-22 * //
// * Last change: 2023-12-15 * //
// * Last change: 2023-12-17 * //
/////////////////////////////////////////////////////////////////////////////


Expand Down Expand Up @@ -512,6 +512,8 @@ pref.add_properties({
showGridReleaseFlags_artwork: ['Georgia-ReBORN - 11. Details: Show release country flags (Artwork)', 'logo'], // true: Show the release country flags in the metadata grid in Artwork layout
showGridCodecLogo_default: ['Georgia-ReBORN - 11. Details: Show codec logo (Default)', 'logo'], // true: Show the codec logo in the metadata grid in Default layout
showGridCodecLogo_artwork: ['Georgia-ReBORN - 11. Details: Show codec logo (Artwork)', 'logo'], // true: Show the codec logo in the metadata grid in Artwork layout
showGridChannelLogo_default: ['Georgia-ReBORN - 11. Details: Show channel logo (Default)', 'logo'], // true: Show the channel logo in the metadata grid in Default layout
showGridChannelLogo_artwork: ['Georgia-ReBORN - 11. Details: Show channel logo (Artwork)', 'logo'], // true: Show the channel logo in the metadata grid in Artwork layout
noDiscArtBg: ['Georgia-ReBORN - 11. Details: Show full background when no disc art', true], // Fill background when no disc art is available
labelArtOnBg: ['Georgia-ReBORN - 11. Details: Draw label art on background', false], // true: Don't show the theme color background behind label art

Expand Down Expand Up @@ -1406,6 +1408,8 @@ async function setThemeSettings(save) {
themeDetails.showGridReleaseFlags_artwork = pref.showGridReleaseFlags_artwork;
themeDetails.showGridCodecLogo_default = pref.showGridCodecLogo_default;
themeDetails.showGridCodecLogo_artwork = pref.showGridCodecLogo_artwork;
themeDetails.showGridChannelLogo_default = pref.showGridChannelLogo_default;
themeDetails.showGridChannelLogo_artwork = pref.showGridChannelLogo_artwork;
themeDetails.noDiscArtBg = pref.noDiscArtBg;
themeDetails.labelArtOnBg = pref.labelArtOnBg;
} else {
Expand Down Expand Up @@ -1439,6 +1443,8 @@ async function setThemeSettings(save) {
pref.showGridReleaseFlags_artwork = custom ? themeDetails.showGridReleaseFlags_artwork : 'logo';
pref.showGridCodecLogo_default = custom ? themeDetails.showGridCodecLogo_default : 'logo';
pref.showGridCodecLogo_artwork = custom ? themeDetails.showGridCodecLogo_artwork : 'logo';
pref.showGridChannelLogo_default = custom ? themeDetails.showGridChannelLogo_default : 'logo';
pref.showGridChannelLogo_artwork = custom ? themeDetails.showGridChannelLogo_artwork : 'logo';
pref.noDiscArtBg = custom ? themeDetails.noDiscArtBg : true;
pref.labelArtOnBg = custom ? themeDetails.labelArtOnBg : false;
}
Expand Down Expand Up @@ -2147,6 +2153,15 @@ function migrateCheck(version, storedVersion) {
});
};

/**
* Checks if specific entry exist in the metadata grid configuration.
* @param {MetadataGridEntry[]} grid Each element in the array is an object with a `label` property.
* @param {...string} labels The labels of the settings to check.
* @returns {boolean} Returns true if all specified labels exist, otherwise false.
*/
const CheckGridEntry = (grid, ...labels) =>
labels.every(label => grid.some(gridEntry => gridEntry.label.toLowerCase() === label.toLowerCase()));

/**
* Renames an entry in the metadata grid with a new label name.
* @param {MetadataGridEntry[]} grid Each element in the array is an object with a `label` property.
Expand Down Expand Up @@ -2191,6 +2206,12 @@ function migrateCheck(version, storedVersion) {
config.addConfigurationObject(settingsSchema, settingsDefaults, settingsComments);
config.writeConfiguration(configFile.settings);
}
if (!CheckGridEntry(configFile.metadataGrid, 'Channels')) {
fso.CopyFile(configPath, fb.ProfilePath + fileName);
config.addConfigurationObject(gridSchema, defaultMetadataGrid);
config.writeConfiguration();
window.Reload(); // Reinit new config
}

// * Update config settings which have changed since last update
if (version !== storedVersion) {
Expand Down
4 changes: 3 additions & 1 deletion profile/georgia-reborn/scripts/Base/gr-setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// * Website: https://github.com/TT-ReBORN/Georgia-ReBORN * //
// * Version: 3.0-DEV * //
// * Dev. started: 2017-12-22 * //
// * Last change: 2023-12-15 * //
// * Last change: 2023-12-17 * //
/////////////////////////////////////////////////////////////////////////////


Expand Down Expand Up @@ -631,6 +631,8 @@ let flagImgs = [];
let releaseFlagImg = null;
/** @type {GdiBitmap} The codec logo image shown in the metadata grid in Details. */
let codecLogo = null;
/** @type {GdiBitmap} The channel logo image shown in the metadata grid in Details. */
let channelLogo = null;
/** @type {GdiBitmap} The Hi-Res Audio badge logo image shown on album art when enabled. */
let hiResAudioImg = null;
/** @type {boolean} The last.fm logo image displayed when we %lastfm_play_count% > 0, shown in the metadata grid in Details. */
Expand Down

0 comments on commit c08ae27

Please sign in to comment.