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

stremio-local-addon

v1.9.2

Published

Local add-on to find playable files: .torrent, .mp4, .mkv and .avi

Downloads

25

Readme

stremio-local-addon

An add-on for stremio meant to be ran locally which indexes locally found torrent and video files

It does a few things:

  • Scans the filesystem for video files (currently mp4, mkv, avi and others - depends on the implementation in lib/findFiles) and torrent files containing videos
  • Tries to recognize video files as entertainment content and associate them with an IMDB ID
  • Presents a catalog to Stremio containing all the found items, where IMDB-recognized video files are grouped by IMDB ID and torrents are grouped by BitTorrent infohash; non-recognized video files are omitted
  • Allows Stremio to open any BitTorrent infoHash using /meta/bt:<infoHash> request to this add-on

Testing

npm start

npm test

Data structure

The data is kept in an set (dictionary) of entries (filePath=>entry). Each entry represents one file on the filesystem.

Each entry is defined by { itemId, name, files }. When the entry represents a filePath of no interest (not an indexable video), we just save { files: [] }. Entries may contain other extra properties such as the Bittorrent-specific ih and sources.

The reason files is an array is that one file on the filesystem may contain multiple indexable videos (e.g. a .torrent file).

itemId

itemId is the stremio metadata ID this entry corresponds to.

It may be formed in two ways:

bt:<bittorrent info hash>

local:<IMDB ID>

In other words, to make a single Stremio MetaItem object, files are grouped either by the torrent they belong in, or by the IMDB ID they are indexed by. So this add-on will only display videos either indexed by IMDB ID or belonging in a torrent.

Storage

The persistence layer is defined in lib/storage, and it keeps each entry as one line in the storage file. Entries may only be added to the storage file, and no entries may be removed.

It allows referencing entries by file path (.byFilePath) or by item ID (.byItemId). There may be more than one entry per item ID.

The in-memory structure is as follows

byFilePath: filePath=>entry

byItemId: itemId=>(filePath=>entry)

Finally, we have the storage.getAggrEntry function, which gives us an aggregate entry for an itemId, by taking all entries for the given itemId and merging them by concatting files and taking the leftmost values of the other properties (name, ih, sources). Taking the leftmost values is OK for torrents since itemId implies grouping by torrent anyway (in other words all ih and sources values will be the same).