Giter Club home page Giter Club logo

media-manager's Introduction

media-manager

useful commands to prepare media files:

rename files to md5:

md5sum ./* | sed -e 's/\([^ ]*\)[ ]*\(.*\(\..*\)\)$/mv -v "\2" "\1\3"/' | sh

add md5 prefix to files:

md5sum ./* | sed -e 's/\([^ ]*\)[ ]*\(.+*\/\(.*\)\(\..*\)\)$/mv -v "\2" "\1 -- \3\4"/'

you can use find command for nested directories: this variant move all files to current directory

find ./ -type f -exec md5sum {} \; | sed -e 's/\([^ ]*\)[ ]*\(.*\(\..*\)\)$/mv -v "\2" "\1\3"/' | sh

media-manager's People

Contributors

unel avatar dependabot[bot] avatar

Stargazers

 avatar

Watchers

 avatar  avatar

media-manager's Issues

basic files upload

  • add dnd for upload files
  • add handle for upload files
  • join them together
  • ...
  • profit!

basic meta information generation

add watcher (use https://github.com/paulmillr/chokidar) for generating meta information file in directory env.INFO_ROOT, meta file name === shome_hash_fn(file content).meta.yml, format - yaml

processed files also rename to shome_hash_fn(file content).(ext)

hash_fn can be md5 or sha-1, for
sha-1 we can use builtin library, see https://stackoverflow.com/questions/6984139/how-can-i-get-the-sha1-hash-of-a-string-in-node-js and https://stackoverflow.com/a/69399958:

const crypto = this.crypto || require('crypto').webcrypto;

const sha1sum = async (message) => {
  const encoder = new TextEncoder()
  const data = encoder.encode(message)
  const hashBuffer = await crypto.subtle.digest('SHA-1', data)
  const hashArray = Array.from(new Uint8Array(hashBuffer));                     // convert buffer to byte array
  const hashHex = hashArray.map(b => b.toString(16).padStart(2, '0')).join(''); // convert bytes to hex string
  return hashHex;
}

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.