--- /dev/null
+/pkg
+/lib_gpkg
+/Gemfile
+/.gpkg*
+/.yardoc
+/coverage
+/rdocs
+/doc
+/tags
--- /dev/null
+GEM
+ remote: https://rubygems.org/
+ specs:
+ diff-lcs (1.5.0)
+ docile (1.4.0)
+ gentex-gems-teamcity_utils (1.13.2)
+ nokogiri (~> 1.6)
+ rexml (~> 3.0)
+ gentex-gpkg (1.29.0)
+ bundler
+ rexml (~> 3.0)
+ yawpa (~> 1.1)
+ json (2.7.1)
+ nokogiri (1.13.8-x86_64-linux)
+ racc (~> 1.4)
+ racc (1.6.0)
+ rake (13.1.0)
+ rexml (3.2.5)
+ rspec (3.12.0)
+ rspec-core (~> 3.12.0)
+ rspec-expectations (~> 3.12.0)
+ rspec-mocks (~> 3.12.0)
+ rspec-core (3.12.2)
+ rspec-support (~> 3.12.0)
+ rspec-expectations (3.12.3)
+ diff-lcs (>= 1.2.0, < 2.0)
+ rspec-support (~> 3.12.0)
+ rspec-mocks (3.12.6)
+ diff-lcs (>= 1.2.0, < 2.0)
+ rspec-support (~> 3.12.0)
+ rspec-support (3.12.1)
+ simplecov (0.22.0)
+ docile (~> 1.1)
+ simplecov-html (~> 0.11)
+ simplecov_json_formatter (~> 0.1)
+ simplecov-html (0.12.3)
+ simplecov_json_formatter (0.1.4)
+ yard (0.9.34)
+ yawpa (1.3.0)
+
+PLATFORMS
+ x86_64-linux
+
+DEPENDENCIES
+ gentex-gems-teamcity_utils (~> 1.3)
+ gentex-gpkg (>= 1.16, < 99.0)
+ json (~> 2.0)
+ rake (~> 13.0)
+ rspec (~> 3.0)
+ simplecov (~> 0.9)
+ yard (~> 0.9)
+
+BUNDLED WITH
+ 2.4.7
--- /dev/null
+require "bundler"
+begin
+ Bundler.setup(:default, :development)
+rescue Bundler::BundlerError => e
+ raise LoadError.new("Unable to Bundler.setup(): You probably need to run `gpkg install`: #{e.message}")
+end
+
+require "rake/clean"
+require "gpkg/rake_tasks"
+require "rspec"
+require "rspec/core/rake_task"
+require "yard"
+require "simplecov"
+require "json"
+require "gentex/gems/teamcity_utils"
+
+CLEAN.include "pkg"
+CLEAN.include "coverage"
+CLOBBER.include ".yardoc"
+CLOBBER.include "doc"
+
+task :default => :spec
+
+RSpec::Core::RakeTask.new(:spec, :example_string) do |task, args|
+ if args.example_string
+ ENV["partial_specs"] = "1"
+ task.rspec_opts = %[-e "#{args.example_string}" -f documentation]
+ end
+end
+
+task :spec do
+ # Report coverage % to TeamCity
+ if Gentex::Gems::TeamcityUtils.server_exec?
+ begin
+ cov_pct = JSON.load(File.read("coverage/.last_run.json"))["result"]["line"]
+ Gentex::Gems::TeamcityUtils.append_build_status(" (cov: #{cov_pct}%)")
+ rescue Exception => e
+ $stderr.puts "Error reporting coverage: #{e.message}"
+ end
+ end
+end
+
+YARD::Rake::YardocTask.new do |yard|
+ yard.options = ["--private", "--title", "atv gem"]
+ yard.files = ["lib/**/*.rb"]
+end
+# Display undocumented items.
+task :yard do
+ yard_status_output = IO.popen(%w[yard stats --private --list-undoc]) do |io|
+ io.read
+ end
+ if undocumented = yard_status_output[/Undocumented Objects:.*/m]
+ $stderr.puts undocumented
+ end
+end
+
+task :build_pkg => :yard
+
+task :teamcity => [
+ :spec,
+ :yard,
+ :build_pkg,
+]
--- /dev/null
+# -*- encoding: utf-8 -*-
+require "gpkg/gem_specification"
+lib = File.expand_path("../lib", __FILE__)
+$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
+require "gentex/gems/atv/version"
+
+Gpkg.gem_specification do |gpkg|
+ gpkg.name = "gems/atv"
+ gpkg.version = Gentex::Gems::Atv::VERSION
+ gpkg.authors = ["TODO: Write your name"]
+ gpkg.email = ["TODO: Write your email address"]
+ gpkg.summary = %q{TODO: Write a short summary. Required.}
+ gpkg.description = %q{TODO: Write a longer description. Optional.}
+ gpkg.homepage = ""
+ gpkg.licenses = ["Nonstandard"]
+
+ gpkg.files = Dir.glob(["{bin,assets,lib,doc}/**/*", "*.gemspec"]).select {|f| File.file?(f)}
+
+ gpkg.executables = gpkg.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
+ gpkg.test_files = gpkg.files.grep(%r{^(test|spec|features)/})
+ gpkg.require_paths = ["lib"]
+
+ gpkg.add_gpkg_dependency "gpkg", ">= 1.16", "< 99.0"
+ gpkg.add_gpkg_development_dependency "gems/teamcity_utils", "~> 1.3"
+ gpkg.add_development_dependency "json", "~> 2.0"
+ gpkg.add_development_dependency "rspec", "~> 3.0"
+ gpkg.add_development_dependency "simplecov", "~> 0.9"
+ gpkg.add_development_dependency "yard", "~> 0.9"
+ gpkg.add_development_dependency "rake", "~> 13.0"
+end
--- /dev/null
+class Database
+ CMD="ffprobe -show_entries format=duration -v quiet -of csv=\"p=0\" -i"
+
+ def initialize(root)
+ @root = root
+ @path = "#{root}/index.json"
+ @data = {}
+ load(path)
+ end
+
+ def load(path)
+ if File.exist? @path
+ @data = JSON.parse(File.read(@path))
+ end
+ end
+
+ def save()
+ File.open(@path, "wb") do |f|
+ f.write JSON.dump(@data)
+ end
+ end
+
+ def reload()
+ end
+
+ def files
+ @data.keys
+ end
+
+ def [](key)
+ @data[key]
+ end
+
+ def cleanup()
+ files.each do |f|
+ @db.delete(f) if not File.exist?(f)
+ end
+ end
+
+ def scan()
+ Dir.glob("#{@path}/**/*.{mp4,webm,ogg}").each do |f|
+ next if @data[f]
+ duration = `#{CMD} \"#{f}\"`.chomp.to_f
+ @data[f] = { "duration" => duration }
+ end
+ end
+end
--- /dev/null
+require "simplecov"
+
+#require all of the support files!
+Dir[File.dirname(__FILE__) + "/support/**/*.rb"].each {|f| require f}
+
+SimpleCov.start do
+ add_filter "/spec/"
+ if ENV["partial_specs"]
+ command_name "RSpec-partial"
+ else
+ command_name "RSpec"
+ end
+end
+
+require "gentex/gems/atv"