kitowall 2.7.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -56,6 +56,7 @@ const logs_1 = require("./core/logs");
56
56
  const node_fs_1 = require("node:fs");
57
57
  const node_path_1 = require("node:path");
58
58
  const workshop_1 = require("./core/workshop");
59
+ const live_1 = require("./core/live");
59
60
  function getCliVersion() {
60
61
  try {
61
62
  const pkgPath = (0, node_path_1.join)(__dirname, '..', 'package.json');
@@ -139,6 +140,37 @@ Commands:
139
140
  Apply wallpapers in batch by monitor map
140
141
  we stop [--monitor <name> | --all] Stop livewallpaper instances and restore previous services
141
142
  we coexist enter|exit|status Temporarily stop/restore wallpaper rotation services
143
+ live init Initialize LiveWallpapers storage/index
144
+ live list [--favorites] [--json] List downloaded LiveWallpapers from local index
145
+ live browse [--page <n>] [--quality 4k|all] [--provider moewalls|motionbgs|all]
146
+ Browse provider pages
147
+ live search <query> [--page <n>] [--limit <n>] [--provider moewalls|motionbgs|all]
148
+ Search provider posts
149
+ live resolve <url> Resolve HD/4K variants from provider post URL
150
+ live preview <url> Resolve + cache local motion preview for side panel playback
151
+ live preview-clear <url> Remove cached side-panel motion preview for one post
152
+ live fetch <url> [--quality auto|hd|4k] [--monitor <name>] [--apply]
153
+ Download from provider and save into local library
154
+ live apply <id> --monitor <name> [--quality auto|hd|4k]
155
+ Apply live wallpaper by local library id
156
+ live auto-apply set --monitor <name> --quality auto|hd|4k
157
+ live auto-apply unset --monitor <name>
158
+ live favorite <id> on|off
159
+ live remove <id> [--delete-files]
160
+ live thumb regen [--id <id>] [--all]
161
+ live open [--id <id>] Print folder path (root or item folder)
162
+ live config show
163
+ live config wallpaper-show --id <id>
164
+ live config wallpaper --id <id> [--keep-services true|false] [--mute-audio true|false] [--profile performance|balanced|quality]
165
+ [--display-fps <n|off>] [--seamless-loop true|false] [--loop-crossfade true|false]
166
+ [--loop-crossfade-seconds <n>] [--optimize true|false]
167
+ [--proxy-width <n>] [--proxy-fps <n>] [--proxy-crf <n>]
168
+ live config runner [--bin-name <name>]
169
+ live config apply-defaults [--keep-services true|false] [--mute-audio true|false] [--display-fps <n|off>]
170
+ [--proxy-width-hd <n>] [--proxy-width-4k <n>] [--proxy-fps <n>] [--proxy-crf-hd <n>] [--proxy-crf-4k <n>]
171
+ [--loop-crossfade-seconds <n>] [--profile performance|balanced|quality]
172
+ [--seamless-loop true|false] [--loop-crossfade true|false] [--optimize true|false]
173
+ live doctor [--fix]
142
174
  check [--namespace <ns>] [--json] Quick system check (no changes)
143
175
 
144
176
  init [--namespace <ns>] [--apply] [--force] Setup kitowall (install daemon + watcher + next.service), validate deps
@@ -476,6 +508,232 @@ async function main() {
476
508
  }
477
509
  throw new Error('Usage: we <config|search|details|download|job|jobs|library|scan-steam|sync-steam|app-status|active|apply|stop|run-job|coexist> ...');
478
510
  }
511
+ if (cmd === 'live') {
512
+ const action = cleanOpt(args[1] ?? null);
513
+ if (!action)
514
+ throw new Error('Usage: live <init|list|browse|search|resolve|preview|preview-clear|fetch|apply|auto-apply|favorite|remove|thumb|open|config|doctor> ...');
515
+ if (action === 'init') {
516
+ console.log(JSON.stringify((0, live_1.liveInit)(), null, 2));
517
+ return;
518
+ }
519
+ if (action === 'list') {
520
+ const out = (0, live_1.liveList)({ favorites: args.includes('--favorites') });
521
+ console.log(JSON.stringify(out, null, 2));
522
+ return;
523
+ }
524
+ if (action === 'browse') {
525
+ const pageRaw = cleanOpt(getOptionValue(args, '--page'));
526
+ const qualityRaw = cleanOpt(getOptionValue(args, '--quality'));
527
+ const providerRaw = cleanOpt(getOptionValue(args, '--provider'));
528
+ const out = await (0, live_1.liveBrowse)({
529
+ page: pageRaw ? Number(pageRaw) : 1,
530
+ quality: qualityRaw === '4k' ? '4k' : 'all',
531
+ provider: (providerRaw === 'moewalls' || providerRaw === 'motionbgs') ? providerRaw : 'all'
532
+ });
533
+ console.log(JSON.stringify(out, null, 2));
534
+ return;
535
+ }
536
+ if (action === 'search') {
537
+ const query = cleanOpt(args[2] ?? null);
538
+ if (!query)
539
+ throw new Error('Usage: live search <query> [--page <n>] [--limit <n>] [--provider moewalls|motionbgs|all]');
540
+ const pageRaw = cleanOpt(getOptionValue(args, '--page'));
541
+ const limitRaw = cleanOpt(getOptionValue(args, '--limit'));
542
+ const providerRaw = cleanOpt(getOptionValue(args, '--provider'));
543
+ const out = await (0, live_1.liveSearch)(query, {
544
+ page: pageRaw ? Number(pageRaw) : 1,
545
+ limit: limitRaw ? Number(limitRaw) : 20,
546
+ provider: (providerRaw === 'moewalls' || providerRaw === 'motionbgs') ? providerRaw : 'all'
547
+ });
548
+ console.log(JSON.stringify(out, null, 2));
549
+ return;
550
+ }
551
+ if (action === 'resolve') {
552
+ const url = cleanOpt(args[2] ?? null);
553
+ if (!url)
554
+ throw new Error('Usage: live resolve <motionbgs_or_moewalls_url>');
555
+ const out = await (0, live_1.liveResolve)(url);
556
+ console.log(JSON.stringify(out, null, 2));
557
+ return;
558
+ }
559
+ if (action === 'preview') {
560
+ const url = cleanOpt(args[2] ?? null);
561
+ if (!url)
562
+ throw new Error('Usage: live preview <motionbgs_or_moewalls_url>');
563
+ const out = await (0, live_1.livePreview)(url);
564
+ console.log(JSON.stringify(out, null, 2));
565
+ return;
566
+ }
567
+ if (action === 'preview-clear') {
568
+ const url = cleanOpt(args[2] ?? null);
569
+ if (!url)
570
+ throw new Error('Usage: live preview-clear <motionbgs_or_moewalls_url>');
571
+ const out = await (0, live_1.livePreviewClear)(url);
572
+ console.log(JSON.stringify(out, null, 2));
573
+ return;
574
+ }
575
+ if (action === 'fetch') {
576
+ const url = cleanOpt(args[2] ?? null);
577
+ if (!url)
578
+ throw new Error('Usage: live fetch <url> [--quality auto|hd|4k] [--monitor <name>] [--apply]');
579
+ const qualityRaw = cleanOpt(getOptionValue(args, '--quality'));
580
+ const monitor = cleanOpt(getOptionValue(args, '--monitor')) ?? undefined;
581
+ const quality = (qualityRaw === 'hd' || qualityRaw === '4k' || qualityRaw === 'auto') ? qualityRaw : 'auto';
582
+ const out = await (0, live_1.liveFetch)({
583
+ url,
584
+ quality,
585
+ monitor,
586
+ apply: args.includes('--apply')
587
+ });
588
+ console.log(JSON.stringify(out, null, 2));
589
+ return;
590
+ }
591
+ if (action === 'apply') {
592
+ const id = cleanOpt(args[2] ?? null);
593
+ const monitor = cleanOpt(getOptionValue(args, '--monitor'));
594
+ if (!id || !monitor)
595
+ throw new Error('Usage: live apply <id> --monitor <name> [--quality auto|hd|4k]');
596
+ const qualityRaw = cleanOpt(getOptionValue(args, '--quality'));
597
+ const quality = (qualityRaw === 'hd' || qualityRaw === '4k' || qualityRaw === 'auto') ? qualityRaw : 'auto';
598
+ const out = await (0, live_1.liveApply)({ id, monitor, quality });
599
+ console.log(JSON.stringify(out, null, 2));
600
+ return;
601
+ }
602
+ if (action === 'auto-apply') {
603
+ const sub = cleanOpt(args[2] ?? null);
604
+ if (sub === 'set') {
605
+ const monitor = cleanOpt(getOptionValue(args, '--monitor'));
606
+ const qualityRaw = cleanOpt(getOptionValue(args, '--quality'));
607
+ if (!monitor)
608
+ throw new Error('Usage: live auto-apply set --monitor <name> --quality auto|hd|4k');
609
+ const quality = (qualityRaw === 'hd' || qualityRaw === '4k' || qualityRaw === 'auto') ? qualityRaw : 'auto';
610
+ const out = (0, live_1.liveAutoApplySet)(monitor, quality);
611
+ console.log(JSON.stringify(out, null, 2));
612
+ return;
613
+ }
614
+ if (sub === 'unset') {
615
+ const monitor = cleanOpt(getOptionValue(args, '--monitor'));
616
+ if (!monitor)
617
+ throw new Error('Usage: live auto-apply unset --monitor <name>');
618
+ const out = (0, live_1.liveAutoApplyUnset)(monitor);
619
+ console.log(JSON.stringify(out, null, 2));
620
+ return;
621
+ }
622
+ throw new Error('Usage: live auto-apply <set|unset> ...');
623
+ }
624
+ if (action === 'favorite') {
625
+ const id = cleanOpt(args[2] ?? null);
626
+ const state = cleanOpt(args[3] ?? null);
627
+ if (!id || !state)
628
+ throw new Error('Usage: live favorite <id> on|off');
629
+ const out = (0, live_1.liveFavorite)(id, state === 'on');
630
+ console.log(JSON.stringify(out, null, 2));
631
+ return;
632
+ }
633
+ if (action === 'remove') {
634
+ const id = cleanOpt(args[2] ?? null);
635
+ if (!id)
636
+ throw new Error('Usage: live remove <id> [--delete-files]');
637
+ const out = (0, live_1.liveRemove)(id, { deleteFiles: args.includes('--delete-files') });
638
+ console.log(JSON.stringify(out, null, 2));
639
+ return;
640
+ }
641
+ if (action === 'thumb') {
642
+ const sub = cleanOpt(args[2] ?? null);
643
+ if (sub !== 'regen')
644
+ throw new Error('Usage: live thumb regen [--id <id>] [--all]');
645
+ const id = cleanOpt(getOptionValue(args, '--id')) ?? undefined;
646
+ const out = await (0, live_1.liveThumbRegen)({ id, all: args.includes('--all') });
647
+ console.log(JSON.stringify(out, null, 2));
648
+ return;
649
+ }
650
+ if (action === 'open') {
651
+ const out = (0, live_1.liveOpenFolderPath)(cleanOpt(getOptionValue(args, '--id')) ?? undefined);
652
+ console.log(JSON.stringify(out, null, 2));
653
+ return;
654
+ }
655
+ if (action === 'doctor') {
656
+ const out = await (0, live_1.liveDoctor)({ fix: args.includes('--fix') });
657
+ console.log(JSON.stringify(out, null, 2));
658
+ return;
659
+ }
660
+ if (action === 'config') {
661
+ const sub = cleanOpt(args[2] ?? null);
662
+ if (sub === 'show') {
663
+ console.log(JSON.stringify((0, live_1.liveGetConfig)(), null, 2));
664
+ return;
665
+ }
666
+ if (sub === 'wallpaper-show') {
667
+ const id = cleanOpt(getOptionValue(args, '--id'));
668
+ if (!id)
669
+ throw new Error('Usage: live config wallpaper-show --id <id>');
670
+ console.log(JSON.stringify((0, live_1.liveGetWallpaperConfig)(id), null, 2));
671
+ return;
672
+ }
673
+ if (sub === 'wallpaper') {
674
+ const id = cleanOpt(getOptionValue(args, '--id'));
675
+ if (!id) {
676
+ throw new Error('Usage: live config wallpaper --id <id> [--keep-services true|false] [--mute-audio true|false] [--profile performance|balanced|quality] [--display-fps <n|off>] [--seamless-loop true|false] [--loop-crossfade true|false] [--loop-crossfade-seconds <n>] [--optimize true|false] [--proxy-width <n>] [--proxy-fps <n>] [--proxy-crf <n>]');
677
+ }
678
+ const profile = cleanOpt(getOptionValue(args, '--profile'));
679
+ const displayFpsRaw = cleanOpt(getOptionValue(args, '--display-fps'));
680
+ const display_fps = !displayFpsRaw
681
+ ? undefined
682
+ : (displayFpsRaw.toLowerCase() === 'off' ? null : Number(displayFpsRaw));
683
+ const out = (0, live_1.liveSetWallpaperConfig)(id, {
684
+ keep_services: parseBool(getOptionValue(args, '--keep-services')),
685
+ mute_audio: parseBool(getOptionValue(args, '--mute-audio')),
686
+ profile: (profile === 'performance' || profile === 'balanced' || profile === 'quality') ? profile : undefined,
687
+ display_fps: (display_fps === undefined || display_fps === null || Number.isFinite(display_fps)) ? display_fps : undefined,
688
+ seamless_loop: parseBool(getOptionValue(args, '--seamless-loop')),
689
+ loop_crossfade: parseBool(getOptionValue(args, '--loop-crossfade')),
690
+ loop_crossfade_seconds: cleanOpt(getOptionValue(args, '--loop-crossfade-seconds')) ? Number(cleanOpt(getOptionValue(args, '--loop-crossfade-seconds'))) : undefined,
691
+ optimize: parseBool(getOptionValue(args, '--optimize')),
692
+ proxy_width: cleanOpt(getOptionValue(args, '--proxy-width')) ? Number(cleanOpt(getOptionValue(args, '--proxy-width'))) : undefined,
693
+ proxy_fps: cleanOpt(getOptionValue(args, '--proxy-fps')) ? Number(cleanOpt(getOptionValue(args, '--proxy-fps'))) : undefined,
694
+ proxy_crf: cleanOpt(getOptionValue(args, '--proxy-crf')) ? Number(cleanOpt(getOptionValue(args, '--proxy-crf'))) : undefined
695
+ });
696
+ console.log(JSON.stringify(out, null, 2));
697
+ return;
698
+ }
699
+ if (sub === 'runner') {
700
+ const out = (0, live_1.liveSetRunner)({
701
+ bin_name: cleanOpt(getOptionValue(args, '--bin-name')) ?? undefined
702
+ });
703
+ console.log(JSON.stringify(out, null, 2));
704
+ return;
705
+ }
706
+ if (sub === 'apply-defaults') {
707
+ const displayFpsRaw = cleanOpt(getOptionValue(args, '--display-fps'));
708
+ const display_fps = !displayFpsRaw
709
+ ? undefined
710
+ : (displayFpsRaw.toLowerCase() === 'off' ? null : Number(displayFpsRaw));
711
+ const out = (0, live_1.liveSetApplyDefaults)({
712
+ keep_services: parseBool(getOptionValue(args, '--keep-services')),
713
+ mute_audio: parseBool(getOptionValue(args, '--mute-audio')),
714
+ profile: cleanOpt(getOptionValue(args, '--profile')) ?? undefined,
715
+ display_fps: (display_fps === undefined || display_fps === null || Number.isFinite(display_fps)) ? display_fps : undefined,
716
+ seamless_loop: parseBool(getOptionValue(args, '--seamless-loop')),
717
+ loop_crossfade: parseBool(getOptionValue(args, '--loop-crossfade')),
718
+ loop_crossfade_seconds: cleanOpt(getOptionValue(args, '--loop-crossfade-seconds')) ? Number(cleanOpt(getOptionValue(args, '--loop-crossfade-seconds'))) : undefined,
719
+ optimize: parseBool(getOptionValue(args, '--optimize')),
720
+ proxy_width_hd: cleanOpt(getOptionValue(args, '--proxy-width-hd')) ? Number(cleanOpt(getOptionValue(args, '--proxy-width-hd'))) : undefined,
721
+ proxy_width_4k: cleanOpt(getOptionValue(args, '--proxy-width-4k')) ? Number(cleanOpt(getOptionValue(args, '--proxy-width-4k'))) : undefined,
722
+ proxy_fps: cleanOpt(getOptionValue(args, '--proxy-fps')) ? Number(cleanOpt(getOptionValue(args, '--proxy-fps'))) : undefined,
723
+ proxy_crf_hd: cleanOpt(getOptionValue(args, '--proxy-crf-hd')) ? Number(cleanOpt(getOptionValue(args, '--proxy-crf-hd'))) : undefined,
724
+ proxy_crf_4k: cleanOpt(getOptionValue(args, '--proxy-crf-4k')) ? Number(cleanOpt(getOptionValue(args, '--proxy-crf-4k'))) : undefined
725
+ });
726
+ console.log(JSON.stringify(out, null, 2));
727
+ return;
728
+ }
729
+ throw new Error('Usage: live config <show|runner|apply-defaults> ...');
730
+ }
731
+ if (action === 'view') {
732
+ console.log(JSON.stringify((0, live_1.liveViewData)(), null, 2));
733
+ return;
734
+ }
735
+ throw new Error('Usage: live <init|list|browse|search|resolve|preview|preview-clear|fetch|apply|auto-apply|favorite|remove|thumb|open|config|doctor> ...');
736
+ }
479
737
  // Regular commands (need config/state)
480
738
  const config = (0, config_1.loadConfig)();
481
739
  const state = (0, state_1.loadState)();