Skip to content

Instantly share code, notes, and snippets.

@tilllt
Created February 8, 2016 11:55
Show Gist options
  • Save tilllt/a1bd4bebe5d74555256b to your computer and use it in GitHub Desktop.
Save tilllt/a1bd4bebe5d74555256b to your computer and use it in GitHub Desktop.
class Scrape
def initialize (pathname, options)
# pathname is required. when only called with pathname, recurses pathname and returns JSON with basic data (filename, size, creationdate) without writing JSON to cache
# options: if called with an optional cache_directory, scans cache if this scan has been done before and only scans if not in cache, if not in cache, writes JSON to cache directory
# options: if called with an optional dir_ignore array, ignores passed patterns, if not, uses default: dir_ignore=[".AppleDouble",".AppleDB",".AppleDesktop",".DS_Store", ".localized"]
end
def mediaspecs (pathname, options)
# pathname is required. when only called with pathname, looks for JSON from initialize method in cache and adds ffprober mediaspecs to JSON hash (Codec, Framsize, fps, etc.pp.), if no JSON from initializer in cache, runs initializer scan to cache directory and then mediaspecs scan
# options: if called with an optional ext_qualifier array, only scans those extensions, if not, uses default: qualifier_ext=[".mkv",".avi",".mp4",".m4v",".mov",".flv",".ogg",".mpeg",".jpg",".mpg",".mp3"]
end
def xxhash (pathname)
# pathname is required. looks for JSON from initialize method in cache and adds xxhash to JSON hash, if no JSON from initializer in cache, runs initializer scan to cache directory and then hashes the listed files
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment