Giter Club home page Giter Club logo

Comments (8)

asapach avatar asapach commented on May 18, 2024

It does already have an API, although not really documented:

  1. POST /torrents with JSON like {"link":"magnet link or URL"} - will add a new torrent
    DELETE /torrents/{infoHash} will delete the torrent
  2. It will automatically start downloading when you request a file
  3. GET /torrents will return all torrents and GET /torrents/{infoHash} one torrent
  4. That would require downloading the files first (at least partially) and integrating with ffmpeg or some other external tool, and I'm not sure it's a good idea. Suggestions are welcome.

Do you have a particular scenario you would like to use the API in?

from peerflix-server.

diaskooo avatar diaskooo commented on May 18, 2024

From /torrents (POST, DELETE, GET) all works

Not enough GET /torrents/{infoHash}/stat - Information about running torrent Speed, Traffic, Peers, Queue. And working through WebSokket I do not like because of the limited SMART TV

  1. That would require downloading the files first (at least partially) and integrating with ffmpeg or some other external tool, and I'm not sure it's a good idea. Suggestions are welcome.

GET /torrents/{infoHash}/codec
This functionality is only active for distribution be used to display information about a file in the information section of a resolution, some ulcer 2.1 or 5.1, etc.

from peerflix-server.

asapach avatar asapach commented on May 18, 2024

Added the /stats endpoint and released as v0.0.19
https://github.com/asapach/peerflix-server/blob/master/REST.md
Will investigate ffmpeg next.

from peerflix-server.

asapach avatar asapach commented on May 18, 2024

Added support for ffmpeg in v0.0.20:

  • /torrents/{infoHash}/files/{path}?ffmpeg=probe - will run ffprobe and dump the JSON output containing the format and streams information. Limitation: ffprobe doesn't work with streams, so the file has to be at least partially downloaded, so that it could inspect the headers.
  • /torrents/{infoHash}/files/{path}?ffmpeg=remux - will run ffmpeg and remux the file to MP4 - meaning the video stream will be copied and the audio stream will be converted to AAC (this should make it work in most browsers). Limitation: the video output doesn't support seeking, so you'll not be able to rewind.

To make it work you need to install ffmpeg: https://github.com/fluent-ffmpeg/node-fluent-ffmpeg#ffmpeg-and-ffprobe
On Windows you'll need to set FFMPEG_PATH and FFPROBE_PATH env variables (e.g. SET FFPROBE_PATH=C:\ffmpeg\bin\ffprobe.exe
On Ubuntu you'll need to install the package from the ppa:

sudo apt-add-repository ppa:jon-severinsson/ffmpeg
sudo apt-get update
sudo apt-get install ffmpeg

from peerflix-server.

asapach avatar asapach commented on May 18, 2024

@diaskooo, could you please try it out and provide some feedback?

from peerflix-server.

 avatar commented on May 18, 2024

I'll try feature with converting to MP4, but is it possible to add ability for rewinding (перемотка) video ?

from peerflix-server.

asapach avatar asapach commented on May 18, 2024

In order to make seek/rewind work, the encoder needs to build the index that maps time to position (byte offset) in the file. For example 0:00:30 could map to offset 65536 in the stream. This allows the video player to jump directly to the requested position without having to make guesses or search the stream for timecodes. Unfortunately it's impossible to build the index on the fly: at least one full pass is required.

from peerflix-server.

asapach avatar asapach commented on May 18, 2024

Merging this thread into #19

from peerflix-server.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.