gnome-wallpaper-slideshow 0.2 → 0.3
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.
- data/bin/create-slideshow +41 -0
- metadata +4 -2
@@ -0,0 +1,41 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# -*- mode: RUBY -*-
|
3
|
+
|
4
|
+
require 'gnome-wallpaper-slideshow'
|
5
|
+
require 'gnome-wallpaper-slideshow/wallpaper'
|
6
|
+
|
7
|
+
DEFAULT_EXTENSIONS = "jpg,png,jpeg"
|
8
|
+
|
9
|
+
# Gets the absolute path to a file
|
10
|
+
# @param [String] file The file for which to construct the absolute path
|
11
|
+
# @return [String] The absolute path of the given file
|
12
|
+
def get_absolute_path(file)
|
13
|
+
File.expand_path file
|
14
|
+
end
|
15
|
+
|
16
|
+
|
17
|
+
if ARGV.length < 3
|
18
|
+
puts "You must specify four arguments: the image directory, the time to display each image in seconds, the transition time in seconds, and the output filename."
|
19
|
+
puts "You may optionally specify a fifth argument: the list of file extensions to include. If omitted, it will default to #{DEFAULT_EXTENSIONS}"
|
20
|
+
exit 1
|
21
|
+
end
|
22
|
+
|
23
|
+
image_directory = get_absolute_path(ARGV[0])
|
24
|
+
time = ARGV[1]
|
25
|
+
transition_time = ARGV[2]
|
26
|
+
output_filename = ARGV[3]
|
27
|
+
extensions = ARGV[4] || DEFAULT_EXTENSIONS
|
28
|
+
|
29
|
+
wallpapers = Dir.glob("#{image_directory}/*.{#{extensions}}").map do |file|
|
30
|
+
GnomeWallpaperSlideshow::Wallpaper.new get_absolute_path(file), time, transition_time
|
31
|
+
end
|
32
|
+
|
33
|
+
slideshow = GnomeWallpaperSlideshow.new do
|
34
|
+
create_new_slideshow output_filename
|
35
|
+
start_time Time.now
|
36
|
+
wallpapers.each do |wallpaper|
|
37
|
+
add_wallpaper wallpaper
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
slideshow.save_xml
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gnome-wallpaper-slideshow
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.3'
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -30,7 +30,8 @@ dependencies:
|
|
30
30
|
description: A gem for creating and interacting with the XML files that define wallpaper
|
31
31
|
slideshows in GNOME
|
32
32
|
email: andrew@andrewjamesjohnson.com
|
33
|
-
executables:
|
33
|
+
executables:
|
34
|
+
- create-slideshow
|
34
35
|
extensions: []
|
35
36
|
extra_rdoc_files: []
|
36
37
|
files:
|
@@ -38,6 +39,7 @@ files:
|
|
38
39
|
- lib/gnome-wallpaper-slideshow/wallpaper.rb
|
39
40
|
- Rakefile
|
40
41
|
- test/test-gnome-wallpaper-slideshow.rb
|
42
|
+
- bin/create-slideshow
|
41
43
|
homepage: https://github.com/ajsquared/gnome-wallpaper-slideshow
|
42
44
|
licenses: []
|
43
45
|
post_install_message:
|