thyme_verbose 0.0.4 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/README.md +1 -0
 - data/lib/thyme_verbose/plugin_music.rb +70 -0
 - data/lib/thyme_verbose.rb +1 -0
 - metadata +5 -3
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 9e1469148db201ee20aea9667188e8074e2606d31728c55ba23bc934c6555015
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: afa03b86646cb8363979bec3a42eccea770b2615c180b222811f403c1e7d255a
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: e589b2fad0ae81bcb49dbb4ce03a169653fac99c5cb78bbb57ed43351ab7e43eaf902401f6cf0666add2affa61eb49e7e8593177a495fdbebe98aa53f9e297c4
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 895862667db0c4ec170b6aefc11a4433170749527223cc4e3bcf8a3ec109382938fccd5e9f3aae67a555bf088cdae0dcca880550a1e45474258146f30ef827d9
         
     | 
    
        data/README.md
    CHANGED
    
    | 
         @@ -21,3 +21,4 @@ Require thyme_verbose in `~/.thymerc` and initialize plugins. 
     | 
|
| 
       21 
21 
     | 
    
         
             
            * ThymePluginTime - print current time before and after each iteration 
         
     | 
| 
       22 
22 
     | 
    
         
             
            * ThymePluginLabel - add a -l / --label option, which defines a custom text to print after each iteration
         
     | 
| 
       23 
23 
     | 
    
         
             
            * ThymePluginBell - make an terminal alarm (beep code) after each iteration 
         
     | 
| 
      
 24 
     | 
    
         
            +
            * ThymePluginMusic - play music during a pomodoro
         
     | 
| 
         @@ -0,0 +1,70 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
             
     | 
| 
      
 2 
     | 
    
         
            +
            class ThymePluginMusic
         
     | 
| 
      
 3 
     | 
    
         
            +
              def initialize(thyme, options={})
         
     | 
| 
      
 4 
     | 
    
         
            +
                @player = options[:player] || 'spotify'
         
     | 
| 
      
 5 
     | 
    
         
            +
                @command_play = options[:command_play] || command_play
         
     | 
| 
      
 6 
     | 
    
         
            +
                @command_pause = options[:command_pause] || command_pause
         
     | 
| 
      
 7 
     | 
    
         
            +
                mute_music = @mute_music = false
         
     | 
| 
      
 8 
     | 
    
         
            +
                thyme.option :m, nil, 'disalbe music plugin for this Pomodoro' do
         
     | 
| 
      
 9 
     | 
    
         
            +
                    mute_music.replace true
         
     | 
| 
      
 10 
     | 
    
         
            +
                    @run = true
         
     | 
| 
      
 11 
     | 
    
         
            +
                end
         
     | 
| 
      
 12 
     | 
    
         
            +
              end
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
              # Hooks
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
              def before
         
     | 
| 
      
 17 
     | 
    
         
            +
                `#{@command_play}` unless @break || @mute_music
         
     | 
| 
      
 18 
     | 
    
         
            +
              end
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
              def after(seconds_left)
         
     | 
| 
      
 21 
     | 
    
         
            +
                `#{@command_pause}` unless @break || @mute_music
         
     | 
| 
      
 22 
     | 
    
         
            +
              end
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
              private
         
     | 
| 
      
 25 
     | 
    
         
            +
              
         
     | 
| 
      
 26 
     | 
    
         
            +
              def command_play
         
     | 
| 
      
 27 
     | 
    
         
            +
                command_tpl % {:player => @player, :action => 'Play'}
         
     | 
| 
      
 28 
     | 
    
         
            +
              end
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
              def command_pause
         
     | 
| 
      
 31 
     | 
    
         
            +
                command_tpl % {:player => @player, :action => 'Pause'}
         
     | 
| 
      
 32 
     | 
    
         
            +
              end
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
              def command_tpl
         
     | 
| 
      
 35 
     | 
    
         
            +
                if which('osascript')
         
     | 
| 
      
 36 
     | 
    
         
            +
                  "osascript"\
         
     | 
| 
      
 37 
     | 
    
         
            +
                  " -e 'tell application \"%{player}\"'"\
         
     | 
| 
      
 38 
     | 
    
         
            +
                  " -e '%{action}'"\
         
     | 
| 
      
 39 
     | 
    
         
            +
                  " -e 'end tell'"
         
     | 
| 
      
 40 
     | 
    
         
            +
                elsif which('dbus-send')
         
     | 
| 
      
 41 
     | 
    
         
            +
                  "dbus-send"\
         
     | 
| 
      
 42 
     | 
    
         
            +
                  " --print-reply"\
         
     | 
| 
      
 43 
     | 
    
         
            +
                  " --dest=org.mpris.MediaPlayer2.%{player}"\
         
     | 
| 
      
 44 
     | 
    
         
            +
                  " /org/mpris/MediaPlayer2"\
         
     | 
| 
      
 45 
     | 
    
         
            +
                  " org.mpris.MediaPlayer2.Player.%{action}"
         
     | 
| 
      
 46 
     | 
    
         
            +
                else
         
     | 
| 
      
 47 
     | 
    
         
            +
                  # exception
         
     | 
| 
      
 48 
     | 
    
         
            +
                end
         
     | 
| 
      
 49 
     | 
    
         
            +
              end
         
     | 
| 
      
 50 
     | 
    
         
            +
             
     | 
| 
      
 51 
     | 
    
         
            +
              # Cross-platform way of finding an executable in the $PATH.
         
     | 
| 
      
 52 
     | 
    
         
            +
              def which(cmd)
         
     | 
| 
      
 53 
     | 
    
         
            +
                exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
         
     | 
| 
      
 54 
     | 
    
         
            +
                ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
         
     | 
| 
      
 55 
     | 
    
         
            +
                  exts.each { |ext|
         
     | 
| 
      
 56 
     | 
    
         
            +
                    exe = File.join(path, "#{cmd}#{ext}")
         
     | 
| 
      
 57 
     | 
    
         
            +
                    return exe if File.executable?(exe) && !File.directory?(exe)
         
     | 
| 
      
 58 
     | 
    
         
            +
                  }
         
     | 
| 
      
 59 
     | 
    
         
            +
                end
         
     | 
| 
      
 60 
     | 
    
         
            +
                return nil
         
     | 
| 
      
 61 
     | 
    
         
            +
              end
         
     | 
| 
      
 62 
     | 
    
         
            +
             
     | 
| 
      
 63 
     | 
    
         
            +
              def show_label
         
     | 
| 
      
 64 
     | 
    
         
            +
                if !@label.empty?
         
     | 
| 
      
 65 
     | 
    
         
            +
                  caption = 'LABEL: ' + @label
         
     | 
| 
      
 66 
     | 
    
         
            +
                  puts caption + ' ' * (50 - caption.length)
         
     | 
| 
      
 67 
     | 
    
         
            +
                end
         
     | 
| 
      
 68 
     | 
    
         
            +
              end
         
     | 
| 
      
 69 
     | 
    
         
            +
            end
         
     | 
| 
      
 70 
     | 
    
         
            +
             
     | 
    
        data/lib/thyme_verbose.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,20 +1,21 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: thyme_verbose
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.0 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.1.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Ilya Shmygol
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2019- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2019-02-09 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies: []
         
     | 
| 
       13 
13 
     | 
    
         
             
            description: "    A set of lightweight plugins for the pomodoro timer 'thyme' aimed
         
     | 
| 
       14 
14 
     | 
    
         
             
              to improve verbosity.\n    ThymePluginTime for printing current time before and
         
     | 
| 
       15 
15 
     | 
    
         
             
              after each iteration; \n    ThymePluginLabel for adding a -l / --label option, which
         
     | 
| 
       16 
16 
     | 
    
         
             
              defines a custom text to print after each iteration;\n    ThymePluginBell for making
         
     | 
| 
       17 
     | 
    
         
            -
              an terminal alarm (beep code) after each iteration\n 
     | 
| 
      
 17 
     | 
    
         
            +
              an terminal alarm (beep code) after each iteration\n    ThymePluginMusic for playing
         
     | 
| 
      
 18 
     | 
    
         
            +
              music during a pomodoro\n"
         
     | 
| 
       18 
19 
     | 
    
         
             
            email:
         
     | 
| 
       19 
20 
     | 
    
         
             
            - ishmygol@gmail.com
         
     | 
| 
       20 
21 
     | 
    
         
             
            executables: []
         
     | 
| 
         @@ -25,6 +26,7 @@ files: 
     | 
|
| 
       25 
26 
     | 
    
         
             
            - lib/thyme_verbose.rb
         
     | 
| 
       26 
27 
     | 
    
         
             
            - lib/thyme_verbose/plugin_bell.rb
         
     | 
| 
       27 
28 
     | 
    
         
             
            - lib/thyme_verbose/plugin_label.rb
         
     | 
| 
      
 29 
     | 
    
         
            +
            - lib/thyme_verbose/plugin_music.rb
         
     | 
| 
       28 
30 
     | 
    
         
             
            - lib/thyme_verbose/plugin_time.rb
         
     | 
| 
       29 
31 
     | 
    
         
             
            homepage: https://github.com/trilliput/thyme_verbose
         
     | 
| 
       30 
32 
     | 
    
         
             
            licenses:
         
     |