parker 0.1.2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/parker +18 -11
- data/lib/parker.rb +1 -1
- data/lib/parker/game.rb +4 -3
- data/lib/parker/platform/base.rb +5 -3
- data/lib/parker/platform/{playstation.rb → ps4.rb} +1 -1
- data/lib/parker/version.rb +1 -1
- metadata +2 -3
- data/lib/parker/README.md +0 -46
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e6b3d51c383bb6974823917dd10513689ac3797a
|
4
|
+
data.tar.gz: 78dcc1a3f3f3500856b0f8926161d78c57b7c211
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d49768e3885a97d26f79e9df40502b7f1119956668baf4707054f9451ba5d2f1c69e88de5048f1c933a88d1d48c95601966e2f99f49a1cb7f682417b806f844e
|
7
|
+
data.tar.gz: 02ab2d5533de7a4a170bc91a1ac88390ba914dc01b6314bb8a25eb940f92c03dfd2c5b644f69c280f4812737b57354fe05fe6f31f8827cbc407fb99f26a83c22
|
data/bin/parker
CHANGED
@@ -37,17 +37,24 @@ Trollop.educate if ARGV.empty?
|
|
37
37
|
platforms = []
|
38
38
|
|
39
39
|
Dir.glob(File.join(source_directory, 'platforms', '*.json')).each do |path|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
40
|
+
klass = case File.basename(path, File.extname(path)).to_sym
|
41
|
+
when :ps4
|
42
|
+
'PS4'
|
43
|
+
when :switch
|
44
|
+
'Switch'
|
45
|
+
when :steam
|
46
|
+
'Steam'
|
47
|
+
end
|
48
|
+
|
49
|
+
next if klass.nil?
|
50
|
+
|
51
|
+
platform_config = JSON.parse(File.read(path))
|
52
|
+
|
53
|
+
platforms << Object.const_get("Parker::Platform::#{klass}").new(
|
54
|
+
platform_config['name'],
|
55
|
+
platform_config['source_path'],
|
56
|
+
platform_config['games']
|
57
|
+
)
|
51
58
|
end
|
52
59
|
|
53
60
|
if platforms.empty?
|
data/lib/parker.rb
CHANGED
data/lib/parker/game.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
module Parker
|
2
2
|
class Game
|
3
|
-
attr_accessor :name, :screenshots
|
3
|
+
attr_accessor :identifier, :name, :screenshots
|
4
4
|
|
5
|
-
def initialize(name)
|
5
|
+
def initialize(identifier, name)
|
6
|
+
@identifier = identifier
|
6
7
|
@name = name
|
7
8
|
@screenshots = []
|
8
9
|
end
|
@@ -16,7 +17,7 @@ module Parker
|
|
16
17
|
|
17
18
|
next if File.exist?(new_file_path)
|
18
19
|
|
19
|
-
FileUtils.
|
20
|
+
FileUtils.mkdir_p(platform_path) unless Dir.exist?(platform_path)
|
20
21
|
FileUtils.cp(screenshot.path, new_file_path)
|
21
22
|
|
22
23
|
copied_screenshots += 1
|
data/lib/parker/platform/base.rb
CHANGED
@@ -5,12 +5,14 @@ module Parker
|
|
5
5
|
attr_accessor :games
|
6
6
|
|
7
7
|
def initialize(name, source_path, game_data)
|
8
|
-
@name = name
|
8
|
+
@name = name || self.class.name.split('::').last
|
9
9
|
@source_path = source_path
|
10
10
|
@games = {}
|
11
11
|
|
12
|
-
game_data.
|
13
|
-
|
12
|
+
unless game_data.nil?
|
13
|
+
game_data.map do |identifier, name|
|
14
|
+
@games[identifier] = Game.new(identifier, name)
|
15
|
+
end
|
14
16
|
end
|
15
17
|
|
16
18
|
scan_games
|
data/lib/parker/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: parker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Bogan
|
@@ -34,10 +34,9 @@ extra_rdoc_files: []
|
|
34
34
|
files:
|
35
35
|
- bin/parker
|
36
36
|
- lib/parker.rb
|
37
|
-
- lib/parker/README.md
|
38
37
|
- lib/parker/game.rb
|
39
38
|
- lib/parker/platform/base.rb
|
40
|
-
- lib/parker/platform/
|
39
|
+
- lib/parker/platform/ps4.rb
|
41
40
|
- lib/parker/platform/steam.rb
|
42
41
|
- lib/parker/platform/switch.rb
|
43
42
|
- lib/parker/screenshot.rb
|
data/lib/parker/README.md
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
# Parker
|
2
|
-
|
3
|
-
This is a very simple tool for organising your video game screenshots. I _love_ my game screenshots, and like to have them neatly sorted by platform and game, but I might just be weird.
|
4
|
-
|
5
|
-
It currently supports 3 platforms: Steam, the Nintendo Switch, and the PS4. Please note: you'll still have to, y'know, actually copy them onto a disk somewhere yourself before running Parker. I wish this wasn't still a painful experience, but here we are.
|
6
|
-
|
7
|
-
## Installation
|
8
|
-
|
9
|
-
Parker is built in Ruby as a gem, and thus:
|
10
|
-
|
11
|
-
> gem install parker
|
12
|
-
|
13
|
-
And done.
|
14
|
-
|
15
|
-
## Usage
|
16
|
-
|
17
|
-
It's a very simple command-line tool - by default, Parker will try to copy your screenshots into the current directory, though you can provide an alternative with the `-d` option.
|
18
|
-
|
19
|
-
It will look for JSON configuration files with a name matching each game platform in its `~/.config/parker` directory:
|
20
|
-
|
21
|
-
- `~/.config/parker/steam.json`
|
22
|
-
- `~/.config/parker/switch.json`
|
23
|
-
- `~/.config/parker/playstation.json`
|
24
|
-
|
25
|
-
All config files share the same format:
|
26
|
-
|
27
|
-
```json
|
28
|
-
{
|
29
|
-
"source_path": "/path/to/game/screenshots/",
|
30
|
-
"name": "My Steam Screenshots",
|
31
|
-
"games": {
|
32
|
-
"game_id_1": "Awesome Game",
|
33
|
-
"game_id_2": "Awesome Game 2: More Awesomer"
|
34
|
-
}
|
35
|
-
}
|
36
|
-
```
|
37
|
-
|
38
|
-
Your config _must_ have a `source_path`, or Parker won't know where to look for screenshots, and that would be bad.
|
39
|
-
|
40
|
-
The optional `name` value will be used to name the parent directory housing each game (and so in the above example, if you were telling Parker to use `~/Pictures/Screenshots`, the above would copy games into `~/Pictures/Screenshots/My Steam Screenshots/Awesome Game`, etc. If left out, it defaults to a capitalised version of the platform name.
|
41
|
-
|
42
|
-
The key/value in the `games` section is required for every platform _except_ the Playstation (due to the layout of the screenshots on disk coming off the console, we can pull the game name for you). You can determine the game ID for Steam and Switch games based on the ID in the screenshot path, or the ending hash of the filename, respectively. This is less than ideal, but hey, it works for now.
|
43
|
-
|
44
|
-
It's possible that eventually I'd either add a way to look these up or keep a giant database of the mappings locally. Maybe.
|
45
|
-
|
46
|
-
And that's pretty much it. This is mostly for me, really, but I'd love to know if someone else finds it useful.
|