Git Product home page Git Product logo

avutil's Introduction

avutil

Release

Provide some useful util functions (and a poweful tool tidyup) for tidying up your personal video folder. Data source from LIBRARY or BUS.

  • Extract designatio
  • Search folder (recursively)
  • Pull & save video info (title, actors etc.)
  • Download cover image
  • Rename video file

gjf

Environment

Python >= 3.4
BeautifulSoup4 >= 4.7.0
requests >= 2.21.0

Install

pip install avutil

Usage of tidyup

$ tidyup -h
usage: tidyup [-h] [-r] [-i IN] [-o OUT] [-p PROXY] [-s SOURCE] [-t THREAD] [-e ENCODER] [--with-poster]

Tidy up your personal video dir

optional arguments:
  -h, --help            show this help message and exit
  -r                    search dir recursively
  -i IN, --in IN        video input dir
  -o OUT, --out OUT     video output dir
  -p PROXY, --proxy PROXY
                        http proxy address
  -s SOURCE, --source SOURCE
                        data source of video info, 'library' or 'bus'
  -t THREAD, --thread THREAD
                        threads num, use multi-threads to download info & images
  -e ENCODER, --encoder ENCODER
                        encoder of meta-data, 'nfo'(default) or 'vsmeta'
  --with-poster         save poster

Tidy up current dir

$ tidyup

Python script usage

Import avutil:

import avutil

Search folder recursively to find videos:

folder = "StudyResource"
videos = avutil.Search_folder(folder)
# videos: map { designatio -> [ slice_paths ] }

Or you can specify the extension type of video

videos = avutil.Search_folder(folder, media_suffix={".mp4", ".wmv", ".avi", ".mkv"})

Pull video info from LIBRARY by default & download cover image

for designatio, file_paths in videos.items():
    video = avutil.Video(designatio, file_paths)

    # Pull video info
    video.pull_info()

    # Download cover image (as video.title + .jpg)
    video.download_cover()

It's okey using BUS

    # Pull video info
    video.pull_info(source=avutil.Bus)

Save video info as .nfo file

    # Save video info
    video.save_info()

Tidy up!

    # Tidy up (rename to video.designatio + video.actors)
    video.rename()

Proxy

Proxy is supported in avutil in two ways, you can either pass http-proxy in code

video.pull_info(http_proxy="http://127.0.0.1:1087")
video.download_cover(http_proxy="http://127.0.0.1:1087")

Or define a global bash variable (eg. http proxy):

$ export HTTP_PROXY="http://127.0.0.1:1087"

avutil's People

Contributors

lqlsoftware avatar

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.