Plugin 1.2.0: Taste 'Gefaellt mir nicht', Fortschrittsbalken auf 'Aktueller Titel'
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -46,6 +46,10 @@
|
||||
"Name": "Gefällt mir",
|
||||
"Tooltip": "Aktuellen Titel mit „Gefällt mir“ markieren"
|
||||
},
|
||||
"com.fojadrachi.playtube.dislike": {
|
||||
"Name": "Gefällt mir nicht",
|
||||
"Tooltip": "Aktuellen Titel mit „Gefällt mir nicht“ markieren"
|
||||
},
|
||||
"com.fojadrachi.playtube.shuffle": {
|
||||
"Name": "Zufallswiedergabe",
|
||||
"Tooltip": "Zufallswiedergabe umschalten"
|
||||
|
||||
@@ -46,6 +46,10 @@
|
||||
"Name": "Like",
|
||||
"Tooltip": "Like the current track"
|
||||
},
|
||||
"com.fojadrachi.playtube.dislike": {
|
||||
"Name": "Dislike",
|
||||
"Tooltip": "Dislike the current track"
|
||||
},
|
||||
"com.fojadrachi.playtube.shuffle": {
|
||||
"Name": "Shuffle",
|
||||
"Tooltip": "Toggle shuffle"
|
||||
|
||||
@@ -285,6 +285,37 @@
|
||||
"UUID": "com.fojadrachi.playtube.like",
|
||||
"PropertyInspectorPath": "propertyInspector/index.html"
|
||||
},
|
||||
{
|
||||
"Icon": "static/icon/[email protected]",
|
||||
"Name": "Dislike",
|
||||
"DisableAutomaticStates": true,
|
||||
"States": [
|
||||
{
|
||||
"Image": "static/btn/dislike_0.png",
|
||||
"TitleAlignment": "bottom",
|
||||
"FontSize": "11",
|
||||
"FontStyle": "Bold",
|
||||
"TitleColor": "#ffffff"
|
||||
},
|
||||
{
|
||||
"Image": "static/btn/dislike_1.png",
|
||||
"TitleAlignment": "bottom",
|
||||
"FontSize": "11",
|
||||
"FontStyle": "Bold",
|
||||
"TitleColor": "#ffffff"
|
||||
}
|
||||
],
|
||||
"Settings": {},
|
||||
"Controllers": [
|
||||
"Keypad",
|
||||
"Information"
|
||||
],
|
||||
"UserTitleEnabled": false,
|
||||
"SupportedInMultiActions": true,
|
||||
"Tooltip": "Dislike the current track",
|
||||
"UUID": "com.fojadrachi.playtube.dislike",
|
||||
"PropertyInspectorPath": "propertyInspector/index.html"
|
||||
},
|
||||
{
|
||||
"Icon": "static/icon/[email protected]",
|
||||
"Name": "Shuffle",
|
||||
@@ -428,7 +459,7 @@
|
||||
"Description": "Control Playtube (YouTube / YouTube Music) from your Stream Dock",
|
||||
"Category": "Playtube",
|
||||
"CategoryIcon": "static/icon/[email protected]",
|
||||
"Version": "1.1.0",
|
||||
"Version": "1.2.0",
|
||||
"OS": [
|
||||
{
|
||||
"Platform": "windows",
|
||||
|
||||
@@ -4030,8 +4030,10 @@ var require_actions = __commonJS({
|
||||
playlistTitle: "",
|
||||
playlistCover: "",
|
||||
// Cover-Adresse, von Playtube geholt (Befehl "playlist_cover")
|
||||
playlistCoverId: ""
|
||||
playlistCoverId: "",
|
||||
// zu welcher Playlist das gespeicherte Cover gehoert
|
||||
showProgress: true
|
||||
// "Aktueller Titel": Fortschrittsbalken ueber dem Cover
|
||||
});
|
||||
var TARGETS = ["auto", "youtube", "music"];
|
||||
var TABS = ["toggle", "youtube", "music"];
|
||||
@@ -4049,6 +4051,8 @@ var require_actions = __commonJS({
|
||||
settings.seconds = clampInt(settings.seconds, 1, 300, DEFAULTS.seconds);
|
||||
const show = raw && raw.showTitle !== void 0 ? raw.showTitle : titleDefault;
|
||||
settings.showTitle = show === true || show === "true";
|
||||
const progress = raw && raw.showProgress !== void 0 ? raw.showProgress : DEFAULTS.showProgress;
|
||||
settings.showProgress = progress === true || progress === "true";
|
||||
settings.playlistId = typeof settings.playlistId === "string" ? settings.playlistId.trim() : "";
|
||||
settings.playlistTitle = typeof settings.playlistTitle === "string" ? settings.playlistTitle : "";
|
||||
const cover = typeof settings.playlistCover === "string" ? settings.playlistCover : "";
|
||||
@@ -4153,9 +4157,13 @@ var require_actions = __commonJS({
|
||||
if (!connected) return { coverUrl: null, title: s.showTitle ? OFFLINE_TITLE : "" };
|
||||
const tab = pickTab(state, s.target);
|
||||
const info = tab && tab.info;
|
||||
const duration = info && Number(info.duration);
|
||||
const current = info && Number(info.currentTime);
|
||||
return {
|
||||
coverUrl: info && info.hasVideo && info.thumbnail ? info.thumbnail : null,
|
||||
title: s.showTitle && info && info.title ? wrapTitle(info.title) : ""
|
||||
title: s.showTitle && info && info.title ? wrapTitle(info.title) : "",
|
||||
// Anteil 0..1 (auf Prozent gerundet, damit nicht jede Sekunde ein neues Bild noetig ist).
|
||||
progress: s.showProgress && duration > 0 && Number.isFinite(current) ? Math.round(Math.max(0, Math.min(1, current / duration)) * 100) / 100 : null
|
||||
};
|
||||
}
|
||||
},
|
||||
@@ -4166,6 +4174,13 @@ var require_actions = __commonJS({
|
||||
return { state: tab && tab.info.likeStatus === "like" ? 1 : 0 };
|
||||
}
|
||||
},
|
||||
dislike: {
|
||||
request: (s) => ({ cmd: "dislike", fields: { target: s.target } }),
|
||||
render: (s, state, connected) => {
|
||||
const tab = connected ? pickTab(state, s.target) : null;
|
||||
return { state: tab && tab.info.likeStatus === "dislike" ? 1 : 0 };
|
||||
}
|
||||
},
|
||||
shuffle: { request: (s) => ({ cmd: "shuffle", fields: { target: s.target } }) },
|
||||
repeat: {
|
||||
request: (s) => ({ cmd: "repeat", fields: { target: s.target } }),
|
||||
@@ -4300,10 +4315,14 @@ var require_infoPanel = __commonJS({
|
||||
parts.push(`<rect x="${BAR_X}" y="${BAR_Y}" width="${(BAR_WIDTH * ratio).toFixed(1)}" height="${BAR_HEIGHT}" rx="3" fill="${ACCENT}"/>`);
|
||||
return `${head}${parts.join("")}</svg>`;
|
||||
}
|
||||
function buildCoverProgressSvg(coverDataUri, ratio) {
|
||||
const clamped = Math.max(0, Math.min(1, Number(ratio) || 0));
|
||||
return `<svg xmlns="http://www.w3.org/2000/svg" width="${SIZE}" height="${SIZE}" viewBox="0 0 ${SIZE} ${SIZE}"><rect width="${SIZE}" height="${SIZE}" fill="${BACKGROUND}"/><image x="0" y="0" width="${SIZE}" height="${SIZE}" preserveAspectRatio="xMidYMid slice" href="${coverDataUri}"/><rect x="0" y="0" width="${SIZE}" height="7" fill="#000" fill-opacity="0.55"/><rect x="0" y="0" width="${(SIZE * clamped).toFixed(1)}" height="7" fill="${ACCENT}"/></svg>`;
|
||||
}
|
||||
function svgToDataUri(svg) {
|
||||
return `data:image/svg+xml;base64,${Buffer.from(svg, "utf8").toString("base64")}`;
|
||||
}
|
||||
module2.exports = { buildInfoSvg, svgToDataUri, formatTime, SIZE };
|
||||
module2.exports = { buildInfoSvg, buildCoverProgressSvg, svgToDataUri, formatTime, SIZE };
|
||||
}
|
||||
});
|
||||
|
||||
@@ -4320,7 +4339,7 @@ var require_controller = __commonJS({
|
||||
pickTab,
|
||||
renderAction
|
||||
} = require_actions();
|
||||
var { buildInfoSvg, svgToDataUri } = require_infoPanel();
|
||||
var { buildInfoSvg, buildCoverProgressSvg, svgToDataUri } = require_infoPanel();
|
||||
var POLL_INTERVAL_MS = 1e3;
|
||||
var REFRESH_AFTER_COMMAND_MS = 350;
|
||||
var COVER_CACHE_LIMIT = 24;
|
||||
@@ -4532,13 +4551,17 @@ var require_controller = __commonJS({
|
||||
const coverUrl = view.coverUrl ? sharpCoverUrl(view.coverUrl) : null;
|
||||
const cover = coverUrl ? this.covers.get(coverUrl) || null : null;
|
||||
if (coverUrl && !cover) this.loadCover(coverUrl);
|
||||
const next = { state: view.state, title: view.title, cover: cover ? coverUrl : null };
|
||||
const progress = cover && typeof view.progress === "number" ? view.progress : null;
|
||||
const next = { state: view.state, title: view.title, cover: cover ? coverUrl : null, progress };
|
||||
const previous = key.last || {};
|
||||
const changed = (name) => previous[name] !== next[name];
|
||||
key.last = next;
|
||||
if (view.state !== void 0 && changed("state")) this.host.setState(context, view.state);
|
||||
if (view.title !== void 0 && changed("title")) this.host.setTitle(context, view.title);
|
||||
if (view.coverUrl !== void 0 && changed("cover")) this.host.setImage(context, cover);
|
||||
if (view.coverUrl !== void 0 && (changed("cover") || changed("progress"))) {
|
||||
const image = cover && progress !== null ? svgToDataUri(buildCoverProgressSvg(cover, progress)) : cover;
|
||||
this.host.setImage(context, image);
|
||||
}
|
||||
}
|
||||
/** Hohes Info-Display: komplette "Aktueller Titel"-Karte als SVG-Bild. */
|
||||
renderInfo(context, key) {
|
||||
|
||||
@@ -74,6 +74,10 @@
|
||||
<input type="checkbox" id="showTitle" />
|
||||
<label id="l-showTitle" for="showTitle"></label>
|
||||
</div>
|
||||
<div class="row check" data-for="showProgress" hidden>
|
||||
<input type="checkbox" id="showProgress" />
|
||||
<label id="l-showProgress" for="showProgress"></label>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var PREFIX = 'com.fojadrachi.playtube.';
|
||||
@@ -81,7 +85,7 @@
|
||||
en: {
|
||||
target: 'Target tab', auto: 'Automatic (active tab)', step: 'Step (%)', volume: 'Volume (%)',
|
||||
seconds: 'Seconds', tab: 'Switch to', toggle: 'Toggle YouTube / Music', playlist: 'Playlist',
|
||||
playlistId: 'Playlist ID (manual)', showTitle: 'Show title on the key', reload: 'Reload',
|
||||
playlistId: 'Playlist ID (manual)', showTitle: 'Show title on the key', showProgress: 'Show progress bar', reload: 'Reload',
|
||||
choose: '- choose a playlist -', loading: 'Loading playlists ...',
|
||||
offline: 'Playtube is not running or too old (needs the newer version with Stream Dock support).',
|
||||
failed: 'Playlists could not be read. Is YouTube Music loaded in Playtube?', count: 'playlists found'
|
||||
@@ -89,7 +93,7 @@
|
||||
de: {
|
||||
target: 'Ziel-Tab', auto: 'Automatisch (aktiver Tab)', step: 'Schrittweite (%)', volume: 'Lautstärke (%)',
|
||||
seconds: 'Sekunden', tab: 'Wechseln zu', toggle: 'YouTube / Musik umschalten', playlist: 'Playlist',
|
||||
playlistId: 'Playlist-ID (manuell)', showTitle: 'Titel auf der Taste anzeigen', reload: 'Neu laden',
|
||||
playlistId: 'Playlist-ID (manuell)', showTitle: 'Titel auf der Taste anzeigen', showProgress: 'Fortschrittsbalken anzeigen', reload: 'Neu laden',
|
||||
choose: '- Playlist wählen -', loading: 'Playlists werden geladen ...',
|
||||
offline: 'Playtube läuft nicht oder ist zu alt (benötigt die neuere Version mit Stream-Dock-Unterstützung).',
|
||||
failed: 'Playlists konnten nicht gelesen werden. Ist YouTube Musik in Playtube geladen?', count: 'Playlists gefunden'
|
||||
@@ -99,7 +103,7 @@
|
||||
var FIELDS = {
|
||||
volumeup: ['target', 'step'], volumedown: ['target', 'step'], volumeset: ['target', 'volume'],
|
||||
seekback: ['target', 'seconds'], seekforward: ['target', 'seconds'],
|
||||
playpause: ['target', 'showTitle'], nowplaying: ['target', 'showTitle'],
|
||||
playpause: ['target', 'showTitle'], nowplaying: ['target', 'showTitle', 'showProgress'],
|
||||
playlist: ['playlist'], switchtab: ['tab'], show: []
|
||||
};
|
||||
var DEFAULT_FIELDS = ['target'];
|
||||
@@ -143,7 +147,7 @@
|
||||
window.connectElgatoStreamDeckSocket = connectElgatoStreamDeckSocket;
|
||||
|
||||
function applyTexts() {
|
||||
['target', 'step', 'volume', 'seconds', 'tab', 'playlist', 'playlistId', 'showTitle'].forEach(function (key) {
|
||||
['target', 'step', 'volume', 'seconds', 'tab', 'playlist', 'playlistId', 'showTitle', 'showProgress'].forEach(function (key) {
|
||||
$('l-' + key).textContent = t[key];
|
||||
});
|
||||
$('o-auto').textContent = t.auto;
|
||||
@@ -168,6 +172,8 @@
|
||||
var defaultShow = actionId() === 'nowplaying';
|
||||
$('showTitle').checked = settings.showTitle === undefined
|
||||
? defaultShow : settings.showTitle === true || settings.showTitle === 'true';
|
||||
$('showProgress').checked = settings.showProgress === undefined
|
||||
|| settings.showProgress === true || settings.showProgress === 'true';
|
||||
selectPlaylist(settings.playlistId || '');
|
||||
}
|
||||
|
||||
@@ -179,7 +185,8 @@
|
||||
seconds: Number($('seconds').value) || 10,
|
||||
tab: $('tab').value,
|
||||
playlistId: $('playlistId').value.trim(),
|
||||
showTitle: $('showTitle').checked
|
||||
showTitle: $('showTitle').checked,
|
||||
showProgress: $('showProgress').checked
|
||||
});
|
||||
clearTimeout(saveTimer);
|
||||
saveTimer = setTimeout(function () { send({ event: 'setSettings', context: uuid, payload: settings }); }, 150);
|
||||
@@ -237,7 +244,7 @@
|
||||
save({ playlistTitle: select.value ? select.options[select.selectedIndex].textContent : '' });
|
||||
});
|
||||
$('reload').addEventListener('click', requestPlaylists);
|
||||
['target', 'step', 'volume', 'seconds', 'tab', 'showTitle'].forEach(function (id) {
|
||||
['target', 'step', 'volume', 'seconds', 'tab', 'showTitle', 'showProgress'].forEach(function (id) {
|
||||
$(id).addEventListener('input', function () { save(); });
|
||||
$(id).addEventListener('change', function () { save(); });
|
||||
});
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 3.1 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 3.0 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 2.1 KiB |
Reference in New Issue
Block a user