budik 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 8555eff6bde9e0ad78896959e1afbc21e179a4f9
4
+ data.tar.gz: 38f7ffb627ade715700822e5d43ca99cbfdfa878
5
+ SHA512:
6
+ metadata.gz: 4ffda66f26a892ce245bc89188467b89f3ac74b92efe8b9406f94e760fffd1fcf452a773a3d2bdd05151083108b19bdfad37c3c51cf3c3f03409b3af322283a3
7
+ data.tar.gz: bcc8f5bbb1cd7c0ae0f6ee4cade8c2d3e6d5daeab5e14f1f9e1ea5da44c4b57529b4758beaecc6ea16f3e1ab5103cc0736d5fb504321befb65c0afc13825f03a
data/.coveralls.yml ADDED
@@ -0,0 +1 @@
1
+ service_name: travis-ci
data/.gitignore ADDED
@@ -0,0 +1,10 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ /lib/budik/config/sources.yml
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,8 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.2
4
+ before_install: gem install bundler -v 1.10.6
5
+ addons:
6
+ apt:
7
+ packages:
8
+ - libav-tools
@@ -0,0 +1,13 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4
+
5
+ We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
6
+
7
+ Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
8
+
9
+ Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
10
+
11
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
12
+
13
+ This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in budik.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Petr Schmied
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,176 @@
1
+ # Budík
2
+
3
+ [![Build Status](https://travis-ci.org/JBlackN/budik.svg?branch=master)](https://travis-ci.org/JBlackN/budik)
4
+ [![Dependency Status](https://gemnasium.com/JBlackN/budik.svg)](https://gemnasium.com/JBlackN/budik)
5
+ [![Code Climate](https://codeclimate.com/github/JBlackN/budik/badges/gpa.svg)](https://codeclimate.com/github/JBlackN/budik)
6
+ [![Coverage Status](https://coveralls.io/repos/JBlackN/budik/badge.svg?branch=master&service=github)](https://coveralls.io/github/JBlackN/budik?branch=master)
7
+ [![Inline docs](http://inch-ci.org/github/JBlackN/budik.svg?branch=master&style=shields)](http://inch-ci.org/github/JBlackN/budik)
8
+
9
+ Budík is a command line application that uses a list of your favorite songs or videos (local or YouTube) to randomly select and play one of them. When combined with cron, systemd timers or schtasks, it can be used as an alarm clock.
10
+
11
+ __Warning:__ The application is intended for casual use only. Occurence of bugs is possible, no matter how much I try to avoid them.
12
+
13
+ ## Requirements
14
+
15
+ * OS/Platform (other are untested):
16
+ * Windows 7+ (Powershell is needed)
17
+ * Linux
18
+ * Raspberry Pi
19
+ * Applications:
20
+ * Ruby (> 1.9.2)
21
+ * __VLC media player__ (Windows, Linux) or __omxplayer__ (Raspberry Pi)
22
+ * __FFmpeg__ or __Libav__
23
+ * If you need to (un)mount or spin down storage devices, these applications are tested:
24
+ * Udisks2
25
+ * Hdparm (read its documentation and take extra care)
26
+
27
+ ## Installation
28
+
29
+ Add this line to your application's Gemfile:
30
+
31
+ ```ruby
32
+ gem 'budik'
33
+ ```
34
+
35
+ And then execute:
36
+
37
+ $ bundle
38
+
39
+ Or install it yourself as:
40
+
41
+ $ gem install budik
42
+
43
+ ## Configuration
44
+
45
+ When the application is run for the first time, it automatically creates its configuration in `your_home_directory/.budik/`. Edit `options.yml` and `sources.yml` as needed.
46
+
47
+ For information about correct YAML syntax, look [here](http://learnxinyminutes.com/docs/yaml/).
48
+
49
+ ### Options.yml - explanation
50
+
51
+ ```yaml
52
+ os: "windows, linux or rpi"
53
+ lang: "language code (default: en)"
54
+ player:
55
+ omxplayer:
56
+ default_volume: "omxplayer's starting volume (default: -2100)"
57
+ path: "path to omxplayer (default: omxplayer)"
58
+ volume_step_secs: "pause between volume ups (default: 3, app uses 7 steps)"
59
+ player: "player to use (vlc or omxplayer)"
60
+ vlc:
61
+ default_volume: "vlc's starting volume (128 (default) ~ 50%, 256 ~ 100%)"
62
+ fullscreen: "self-explainatory (true (default) or false)"
63
+ path: "path to vlc (default: vlc)"
64
+ rc_host: "vlc's remote control interface host (default: localhost)"
65
+ rc_port: "vlc's remote control interface port (default: 50000)"
66
+ volume_fadein_secs: "pause between volume ups (default: 0.125)"
67
+ volume_step: "self-explainatory (default: 1.0)"
68
+ wait_secs_after_run: "give vlc time to start if needed (default: 5)"
69
+ wait_secs_if_http: "not used in current version (default: 3)"
70
+ rng:
71
+ hwrng:
72
+ source: "/dev/urandom, /dev/random/ or /dev/hwrng"
73
+ method: "hwrng, random.org, rand-hwrng-seed or rand"
74
+ random.org:
75
+ apikey: "your Random.org API key"
76
+ sources:
77
+ download:
78
+ device: "self-explainatory (example: /dev/sda)"
79
+ dir: "where to download sources (default (except rpi): ~/.budik/downloads/)"
80
+ method: "keep, remove, stream"
81
+ mount: "mount command, you can use $device/$partition variables (example: udisksctl mount -b $partition)"
82
+ partition: "self-explainatory (example: /dev/sda1)"
83
+ sleep: "sleep command, you can use $device/$partition variables (example: sudo hdparm -y $device)"
84
+ unmount: "unmount command, you can use $device/$partition variables (example: udisksctl unmount -b $partition)"
85
+ path: "path to sources file (default: ~/.budik/sources.yml)"
86
+ tv:
87
+ available: "self-explainatory (true or false)"
88
+ use_if_no_video: "self-explainatory (true or false)"
89
+ wait_secs_after_on: "give TV time to turn on (default: 15)"
90
+ ```
91
+
92
+ ### Sources.yml - explanation
93
+
94
+ * Category can't contain both items and subcategories.
95
+ * Every item must have a category (file has to contain at least one category)
96
+ * __Don't__ use backslashes in paths.
97
+
98
+ ```yaml
99
+ category1:
100
+ subcategory1:
101
+ - "path" # Unnamed single item
102
+ - # Unnamed multiple items
103
+ - "path1"
104
+ - "path2"
105
+ - name: # Named single item
106
+ - "path"
107
+ - name: # Named multiple items
108
+ - "path1"
109
+ - "path2"
110
+ subcategory2:
111
+ - "path"
112
+ category2:
113
+ subcategory1:
114
+ subsubcategory1:
115
+ - "path1"
116
+ - "path2"
117
+ subsubcategory2:
118
+ - "path3"
119
+ subcategory2:
120
+ - "path4"
121
+ category:
122
+ - "path"
123
+ another_category:
124
+ category:
125
+ - "path2"
126
+ ```
127
+
128
+ ## Usage
129
+
130
+ Linux:
131
+
132
+ $ budik --help
133
+
134
+ Windows:
135
+
136
+ $ budik.bat --help
137
+
138
+ ### Scheduling
139
+
140
+ #### Cron
141
+
142
+ * [Scheduling Tasks with Cron Jobs](http://code.tutsplus.com/tutorials/scheduling-tasks-with-cron-jobs--net-8800)
143
+
144
+ #### Systemd timers
145
+
146
+ * [How to Use Systemd Timers](http://jason.the-graham.com/2013/03/06/how-to-use-systemd-timers/)
147
+ * [systemd.timer — Timer unit configuration](http://www.freedesktop.org/software/systemd/man/systemd.timer.html)
148
+ * [systemd.time — Time and date specifications](http://www.freedesktop.org/software/systemd/man/systemd.time.html)
149
+
150
+ #### Schtasks
151
+
152
+ * [Schtasks.exe](https://msdn.microsoft.com/en-us/library/windows/desktop/bb736357(v=vs.85).aspx)
153
+ * [Two Minute Drill: The Schtasks command](http://blogs.technet.com/b/askperf/archive/2010/05/14/two-minute-drill-the-schtasks-command.aspx)
154
+
155
+ ## Development
156
+
157
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
158
+
159
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
160
+
161
+ ## Todo (Ideas)
162
+
163
+ * [ ] Better sources management (add, remove, etc.)
164
+ * [ ] Scheduling without need to interact with external tools
165
+ * [ ] Download timeout
166
+ * [ ] Automatic download after sources change
167
+ * [ ] Better config management
168
+
169
+ ## Contributing
170
+
171
+ Bug reports and pull requests are welcome on GitHub at https://github.com/JBlackN/budik. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
172
+
173
+ ## License
174
+
175
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
176
+
data/Rakefile ADDED
@@ -0,0 +1,23 @@
1
+ require 'rubygems'
2
+ require 'bundler/gem_tasks'
3
+ require 'coveralls/rake/task'
4
+ require 'cucumber'
5
+ require 'cucumber/rake/task'
6
+ require 'rdoc/task'
7
+ require 'rspec/core/rake_task'
8
+ require 'rubocop/rake_task'
9
+
10
+ Cucumber::Rake::Task.new(:features) do |t|
11
+ t.cucumber_opts = 'features --format pretty'
12
+ end
13
+ RSpec::Core::RakeTask.new(:spec)
14
+ Coveralls::RakeTask.new
15
+ RuboCop::RakeTask.new
16
+
17
+ RDoc::Task.new do |rdoc|
18
+ rdoc.main = 'README.md'
19
+ rdoc.rdoc_files.include('README.md', 'lib/*.rb', 'lib/budik/*.rb')
20
+ rdoc.rdoc_dir = 'doc'
21
+ end
22
+
23
+ task default: [:features, :spec, 'coveralls:push', :rubocop]
data/bin/budik ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'budik'
4
+ Budik::Budik.new.run
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+ require 'budik'
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require 'irb'
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,10 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
8
+ cat lib/budik.rb | sed "s/require 'budik/require '\.\/lib\/budik/g" >lib/budik2.rb
9
+ rm -f lib/budik.rb
10
+ mv lib/budik2.rb lib/budik.rb
data/budik.gemspec ADDED
@@ -0,0 +1,55 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'budik/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'budik'
8
+ spec.version = Budik::VERSION
9
+ spec.authors = ['Petr Schmied']
10
+ spec.email = ['jblack@paworld.eu']
11
+
12
+ spec.summary = 'Alarm clock.'
13
+ spec.description = 'Alarm clock that randomly plays a song or'\
14
+ ' a video from YouTube or your local collection.'
15
+ spec.homepage = 'http://jblack.paworld.eu/apps/budik'
16
+ spec.license = 'MIT'
17
+
18
+ # Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
19
+ # delete this section to allow pushing this gem to any host.
20
+ if spec.respond_to?(:metadata)
21
+ spec.metadata['allowed_push_host'] = 'https://rubygems.org'
22
+ else
23
+ fail 'RubyGems 2.0 or newer is required to protect'\
24
+ ' against public gem pushes.'
25
+ end
26
+
27
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
28
+ f.match(%r{^(test|spec|features)/})
29
+ end
30
+ spec.bindir = 'bin'
31
+ # spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
32
+ spec.executables << 'budik'
33
+ spec.require_paths = ['lib']
34
+
35
+ spec.add_dependency 'colorize'
36
+ spec.add_dependency 'commander'
37
+ spec.add_dependency 'r18n-core'
38
+ spec.add_dependency 'sys-uname'
39
+ spec.add_dependency 'terminal-table'
40
+ spec.add_dependency 'ya2yaml'
41
+ spec.add_dependency 'youtube_addy'
42
+ spec.add_dependency 'youtube-dl.rb'
43
+
44
+ spec.add_development_dependency 'bundler', '~> 1.10'
45
+ spec.add_development_dependency 'rake', '~> 10.0'
46
+ spec.add_development_dependency 'rspec'
47
+ spec.add_development_dependency 'cucumber'
48
+ spec.add_development_dependency 'rubocop'
49
+ spec.add_development_dependency 'coveralls'
50
+ spec.add_development_dependency 'rdoc'
51
+
52
+ spec.post_install_message = 'Please make sure VLC/omxplayer and FFmpeg'\
53
+ "/Libav are installed.\nRun 'budik(.bat) config' to edit app's options"\
54
+ " as needed.\nRun 'budik(.bat) sources -e' to edit your media sources."
55
+ end
@@ -0,0 +1,37 @@
1
+ lang: "en" # Do not remove this line.
2
+ budik:
3
+ description: "Alarm clock that randomly plays a song or a video from YouTube or your local collection."
4
+ commands:
5
+ config:
6
+ summary: "Edit program configuration."
7
+ description: "Open options file in your default editor."
8
+ options:
9
+ reset: "Resets configuration file to default values."
10
+ invalid: "Invalid command."
11
+ run:
12
+ summary: "Runs alarm (default command)."
13
+ description: "Runs alarm with specified options. CLI options > options.yml."
14
+ options:
15
+ categories: "Limit selection by categories. Example usage: \"cat1.subcat1 cat2.subcat1.subsubcat1 .excludethis.subcat etc.\""
16
+ dl_method: "Override download method set in your active options."
17
+ number: "Override selection using random number generator by specifying fixed number."
18
+ player: "Override which player to use."
19
+ rng: "Override random number generation method specified in your options.yml file. Possible values: \"hwrng\", \"random.org\", \"rand-hwrng-seed\", \"rand\". Default value: \"hwrng\"."
20
+ sources:
21
+ summary: "Manage source(s)."
22
+ description: "List or download source(s) or edit your sources file in your default editor (default: edit)."
23
+ options:
24
+ list: "List sources. Can be restricted by categories. DEFAULT option. Usage: list \"all|category.subcategory .exclude.this\". Default: list \"all\""
25
+ download: "Downloads source(s). Usage: download \"all|number\". Default: download \"all\"."
26
+ translate:
27
+ summary: "Translate app."
28
+ description: "Opens your language file in your default editor."
29
+ output:
30
+ alarm: "Alarm"
31
+ category: "Category"
32
+ date: "DateTime"
33
+ downloading: "Downloading: "
34
+ number: "Number"
35
+ sources:
36
+ invalid_format: "Invalid sources format."
37
+ invalid_item: "Item %1 is invalid."
@@ -0,0 +1,39 @@
1
+ ---
2
+ os: linux
3
+ lang: en
4
+ player:
5
+ omxplayer:
6
+ default_volume: -2100
7
+ path: omxplayer
8
+ volume_step_secs: 3
9
+ player: vlc
10
+ vlc:
11
+ default_volume: 128
12
+ fullscreen: true
13
+ path: vlc
14
+ rc_host: localhost
15
+ rc_port: 50000
16
+ volume_fadein_secs: 0.125
17
+ volume_step: 1.0
18
+ wait_secs_after_run: 5
19
+ wait_secs_if_http: 3
20
+ rng:
21
+ hwrng:
22
+ source: /dev/urandom
23
+ method: hwrng
24
+ random.org:
25
+ apikey: ""
26
+ sources:
27
+ download:
28
+ device: ""
29
+ dir: ~/.budik/downloads/
30
+ method: stream
31
+ mount: ""
32
+ partition: ""
33
+ sleep: ""
34
+ unmount: ""
35
+ path: ~/.budik/sources.yml
36
+ tv:
37
+ available: false
38
+ use_if_no_video: false
39
+ wait_secs_after_on: 0