Code Monkey home page Code Monkey logo

go-videosmover's Introduction

Alt text Videos Mover

Description

VideosMover is a lightweight cross-platform desktop-webapp helper which can make it easy to play videos in Kodi media player as it can find your downloaded videos, get video descriptions from TMDB (https://www.themoviedb.org/), prepare folders based on type and move them accordingly. Custom http cache server based on https://github.com/VictoriaMetrics/fastcache is provided for caching online results (etcd impl also available). Future versions will have more capabilities to make your video library management even easier, for example, automatically showing you which videos were viewed already and such.

Light mode screenshot: Alt text

Dark mode screenshot: Alt text

This project contains 5 applications:

  • commander
  • proxy_server
  • webview
  • cache_server
  • remove_torrents

How to use:

Remove_torrents app is used as an execute action after each torrent download complete (see below for details). It will just remove the finished download from the torrent list so it can be moved.
The rest are used together, proxy_server and cache_server are meant to run always, so you can add them on startup, both are a very small webserver (1mb RAM usage and basically no CPU). One is a proxy used from an external tool (can be an Android app or such) to your PC, the other is a server to cache online metadata results.
The proxy will execute command-line actions on the commander which actually does the jobs, like searching videos, moving them and so on.
The webview is the UI part and basically just opens a tab in your default browser which issues requests on the proxy as needed. Closing the tab will close the webview app as it listens to a "pulse" every second.

Deployment script provided in static/deploy/rebuild_<OS>.sh
Tests provided for each commander action (core of app)

Proxy Server

How to run Server:

  1. make a config (minimal example provided), options include:
    • logFile path to logfile (default: vm-proxyserver.log)
    • port port of server (default: 8077)
    • bin list of objects containing uri, path and cfgPath (see example)
  2. from root of project cd cmd/proxy_server && go install NOTE (windows): add -ldflags="-H windowsgui"
  3. launch server providing config path

Proxy also has internal endpoints included like: /shutdown?seconds=30 which would shutdown your pc in 30 seconds, or don't specify seconds and it will shutdown instantly

JSON requests should be like (regardless of GET or POST usage):

{  
  "action": action to give the executable (like "search")  
  "payload" : json data that will be serialized to tmp file, 
      the path will be sent to jar/bin (file will be deleted after request is done)    
}

JSON response should be like:

{  
  "code": 200 or 500 or whatever  
  "error" : "" if error not empty (errors might be, jar not found or such)  
  "date": "2019-02-20 20:15:85"  
  "body" : some JSON body response or empty if error  
}

Webview

How to run:

  1. make a config (minimal example provided), options include:

    • logFile path to logfile (default: vm-webview.log)
    • port port of server (default: 8079)
    • autoDarkModeEnable enable auto dark theme mode (defaut: true)
    • autoDarkModeHourStart hour after which to enable dark theme (default: 18)
    • autoDarkModeHourEnd hour until which to enable dark theme (default: 6)
    • serverPingTimeoutMs timeout to server close if ping failed (default: 10000 -> 10sec)
    • videosMoverAPI address of videos mover API (default: http://localhost:8077/exec-bin/videos-mover)
    • htmlFilesPath path to html files and templates
    • downloadsPath path to downloaded videos
    • moviesPath path to move movies to
    • tvSeriesPath path to move tv shows to
  2. from root of project cd cmd/webview && go install NOTE (windows): add -ldflags="-H windowsgui"

  3. launch server providing config path

TODO:

  • add custom logo
  • improve UI in general (improve html responsiveness, add CSS animations, hover move button and etc.)

Commander

How to run:

  1. make a config (configured example provided), options include:
    • logFile path to logfile (default: vm-commander.log)
    • cacheAddress address of cache server (etcd) (default: http://127.0.0.1:2379)
    • cachePoolSize size of cache connection pool -> not used by etcd (default: 10)
    • minimumVideoSize minimum byte file size to be considered proper video and not trailer or such (default: 52428800 -> 50mb)
    • similarityPercent percent used to determine if video exists on disk -> Levenshtein algorithm used (default: 80)
    • maxOutputWalkDepth how many child folder levels to scan for videos when executing output action find on disk (default: 2)
    • maxSearchWalkDepth how many child folder levels to scan for videos when executing search action find on disk (default: 4)
    • maxWebSearchResultCount max results to obtain from online metadata search -> TMDB (default: 10)
    • headerBytesSize size of header in bytes, used to determine file types (default: 261)
    • restrictedRemovePaths list of paths that are restricted from clean / removal operations
    • nameTrimRegexes list of regexes to use when cleaning the name of videos downloaded
    • searchExcludePaths list of folder names in downloads path to exclude from searching
    • allowedMIMETypes list of MIME types considered proper videos
    • allowedSubtitleExtensions list of subtitle extensions used when deciding what subs to move with the videos
  2. from root of project cd cmd/commander && go install NOTE (windows): add -ldflags="-H windowsgui"
  3. OPTIONAL: for the TMDB online API search to work you need to set tmdbApiKey config property to your API key
  4. execute actions on built app

Cache Server

How to run:

  1. make a config (minimal example provided), options include:
    • logFile path to logfile (default: vm-cacheserver.log)
    • port port of server (default: 8076)
    • maxSizeBytes size in bytes of cache (defaut: 1024 * 1024 * 10 -> 10mb)
    • CacheDBPath path to cache
  2. from root of project cd cmd/cache_server && go install NOTE (windows): add -ldflags="-H windowsgui"
  3. launch server providing config path

Remove Torrents

How to run:

  1. from root of project cd cmd/remove_from_qtorrent && go install NOTE (windows): add -ldflags="-H windowsgui"
  2. execute actions on built app

qBittorrent required settings:

  • enable WebUI, set its port and config it to bypass localhost credentials
  • on torrent download completion use the following command: /path/to/remove_from_qtorrent -logFile="path/to/logFile" -port=portNumber -hash="%I"

go-videosmover's People

Contributors

lcserny avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

go-videosmover's Issues

Webview comunication to Proxy Server

  • proxy server should start a ZeroMQ server not a HTTP one
  • Webview should send events onto the ZeroMQ proxy server
  • proxy server ZeroMQ should parse the events and respond correctly

Logo Design

Hi, how are you? I'd like to collaborate on your open source project and propose free logo/icon design for this project. If it's something you're interested in, please, let me know!
Best Regards
Zuur

Sorting

Add video add date and allow table to sort by something, default by date.

Add more tests

Check that configs are validated

Check that main runs at least

Proxy: improve comm

Currently proxy send data to commander through a tmp file, change it to either send a base64 string or through socket?

Cache Server with ZeroMQ

  • Switch the Cache Server from HTTP to ZeroMQ
  • Change commander to use ZeroMQ API when communicating to Cache Server

Remove TMP file when issueing commander exec

Currently the Proxy Server, receives a payload with a command and data, saves it to a tmp file, calls a command on the commander which in turn reads the data from that TMP file.
This is slow.
Remove the TMP file flow and send data to commander as a Base64 encoded (or smaller if another algorithm is found) string directly.
The commander needs to parse this payload, decode the Base64 string, decode the json into and object and continue normally.

Change also the remove to Recycle Bin to direct OS delete.

After its done, do the same for the Java version :)

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.