Plugin 1.3.0: Tasten Schlaf-Timer und Mini-Player
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -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 |
Reference in New Issue
Block a user