@soffits/dsh-media-hub 0.15.2 → 0.15.3
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/CHANGELOG.md +8 -0
- package/README.md +5 -3
- package/client.js +4 -4
- package/dist/index.js +345 -346
- package/locale/en.json +3 -1
- package/locale/fr.json +3 -1
- package/locale/zh.json +3 -1
- package/package.json +1 -1
- package/web/boundary.js +31 -0
- package/web/library-view.js +1 -1
- package/web/panel.css +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.15.3
|
|
4
|
+
|
|
5
|
+
- A saved show whose folder is no longer one of the library folders no longer keeps the hub from starting (every page said "starting"); it is left alone.
|
|
6
|
+
- When the page hits an error while drawing, it says what broke and offers *Reload* instead of going blank.
|
|
7
|
+
- Auto-delete only removes watched shows from the hub's own library folder, never from a `libraryRoots` folder of yours.
|
|
8
|
+
- A state file that can't be read (shows, shelves, rooms, downloads, Discover's copies) is moved aside as `<file>.bad-<time>` instead of being overwritten by the next save, and downloaded books are no longer deleted when the shelves file is damaged.
|
|
9
|
+
- A broken address, an odd socket message, a source that ignores *Stop* or a book shelf that can't be trimmed no longer cause an unhandled error; stopping waits at most 10 s.
|
|
10
|
+
|
|
3
11
|
## 0.15.2
|
|
4
12
|
|
|
5
13
|
- A click on the picture plays or pauses, for everyone in the room, and a double click goes full screen with the danmaku. On a phone the first tap still shows the controls.
|
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ This plugin was called Video Sync (`@soffits/dsh-video-sync`) until 0.2.0; the r
|
|
|
10
10
|
- **Local files**: one video or a folder of episodes (numbered files play in natural order). Videos browsers can't play or seek well are remuxed, or transcoded to HLS that plays a few seconds in while the rest is made, and cached. Subtitles next to a video (`.srt`, `.ass`, `.vtt`, also `name.zh.srt`) and text subtitle tracks inside MKV files show up in the player; Chinese, Japanese and Korean legacy encodings are detected.
|
|
11
11
|
- **Link**: the address of a video or a playlist on any site [yt-dlp](https://github.com/yt-dlp/yt-dlp) reads (YouTube, Vimeo, Bilibili and over a thousand more). It shows as one work with its thumbnail, length and episodes (a playlist's videos), and plays like any show from a source: the episode being watched is downloaded first, then the next few, and every viewer streams the same file from DSH. Pick the quality before watching: *Auto* (the best up to `maxHeight`, in formats a browser plays as they are), a height, or *Audio only*. A link to a video inside a playlist plays that video; paste the playlist's own address for all of it. Captions come with each episode: every track a person made, plus machine-made ones only in your language and the video's own, never a machine translation into a third language. The player starts the one in your language, else the video's own when no machine translated it, else none, and names each track in its own language with *auto* on machine-made ones. An episode plays while it downloads: its video and audio are fetched side by side and served as HLS once a few seconds are in, and a room waiting on it shows one progress for the whole episode. Sites that need a signed-in account read the `cookies` setting; other yt-dlp options go in yt-dlp's own config file.
|
|
12
12
|
- **Sync**: the room's state lives on the server with server timestamps; each browser corrects its own clock offset and drift (under 0.3 s ignored, 0.3–2 s caught up by playing 5 % faster or slower, more than 2 s by a seek). Opening a room, switching episode and seeking go through a waiting room, as in Plex: playback holds until every viewer can play a few seconds ahead, each listed as loading or ready, then everyone starts at the same instant; after 10 s anyone may start without the ones still loading. When someone's player stalls mid-episode, everyone pauses with "Waiting for <name>" and resumes together. A dropped connection doesn't stop playback; the player resyncs when it's back.
|
|
13
|
-
- **Library**: shows (a folder of episodes, or one file) in `<stateDir>/library` and any `libraryRoots`, with a poster frame, episodes, size, the total and the free space on the disk. Delete a show or one episode, rename a show, keep it. Watched episodes are marked in the library and in the room; a show watched to the end (its last episode, or every episode) is deleted `autoDeleteDays` later unless someone keeps it, and the list says when. A show an open room plays can't be deleted or renamed. Opening a show again continues where its viewers stopped.
|
|
13
|
+
- **Library**: shows (a folder of episodes, or one file) in `<stateDir>/library` and any `libraryRoots`, with a poster frame, episodes, size, the total and the free space on the disk. Delete a show or one episode, rename a show, keep it. Watched episodes are marked in the library and in the room; a show watched to the end (its last episode, or every episode) is deleted `autoDeleteDays` later unless someone keeps it (only in `<stateDir>/library`, never in a `libraryRoots` folder), and the list says when. A show an open room plays can't be deleted or renamed. Opening a show again continues where its viewers stopped.
|
|
14
14
|
- **Sources**: one search box over *All sources* or one of them; each source is a configured command line tool that speaks a small JSON protocol ([docs/source-protocol.md](docs/source-protocol.md), the hub's public interface for extensions, see [docs/extensions.md](docs/extensions.md)) and brings its kinds. The defaults are `fanqie` (short dramas, audiobooks, novels) and `bookfetch source` (ebooks and papers); every request runs through the source's command, so any proxy its launcher enforces holds, and a wrapper for another site is one more entry. *Watch* opens it at once, for you alone (*Watch together* in the player opens that room to others where it stands and copies its link); *Save to library* adds the show; *Download all (offline)* keeps every episode on disk. Sources implement one small interface (`src/sources/index.js`).
|
|
15
15
|
- **Search results as cards**: cover, title, score, how many watched it ("36.7万次播放" or "36.7K plays", by the page language), episodes, whether it is finished, tags; *Details* shows everything the source gives (cast, heat, last update…) and the other seasons and linked works.
|
|
16
16
|
- **Pictures for everything**: a work's cover, a show's poster and a room's preview all come from the host and are cached under `<stateDir>/covers`: a source's cover through the source's own command (so its proxy keeps applying), a link's thumbnail through the `proxies` setting, and a still of the video for local files and shows without a cover. A browser never contacts a site's CDN, and a placeholder shows only when there is no picture at all.
|
|
@@ -29,6 +29,8 @@ dsh plugin --profile web add github:soffits/dsh-media-hub
|
|
|
29
29
|
|
|
30
30
|
The bundle adds two rows: `media-hub` (the page, shelves, rooms, media) and `media-hub-tools` (the assistant's `videosync` tool for rooms). Needs `ffmpeg`/`ffprobe` on the PATH for local media, `yt-dlp` for Link (keep it current: sites change), the commands of the sources you use (`fanqie` from fanqie-cli, `bookfetch` from [bookfetch-cli](https://github.com/soffits/bookfetch-cli); a source is hidden without its command), and optionally Calibre's `ebook-convert` for format conversion. Coming from Video Sync: replace the `@soffits/dsh-video-sync` package with this one; an existing `$DSH_HOME/videosync` folder keeps being used. A source's command runs in `<stateDir>/<source id>`, so nothing it writes into its working folder lands in DSH's.
|
|
31
31
|
|
|
32
|
+
Removing the package leaves `<stateDir>` (the library, the shelves, the watch log) on disk; delete it yourself if you want them gone.
|
|
33
|
+
|
|
32
34
|
## Use
|
|
33
35
|
|
|
34
36
|
- **From the page**: open **Media** in the sidebar (the `label` setting renames it). Three tabs: **Watching** (the default) lists the rooms opened to others, with who is in them and the episode, with copying a room's link or closing it, and the shows someone started, to continue; **Library** manages the shows and starts or continues one; **Discover** searches: pick a source (*All sources*, every configured one, or *Link* to paste the address of a video or playlist), then one of that source's categories, then search. Before any search it shows what the sources put forward for that category (their rank lists and new arrivals, from a source's `trending` verb) (Link has none). They are kept as dated copies and refreshed in the background about daily, so the page never waits on a site; *All sources* lists each source's boards under its name. Picks from a `recommender` show on the Watching tab. The tab, source and category are in the page's URL (`?vs-tab=library`, `?vs-tab=discover&vs-source=<id>&vs-kind=<id>`), so a refresh and the back button keep them and a link can open a tab directly; the last source and category are remembered per browser.
|
|
@@ -46,7 +48,7 @@ The page follows DSH's language setting. It ships in English, French and Chinese
|
|
|
46
48
|
| Field | Default | |
|
|
47
49
|
|---|---|---|
|
|
48
50
|
| `label` | empty | Name of the sidebar entry: a string, or `{ "<tag>": "text" }` with one per language, picked by the viewer's language tag, then its primary subtag (`pt-BR` → `pt`), then `en`. Empty shows the page's own name (*Media*) in the viewer's language. |
|
|
49
|
-
| `libraryRoots` | `[]` | More folders the panel may start rooms from. |
|
|
51
|
+
| `libraryRoots` | `[]` | More folders the panel may start rooms from. Shows in them are never deleted on their own. |
|
|
50
52
|
| `delivery` | `origin` | `origin` serves media from DSH's own web server. `r2` (object storage with signed links) is reserved and not built yet. |
|
|
51
53
|
| `stateDir` | `$DSH_HOME/media-hub` (or an existing `$DSH_HOME/videosync`) | Open rooms, the default library folder (downloads go there), shelves and book files (`books/`), prepared media, posters, the watch log and library notes. |
|
|
52
54
|
| `maxHeight` | `1080` | Taller videos are transcoded to this height. |
|
|
@@ -54,7 +56,7 @@ The page follows DSH's language setting. It ships in English, French and Chinese
|
|
|
54
56
|
| `emptyMinutes` | `30` | A room closes this long after its last viewer left. |
|
|
55
57
|
| `unopenedHours` | `24` | A room nobody opened yet closes this long after it was created. |
|
|
56
58
|
| `cacheDays` | `7` | Prepared media no room uses is deleted after this long. |
|
|
57
|
-
| `autoDeleteDays` | `7` | A show is deleted this long after it was watched to the end, unless kept. `0` keeps everything. |
|
|
59
|
+
| `autoDeleteDays` | `7` | A show in `<stateDir>/library` is deleted this long after it was watched to the end, unless kept. `0` keeps everything. |
|
|
58
60
|
| `cacheAhead` | `5` | Rolling cache: episodes kept after the one being watched. |
|
|
59
61
|
| `cacheBehind` | `1` | Rolling cache: watched episodes kept before it; older watched ones are deleted. |
|
|
60
62
|
| `cacheLimitGb` | `5` | Rolling cache: most disk (GB) cached episodes of shows from a source may use, the prepared copies included. Kept-offline shows don't count. `0` is no limit. |
|
package/client.js
CHANGED
|
@@ -90,11 +90,11 @@ window.__ModuleLoader__.load({
|
|
|
90
90
|
/** The page's modules, loaded once and handed this page's React, DSH's components and the kit. */
|
|
91
91
|
let pageModule
|
|
92
92
|
const loadPage = () => {
|
|
93
|
-
pageModule ??= Promise.all([import(web('ui.js')), import(web('page.js'))]).then(([ui, page]) => {
|
|
93
|
+
pageModule ??= Promise.all([import(web('ui.js')), import(web('page.js')), import(web('boundary.js'))]).then(([ui, page, boundary]) => {
|
|
94
94
|
ui.init(React, { primitives, kit })
|
|
95
95
|
ui.setChat(chat)
|
|
96
96
|
ui.setPoints(points)
|
|
97
|
-
return page
|
|
97
|
+
return { Page: page.Page, Boundary: boundary.createBoundary(React) }
|
|
98
98
|
})
|
|
99
99
|
return pageModule
|
|
100
100
|
}
|
|
@@ -134,7 +134,7 @@ window.__ModuleLoader__.load({
|
|
|
134
134
|
return () => { live = false }
|
|
135
135
|
}, [ready])
|
|
136
136
|
return h('div', { className: 'vsync-page' },
|
|
137
|
-
page !== null && h(page.Page, { t, initialRoom }),
|
|
137
|
+
page !== null && h(page.Boundary, { t }, h(page.Page, { t, initialRoom })),
|
|
138
138
|
error && h('p', { className: 'vsync-error', role: 'alert', style: { padding: 24 } }, error))
|
|
139
139
|
}
|
|
140
140
|
|
|
@@ -201,7 +201,7 @@ window.__ModuleLoader__.load({
|
|
|
201
201
|
locale: NS,
|
|
202
202
|
label: () => sourceName(),
|
|
203
203
|
}, SidebarIcon)))
|
|
204
|
-
})
|
|
204
|
+
}, error => console.warn('[media-hub] could not load its words and settings: %s', error.message))
|
|
205
205
|
return () => {
|
|
206
206
|
live = false
|
|
207
207
|
for (const dispose of disposers.reverse()) dispose()
|