Plugin 1.3.0: Tasten Schlaf-Timer und Mini-Player
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -33,6 +33,8 @@ findest du in der Kategorie **Playtube**. Das Skript installiert auch das Icon-P
|
||||
| Stumm | Ton aus/ein, zeigt die Lautstärke |
|
||||
| Aktueller Titel | Cover und Titel, oben ein Fortschrittsbalken (abschaltbar); auf dem Info-Display eine große Karte mit Interpret und Fortschritt |
|
||||
| Gefällt mir, Gefällt mir nicht, Zufall, Wiederholen | Umschalten, Symbol zeigt den Zustand |
|
||||
| Schlaf-Timer | Startet den Schlaf-Timer am PC (Minuten oder Songende einstellbar), zeigt die Restzeit; nochmal drücken = aus (ab Playtube 2.14.0) |
|
||||
| Mini-Player | Öffnet/schließt den Mini-Player von Playtube (ab 2.14.0) |
|
||||
| Playlist abspielen | Playlist aus YouTube Music wählen (Liste wird von Playtube geladen); die Taste zeigt das Cover der Playlist (ab Playtube 2.12.0, sonst den Namen) |
|
||||
| Tab wechseln / Playtube anzeigen | YouTube ↔ YouTube Music, Fenster nach vorn |
|
||||
|
||||
|
||||
@@ -66,6 +66,14 @@
|
||||
"Name": "Tab wechseln",
|
||||
"Tooltip": "Zwischen YouTube und YouTube Musik wechseln"
|
||||
},
|
||||
"com.fojadrachi.playtube.sleep": {
|
||||
"Name": "Schlaf-Timer",
|
||||
"Tooltip": "Nach einer Weile pausieren (nochmal drücken = aus)"
|
||||
},
|
||||
"com.fojadrachi.playtube.mini": {
|
||||
"Name": "Mini-Player",
|
||||
"Tooltip": "Mini-Player von Playtube öffnen oder schließen"
|
||||
},
|
||||
"com.fojadrachi.playtube.show": {
|
||||
"Name": "Playtube anzeigen",
|
||||
"Tooltip": "Das Playtube-Fenster in den Vordergrund holen"
|
||||
|
||||
@@ -66,6 +66,14 @@
|
||||
"Name": "Switch tab",
|
||||
"Tooltip": "Switch between YouTube and YouTube Music"
|
||||
},
|
||||
"com.fojadrachi.playtube.sleep": {
|
||||
"Name": "Sleep timer",
|
||||
"Tooltip": "Pause after a while (press again to turn off)"
|
||||
},
|
||||
"com.fojadrachi.playtube.mini": {
|
||||
"Name": "Mini player",
|
||||
"Tooltip": "Open or close the Playtube mini player"
|
||||
},
|
||||
"com.fojadrachi.playtube.show": {
|
||||
"Name": "Show Playtube",
|
||||
"Tooltip": "Bring the Playtube window to the front"
|
||||
|
||||
@@ -426,6 +426,61 @@
|
||||
"UUID": "com.fojadrachi.playtube.switchtab",
|
||||
"PropertyInspectorPath": "propertyInspector/index.html"
|
||||
},
|
||||
{
|
||||
"Icon": "static/icon/[email protected]",
|
||||
"Name": "Sleep timer",
|
||||
"DisableAutomaticStates": true,
|
||||
"States": [
|
||||
{
|
||||
"Image": "static/btn/sleep_0.png",
|
||||
"TitleAlignment": "bottom",
|
||||
"FontSize": "11",
|
||||
"FontStyle": "Bold",
|
||||
"TitleColor": "#ffffff"
|
||||
},
|
||||
{
|
||||
"Image": "static/btn/sleep_1.png",
|
||||
"TitleAlignment": "bottom",
|
||||
"FontSize": "11",
|
||||
"FontStyle": "Bold",
|
||||
"TitleColor": "#ffffff"
|
||||
}
|
||||
],
|
||||
"Settings": {},
|
||||
"Controllers": [
|
||||
"Keypad",
|
||||
"Information"
|
||||
],
|
||||
"UserTitleEnabled": false,
|
||||
"SupportedInMultiActions": true,
|
||||
"Tooltip": "Pause after a while (press again to turn off)",
|
||||
"UUID": "com.fojadrachi.playtube.sleep",
|
||||
"PropertyInspectorPath": "propertyInspector/index.html"
|
||||
},
|
||||
{
|
||||
"Icon": "static/icon/[email protected]",
|
||||
"Name": "Mini player",
|
||||
"DisableAutomaticStates": true,
|
||||
"States": [
|
||||
{
|
||||
"Image": "static/btn/mini_0.png",
|
||||
"TitleAlignment": "bottom",
|
||||
"FontSize": "11",
|
||||
"FontStyle": "Bold",
|
||||
"TitleColor": "#ffffff"
|
||||
}
|
||||
],
|
||||
"Settings": {},
|
||||
"Controllers": [
|
||||
"Keypad",
|
||||
"Information"
|
||||
],
|
||||
"UserTitleEnabled": false,
|
||||
"SupportedInMultiActions": true,
|
||||
"Tooltip": "Open or close the Playtube mini player",
|
||||
"UUID": "com.fojadrachi.playtube.mini",
|
||||
"PropertyInspectorPath": "propertyInspector/index.html"
|
||||
},
|
||||
{
|
||||
"Icon": "static/icon/[email protected]",
|
||||
"Name": "Show Playtube",
|
||||
@@ -459,7 +514,7 @@
|
||||
"Description": "Control Playtube (YouTube / YouTube Music) from your Stream Dock",
|
||||
"Category": "Playtube",
|
||||
"CategoryIcon": "static/icon/[email protected]",
|
||||
"Version": "1.2.0",
|
||||
"Version": "1.3.0",
|
||||
"OS": [
|
||||
{
|
||||
"Platform": "windows",
|
||||
|
||||
@@ -4032,8 +4032,10 @@ var require_actions = __commonJS({
|
||||
// Cover-Adresse, von Playtube geholt (Befehl "playlist_cover")
|
||||
playlistCoverId: "",
|
||||
// zu welcher Playlist das gespeicherte Cover gehoert
|
||||
showProgress: true
|
||||
showProgress: true,
|
||||
// "Aktueller Titel": Fortschrittsbalken ueber dem Cover
|
||||
sleepMinutes: 30
|
||||
// Schlaf-Timer: Minuten, -1 = Ende des Songs
|
||||
});
|
||||
var TARGETS = ["auto", "youtube", "music"];
|
||||
var TABS = ["toggle", "youtube", "music"];
|
||||
@@ -4049,6 +4051,7 @@ var require_actions = __commonJS({
|
||||
settings.step = clampInt(settings.step, 1, 25, DEFAULTS.step);
|
||||
settings.volume = clampInt(settings.volume, 0, 100, DEFAULTS.volume);
|
||||
settings.seconds = clampInt(settings.seconds, 1, 300, DEFAULTS.seconds);
|
||||
settings.sleepMinutes = clampInt(settings.sleepMinutes, -1, 1440, DEFAULTS.sleepMinutes) || DEFAULTS.sleepMinutes;
|
||||
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;
|
||||
@@ -4099,6 +4102,14 @@ var require_actions = __commonJS({
|
||||
if (truncated && lines.length) lines[lines.length - 1] = `${lines[lines.length - 1].slice(0, perLine - 2)}..`;
|
||||
return lines.join("\n");
|
||||
}
|
||||
function sleepTitle(seconds) {
|
||||
if (seconds === -1) return "Song-\nende";
|
||||
const s = Math.max(0, Math.round(seconds));
|
||||
const h = Math.floor(s / 3600);
|
||||
const m = Math.floor(s % 3600 / 60);
|
||||
const sec = String(s % 60).padStart(2, "0");
|
||||
return h > 0 ? `${h}:${String(m).padStart(2, "0")}:${sec}` : `${m}:${sec}`;
|
||||
}
|
||||
function volumeTitle(tab) {
|
||||
const volume = tab && tab.info.volume;
|
||||
return typeof volume === "number" ? `${Math.round(volume)}%` : "";
|
||||
@@ -4208,6 +4219,18 @@ var require_actions = __commonJS({
|
||||
return { title: "" };
|
||||
}
|
||||
},
|
||||
sleep: {
|
||||
// Laeuft der Timer am PC, schaltet Druecken ihn aus; sonst startet er mit der eingestellten Zeit.
|
||||
request: (s, state) => ({
|
||||
cmd: "sleep_timer",
|
||||
fields: { value: state && typeof state.sleepTimer === "number" ? 0 : s.sleepMinutes }
|
||||
}),
|
||||
render: (s, state, connected) => {
|
||||
const active = connected && state && typeof state.sleepTimer === "number";
|
||||
return { state: active ? 1 : 0, title: active ? sleepTitle(state.sleepTimer) : "" };
|
||||
}
|
||||
},
|
||||
mini: { request: () => ({ cmd: "mini_player", fields: {} }) },
|
||||
show: { request: () => ({ cmd: "show", fields: {} }) }
|
||||
};
|
||||
function actionIdFromUuid(uuid) {
|
||||
@@ -4220,10 +4243,10 @@ var require_actions = __commonJS({
|
||||
const settings = normalizeSettings(rawSettings, definition.titleDefault);
|
||||
return definition.render ? definition.render(settings, state, connected) : {};
|
||||
}
|
||||
function buildRequest(id, rawSettings) {
|
||||
function buildRequest(id, rawSettings, state = null) {
|
||||
const definition = DEFINITIONS[id];
|
||||
const settings = normalizeSettings(rawSettings, definition.titleDefault);
|
||||
return definition.request(settings);
|
||||
return definition.request(settings, state);
|
||||
}
|
||||
module2.exports = {
|
||||
PREFIX,
|
||||
@@ -4233,6 +4256,7 @@ var require_actions = __commonJS({
|
||||
needsPlaylistCover,
|
||||
pickTab,
|
||||
wrapTitle,
|
||||
sleepTitle,
|
||||
actionIdFromUuid,
|
||||
renderAction,
|
||||
buildRequest
|
||||
@@ -4506,7 +4530,7 @@ var require_controller = __commonJS({
|
||||
async execute(context, { quiet = false } = {}) {
|
||||
const key = this.keys.get(context);
|
||||
if (!key) return;
|
||||
const request = buildRequest(key.actionId, key.settings);
|
||||
const request = buildRequest(key.actionId, key.settings, this.state);
|
||||
if (!request) {
|
||||
this.host.showAlert(context);
|
||||
return;
|
||||
|
||||
@@ -47,6 +47,19 @@
|
||||
<input type="number" id="seconds" min="1" max="300" />
|
||||
</div>
|
||||
|
||||
<div class="row" data-for="sleepMinutes" hidden>
|
||||
<label id="l-sleepMinutes" for="sleepMinutes"></label>
|
||||
<select id="sleepMinutes">
|
||||
<option value="15">15</option>
|
||||
<option value="30">30</option>
|
||||
<option value="45">45</option>
|
||||
<option value="60">60</option>
|
||||
<option value="90">90</option>
|
||||
<option value="120">120</option>
|
||||
<option value="-1" id="o-sleepEnd"></option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="row" data-for="tab" hidden>
|
||||
<label id="l-tab" for="tab"></label>
|
||||
<select id="tab">
|
||||
@@ -85,7 +98,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', showProgress: 'Show progress bar', reload: 'Reload',
|
||||
playlistId: 'Playlist ID (manual)', showTitle: 'Show title on the key', showProgress: 'Show progress bar', sleepMinutes: 'Minutes', sleepEnd: 'End of song', 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'
|
||||
@@ -93,7 +106,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', showProgress: 'Fortschrittsbalken anzeigen', reload: 'Neu laden',
|
||||
playlistId: 'Playlist-ID (manuell)', showTitle: 'Titel auf der Taste anzeigen', showProgress: 'Fortschrittsbalken anzeigen', sleepMinutes: 'Minuten', sleepEnd: 'Ende des Songs', 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'
|
||||
@@ -104,7 +117,7 @@
|
||||
volumeup: ['target', 'step'], volumedown: ['target', 'step'], volumeset: ['target', 'volume'],
|
||||
seekback: ['target', 'seconds'], seekforward: ['target', 'seconds'],
|
||||
playpause: ['target', 'showTitle'], nowplaying: ['target', 'showTitle', 'showProgress'],
|
||||
playlist: ['playlist'], switchtab: ['tab'], show: []
|
||||
playlist: ['playlist'], switchtab: ['tab'], sleep: ['sleepMinutes'], mini: [], show: []
|
||||
};
|
||||
var DEFAULT_FIELDS = ['target'];
|
||||
|
||||
@@ -147,11 +160,12 @@
|
||||
window.connectElgatoStreamDeckSocket = connectElgatoStreamDeckSocket;
|
||||
|
||||
function applyTexts() {
|
||||
['target', 'step', 'volume', 'seconds', 'tab', 'playlist', 'playlistId', 'showTitle', 'showProgress'].forEach(function (key) {
|
||||
['target', 'step', 'volume', 'seconds', 'tab', 'playlist', 'playlistId', 'showTitle', 'showProgress', 'sleepMinutes'].forEach(function (key) {
|
||||
$('l-' + key).textContent = t[key];
|
||||
});
|
||||
$('o-auto').textContent = t.auto;
|
||||
$('o-toggle').textContent = t.toggle;
|
||||
$('o-sleepEnd').textContent = t.sleepEnd;
|
||||
$('reload').textContent = t.reload;
|
||||
}
|
||||
|
||||
@@ -168,6 +182,7 @@
|
||||
$('volume').value = settings.volume === undefined ? 30 : settings.volume;
|
||||
$('seconds').value = settings.seconds || 10;
|
||||
$('tab').value = settings.tab || 'toggle';
|
||||
$('sleepMinutes').value = String(settings.sleepMinutes || 30);
|
||||
$('playlistId').value = settings.playlistId || '';
|
||||
var defaultShow = actionId() === 'nowplaying';
|
||||
$('showTitle').checked = settings.showTitle === undefined
|
||||
@@ -184,6 +199,7 @@
|
||||
volume: Number($('volume').value),
|
||||
seconds: Number($('seconds').value) || 10,
|
||||
tab: $('tab').value,
|
||||
sleepMinutes: Number($('sleepMinutes').value) || 30,
|
||||
playlistId: $('playlistId').value.trim(),
|
||||
showTitle: $('showTitle').checked,
|
||||
showProgress: $('showProgress').checked
|
||||
@@ -244,7 +260,7 @@
|
||||
save({ playlistTitle: select.value ? select.options[select.selectedIndex].textContent : '' });
|
||||
});
|
||||
$('reload').addEventListener('click', requestPlaylists);
|
||||
['target', 'step', 'volume', 'seconds', 'tab', 'showTitle', 'showProgress'].forEach(function (id) {
|
||||
['target', 'step', 'volume', 'seconds', 'tab', 'showTitle', 'showProgress', 'sleepMinutes'].forEach(function (id) {
|
||||
$(id).addEventListener('input', function () { save(); });
|
||||
$(id).addEventListener('change', function () { save(); });
|
||||
});
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 2.3 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 965 B |
Binary file not shown.
|
After Width: | Height: | Size: 2.2 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.9 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.6 KiB |
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "playtube-streamdock-plugin",
|
||||
"version": "1.2.0",
|
||||
"version": "1.3.0",
|
||||
"private": true,
|
||||
"description": "Stream Dock plugin (Ajazz AKP153E and other Stream Dock devices) to control Playtube",
|
||||
"license": "MIT",
|
||||
|
||||
+28
-3
@@ -20,6 +20,7 @@ const DEFAULTS = Object.freeze({
|
||||
playlistCover: '', // Cover-Adresse, von Playtube geholt (Befehl "playlist_cover")
|
||||
playlistCoverId: '', // zu welcher Playlist das gespeicherte Cover gehoert
|
||||
showProgress: true, // "Aktueller Titel": Fortschrittsbalken ueber dem Cover
|
||||
sleepMinutes: 30, // Schlaf-Timer: Minuten, -1 = Ende des Songs
|
||||
});
|
||||
|
||||
const TARGETS = ['auto', 'youtube', 'music'];
|
||||
@@ -39,6 +40,7 @@ function normalizeSettings(raw, titleDefault = false) {
|
||||
settings.step = clampInt(settings.step, 1, 25, DEFAULTS.step);
|
||||
settings.volume = clampInt(settings.volume, 0, 100, DEFAULTS.volume);
|
||||
settings.seconds = clampInt(settings.seconds, 1, 300, DEFAULTS.seconds);
|
||||
settings.sleepMinutes = clampInt(settings.sleepMinutes, -1, 1440, DEFAULTS.sleepMinutes) || DEFAULTS.sleepMinutes;
|
||||
const show = raw && raw.showTitle !== undefined ? raw.showTitle : titleDefault;
|
||||
settings.showTitle = show === true || show === 'true';
|
||||
const progress = raw && raw.showProgress !== undefined ? raw.showProgress : DEFAULTS.showProgress;
|
||||
@@ -97,6 +99,16 @@ function wrapTitle(text, perLine = 8, maxLines = 3) {
|
||||
return lines.join('\n');
|
||||
}
|
||||
|
||||
/** "12:34" / "1:02:03" fuer die Restzeit des Schlaf-Timers. */
|
||||
function sleepTitle(seconds) {
|
||||
if (seconds === -1) return 'Song-\nende';
|
||||
const s = Math.max(0, Math.round(seconds));
|
||||
const h = Math.floor(s / 3600);
|
||||
const m = Math.floor((s % 3600) / 60);
|
||||
const sec = String(s % 60).padStart(2, '0');
|
||||
return h > 0 ? `${h}:${String(m).padStart(2, '0')}:${sec}` : `${m}:${sec}`;
|
||||
}
|
||||
|
||||
function volumeTitle(tab) {
|
||||
const volume = tab && tab.info.volume;
|
||||
return typeof volume === 'number' ? `${Math.round(volume)}%` : '';
|
||||
@@ -215,6 +227,18 @@ const DEFINITIONS = {
|
||||
return { title: '' };
|
||||
},
|
||||
},
|
||||
sleep: {
|
||||
// Laeuft der Timer am PC, schaltet Druecken ihn aus; sonst startet er mit der eingestellten Zeit.
|
||||
request: (s, state) => ({
|
||||
cmd: 'sleep_timer',
|
||||
fields: { value: state && typeof state.sleepTimer === 'number' ? 0 : s.sleepMinutes },
|
||||
}),
|
||||
render: (s, state, connected) => {
|
||||
const active = connected && state && typeof state.sleepTimer === 'number';
|
||||
return { state: active ? 1 : 0, title: active ? sleepTitle(state.sleepTimer) : '' };
|
||||
},
|
||||
},
|
||||
mini: { request: () => ({ cmd: 'mini_player', fields: {} }) },
|
||||
show: { request: () => ({ cmd: 'show', fields: {} }) },
|
||||
};
|
||||
|
||||
@@ -231,11 +255,11 @@ function renderAction(id, rawSettings, state, connected) {
|
||||
return definition.render ? definition.render(settings, state, connected) : {};
|
||||
}
|
||||
|
||||
/** {cmd, fields} fuer einen Tastendruck oder null. */
|
||||
function buildRequest(id, rawSettings) {
|
||||
/** {cmd, fields} fuer einen Tastendruck oder null (`state` = letzter Status von Playtube). */
|
||||
function buildRequest(id, rawSettings, state = null) {
|
||||
const definition = DEFINITIONS[id];
|
||||
const settings = normalizeSettings(rawSettings, definition.titleDefault);
|
||||
return definition.request(settings);
|
||||
return definition.request(settings, state);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
@@ -246,6 +270,7 @@ module.exports = {
|
||||
needsPlaylistCover,
|
||||
pickTab,
|
||||
wrapTitle,
|
||||
sleepTitle,
|
||||
actionIdFromUuid,
|
||||
renderAction,
|
||||
buildRequest,
|
||||
|
||||
+1
-1
@@ -198,7 +198,7 @@ class Controller {
|
||||
async execute(context, { quiet = false } = {}) {
|
||||
const key = this.keys.get(context);
|
||||
if (!key) return;
|
||||
const request = buildRequest(key.actionId, key.settings);
|
||||
const request = buildRequest(key.actionId, key.settings, this.state);
|
||||
if (!request) {
|
||||
this.host.showAlert(context);
|
||||
return;
|
||||
|
||||
@@ -276,3 +276,33 @@ test('Gefaellt-mir-nicht-Taste sendet dislike und zeigt den Zustand', async () =
|
||||
await tick();
|
||||
assert.deepEqual(client.requests.at(-1), { cmd: 'dislike', target: 'auto' });
|
||||
});
|
||||
|
||||
test('Schlaf-Timer-Taste startet den Timer, zeigt die Restzeit und schaltet ihn wieder aus', async () => {
|
||||
const { host, client, controller } = setup();
|
||||
appear(controller, 'sleep', 's1', { sleepMinutes: 45 });
|
||||
await controller.poll();
|
||||
assert.deepEqual(host.named('setState').filter((c) => c[1] === 's1').at(-1), ['setState', 's1', 0]);
|
||||
controller.handleEvent({ event: 'keyUp', context: 's1' });
|
||||
await tick();
|
||||
assert.deepEqual(client.requests.at(-1), { cmd: 'sleep_timer', value: 45 });
|
||||
|
||||
client.state = { ...STATE, sleepTimer: 2700 };
|
||||
await controller.poll();
|
||||
assert.deepEqual(host.named('setState').filter((c) => c[1] === 's1').at(-1), ['setState', 's1', 1]);
|
||||
assert.equal(host.named('setTitle').filter((c) => c[1] === 's1').at(-1)[2], '45:00');
|
||||
controller.handleEvent({ event: 'keyUp', context: 's1' });
|
||||
await tick();
|
||||
assert.deepEqual(client.requests.at(-1), { cmd: 'sleep_timer', value: 0 });
|
||||
|
||||
client.state = { ...STATE, sleepTimer: -1 };
|
||||
await controller.poll();
|
||||
assert.equal(host.named('setTitle').filter((c) => c[1] === 's1').at(-1)[2], 'Song-\nende');
|
||||
});
|
||||
|
||||
test('Mini-Player-Taste schickt mini_player', async () => {
|
||||
const { client, controller } = setup();
|
||||
appear(controller, 'mini', 'm1');
|
||||
controller.handleEvent({ event: 'keyUp', context: 'm1' });
|
||||
await tick();
|
||||
assert.deepEqual(client.requests, [{ cmd: 'mini_player' }]);
|
||||
});
|
||||
|
||||
@@ -58,6 +58,12 @@ const ACTIONS = [
|
||||
{ id: 'switchtab', accent: 'misc', titled: true, states: [{ glyph: 'tabs' }],
|
||||
en: ['Switch tab', 'Switch between YouTube and YouTube Music'],
|
||||
de: ['Tab wechseln', 'Zwischen YouTube und YouTube Musik wechseln'] },
|
||||
{ id: 'sleep', accent: 'misc', titled: true, states: [{ glyph: 'moon', dim: true }, { glyph: 'moon', on: true }],
|
||||
en: ['Sleep timer', 'Pause after a while (press again to turn off)'],
|
||||
de: ['Schlaf-Timer', 'Nach einer Weile pausieren (nochmal drücken = aus)'] },
|
||||
{ id: 'mini', accent: 'misc', states: [{ glyph: 'mini' }],
|
||||
en: ['Mini player', 'Open or close the Playtube mini player'],
|
||||
de: ['Mini-Player', 'Mini-Player von Playtube öffnen oder schließen'] },
|
||||
{ id: 'show', accent: 'misc', states: [{ glyph: 'window' }],
|
||||
en: ['Show Playtube', 'Bring the Playtube window to the front'],
|
||||
de: ['Playtube anzeigen', 'Das Playtube-Fenster in den Vordergrund holen'] },
|
||||
|
||||
+15
-1
@@ -15,7 +15,7 @@ const HEART = heartPoints();
|
||||
|
||||
export const GLYPHS = [
|
||||
'play', 'pause', 'next', 'previous', 'rewind', 'forward', 'volup', 'voldown', 'vol', 'mute',
|
||||
'note', 'heart', 'heartfill', 'dislike', 'dislikefill', 'shuffle', 'repeat', 'repeatone', 'playlist', 'tabs', 'window',
|
||||
'note', 'heart', 'heartfill', 'dislike', 'dislikefill', 'shuffle', 'repeat', 'repeatone', 'playlist', 'tabs', 'window', 'moon', 'mini',
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -148,6 +148,20 @@ export function drawGlyph(canvas, name, cx, cy, r, color, background) {
|
||||
canvas.roundRect(...p(-0.9, -0.7), 1.8 * r, 1.4 * r, 0.14 * r, color);
|
||||
canvas.roundRect(...p(-0.75, -0.25), 1.5 * r, 0.85 * r, 0.05 * r, background);
|
||||
break;
|
||||
case 'moon': {
|
||||
// Mondsichel: grosser Kreis, davon ein versetzter Kreis in Hintergrundfarbe abgezogen.
|
||||
const [mx, my] = p(-0.05, 0.05);
|
||||
canvas.circle(mx, my, 0.82 * r, color);
|
||||
const [cx2, cy2] = p(0.38, -0.32);
|
||||
canvas.circle(cx2, cy2, 0.7 * r, background);
|
||||
break;
|
||||
}
|
||||
case 'mini':
|
||||
// Grosses Fenster, darin unten rechts ein kleines (Bild im Bild).
|
||||
canvas.roundRect(...p(-0.9, -0.7), 1.8 * r, 1.4 * r, 0.14 * r, color);
|
||||
canvas.roundRect(...p(-0.75, -0.55), 1.5 * r, 1.1 * r, 0.05 * r, background);
|
||||
canvas.roundRect(...p(0.0, 0.05), 0.65 * r, 0.42 * r, 0.06 * r, color);
|
||||
break;
|
||||
default:
|
||||
throw new Error(`Unbekanntes Symbol: ${name}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user