wallhaven-cli 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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: a4c6b02787c49f4ed8566f774d3266a61b9d64cef348deee837381ed8ad40486
4
+ data.tar.gz: 07626050ec63ef9dee3951ce095533cb86d03f0ac339fddc7d14da97ec3a1e61
5
+ SHA512:
6
+ metadata.gz: f3023dffbf3686fbb6737ec75981df073bbb80804637a50ed7a132375daafb41e277a1fbef0676f5707eb83822052db9fa3a90b0e0dd78b385cd135ebb091fbc
7
+ data.tar.gz: 7c000233e6e4f271d38dbb11f47021989b0334466333317414ad0698d58b45964eeda52b2df98e3695efe90d31a6740f7df44fb0aa01b6005b0dd6c9e39b1819
data/LICENSE.txt ADDED
@@ -0,0 +1,23 @@
1
+ GNU LESSER GENERAL PUBLIC LICENSE
2
+ Version 3, 29 June 2007
3
+
4
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
5
+ Everyone is permitted to copy and distribute verbatim copies
6
+ of this license document, but changing it is not allowed.
7
+
8
+ This version of the GNU Lesser General Public License incorporates
9
+ the terms and conditions of version 3 of the GNU General Public
10
+ License, supplemented by the additional permissions listed below.
11
+
12
+ This program is free software: you can redistribute it and/or modify
13
+ it under the terms of the GNU Lesser General Public License as
14
+ published by the Free Software Foundation, either version 3 of the
15
+ License, or (at your option) any later version.
16
+
17
+ This program is distributed in the hope that it will be useful,
18
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
19
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
+ GNU Lesser General Public License for more details.
21
+
22
+ You should have received a copy of the GNU Lesser General Public License
23
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
data/README.md ADDED
@@ -0,0 +1,73 @@
1
+ # Wallhaven
2
+
3
+ A command-line tool to fetch wallpapers from [Wallhaven](https://wallhaven.cc) and set them as your desktop background.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'wallhaven-cli'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle install
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install wallhaven-cli
20
+
21
+ ## Usage
22
+
23
+ First, set your Wallhaven API key (optional, but recommended):
24
+
25
+ ```bash
26
+ export WALLHAVEN_API_KEY=your_api_key_here
27
+ ```
28
+
29
+ ### Search for wallpapers
30
+
31
+ ```bash
32
+ wallhaven search nature
33
+ ```
34
+
35
+ You can add options:
36
+
37
+ ```bash
38
+ wallhaven search mountains --categories=100 --purity=100 --sorting=random
39
+ ```
40
+
41
+ Categories are represented as a 3-digit string where each digit represents whether to include General, Anime, and People categories respectively.
42
+
43
+ Purity is a 3-digit string where each digit represents whether to include SFW, Sketchy, and NSFW content respectively.
44
+
45
+ ### Set a random wallpaper
46
+
47
+ ```bash
48
+ wallhaven random
49
+ ```
50
+
51
+ With filtering:
52
+
53
+ ```bash
54
+ wallhaven random --categories=110 --purity=100
55
+ ```
56
+
57
+ ### Set a specific wallpaper by ID
58
+
59
+ ```bash
60
+ wallhaven set j3m8y5
61
+ ```
62
+
63
+ ## Development
64
+
65
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
66
+
67
+ ## Contributing
68
+
69
+ Bug reports and pull requests are welcome on GitHub.
70
+
71
+ ## License
72
+
73
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -0,0 +1,45 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'fileutils'
4
+ require 'bundler'
5
+ require 'rubygems'
6
+ require 'rubygems/package'
7
+
8
+
9
+ def log(message)
10
+ puts "[#{Time.now.strftime('%H:%M:%S')}] #{message}"
11
+ end
12
+
13
+ def build_and_publish
14
+ spec_file = Dir.glob('*.gemspec').first
15
+ raise 'No gemspec file found!' unless spec_file
16
+
17
+ spec = Gem::Specification.load(spec_file)
18
+ gem_file = "#{spec.name}-#{spec.version}.gem"
19
+ build_path = File.join('build', gem_file)
20
+
21
+ # Clean and prepare build directory
22
+ FileUtils.rm_rf('build')
23
+ FileUtils.mkdir_p('build')
24
+
25
+ # Build gem
26
+ log "Building #{gem_file}..."
27
+ Gem::Package.build(spec)
28
+ FileUtils.mv(gem_file, build_path)
29
+ log "Successfully built gem at #{build_path}"
30
+
31
+ # Push gem
32
+ log "Pushing #{gem_file} to RubyGems.org..."
33
+ require 'rubygems/command_manager'
34
+ command = Gem::CommandManager.instance.find_command('push')
35
+ command.handle_options([build_path])
36
+ command.execute
37
+
38
+ log "Successfully published #{spec.name} version #{spec.version}"
39
+ rescue StandardError => e
40
+ log "Error: #{e.message}"
41
+ log e.backtrace.join("\n") if ENV['DEBUG']
42
+ exit 1
43
+ end
44
+
45
+ build_and_publish
File without changes
data/exe/wallhaven ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "wallhaven_cli"
5
+
6
+ WallhavenCli::CLI.start(ARGV)
@@ -0,0 +1,8 @@
1
+ require 'net/http'
2
+ require 'json'
3
+
4
+ module WallhavenCli
5
+ class API
6
+
7
+ end
8
+ end
@@ -0,0 +1,4 @@
1
+ module WallhavenCli
2
+ class Cache
3
+ end
4
+ end
@@ -0,0 +1,80 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'gli'
4
+ require_relative '../lib/wallhaven'
5
+
6
+ class WallhavenCli
7
+ extend GLI::App
8
+
9
+ program_desc 'CLI tool to interact with Wallhaven'
10
+ version WallhavenCli::VERSION
11
+
12
+ subcommand_option_handling :normal
13
+ arguments :strict
14
+
15
+ desc 'Download a random wallpaper'
16
+ command :random do |c|
17
+ c.desc 'Filter by categories - General, Anime, People (comma separated)'
18
+ c.flag [:c, :categories], type: String
19
+
20
+ c.desc 'Filter by purity - SFW, Sketchy (comma separated)'
21
+ c.flag [:p, :purity], type: String
22
+
23
+ c.desc 'Filter by ratio - 16x9, 16x10, etc.'
24
+ c.flag [:r, :ratio], type: String
25
+
26
+ c.desc 'Filter by resolution - 1920x1080, etc.'
27
+ c.flag [:res, :resolution], type: String
28
+
29
+ c.action do |global_options, options, args|
30
+ filters = {}
31
+ filters[:categories] = options[:categories] if options[:categories]
32
+ filters[:purity] = options[:purity] if options[:purity]
33
+ filters[:ratio] = options[:ratio] if options[:ratio]
34
+ filters[:resolution] = options[:resolution] if options[:resolution]
35
+
36
+ WallhavenCli::Downloader.new.download_random(filters)
37
+ end
38
+ end
39
+
40
+ desc 'Search for wallpapers based on query'
41
+ arg_name 'query'
42
+ command :search do |c|
43
+ c.desc 'Filter by categories - General, Anime, People (comma separated)'
44
+ c.flag [:c, :categories], type: String
45
+
46
+ c.desc 'Filter by purity - SFW, Sketchy (comma separated)'
47
+ c.flag [:p, :purity], type: String
48
+
49
+ c.desc 'Filter by ratio - 16x9, 16x10, etc.'
50
+ c.flag [:r, :ratio], type: String
51
+
52
+ c.desc 'Filter by resolution - 1920x1080, etc.'
53
+ c.flag [:res, :resolution], type: String
54
+
55
+ c.action do |global_options, options, args|
56
+ if args.empty?
57
+ raise "Error: search requires a query argument"
58
+ end
59
+
60
+ query = args.first
61
+ filters = {}
62
+ filters[:categories] = options[:categories] if options[:categories]
63
+ filters[:purity] = options[:purity] if options[:purity]
64
+ filters[:ratio] = options[:ratio] if options[:ratio]
65
+ filters[:resolution] = options[:resolution] if options[:resolution]
66
+
67
+ WallhavenCli::Downloader.new.search_and_download(query, filters)
68
+ end
69
+ end
70
+
71
+ desc 'Configure wallhaven settings'
72
+ command :config do |c|
73
+ c.action do |global_options, options, args|
74
+ # Implementation for config command
75
+ puts "Configuration functionality will be added soon"
76
+ end
77
+ end
78
+
79
+ exit run(ARGV)
80
+ end
@@ -0,0 +1,6 @@
1
+ module WallhavenCli
2
+ module Command
3
+ class Cache < Base
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ module WallhavenCli
2
+ module Command
3
+ class Download < Base
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ module WallhavenCli
2
+ module Command
3
+ class Render < Base
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ module WallhavenCli
2
+ module Command
3
+ class Search < Base
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,5 @@
1
+ module WallhavenCli
2
+ module Command
3
+
4
+ end
5
+ end
@@ -0,0 +1,7 @@
1
+ require 'fileutils'
2
+ require 'yaml'
3
+
4
+ module WallhavenCli
5
+ class Config
6
+ end
7
+ end
@@ -0,0 +1,6 @@
1
+ require_relative 'api'
2
+
3
+ module WallhavenCli
4
+ class Downloader
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ module WallhavenCli
2
+ module Platform
3
+ class Base
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ module WallhavenCli
2
+ module Platform
3
+ class Linux < Base
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ module WallhavenCli
2
+ module Platform
3
+ class MacOS < Base
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ module WallhavenCli
2
+ module Platform
3
+ class Windows < Base
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,3 @@
1
+ module WallhavenCli
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,8 @@
1
+ require_relative 'wallhaven/version'
2
+ require_relative 'wallhaven/downloader'
3
+ require_relative 'wallhaven/api'
4
+ require_relative 'wallhaven/config'
5
+
6
+ module WallhavenCli
7
+
8
+ end
metadata ADDED
@@ -0,0 +1,146 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: wallhaven-cli
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Ernie Brodeur
8
+ bindir: exe
9
+ cert_chain: []
10
+ date: 2025-03-07 00:00:00.000000000 Z
11
+ dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: bundler
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - ">="
17
+ - !ruby/object:Gem::Version
18
+ version: '0'
19
+ type: :development
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - ">="
24
+ - !ruby/object:Gem::Version
25
+ version: '0'
26
+ - !ruby/object:Gem::Dependency
27
+ name: rake
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ - !ruby/object:Gem::Dependency
41
+ name: rspec
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ type: :development
48
+ prerelease: false
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ - !ruby/object:Gem::Dependency
55
+ name: excon
56
+ requirement: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ type: :runtime
62
+ prerelease: false
63
+ version_requirements: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ - !ruby/object:Gem::Dependency
69
+ name: oj
70
+ requirement: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ type: :runtime
76
+ prerelease: false
77
+ version_requirements: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
82
+ - !ruby/object:Gem::Dependency
83
+ name: gli
84
+ requirement: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ type: :runtime
90
+ prerelease: false
91
+ version_requirements: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ description: Fetch and set wallpapers from Wallhaven as your desktop background
97
+ email:
98
+ - ebrodeur@ujami.net
99
+ executables:
100
+ - wallhaven
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - LICENSE.txt
105
+ - README.md
106
+ - bin/build_and_publish
107
+ - bin/build_and_publish.rb
108
+ - exe/wallhaven
109
+ - lib/wallhaven_cli.rb
110
+ - lib/wallhaven_cli/api.rb
111
+ - lib/wallhaven_cli/cache.rb
112
+ - lib/wallhaven_cli/cli.rb
113
+ - lib/wallhaven_cli/command.rb
114
+ - lib/wallhaven_cli/command/cache.rb
115
+ - lib/wallhaven_cli/command/download.rb
116
+ - lib/wallhaven_cli/command/render.rb
117
+ - lib/wallhaven_cli/command/search.rb
118
+ - lib/wallhaven_cli/config.rb
119
+ - lib/wallhaven_cli/downloader.rb
120
+ - lib/wallhaven_cli/platform/base.rb
121
+ - lib/wallhaven_cli/platform/linux.rb
122
+ - lib/wallhaven_cli/platform/macos.rb
123
+ - lib/wallhaven_cli/platform/windows.rb
124
+ - lib/wallhaven_cli/version.rb
125
+ homepage: https://github.com/erniebrodeur/wallhaven
126
+ licenses:
127
+ - LGPL-3.0+
128
+ metadata: {}
129
+ rdoc_options: []
130
+ require_paths:
131
+ - lib
132
+ required_ruby_version: !ruby/object:Gem::Requirement
133
+ requirements:
134
+ - - ">="
135
+ - !ruby/object:Gem::Version
136
+ version: '0'
137
+ required_rubygems_version: !ruby/object:Gem::Requirement
138
+ requirements:
139
+ - - ">="
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
142
+ requirements: []
143
+ rubygems_version: 3.6.2
144
+ specification_version: 4
145
+ summary: A CLI tool for setting Wallhaven wallpapers as background
146
+ test_files: []