npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@mpv-easy/play-with

v0.1.1

Published

tampermonkey script for using local mpv player to play web videos, which requires local support for `mpv-easy://` protocol

Downloads

8

Readme

mpv-play-with

tampermonkey script for using local mpv player to play web videos, which requires local support for mpv-easy:// protocol

If you use mpv-easy, you only need to start mpv once, and mpv-easy will automatically register the mpv-easy:// protocol

Inspired by https://github.com/LuckyPuppy514/Play-With-MPV

install

You need to install the tampermonkey extension first

Then install script mpv-easy-play-with.user.js

npm

npm i @mpv-easy/play-with
import { sendToMpv, encodeToBase64 } from '@mpv-easy/play-with';
import type { PlayItem } from '@mpv-easy/play-with';

const list: PlayItem[] = [];
const base64 = encodeToBase64(list);
sendToMpv(base64);

type

A playable video corresponds to the following structure

export type PlayItem = {
  url: string;
  title: string;
  args: string[];
};

Encode a set of video information in base64 and pass it to the player Since the URL length is limited to 2048, zip compression is used to support more videos.

export function getMpvUrl(playList: PlayItem[]): string {
  const jsonStr = JSON.stringify(playList);
  const zipBuf = gzipSync(strToU8(jsonStr));
  const base64 = encode(zipBuf);
  return `mpv-easy://${base64}`;
}

chunk

When the data length exceeds 2048, you can use chunks to pass the data. You only need to concatenate the current chunk id and the total number of chunks after base64. To prevent errors in the order of chunk merging, it is recommended to wait 100ms after each chunk is sent to allow the program enough time to write the file.

base64?chunkId&chunkCount

short key

ctrl+shift+r

reset icon position to bottom left

rules

youtube

https://www.youtube.com/
https://www.youtube.com/watch?v=xxx
https://www.youtube.com/watch?v=xxx&list=xxx
https://www.youtube.com/@xxx
https://www.youtube.com/@xxx/videos

jellyfin

host/web/index.html#!/movies.html?topParentId=xxx
host/web/index.html#!/details?id=xxx&serverId=xxx
host/web/index.html#!/video

bilibili

todo

custom protocol

regedit.exe /S ./mpv-easy.reg
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Google\Chrome]
"ExternalProtocolDialogShowAlwaysOpenCheckbox"=dword:00000001

[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Edge]
"ExternalProtocolDialogShowAlwaysOpenCheckbox"=dword:00000001

[HKEY_CLASSES_ROOT\mpv-easy]
@="mpv-easy"
"URL Protocol"=""

[HKEY_CLASSES_ROOT\mpv-easy\DefaultIcon]
@=""

[HKEY_CLASSES_ROOT\mpv-easy\shell]
@=""

[HKEY_CLASSES_ROOT\mpv-easy\shell\open]
@=""

[HKEY_CLASSES_ROOT\mpv-easy\shell\open\command]
@="c:\\your\\mpv-easy-play-with-windows c:\\your\\mpv.exe %1"