GithubHelp home page GithubHelp logo

wybiral / tube Goto Github PK

View Code? Open in Web Editor NEW
262.0 13.0 77.0 1.24 MB

Personal video streaming server.

License: MIT License

Go 77.61% CSS 12.05% HTML 5.25% Python 5.10%
streaming-video tube youtube golang

tube's Introduction

tube GoDoc

This is a Golang project to build a self hosted "tube"-style video player for watching your own video collection over HTTP or hosting your own channel for others to watch.

Some of the key features include:

  • Easy to add videos (just move a file into the folder)
  • No database (video info pulled from file metadata)
  • No JavaScript (the player UI is entirely HTML)
  • Easy to customize CSS and HTML template
  • Automatically generates RSS feed (at /feed.xml)
  • Builtin Tor onion service support
  • Clean, simple, familiar UI

Currently only supports MP4 video files so you may need to re-encode your media to MP4 using something like ffmpeg.

Since all of the video info comes from metadata it's also useful to have a metadata editor such as EasyTAG (which supports attaching images as thumbnails too).

By default the server is configured to run on 127.0.0.1:0 which will assign a random port every time you run it. This is to avoid conflicting with other applications and to ensure privacy. You can configure this to be any specific host:port by editing config.json before running the server. You can also change the RSS feed details and library path from config.json.

installation

from release

  1. Download release for your platform
  2. Extract zip archive
  3. Run tube executable to start server (this will output the URL for accessing from a browser)
  4. Move videos to videos directory
  5. Open the URL from step 3 and enjoy!

from source

  1. Install Golang if you don't already have it
  2. go get github.com/wybiral/tube
  3. cd $GOPATH/src/github.com/wybiral/tube
  4. go run main.go (this will output the URL for accessing from a browser)
  5. Move videos to $GOPATH/src/github.com/wybiral/tube/videos
  6. Open the URL from step 4 and enjoy!

tube's People

Contributors

wybiral avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tube's Issues

connection refused

$ go run main.go
2019/07/19 00:08:34 dial tcp 127.0.0.1:9051: connect: connection refused
exit status 1

help me.

Multiple library paths

It would be useful to support multiple library paths instead of just one. Something like this in the config.json file:

{
  "libraries": [
    {"path": "/path/to/season01", "prefix": "s01"},
    {"path": "/path/to/season02", "prefix": "s02"}
  ]
}

The prefixes will be included in the URL paths, so you might have /v/s01/e01 and so on. This will ensure that all names are unique across multiple library paths and allow for some hierarchical structuring.

Using "prefix" as the key may be too ambiguous though. Consider using "name" or "id" or something.

One question this opens is how to visually convey the path difference in the UI. Especially in the sidebar video selection. Could be another line like the modified field?

RSS Feed

An RSS feed should be generated from the scanned files and provided at some endpoint (maybe /feed.xml). Even better if it supports JSON feeds too (/feed.json).

Most likely implementation: https://github.com/gorilla/feeds

Documentation

Don't release an official v0.0.1 until this thing is better documented. Both in terms of README and in terms of code comments.

This should be the last thing done before v0.0.1 and will probably involve a general code review to catch any missing documentation and to make sure the behavior is consistent with the docs.

Build zip archives

Requiring a proper Go environment setup is messy and not user friendly at all. The solution will be to build the project as a zip archive for each platform containing the relative static files and binary application.

This will probably be done with a Python script.

Can't find config.json under ubuntu server

Hey,

1)about config.json
When I try to run tube as a service under ubuntu 16 tls , tube can't load the config.json file automatic,but it can work well under command line in the tube folder. how about add a function like -c /path/config.json ?

  1. If organize videos with folders ,will tube support it ?

best regards

Cache the feed

Currently the RSS feed is generated every time it's requested. That's pretty wasteful if people are requesting the feed at some frequency, especially if there are a lot of videos in the library. It would be best to only build the feed after the library changes.

It's probably easiest to move the feed generating portion into the Library type. It is a feed of the library, after all. Otherwise we'd need some kind of messaging to trigger the outside components when the library is changed.

Better error messages

Errors like #15 should be more clear about why they're happening. In that case it was because the Tor controller port wasn't open so the application should notify the user about this and possibly recommend a solution (disable Tor or check the daemon, in this case).

Tor hidden service

Add the following (optional) structure to config.json:

"tor": {
  "onion_file": "/path/to/key/file",
  "controller": {
    "host": "127.0.0.1",
    "port": 9051
  }
}

If it exists the server will start a Tor hidden service using the onion key file routed to the local host:port TCP server. If the tor structure is in the config file but onion_file is blank a random onion will be generated.

To make things even smoother, when the external_url property of feed is blank it can be filled with the onion address.

This will make it easy to publish content on Tor in a way that RSS readers can subscribe to and remotely access.

Outside the scope of this project: if someone implemented a Tor proxied feed reader into the backend of this you could build a YouTube-like application where people could subscribe to peer videos and host their own. Just an idea.

Library Update

Having to restart the server to update the library is really annoying and it would interrupt any streams currently playing. Here are some possibilities:

  • Watch the videos directory for file changes and update (best)
  • Provide a way to force an update on demand
  • Update at a configurable interval

Debounce watcher

Currently the watcher is working overtime while a large file is being copied into the library because every flush during the copy triggers a write event in fsnotify which results in a bunch of unnecessary Library.Remove & Library.Add calls.

This can be fixed by debouncing the watcher so that events don't cause an action on a specific path until a fixed amount of time passes with no events. It may even be optimal to just accumulate all changes to the library and perform them in batch after a reasonable debounce time.

Configuration

Right now there is no configuration but it would be more ideal to have a configuration file for specifying things like library path and server port.

Use onion address for feed defaults

If no explicit external_url or link values are supplied in config.json and you run the server as a Tor onion service the server should plug in the onion address for those values.

This will make it easier to subscribe from RSS readers through a Tor proxy without any setup from a hosting perspective.

tor keys problem

the config file seems to just ignore the tor keys, and when it generates one it doesn't save it on any particular file.
would be extremely helpful if the current address got saved somehow.

this piece of code could be modified to store the generated key for future usage:

// AddOnion adds Onion hidden service. If no private key is supplied one will

so it wont change the onion url everytime the server starts

About the number of visits supported at the same time

Hi:
I want to know how many people can access this system at the same time on the premise that the network bandwidth is not a problem? After the deployment of the intranet, I found that the response speed of about 6 or 7 simultaneous accesses became very slow or even stuck. Is there any optimization method?

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.