-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathindex.html
More file actions
253 lines (253 loc) · 14.1 KB
/
index.html
File metadata and controls
253 lines (253 loc) · 14.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
<html>
<head>
<meta name="google-site-verification" content="hld4LE5BCxMPCXiPW8i1VZQwJeTbKDO2W9ZMGE6foFc" />
<title>Streamarrfs | Stream torrents on your TV with Plex/Jellyfin</title>
</head>
<body>
<div id="preview" sd-model-to-html="text" class="ng-isolate-scope"><div ng-bind-html="trustedHtml" class="ng-binding"><h1>Streamarrfs (experimental)</h1>
<p><a href="https://github.com/puttyman/streamarrfs">Streamarrfs</a> allows you to stream movies or tv shows torrents via plex, jellyfin and etc. Powered by ⚡️<a href="https://github.com/webtorrent/webtorrent">webtorrent</a>.</p>
<p><a href="https://www.buymeacoffee.com/puttyman"><img src="https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png" alt=""Buy Me A Coffee""></a> if you like this project.</p>
<h2>How does it work?</h2>
<ol>
<li>Streamarrfs finds torrents from your favorite torrent indexer. e.g. <a href="https://github.com/Jackett/Jackett">Jackett</a></li>
<li>Stores info about torrents and including files in its internal database (sqlite3).</li>
<li>Mount and creates a virtual directory through <a href="https://github.com/libfuse/libfuse">fuse</a> to simulate as if the files in the torrents are present locally.</li>
<li>Whenever a read if requested to a file, Streamarrfs starts the torrent and stream through the portion of the file requested.</li>
<li>Automatically stop torrents that has no read activity after certain period.</li>
</ol>
<h2>Features</h2>
<ul>
<li>Monitors torrents that are not being streamed and stop them.</li>
<li>Automatically paused followed to a stop of torrents if no read activity detected.</li>
<li>Polls feed(s) on desired frequency.</li>
<li>Ability to seek through video while streaming.</li>
<li>File system can be mounted for other usage e.g. nginx as a file server.</li>
<li>Handles torrent duplicates from multiple feeds.</li>
</ul>
<h3>Supported Indexes</h3>
<ul>
<li><a href="https://github.com/Jackett/Jackett">Jackett</a></li>
</ul>
<h3>Caveats</h3>
<ul>
<li>When Plex or Jellyfin scans your media library it will cause torrents to start. Streamarrfs get around this problem by having a max number of streaming or running torrents see <code>STREAMARRFS_TORRENT_MAX_READY</code>. However, the limit might cause a new stream to result in an <a href="https://github.com/puttyman/streamarrfs?tab=readme-ov-file#occassional-plex-errors">error</a> if the max running torrents has been reached. You can get around this problem by manually stopping the torrent via the <a href="https://github.com/puttyman/streamarrfs?tab=readme-ov-file#is-there-a-web-gui">web gui</a> at <code>http://{HOST}:3000/</code> or simply wait for it to be automatically stopped due to no read activity.</li>
</ul>
<h2>Setup instructions</h2>
<p>At the present this project only supports running as a docker image and on a x86_64 architecture. PRs are welcomed for any features and bug fixes. Given this project is at an experimental stage it is recommended to use a seperate plex server instance.</p>
<h3>Dependencies & Prerequisites</h3>
<ul>
<li><p>Fuse v2 (host).</p>
<pre><code class="bash language-bash"># On Ubuntu 22.04 LTS you may install this with the commands below.
apt update
apt apt install fuse libfuse2 libfuse-dev -y</code></pre></li>
<li><p>Docker & Docker compose v2 (host).</p>
<pre><code class="bash language-bash"># On Ubuntu 22.04 LTS you may install this with the commands below.
apt update
apt install docker.io
# Install docker compose v2
# See: https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-compose-on-ubuntu-22-04
# Confirm you have docker and compose v2.x.x
# Note make sure you have at least docker-compose 2.24
docker info
docker compose version</code></pre></li>
<li><p>Root access. Running the image as a user should be possible with a few tweaks.</p></li>
<li><p>Hardware. Recommended minimum of 8gb RAM due to a <a href="https://github.com/webtorrent/webtorrent/issues/1973">webtorrent issue</a>.</p></li>
</ul>
<h3>Common steps for Plex & Jellyfin (Tested on Ubuntu 22.04 LTS)</h3>
<ol>
<li><p>Make sure your host has the fuse at <code>/dev/fuse</code>.</p>
<p>ls /dev/fuse</p></li>
<li><p>SSH as root with command:</p>
<p>sudo su</p></li>
<li><p>Create a directory where Streamarrfs will mount the torrents' files.</p>
<p>mkdir /tmp/streamarrfs-tmp</p></li>
<li><p>Create & change to directory for the docker compose file.</p>
<p>mkdir /opt/streamarrfs && cd /opt/streamarrfs</p></li>
<li><p>Create the docker-compose.yml file from the examples. </p></li>
</ol>
<pre><code class="bash language-bash"> curl https://raw.githubusercontent.com/puttyman/streamarrfs/master/examples/plex/docker-compose.yml > docker-compose.yml</code></pre>
<ol start="7">
<li>Start the docker compose stack in the background.</li>
</ol>
<pre><code class="bash language-bash"> docker compose up -d</code></pre>
<ol start="8">
<li>Streamarrfs should now have the files of torrents mounted under <strong>/tmp/streamarrfs-tmp/streamarrfs-mnt/</strong>. You may now access the files directly on your host or mount it to another docker container e.g. Plex or Jellyfin. If you are unsure how to do so continue to <a href="https://github.com/puttyman/streamarrfs?tab=readme-ov-file#adding-the-streamarrfs-files-as-a-media-libray">Adding the streamarrfs files as a media libray</a>.</li>
</ol>
<h3>Adding the streamarrfs files as a media libray</h3>
<h4>Plex</h4>
<p>The instructions below is based on the <a href="https://raw.githubusercontent.com/puttyman/streamarrfs/master/examples/plex/docker-compose.yml">example</a>.</p>
<ol>
<li>On a browser go to your plex instance web ui. Based example on the docker file plex should be listening on the IP of your host machine.</li>
</ol>
<pre><code class="bash language-bash"> open http://{YOUR_HOST_IP}:32400/web</code></pre>
<ol start="2">
<li><p>Follow the <a href="https://support.plex.tv/articles/200288896-basic-setup-wizard/">Official Plex Basic Setup Wizard</a></p></li>
<li><p>At <strong>Step 10.</strong> add the folder <strong>/streamarrfs</strong> as the media library.</p></li>
<li><p>Optional for optimal experience. In the <strong>Advanced</strong> section. <strong>Disable</strong> the following options:</p>
<p>4.1 Prefer artwork based on library language</p>
<p>4.2 Disable Include related external content</p>
<p>4.3 Use local assets</p>
<p>4.4 Enable video preview thumbnails</p></li>
<li><p>Save your media library and you may now test plex with the sample free torrents</p></li>
<li><p>To add a Jackett feed. See <a href="https://github.com/puttyman/streamarrfs?tab=readme-ov-file#adding-jackett-indexers-to-streamarrfs">Adding Jackett indexers to Streamarrfs</a></p></li>
</ol>
<h4>Jellyfin (TODO)</h4>
<p>The instructions below is based on the <a href="https://raw.githubusercontent.com/puttyman/streamarrfs/master/examples/plex/docker-compose.yml">example</a>.</p>
<h3>Adding Jackett indexers to Streamarrfs</h3>
<ol>
<li><p>Create your desired Jackett indexer. The <a href="https://raw.githubusercontent.com/puttyman/streamarrfs/master/examples/plex/docker-compose.yml">example</a> should have an instance of Jackett running at <code>http://{YOUR_HOST_IP}:9117</code>. If you are unsure how to do so follow this <a href="https://www.rapidseedbox.com/blog/guide-to-jackett">guide</a>.</p></li>
<li><p>Copy the RSS link of your indexer from your Jackett web portal.</p></li>
<li><p>In the <a href="https://raw.githubusercontent.com/puttyman/streamarrfs/master/examples/plex/docker-compose.yml">docker-compose.yaml</a> file add a new environment variable named <code>STREAMARRFS_JACKETT_FEED_URL_ITEM_{NAME}</code>. Replace <code>{NAME}</code> with any name so you can uniquely identify your indexer. The value of the variable should be the RSS link of your indexer from Jackett. You may add any extra query params to fine tune your results from Jackett. Example below.</p></li>
</ol>
<pre><code class="yml language-yml"> environment:
- NODE_ENV=production
- STREAMARRFS_JACKETT_FEED_URL_ITEM_YTS=http://HOST:9117/api/v2.0/indexers/yts/results/torznab/api?apikey=key&t=search&cat=&q=</code></pre>
<ol start="4">
<li>Restart your docker stack. <code>docker compose restart</code>.</li>
<li>Enjoy.</li>
</ol>
<h2>Container environment variables</h2>
<p>Note: some variables are undocumented.</p>
<table>
<thead>
<tr>
<th>Variable</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>STREAMARRFS_JACKETT_FEED_URL_PREFIX</td>
<td>The prefix of the environment variable to look for jackett feed URLs. Default = <code>STREAMARRFS_JACKETT_FEED_URL_ITEM</code></td>
</tr>
<tr>
<td>STREAMARRFS_JACKETT_FEED_URL_ITEM_*</td>
<td>The prefix for a jackett feed URL</td>
</tr>
<tr>
<td>STREAMARRFS_LOG_LEVEL</td>
<td>Can be a list seperated by comma for multiple log level. e.g. debug,error,fatal,log,warn,verbose . Default for production error,log</td>
</tr>
<tr>
<td>STREAMARRFS_ADD_FREE_TORRENTS</td>
<td>Add some free torrents on startup. Default = true</td>
</tr>
<tr>
<td>STREAMARRFS_TORRENT_PAUSE_AFTER_MS</td>
<td>The time to wait when no read activity is detected to pause a torrent.</td>
</tr>
<tr>
<td>STREAMARRFS_TORRENT_STOP_AFTER_MS</td>
<td>The time to wait when no read activity is detected to stop a torrent.</td>
</tr>
<tr>
<td>STREAMARRFS_TORRENT_MAX_READY</td>
<td>The maximum number of torrents allowed to be streaming at any given time. Default = 1.</td>
</tr>
<tr>
<td>STREAMARRFS_TORRENT_START_TIMEOUT</td>
<td>The timeout for a torrent to be in a readable state. Default = 2mins.</td>
</tr>
<tr>
<td>STREAMARRFS_TORRENT_INDEXER_CONCURRENCY</td>
<td>The number of concurrent torrents which can be indexed at any given time. Default = 1.</td>
</tr>
<tr>
<td>STREAMARRFS_WEBTORRENT_MAX_CONNS</td>
<td>The max connections per torrent. Default = 1.</td>
</tr>
</tbody>
</table>
<h2>Development</h2>
<h3>Linux/WSL (Ubuntu 22.04 LTS) dependencies</h3>
<ol>
<li><p>Install libfuse</p>
<p>apt update
apt install fuse libfuse2 libfuse-dev -y</p></li>
</ol>
<h3>OSX</h3>
<ol>
<li><p>Install osxfuse</p>
<p>brew install --cask osxfuse</p></li>
<li><p>Alternatively install the .dmg from their <a href="https://github.com/osxfuse/osxfuse/releases">github releases</a>.</p></li>
</ol>
<h3>Getting started</h3>
<ol>
<li>From project root <code>cd server && npm i</code></li>
<li>Init database <code>npm run build</code></li>
<li>Init database <code>npm run migration:run</code></li>
<li>Run dev <code>npm run start:dev</code></li>
</ol>
<h3>Database changes & migrations</h3>
<ol>
<li>Make changes to your entities .ts files.</li>
<li>Generate a migration <code>npm run migration:generate db/migrations/db-change</code>.</li>
</ol>
<h2>FAQs</h2>
<h4>Is there a web GUI?</h4>
<p>There is a simple web gui available at http://{YOUR_SERVER_IP}:3000/web. This GUI should allow you to view stats of streaming and indexing torrent.</p>
<p>The UI also allow you stop them in case you do not wish to wait for the automatic cleanup.</p>
<h4>Why stream when I can download?</h4>
<ul>
<li>Quickly finds content of your liking before needing a download.</li>
<li>No storage required. (only cached during streaming).</li>
<li>Skim through multiple videos to check content.</li>
</ul>
<h2>Occassional Plex errors</h2>
<h3>Errors</h3>
<ul>
<li>Playback error.</li>
<li>Content Unavailable.</li>
<li>An error occurred trying to play "…". Error code: s1001 (Network)</li>
</ul>
<h4>You are likely to get this error if:</h4>
<ul>
<li>Your connection is not fast enough.</li>
<li>Your server is not fast enough.</li>
<li>The torrent does not have enough peers.</li>
<li>The torrent has timed-out to be in readable state.</li>
<li>Plex is currently indexing the library and may cause torrents to start.</li>
<li>Your server does not have enough RAM. Your allocated RAM should be more than the size of the video being streamed. See <a href="https://github.com/webtorrent/webtorrent/issues/1973">webtorrent issue</a></li>
<li>The video your are trying to stream have multiple versions. e.g. movie.1080p.mp4 movie.2160p.mp4.</li>
</ul>
<h4>Solutions & Workarounds</h4>
<ul>
<li>Simply retry playing the video until it works.</li>
<li>Use a feed source that returns movies with 100+ Seeds. e.g. YTS</li>
<li>Check CPU usage and see if your server is powerful enough.</li>
<li>Plex indexing - wait for 1-2mins streamarrfs will stop the torrent after no activity.</li>
<li>Lower the frequency that torrents are added from feeds.</li>
</ul>
<h4>ERROR - Please check that the file exists and the necessary drive is mounted.</h4>
<p>Plex will not see the files from streamarrfs if it has been restarted.
Plex should always be started after streamarrfs has successfully been mounted. Restarting plex should fix the issue.</p>
<p>See <a href="examples/plex/docker-compose.yml">example</a> to start plex as a docker image and depends on streamarrfs.</p>
<h2>Troubleshooting</h2>
<h3>Common issues</h3>
<ul>
<li>When you force remove the container, you have to sudo fusermount -uz /host/mount/point on the hostsystem!</li>
</ul>
<pre><code class="bash language-bash">rm: cannot remove '/tmp/streamarrfs: Device or resource busy
user@server: sudo fusermount -uz /tmp/streamarrfs
user@server: rm -rf /tmp/streamarrfs</code></pre>
<ul>
<li>For running outside of docker.</li>
</ul>
<pre><code>npm ERR! Package fuse was not found in the pkg-config search path.
npm ERR! Perhaps you should add the directory containing `fuse.pc'
npm ERR! to the PKG_CONFIG_PATH environment variable
npm ERR! No package 'fuse' found
npm ERR! Package fuse was not found in the pkg-config search path.
npm ERR! Perhaps you should add the directory containing `fuse.pc'
npm ERR! to the PKG_CONFIG_PATH environment variable
npm ERR! No package 'fuse' found
npm ERR! gyp: Call to 'pkg-config --libs-only-L --libs-only-l fuse' returned exit status 1 while in binding.gyp. while trying to load binding.gyp
npm ERR! gyp ERR! configure error</code></pre>
<p>You need to have libfuse-dev prior to <code>npm install</code> as @cocalc/fuse-native does not ship with libfuse.</p>
<pre><code>sudo apt-get install -y libfuse-dev</code></pre>
<h4>Mounted directory is empty</h4>
<p>Add this flag if you want to allow other users to access this fuse mountpoint.
You need to add user_allow_other flag to /etc/fuse.conf file.</p>
<p><code>user_allow_other</code></p></div></div>
</body>
</html>