diff --git a/README.md b/README.md
index a8443c5..09410e4 100644
--- a/README.md
+++ b/README.md
@@ -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 |
diff --git a/com.fojadrachi.playtube.sdPlugin/de.json b/com.fojadrachi.playtube.sdPlugin/de.json
index 324942c..61d0b07 100644
--- a/com.fojadrachi.playtube.sdPlugin/de.json
+++ b/com.fojadrachi.playtube.sdPlugin/de.json
@@ -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"
diff --git a/com.fojadrachi.playtube.sdPlugin/en.json b/com.fojadrachi.playtube.sdPlugin/en.json
index 218bc51..9adb547 100644
--- a/com.fojadrachi.playtube.sdPlugin/en.json
+++ b/com.fojadrachi.playtube.sdPlugin/en.json
@@ -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"
diff --git a/com.fojadrachi.playtube.sdPlugin/manifest.json b/com.fojadrachi.playtube.sdPlugin/manifest.json
index ae36270..599635c 100644
--- a/com.fojadrachi.playtube.sdPlugin/manifest.json
+++ b/com.fojadrachi.playtube.sdPlugin/manifest.json
@@ -426,6 +426,61 @@
"UUID": "com.fojadrachi.playtube.switchtab",
"PropertyInspectorPath": "propertyInspector/index.html"
},
+ {
+ "Icon": "static/icon/sleep@2x.png",
+ "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/mini@2x.png",
+ "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/show@2x.png",
"Name": "Show Playtube",
@@ -459,7 +514,7 @@
"Description": "Control Playtube (YouTube / YouTube Music) from your Stream Dock",
"Category": "Playtube",
"CategoryIcon": "static/icon/icon@2x.png",
- "Version": "1.2.0",
+ "Version": "1.3.0",
"OS": [
{
"Platform": "windows",
diff --git a/com.fojadrachi.playtube.sdPlugin/plugin/index.js b/com.fojadrachi.playtube.sdPlugin/plugin/index.js
index bb20e74..09eb1ff 100644
--- a/com.fojadrachi.playtube.sdPlugin/plugin/index.js
+++ b/com.fojadrachi.playtube.sdPlugin/plugin/index.js
@@ -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;
diff --git a/com.fojadrachi.playtube.sdPlugin/propertyInspector/index.html b/com.fojadrachi.playtube.sdPlugin/propertyInspector/index.html
index 519c1d7..2495411 100644
--- a/com.fojadrachi.playtube.sdPlugin/propertyInspector/index.html
+++ b/com.fojadrachi.playtube.sdPlugin/propertyInspector/index.html
@@ -47,6 +47,19 @@
+
+
+
+
+