hearken 0.1.1 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +7 -0
  2. data/.rubocop.yml +14 -0
  3. data/.tool-versions +1 -0
  4. data/Gemfile +7 -1
  5. data/Gemfile.lock +95 -0
  6. data/{README.rdoc → README.md} +12 -50
  7. data/bin/console +15 -0
  8. data/bin/setup +8 -0
  9. data/exe/hearken +9 -0
  10. data/exe/hearken_index +13 -0
  11. data/hearken.gemspec +35 -35
  12. data/lib/hearken/colour.rb +3 -1
  13. data/lib/hearken/command/enqueue.rb +35 -10
  14. data/lib/hearken/command/reload.rb +18 -6
  15. data/lib/hearken/command/search.rb +31 -20
  16. data/lib/hearken/console.rb +11 -27
  17. data/lib/hearken/debug.rb +6 -6
  18. data/lib/hearken/indexing/ffmpeg_file.rb +7 -0
  19. data/lib/hearken/indexing/file.rb +3 -1
  20. data/lib/hearken/indexing/indexer.rb +32 -24
  21. data/lib/hearken/library.rb +49 -41
  22. data/lib/hearken/monkey_violence.rb +9 -7
  23. data/lib/hearken/paths.rb +13 -19
  24. data/lib/hearken/range_expander.rb +18 -13
  25. data/lib/hearken/tagged.rb +15 -11
  26. data/lib/hearken/track.rb +53 -39
  27. data/lib/hearken.rb +2 -2
  28. metadata +52 -141
  29. data/.gitignore +0 -5
  30. data/HISTORY.rdoc +0 -38
  31. data/MIT-LICENSE +0 -20
  32. data/bin/hearken +0 -7
  33. data/bin/hearken_index +0 -12
  34. data/lib/hearken/command/list.rb +0 -32
  35. data/lib/hearken/command/love.rb +0 -7
  36. data/lib/hearken/command/profile.rb +0 -7
  37. data/lib/hearken/command/recent.rb +0 -38
  38. data/lib/hearken/command/remove.rb +0 -15
  39. data/lib/hearken/command/restart.rb +0 -7
  40. data/lib/hearken/command/scrobbling.rb +0 -14
  41. data/lib/hearken/command/setup_scrobbling.rb +0 -7
  42. data/lib/hearken/command/shuffle.rb +0 -13
  43. data/lib/hearken/command/start.rb +0 -7
  44. data/lib/hearken/command/status.rb +0 -7
  45. data/lib/hearken/command/stop.rb +0 -7
  46. data/lib/hearken/command.rb +0 -35
  47. data/lib/hearken/notification/growl_notifier.rb +0 -15
  48. data/lib/hearken/player.rb +0 -126
  49. data/lib/hearken/preferences.rb +0 -30
  50. data/lib/hearken/queue.rb +0 -33
  51. data/lib/hearken/scrobbler.rb +0 -77
  52. data/lib/hearken/simple_scrobbler.rb +0 -94
  53. data/media/ice_cream.png +0 -0
  54. data/spec/hearken/command/enqueue_spec.rb +0 -24
  55. data/spec/hearken/command/list_spec.rb +0 -31
  56. data/spec/hearken/command/reload_spec.rb +0 -20
  57. data/spec/hearken/command/shuffle_spec.rb +0 -31
  58. data/spec/hearken/player_spec.rb +0 -38
  59. data/spec/hearken/range_expander_spec.rb +0 -28
  60. data/spec/spec_helper.rb +0 -5
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 761d514192be6b3c770a1e81f2ac0a72dfe0de27ede2a5e76fd02d61d1058b15
4
+ data.tar.gz: 22001a8cdd6df13c97e9bbaf79a32822afdcdba15e2504fde2051b0ebcb849ce
5
+ SHA512:
6
+ metadata.gz: 3ba4d3631c06bc18146bfab3b12ad7dd8fbac92c99fd5dc6105fb73019f5a880147a6563353ff3e4ea7e6a41cd4579b8c0bf65167a51fdad219e627a96ae392e
7
+ data.tar.gz: 83f77b3a824a01bc87c263e1325695174ffdb8772fd1ded3e4712c6280a6e1f94945dc577d13a9a1d65d57cfe0c38b31535989c2e20320f92c63546778f65d7b
data/.rubocop.yml ADDED
@@ -0,0 +1,14 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.6
3
+ NewCops: enable
4
+
5
+ Style/StringLiterals:
6
+ Enabled: true
7
+ EnforcedStyle: double_quotes
8
+
9
+ Style/StringLiteralsInInterpolation:
10
+ Enabled: true
11
+ EnforcedStyle: double_quotes
12
+
13
+ Layout/LineLength:
14
+ Max: 120
data/.tool-versions ADDED
@@ -0,0 +1 @@
1
+ ruby 3.1.0
data/Gemfile CHANGED
@@ -1,2 +1,8 @@
1
1
  source 'http://rubygems.org'
2
- gemspec
2
+
3
+ gemspec
4
+
5
+ gem "rake"
6
+ gem "rspec"
7
+ gem "rubocop"
8
+ gem "solargraph"
data/Gemfile.lock ADDED
@@ -0,0 +1,95 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ hearken (0.1.3)
5
+ rainbow (~> 2)
6
+ shell_shock
7
+
8
+ GEM
9
+ remote: http://rubygems.org/
10
+ specs:
11
+ ast (2.4.2)
12
+ backport (1.2.0)
13
+ benchmark (0.2.0)
14
+ diff-lcs (1.5.0)
15
+ e2mmap (0.1.0)
16
+ jaro_winkler (1.5.4)
17
+ json (2.6.2)
18
+ kramdown (2.4.0)
19
+ rexml
20
+ kramdown-parser-gfm (1.1.0)
21
+ kramdown (~> 2.0)
22
+ nokogiri (1.13.8-x86_64-darwin)
23
+ racc (~> 1.4)
24
+ parallel (1.22.1)
25
+ parser (3.1.2.1)
26
+ ast (~> 2.4.1)
27
+ racc (1.6.0)
28
+ rainbow (2.2.2)
29
+ rake
30
+ rake (13.0.6)
31
+ regexp_parser (2.5.0)
32
+ reverse_markdown (2.1.1)
33
+ nokogiri
34
+ rexml (3.2.5)
35
+ rspec (3.11.0)
36
+ rspec-core (~> 3.11.0)
37
+ rspec-expectations (~> 3.11.0)
38
+ rspec-mocks (~> 3.11.0)
39
+ rspec-core (3.11.0)
40
+ rspec-support (~> 3.11.0)
41
+ rspec-expectations (3.11.1)
42
+ diff-lcs (>= 1.2.0, < 2.0)
43
+ rspec-support (~> 3.11.0)
44
+ rspec-mocks (3.11.1)
45
+ diff-lcs (>= 1.2.0, < 2.0)
46
+ rspec-support (~> 3.11.0)
47
+ rspec-support (3.11.1)
48
+ rubocop (1.36.0)
49
+ json (~> 2.3)
50
+ parallel (~> 1.10)
51
+ parser (>= 3.1.2.1)
52
+ rainbow (>= 2.2.2, < 4.0)
53
+ regexp_parser (>= 1.8, < 3.0)
54
+ rexml (>= 3.2.5, < 4.0)
55
+ rubocop-ast (>= 1.20.1, < 2.0)
56
+ ruby-progressbar (~> 1.7)
57
+ unicode-display_width (>= 1.4.0, < 3.0)
58
+ rubocop-ast (1.21.0)
59
+ parser (>= 3.1.1.0)
60
+ ruby-progressbar (1.11.0)
61
+ shell_shock (0.0.5)
62
+ solargraph (0.47.0)
63
+ backport (~> 1.2)
64
+ benchmark
65
+ bundler (>= 1.17.2)
66
+ diff-lcs (~> 1.4)
67
+ e2mmap
68
+ jaro_winkler (~> 1.5)
69
+ kramdown (~> 2.3)
70
+ kramdown-parser-gfm (~> 1.1)
71
+ parser (~> 3.0)
72
+ reverse_markdown (>= 1.0.5, < 3)
73
+ rubocop (>= 0.52)
74
+ thor (~> 1.0)
75
+ tilt (~> 2.0)
76
+ yard (~> 0.9, >= 0.9.24)
77
+ thor (1.2.1)
78
+ tilt (2.0.11)
79
+ unicode-display_width (2.3.0)
80
+ webrick (1.7.0)
81
+ yard (0.9.28)
82
+ webrick (~> 1.7.0)
83
+
84
+ PLATFORMS
85
+ x86_64-darwin-21
86
+
87
+ DEPENDENCIES
88
+ hearken!
89
+ rake
90
+ rspec
91
+ rubocop
92
+ solargraph
93
+
94
+ BUNDLED WITH
95
+ 2.3.3
@@ -1,32 +1,27 @@
1
- = Hearken
1
+ # Hearken
2
2
 
3
- This is a command line shell for queuing and playing music tracks.
3
+ This is a command line shell for queuing music tracks to be played
4
+ by [vlcraptor](https://github.com/markryall/vlcraptor).
4
5
 
5
6
  It also extracts id3 tags from audio files for faster search.
6
7
 
7
8
  This may may be platform independent but at this stage has only been used on mac os x
8
9
 
9
- = Usage
10
+ # Usage
10
11
 
11
12
  Here you sit expectantly in front of a computer at the command line.
12
13
 
13
- == Install
14
+ ## Install
14
15
 
15
16
  gem install hearken
16
17
 
17
- == Dependencies
18
+ ## Dependencies
18
19
 
19
20
  Tags are currently extracted using ffmpeg. On mac os x, this can be installed easily using brew:
20
21
 
21
22
  brew install ffmpeg
22
23
 
23
- Tracks are played using sox (afplay is preinstalled on a mac but does not support as many audio formats) which can also be installed with brew:
24
-
25
- brew install sox
26
-
27
- Growl notification (as new tracks are played) will work but only if 'growlnotify' is detected on the path.
28
-
29
- == Indexing tracks
24
+ ## Indexing tracks
30
25
 
31
26
  hearken_index DIRECTORY
32
27
 
@@ -37,15 +32,15 @@ runs will only query tags for new or modified files so will be very fast.
37
32
 
38
33
  The index can be regenerated while the console is running and reloaded using the 'reload' command.
39
34
 
40
- == Console
35
+ ## Console
41
36
 
42
37
  hearken
43
38
 
44
- This enters an interactive prompt where you can start/stop the player, search and enqueue tracks.
39
+ This enters an interactive prompt where you can search and enqueue tracks.
45
40
 
46
41
  The queue will be persisted to ~/.hearken/queue
47
42
 
48
- == Commands
43
+ ## Commands
49
44
 
50
45
  ?
51
46
 
@@ -55,7 +50,7 @@ will list all commands
55
50
 
56
51
  will describe the use and purpose of a particular command
57
52
 
58
- == Main commands
53
+ ## Main commands
59
54
 
60
55
  search iver bon
61
56
 
@@ -63,39 +58,6 @@ Searches for tracks with 'bon' and 'iver' in the track, artist or album name (th
63
58
 
64
59
  Results will be displayed and the ids will be added to the clipboard (for convenient pasting to the '+' command).
65
60
 
66
- + abc-f 123 456
61
+ enqueue abc-f 123 456
67
62
 
68
63
  Enqueues tracks with ids abc, abd, abe, abf, 123 and 456
69
-
70
- play
71
-
72
- Starts the player
73
-
74
- stop
75
-
76
- Stops the player
77
-
78
- next
79
-
80
- Stops and restarts the player (which will kill the currently playing track)
81
-
82
- love
83
-
84
- Tells last.fm that you love the current track (this will do nothing if last.fm is not configured or the player is
85
- stopped)
86
-
87
- rm iver bon
88
-
89
- Removes any enqueued track with 'bon' and 'iver' in the track, artist or album name
90
-
91
- setup_scrobbling
92
-
93
- Runs through a wizard to configure scrobbling to last.fm
94
-
95
- scrobbling on
96
-
97
- Turns scrobbling on (has no effect if scrobbling has not been configured)
98
-
99
- scrobbling off
100
-
101
- Turns scrobbling off
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+ require "hearken"
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require "irb"
15
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/exe/hearken ADDED
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ $LOAD_PATH << ("#{File.dirname(__FILE__)}/../lib")
5
+
6
+ require "hearken/monkey_violence"
7
+ require "hearken/console"
8
+
9
+ Hearken::Console.new.push
data/exe/hearken_index ADDED
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ $LOAD_PATH << ("#{File.dirname(__FILE__)}/../lib")
5
+
6
+ require "hearken/indexing"
7
+
8
+ unless ARGV.size == 1
9
+ puts "usage: hearken_index path_to_directory_containing_music_collection"
10
+ exit
11
+ end
12
+
13
+ Hearken::Indexing::Indexer.new(ARGV.shift).execute
data/hearken.gemspec CHANGED
@@ -1,48 +1,48 @@
1
- # -*- encoding: utf-8 -*-
2
- $:.push File.expand_path("../lib", __FILE__)
3
- require 'hearken'
1
+ # frozen_string_literal: true
4
2
 
5
- Gem::Specification.new do |s|
6
- s.name = "hearken"
7
- s.version = Hearken::VERSION
8
- s.authors = ["Mark Ryall"]
9
- s.email = ["mark@ryall.name"]
10
- s.homepage = "http://github.com/markryall/hearken"
11
- s.summary = "command line music player"
12
- s.description = <<EOF
13
- A command line tool to enqueue and play music tracks.
3
+ require_relative "lib/hearken"
14
4
 
15
- This also extracts the tags from a collection of folders.
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "hearken"
7
+ spec.version = Hearken::VERSION
8
+ spec.authors = ["Mark Ryall"]
9
+ spec.email = ["mark@ryall.name"]
10
+ spec.homepage = "http://github.com/markryall/hearken"
11
+ spec.summary = "command line music player"
12
+ spec.description = <<~EOF
13
+ A command line tool to enqueue and play music trackspec.
16
14
 
17
- This replaces and combines the functionality from a couple of other gems (audio_library and songbirdsh).
18
- EOF
15
+ This also extracts the tags from a collection of folderspec.
19
16
 
20
- s.post_install_message = <<EOF
21
- Hey - thanks for installing hearken.
17
+ This replaces and combines the functionality from a couple of other gems (audio_library and songbirdsh).
18
+ EOF
22
19
 
23
- Before doing anything else, you should index your music collection by running:
20
+ spec.post_install_message = <<~EOF
21
+ Hey - thanks for installing hearken.
24
22
 
25
- hearken_index path_to_your_music_collection
23
+ Before doing anything else, you should index your music collection by running:
26
24
 
27
- This could take a while if you have a large collection - you should hear some applause when it's done
25
+ hearken_index path_to_your_music_collection
28
26
 
29
- After that just run hearken to start playing, queueing and rocking out.
30
- EOF
27
+ This could take a while if you have a large collection - you should hear some applause when it's done
31
28
 
32
- s.license = 'MIT'
33
- s.rubyforge_project = "hearken"
29
+ After that just run hearken to start searching for and then queueing tracks.
30
+ EOF
34
31
 
35
- s.files = `git ls-files`.split("\n")
36
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
37
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
38
- s.require_paths = ["lib"]
32
+ spec.required_ruby_version = ">= 2.6.0"
39
33
 
40
- s.required_ruby_version = '>= 1.9.2'
34
+ # Specify which files should be added to the gem when it is released.
35
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
36
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
37
+ `git ls-files -z`.split("\x0").reject do |f|
38
+ (f == __FILE__) || f.match(%r{\A(?:(?:test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
39
+ end
40
+ end
41
+ spec.bindir = "exe"
42
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
43
+ spec.require_paths = ["lib"]
41
44
 
42
- s.add_dependency 'shell_shock', '~>0'
43
- s.add_dependency 'rainbow', '~> 1'
44
- s.add_dependency 'nokogiri', '~> 1'
45
-
46
- s.add_development_dependency 'rake', '~>0'
47
- s.add_development_dependency 'rspec', '~>2'
45
+ spec.add_dependency "rainbow", "~> 2"
46
+ spec.add_dependency "shell_shock"
47
+ spec.metadata["rubygems_mfa_required"] = "true"
48
48
  end
@@ -1,5 +1,7 @@
1
+ require 'rainbow'
2
+
1
3
  module Hearken::Colour
2
4
  def c text,colour
3
- text.to_s.foreground colour
5
+ Rainbow(text.to_s).color colour
4
6
  end
5
7
  end
@@ -1,12 +1,37 @@
1
- require 'hearken/range_expander'
2
- require 'hearken/command'
3
-
4
- class Hearken::Command::Enqueue
5
- include Hearken::Command
6
- usage '*<id>'
7
- help 'enqueues the list of songs with the specified ids'
8
- execute do |text|
9
- @expander ||= Hearken::RangeExpander.new
10
- @expander.expand(text).each {|id| @player.enqueue id }
1
+ # frozen_string_literal: true
2
+
3
+ require "yaml"
4
+ require "hearken/range_expander"
5
+
6
+ module Hearken
7
+ module Command
8
+ class Enqueue
9
+ attr_reader :usage, :help
10
+
11
+ def initialize(library)
12
+ @usage = "*<id>"
13
+ @help = "enqueues the list of songs with the specified ids"
14
+ @expander = Hearken::RangeExpander.new
15
+ @library = library
16
+ end
17
+
18
+ def execute(text)
19
+ `mkdir -p /tmp/queue`
20
+ count = (Time.now.to_f * 1000).to_i
21
+ @expander.expand(text).each do |id|
22
+ @library.with_track id do |track|
23
+ meta = {
24
+ title: track.title,
25
+ artist: track.artist,
26
+ album: track.album,
27
+ length: track.time.to_i,
28
+ path: track.path
29
+ }
30
+ File.open("/tmp/queue/#{count}.yml", "w") { |f| f.puts meta.to_yaml }
31
+ count += 1
32
+ end
33
+ end
34
+ end
35
+ end
11
36
  end
12
37
  end
@@ -1,7 +1,19 @@
1
- require 'hearken/command'
1
+ # frozen_string_literal: true
2
2
 
3
- class Hearken::Command::Reload
4
- include Hearken::Command
5
- help 'reloads the contents of the music library for fast searching'
6
- execute {|ignored| @player.library.reload }
7
- end
3
+ module Hearken
4
+ module Command
5
+ class Reload
6
+ def initialize(library)
7
+ @library = library
8
+ end
9
+
10
+ def help
11
+ "reload the contents of the music library for fast searching"
12
+ end
13
+
14
+ def execute(_text)
15
+ @library.reload
16
+ end
17
+ end
18
+ end
19
+ end
@@ -1,24 +1,35 @@
1
- require 'hearken/command'
1
+ # frozen_string_literal: true
2
2
 
3
- class Hearken::Command::Search
4
- include Hearken::Command
5
- usage '*<word>'
6
- help <<EOF
7
- searches for tracks containing the specified words (in artist, title or album)
8
- ids are placed on the clipboard for convenient use with +
9
- EOF
10
- execute do |text|
11
- terms = text.split(/\W/)
12
- matches = []
13
- @player.library.reload unless @player.library.tracks
14
- matches = []
15
- @player.library.tracks.each do |track|
16
- if terms.all? {|term| track.search_string.include? term }
17
- puts track
18
- matches << track.search_id
3
+ module Hearken
4
+ module Command
5
+ class Search
6
+ attr_reader :help
7
+
8
+ def initialize(library)
9
+ @help = <<~EOF
10
+ searches for tracks containing the specified words (in artist, title or album)
11
+ ids are placed on the clipboard for convenient use with +
12
+ EOF
13
+ @library = library
14
+ end
15
+
16
+ def execute(text)
17
+ terms = text.split(/\W/)
18
+ matches = []
19
+ @library.tracks.each do |track|
20
+ if terms.all? { |term| track.search_string.include? term }
21
+ puts track
22
+ matches << track.search_id
23
+ end
24
+ end
25
+
26
+ if matches.size < 50
27
+ IO.popen("pbcopy", "w") { |clipboard| clipboard.print matches.join " " }
28
+ puts "Found #{matches.size} matches (ids have been placed on clipboard)"
29
+ else
30
+ puts "Found #{matches.size} matches"
31
+ end
19
32
  end
20
33
  end
21
- puts "Found #{matches.size} matches (ids have been placed on clipboard)"
22
- IO.popen('pbcopy','w') { |clipboard| clipboard.print matches.join ' ' }
23
34
  end
24
- end
35
+ end
@@ -1,37 +1,21 @@
1
- require 'shell_shock/context'
1
+ # frozen_string_literal: true
2
2
 
3
- require 'hearken'
4
- require 'hearken/player'
5
- require 'hearken/preferences'
6
- require 'hearken/command'
7
-
8
- require 'yaml'
3
+ require "hearken/command/enqueue"
4
+ require "hearken/command/reload"
5
+ require "hearken/command/search"
6
+ require "hearken/library"
7
+ require "shell_shock/context"
9
8
 
10
9
  module Hearken
11
10
  class Console
12
11
  include ShellShock::Context
13
12
 
14
- def with name, *aliases
15
- aliases << name.to_s if aliases.empty?
16
- add_command Command.load(name, @player), *aliases
17
- end
18
-
19
- def with_all *names
20
- names.each {|name| with name}
21
- end
22
-
23
13
  def initialize
24
- preferences = Preferences.new
25
- @player = Player.new preferences
26
- at_exit { @player.stop }
27
14
  @prompt = "hearken > "
28
- with :status, "'"
29
- with :restart, 'next'
30
- with :list, 'ls'
31
- with :enqueue, 'add'
32
- with :remove, 'rm'
33
- with :start, 'play'
34
- with_all *%w{reload search stop scrobbling shuffle setup_scrobbling recent love profile}
15
+ library = Hearken::Library.new
16
+ add_command(Hearken::Command::Enqueue.new(library), "enqueue")
17
+ add_command(Hearken::Command::Reload.new(library), "reload")
18
+ add_command(Hearken::Command::Search.new(library), "search")
35
19
  end
36
20
  end
37
- end
21
+ end
data/lib/hearken/debug.rb CHANGED
@@ -1,16 +1,16 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Hearken
2
4
  module Debug
3
- def debug message
4
- if ENV['DEBUG']
5
- puts message
6
- end
5
+ def debug(message)
6
+ puts message if ENV["DEBUG"]
7
7
  end
8
8
 
9
9
  def pause
10
- if ENV['DEBUG']
10
+ if ENV["DEBUG"]
11
11
  puts "Hit enter to continue"
12
12
  gets
13
13
  end
14
14
  end
15
15
  end
16
- end
16
+ end
@@ -1,9 +1,16 @@
1
+ require 'hearken/indexing/file'
1
2
  require 'hearken/indexing/executor'
2
3
  require 'hearken/monkey_violence'
4
+ require 'pathname'
3
5
 
4
6
  class Hearken::Indexing::FfmpegFile
5
7
  include Hearken::Indexing::Executor
6
8
 
9
+ def self.from_file path
10
+ file = Hearken::Indexing::File.new Pathname.new path
11
+ Hearken::Indexing::FfmpegFile.new file
12
+ end
13
+
7
14
  def initialize path
8
15
  extract_file_attributes path
9
16
  content = execute "ffmpeg -i #{@path.escape_for_sh}"
@@ -1,5 +1,7 @@
1
+ module Hearken; module Indexing; end; end
2
+
1
3
  class Hearken::Indexing::File
2
- def initialize path, root
4
+ def initialize path, root=nil
3
5
  @path, @root = path, root
4
6
  end
5
7