gamerom 0.2.2 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '027025340857f449af782261d9ae0106e8ab77ec5a6f2e9e0239e7a7da4a0d96'
4
- data.tar.gz: 2302ea6f765653ec67226171623bdab25f0ed0c87fed6b47b9ef860f9b05d0e6
3
+ metadata.gz: 4f51e93d7f99ee967817de3ac803470be484e9223574971e39e594c23e457fed
4
+ data.tar.gz: 0cfbfa5e0712c540e2e7e175b274e1d0f4501214f88c68b00833277561e2ae19
5
5
  SHA512:
6
- metadata.gz: 5bd89962c1a23e7b95ccea5d1db99e3b4080aefa0ab01d1ea1bb4a68a2740834cde441b5e45bfafc494fc9b500e9f7a9b5756678658730c5bbf696044c540b13
7
- data.tar.gz: 97b67d4f999d9db6bd083d0b8f59533f2e38ee118810dda3b0bec428b71b76d461c450f48f9afdc3e214a2d62f458879cd9089d719f33e6f72ac340786967b29
6
+ metadata.gz: 835103d42c4c74a0593bfc7b8d2362dd8b95dc04ccfc1fc8d01bad508193ea6aeaac940479e5acc003db52310e5f7e5b9f70239ad5a452ae0a6ccef9dc85d060
7
+ data.tar.gz: f1697e783df89bedb5437bcc54473d0fea2074f2b7a5794460ad8a8c5e08d78e449193a77eed645ea48a3f323608f3d81ea843863b0a34ea4a045462805e1471
data/CHANGELOG.md CHANGED
@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.3.0] - 2021-05-14
10
+ - Use progress bar on the update database commands
11
+ - Add romnation repo
12
+
9
13
  ## [0.2.2] - 2021-05-09
10
14
  - Fix download from some vimm’s repo platforms
11
15
 
@@ -19,7 +23,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
19
23
  ## [0.1.0] - 2021-05-07
20
24
  - Initial release
21
25
 
22
- [Unreleased]: https://github.com/lucasmundim/gamerom/compare/v0.2.2...HEAD
26
+ [Unreleased]: https://github.com/lucasmundim/gamerom/compare/v0.3.0...HEAD
27
+ [0.3.0]: https://github.com/lucasmundim/gamerom/compare/v0.2.2...v0.3.0
23
28
  [0.2.2]: https://github.com/lucasmundim/gamerom/compare/v0.2.1...v0.2.2
24
29
  [0.2.1]: https://github.com/lucasmundim/gamerom/compare/v0.2.0...v0.2.1
25
30
  [0.2.0]: https://github.com/lucasmundim/gamerom/compare/v0.1.0...v0.2.0
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gamerom (0.2.2)
4
+ gamerom (0.3.0)
5
5
  mechanize (~> 2.8.0)
6
6
  mechanize-progressbar (~> 0.2.0)
7
7
  nokogiri (~> 1.11.3)
data/README.md CHANGED
@@ -4,8 +4,9 @@ A command-line installer for game ROMs from many repositories.
4
4
 
5
5
  It currently supports the following repositories:
6
6
 
7
- - https://vimm.net/
8
- - https://coolrom.com.au/
7
+ - https://vimm.net
8
+ - https://coolrom.com.au
9
+ - https://www.romnation.net
9
10
 
10
11
  ## Installation
11
12
 
@@ -14,7 +15,7 @@ It currently supports the following repositories:
14
15
  Add this to your .bashrc, .bash_aliases, etc:
15
16
 
16
17
  ```
17
- alias gamerom='docker run --rm -it -v ~/.gamerom:/root/.gamerom docker.io/lucasmundim/gamerom:0.2.2'
18
+ alias gamerom='docker run --rm -it -v ~/.gamerom:/root/.gamerom docker.io/lucasmundim/gamerom:0.3.0'
18
19
  ```
19
20
 
20
21
  Use it as:
@@ -85,6 +86,7 @@ List available repo
85
86
  $ gamerom repo
86
87
  listing available repo...
87
88
  coolrom
89
+ romnation
88
90
  vimm
89
91
  ```
90
92
 
@@ -122,6 +124,46 @@ listing available platforms for coolrom repo...
122
124
  psp: Sony Playstation Portable
123
125
  ```
124
126
 
127
+ ```
128
+ $ gamerom platforms -r romnation
129
+ listing available platforms for romnation repo...
130
+ ---
131
+ :platforms:
132
+ amstrad: Amstrad
133
+ atari2600: Atari 2600
134
+ atari5200: Atari 5200
135
+ atari7800: Atari 7800
136
+ atarijaguar: Atari Jaguar
137
+ atarilynx: Atari Lynx
138
+ colecovision: ColecoVision
139
+ commodore64: Commodore 64
140
+ gamegear: Game Gear
141
+ gb: Game Boy
142
+ gbc: Game Boy Color
143
+ gcdvectrex: Vectrex
144
+ genesis: Genesis
145
+ intellivision: Intellivision
146
+ mame: MAME
147
+ msx1: MSX
148
+ msx2: MSX2
149
+ mtx: MTX
150
+ n64: N64
151
+ neogeocd: Neo Geo CD
152
+ neogeopocket: Neo Geo Pocket
153
+ nes: NES
154
+ oric: Oric
155
+ pce: PC Engine
156
+ radioshackcolorcomputer: TRS-80
157
+ samcoupe: SAM Coupé
158
+ segacd: Sega CD
159
+ segamastersystem: Master System
160
+ snes: SNES
161
+ thompsonmo5: Thomson MO5
162
+ virtualboy: Virtual Boy
163
+ watara: Watara Supervision
164
+ wonderswan: WonderSwan
165
+ ```
166
+
125
167
  ```
126
168
  $ gamerom platform -r vimm
127
169
  listing available platforms for vimm repo...
@@ -153,18 +195,18 @@ List available games
153
195
  ```
154
196
  $ gamerom list -r coolrom -p namcosystem22
155
197
  listing available games for namcosystem22 platform on coolrom repo...
156
- ID NAME REGION INSTALLED
157
- 316 Rave Racer USA installed
158
- 318 Ridge Racer 2 USA -
198
+ ID NAME REGION INSTALLED TAGS
199
+ 316 Rave Racer USA installed -
200
+ 318 Ridge Racer 2 USA installed -
159
201
  ```
160
202
 
161
203
  Filtering by region:
162
204
  ```
163
205
  $ gamerom list -r coolrom -p model2 -g Japan
164
206
  listing available games for model2 platform on coolrom repo...
165
- ID NAME REGION INSTALLED
166
- 12952 Virtual On Cyber Troopers (Japan) Japan -
167
- 12956 Zero Gunner (Japan Model 2B) Japan -
207
+ ID NAME REGION INSTALLED TAGS
208
+ 12952 Virtual On Cyber Troopers (Japan) Japan - -
209
+ 12956 Zero Gunner (Japan Model 2B) Japan - -
168
210
  ```
169
211
 
170
212
  ### search
@@ -172,10 +214,12 @@ ID NAME REGION INSTALLED
172
214
  Search games by KEYWORD
173
215
 
174
216
  ```
175
- $ gamerom search -r vimm -p SNES zelda
176
- searching available games for SNES platform on vimm repo...
177
- ID NAME REGION INSTALLED
178
- 1346 Legend of Zelda, The: A Link to the Past USA -
217
+ $ gamerom search -r romnation -p segamastersystem "Alex Kidd in Shinobi World"
218
+ searching available games for segamastersystem platform on romnation repo...
219
+ ID NAME REGION INSTALLED TAGS
220
+ 39126 Alex Kidd in Shinobi World (UE) [!] USA - good
221
+ 39127 Alex Kidd in Shinobi World (UE) [b1] USA - bad
222
+ 39128 Alex Kidd in Shinobi World (UE) [b2] USA - bad
179
223
  ```
180
224
 
181
225
  ### regions
@@ -205,6 +249,9 @@ Install game GAME_IDENTIFIER (id/name)
205
249
  ```
206
250
  $ gamerom install -r vimm -p NES 'Mega Man'
207
251
  installing game 545 - Mega Man - USA on NES platform on vimm repo...
252
+ downloading single file rom
253
+ http://download4.vimm.net/download/?mediaId=530
254
+ 100% |ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo| 74.8KB 46.3KB/s Time: 00:00:01
208
255
  Game installed
209
256
  ```
210
257
 
@@ -215,30 +262,56 @@ Install all games
215
262
  ```
216
263
  $ gamerom install_all -r coolrom -p genesis -g Brazil
217
264
  installing game 48155 - Duke Nukem 3D (Brazil) - Brazil on genesis platform on coolrom repo...
265
+ http://dl.coolrom.com.au/dl/48155/5dK3T--nRZaY8u4PI5T8cA/1621206423/
266
+ 100% |ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo| 871.7KB 947.8KB/s Time: 00:00:00
218
267
  Game installed
219
268
  installing game 6501 - Ferias Frustradas do Pica-Pau (Brazil) - Brazil on genesis platform on coolrom repo...
269
+ http://dl.coolrom.com.au/dl/6501/ZRVwx6lSpE6lRovr9xyEdg/1621206427/
270
+ 100% |ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo| 383.1KB 679.3KB/s Time: 00:00:00
220
271
  Game installed
221
272
  installing game 6358 - Mega Games 10 (Brazil) - Brazil on genesis platform on coolrom repo...
273
+ http://dl.coolrom.com.au/dl/6358/kjK-Zsuc0pr0JEqvG_G80Q/1621206429/
274
+ 100% |ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo| 2.6MB 1.1MB/s Time: 00:00:02
222
275
  Game installed
223
276
  installing game 47766 - Phantasy Star II (Brazil) - Brazil on genesis platform on coolrom repo...
277
+ http://dl.coolrom.com.au/dl/47766/wH66hX5V4j3oShDXn511NA/1621206434/
278
+ 100% |ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo| 455.1KB 602.7KB/s Time: 00:00:00
224
279
  Game installed
225
280
  installing game 5683 - Sega Top Five (Brazil) - Brazil on genesis platform on coolrom repo...
281
+ http://dl.coolrom.com.au/dl/5683/2DjilMgmxbTPShCju0uCiA/1621206436/
282
+ 100% |ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo| 1.2MB 998.2KB/s Time: 00:00:01
226
283
  Game installed
227
284
  installing game 47898 - Show do Milhao (Brazil) - Brazil on genesis platform on coolrom repo...
285
+ http://dl.coolrom.com.au/dl/47898/_T8xacEEtXt1iYsFG6MzFw/1621206439/
286
+ 100% |ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo| 1.2MB 931.3KB/s Time: 00:00:01
228
287
  Game installed
229
288
  installing game 47909 - Show do Milhao Volume 2 (Brazil) - Brazil on genesis platform on coolrom repo...
289
+ http://dl.coolrom.com.au/dl/47909/O8MHNPxxA6bd3TMyaa7x_g/1621206442/
290
+ 100% |ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo| 1.2MB 776.2KB/s Time: 00:00:01
230
291
  Game installed
231
292
  installing game 47747 - Sport Games (Brazil) - Brazil on genesis platform on coolrom repo...
293
+ http://dl.coolrom.com.au/dl/47747/9Ne0wIsVUErFiMNWURrjsQ/1621206445/
294
+ 100% |ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo| 745.7KB 693.8KB/s Time: 00:00:01
232
295
  Game installed
233
296
  installing game 5552 - Telebradesco Residencia (Brazil) - Brazil on genesis platform on coolrom repo...
297
+ http://dl.coolrom.com.au/dl/5552/Ne3f6ZBFQSGN-SXMPRWwgw/1621206448/
298
+ 100% |ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo| 48.6KB 270.2KB/s Time: 00:00:00
234
299
  Game installed
235
300
  installing game 5808 - Turma da Monica na Terra dos Monstros (Brazil) - Brazil on genesis platform on coolrom repo...
301
+ http://dl.coolrom.com.au/dl/5808/iOJ8k5sD7SVnbh_FtXyAWQ/1621206450/
302
+ 100% |ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo| 546.2KB 268.1KB/s Time: 00:00:02
236
303
  Game installed
237
304
  installing game 48020 - Where in the World Is Carmen Sandiego (Brazil) - Brazil on genesis platform on coolrom repo...
305
+ http://dl.coolrom.com.au/dl/48020/p5HRSrsXvU_3GfO9-C1I0w/1621206453/
306
+ 100% |ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo| 713.7KB 336.5KB/s Time: 00:00:02
238
307
  Game installed
239
308
  installing game 47824 - Where in Time Is Carmen Sandiego (Brazil) - Brazil on genesis platform on coolrom repo...
309
+ http://dl.coolrom.com.au/dl/47824/iNkVLfIiFm30d5mPyRIO6g/1621206457/
310
+ 100% |ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo| 631.7KB 332.4KB/s Time: 00:00:01
240
311
  Game installed
241
312
  installing game 47770 - Yuu Yuu Hakusho - Sunset Fighters (Brazil) - Brazil on genesis platform on coolrom repo...
313
+ http://dl.coolrom.com.au/dl/47770/lygKB0n14EGKCmQkd_lHuw/1621206460/
314
+ 100% |ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo| 1.1MB 345.3KB/s Time: 00:00:03
242
315
  Game installed
243
316
  ```
244
317
 
@@ -271,7 +344,7 @@ Game uninstalled
271
344
  Info for game GAME_IDENTIFIER (id/name)
272
345
 
273
346
  ```
274
- $ gamerom info --repo coolrom --platform atari2600 adventure
347
+ $ gamerom info -r coolrom -p atari2600 adventure
275
348
  showing info for game adventure on atari2600 platform on coolrom repo...
276
349
  15913 - Adventure - USA (installed)
277
350
  /Users/lucas/.gamerom/games/coolrom/atari2600/USA/Adventure.zip
@@ -282,10 +355,10 @@ showing info for game adventure on atari2600 platform on coolrom repo...
282
355
  Update local database
283
356
 
284
357
  ```
285
- $ gamerom update_database --repo vimm --platform SNES
286
- updating SNES platform on vimm repo...
287
- number a b c d e f g h i j k l m n o p q r s t u v w x y z
288
- Game database updated for platform SNES on vimm repo
358
+ $ gamerom update_database -r coolrom -p atari2600
359
+ updating atari2600 platform on coolrom repo...
360
+ atari2600: 100% |oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo| Time: 00:00:13
361
+ Game database updated for platform atari2600 on coolrom repo
289
362
  ```
290
363
 
291
364
  ### update_all_databases
@@ -293,58 +366,31 @@ Game database updated for platform SNES on vimm repo
293
366
  Update all local databases
294
367
 
295
368
  ```
296
- $ gamerom update_all_databases -r vimm
297
- updating Dreamcast platform on vimm repo...
298
- number a b c d e f g h i j k l m n o p q r s t u v w x y z
299
- Game database updated for platform Dreamcast on vimm repo
300
- updating DS platform on vimm repo...
301
- number a b c d e f g h i j k l m n o p q r s t u v w x y z
302
- Game database updated for platform DS on vimm repo
303
- updating GameCube platform on vimm repo...
304
- number a b c d e f g h i j k l m n o p q r s t u v w x y z
305
- Game database updated for platform GameCube on vimm repo
306
- updating GB platform on vimm repo...
307
- number a b c d e f g h i j k l m n o p q r s t u v w x y z
308
- Game database updated for platform GB on vimm repo
309
- updating GBA platform on vimm repo...
310
- number a b c d e f g h i j k l m n o p q r s t u v w x y z
311
- Game database updated for platform GBA on vimm repo
312
- updating GBC platform on vimm repo...
313
- number a b c d e f g h i j k l m n o p q r s t u v w x y z
314
- Game database updated for platform GBC on vimm repo
315
- updating Genesis platform on vimm repo...
316
- number a b c d e f g h i j k l m n o p q r s t u v w x y z
317
- Game database updated for platform Genesis on vimm repo
318
- updating N64 platform on vimm repo...
319
- number a b c d e f g h i j k l m n o p q r s t u v w x y z
320
- Game database updated for platform N64 on vimm repo
321
- updating NES platform on vimm repo...
322
- number a b c d e f g h i j k l m n o p q r s t u v w x y z
323
- Game database updated for platform NES on vimm repo
324
- updating PS1 platform on vimm repo...
325
- number a b c d e f g h i j k l m n o p q r s t u v w x y z
326
- Game database updated for platform PS1 on vimm repo
327
- updating PS2 platform on vimm repo...
328
- number a b c d e f g h i j k l m n o p q r s t u v w x y z
329
- Game database updated for platform PS2 on vimm repo
330
- updating PS3 platform on vimm repo...
331
- number a b c d e f g h i j k l m n o p q r s t u v w x y z
332
- Game database updated for platform PS3 on vimm repo
333
- updating PSP platform on vimm repo...
334
- number a b c d e f g h i j k l m n o p q r s t u v w x y z
335
- Game database updated for platform PSP on vimm repo
336
- updating Saturn platform on vimm repo...
337
- number a b c d e f g h i j k l m n o p q r s t u v w x y z
338
- Game database updated for platform Saturn on vimm repo
339
- updating SNES platform on vimm repo...
340
- number a b c d e f g h i j k l m n o p q r s t u v w x y z
341
- Game database updated for platform SNES on vimm repo
342
- updating Wii platform on vimm repo...
343
- number a b c d e f g h i j k l m n o p q r s t u v w x y z
344
- Game database updated for platform Wii on vimm repo
345
- updating WiiWare platform on vimm repo...
346
- number a b c d e f g h i j k l m n o p q r s t u v w x y z
347
- Game database updated for platform WiiWare on vimm repo
369
+ $ gamerom update_all_databases -r coolrom
370
+ updating all databases on coolrom repo...
371
+ atari2600: 100% |oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo| Time: 00:00:11
372
+ atari5200: 100% |oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo| Time: 00:00:10
373
+ atari7800: 100% |oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo| Time: 00:00:10
374
+ atarijaguar: 100% |oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo| Time: 00:00:11
375
+ atarilynx: 100% |oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo| Time: 00:00:11
376
+ c64: 100% |oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo| Time: 00:00:23
377
+ cps1: 100% |oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo| Time: 00:00:10
378
+ cps2: 100% |oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo| Time: 00:00:11
379
+ mame: 100% |oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo| Time: 00:01:20
380
+ namcosystem22: 100% |oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo| Time: 00:00:10
381
+ neogeo: 100% |oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo| Time: 00:00:11
382
+ neogeocd: 100% |oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo| Time: 00:00:11
383
+ neogeopocket: 100% |oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo| Time: 00:00:10
384
+ segacd: 100% |oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo| Time: 00:00:11
385
+ dc: 100% |oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo| Time: 00:00:12
386
+ gamegear: 100% |oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo| Time: 00:00:11
387
+ genesis: 100% |oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo| Time: 00:00:14
388
+ mastersystem: 100% |oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo| Time: 00:00:11
389
+ model2: 100% |oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo| Time: 00:00:11
390
+ saturn: 100% |oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo| Time: 00:00:11
391
+ psx: 100% |oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo| Time: 00:00:21
392
+ ps2: 100% |oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo| Time: 00:00:17
393
+ psp: 100% |oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo| Time: 00:00:16
348
394
  All game databases updated
349
395
  ```
350
396
 
@@ -539,7 +585,7 @@ Print program version
539
585
 
540
586
  ```
541
587
  $ gamerom version
542
- 0.2.2
588
+ 0.3.0
543
589
  ```
544
590
 
545
591
  ## Development
data/lib/gamerom.rb CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  require_relative "gamerom/config"
4
4
  require_relative "gamerom/game"
5
+ require_relative "gamerom/game_info"
5
6
  require_relative "gamerom/repo"
6
7
  require_relative "gamerom/cli"
7
8
  require_relative "gamerom/version"
data/lib/gamerom/cli.rb CHANGED
@@ -262,11 +262,11 @@ module Gamerom
262
262
  desc 'update_all_databases', 'Update all local databases'
263
263
  option :repo, :aliases => ['-r'], type: :string, required: true, desc: "Which repo to use", enum: Gamerom::Repo.list.map(&:to_s)
264
264
  def update_all_databases
265
+ puts "updating all databases on #{options[:repo]} repo..."
265
266
  repo = Repo.new(options[:repo])
266
267
  repo.platforms.keys.each do |platform|
267
- a = Gamerom::Cli.new
268
- a.options = { platform: platform, repo: options[:repo] }
269
- a.update_database
268
+ repo = Repo.new(options[:repo])
269
+ repo.update_database platform
270
270
  end
271
271
  shell.say 'All game databases updated', :green
272
272
  rescue => e
@@ -303,10 +303,11 @@ module Gamerom
303
303
  game.name,
304
304
  game.region,
305
305
  game.installed? ? shell.set_color('installed', :green) : '-',
306
+ game.respond_to?(:tags) ? game.tags.join(", ") : '-'
306
307
  ]
307
308
  end
308
309
  results.sort_by! { |columns| columns[1] }
309
- results.unshift ['ID', 'NAME', 'REGION', 'INSTALLED']
310
+ results.unshift ['ID', 'NAME', 'REGION', 'INSTALLED', 'TAGS']
310
311
  shell.print_table(results)
311
312
  end
312
313
 
data/lib/gamerom/game.rb CHANGED
@@ -31,7 +31,11 @@ module Gamerom
31
31
  end
32
32
 
33
33
  def to_s
34
- "#{self.id} - #{self.name} - #{self.region}#{self.installed? ? " (#{shell.set_color 'installed', :green})" : ''}"
34
+ install_status = ''
35
+ install_status = " (#{shell.set_color 'installed', :green})" if self.installed?
36
+ tags = ''
37
+ tags = " - tags: #{self.tags.join(", ")}" if self.respond_to?(:tags) && !self.tags.empty?
38
+ "#{self.id} - #{self.name} - #{self.region}#{install_status}#{tags}"
35
39
  end
36
40
 
37
41
  def uninstall
@@ -0,0 +1,94 @@
1
+ # 'frozen_string_literal' => true
2
+
3
+ module Gamerom
4
+ class GameInfo
5
+ REGIONS = {
6
+ '1' => 'Japan & Korea',
7
+ '4' => 'USA & Brazil - NTSC',
8
+ '5' => 'NTSC',
9
+ '8' => 'PAL',
10
+ 'A' => 'Australia',
11
+ 'As' => 'Asia',
12
+ 'B' => 'Brazil',
13
+ 'C' => 'Canada',
14
+ 'Ch' => 'China',
15
+ 'D' => 'Netherlands (Dutch)',
16
+ 'E' => 'Europe',
17
+ 'F' => 'France',
18
+ 'FC' => 'French Canadian',
19
+ 'FN' => 'Finland',
20
+ 'G' => 'Germany',
21
+ 'GR' => 'Greece',
22
+ 'H' => 'Holland',
23
+ 'HK' => 'Hong Kong',
24
+ 'I' => 'Italy',
25
+ 'J' => 'Japan',
26
+ 'JUE' => 'Japan & USA & Europe',
27
+ 'K' => 'Korea',
28
+ 'Nl' => 'Netherlands',
29
+ 'NL' => 'Netherlands',
30
+ 'No' => 'Norway',
31
+ 'PD' => 'Public Domain',
32
+ 'R' => 'Russia',
33
+ 'S' => 'Spain',
34
+ 'Sw' => 'Sweden',
35
+ 'SW' => 'Sweden',
36
+ 'U' => "USA",
37
+ 'UK' => 'England',
38
+ 'Unk' => 'Unknown Country',
39
+ 'Unl' => 'Unlicensed',
40
+ 'PAL' => 'PAL regions (Australia, Europe)',
41
+ 'NTSC' => 'NTSC regions (Japan, USA, Latin America)',
42
+ }
43
+
44
+ TAGS = {
45
+ '!' => :good,
46
+ '!p' => :pending,
47
+ 'a' => :alternate,
48
+ 'b' => :bad,
49
+ 'BF' => :bung,
50
+ 'c' => :checksum,
51
+ 'C' => :color,
52
+ 'f' => :fixed,
53
+ 'h' => :hack,
54
+ 'J' => :japanese_translation,
55
+ 'o' => :overdump,
56
+ 'p' => :pirate,
57
+ 'PC10' => :pc10,
58
+ 'S' => :super,
59
+ 'T-' => :old_translation,
60
+ 't' => :trained,
61
+ 'T+' => :newer_translation,
62
+ 'VS' => :vs,
63
+ 'x' => :bad_checksum,
64
+ }
65
+
66
+ def initialize(name)
67
+ @name = name
68
+ end
69
+
70
+ def name
71
+ @name
72
+ end
73
+
74
+ def region
75
+ identifiers = @name.scan(/\((?<region>[A-Za-z0-9]+)\)/).flatten
76
+ region_id = identifiers.find { |i| REGIONS.include? i }
77
+ if region_id
78
+ REGIONS[region_id]
79
+ else
80
+ "USA"
81
+ end
82
+ end
83
+
84
+ def tags
85
+ tags = []
86
+ codes = @name.scan(/\[(?<code>[^\]]+)\]/).flatten
87
+ codes.each do |code|
88
+ code = $1 if code.match /^(?<code>[abcfhop])[0-9]*/
89
+ tags << TAGS[code] if TAGS.include?(code)
90
+ end
91
+ tags
92
+ end
93
+ end
94
+ end
data/lib/gamerom/repo.rb CHANGED
@@ -77,7 +77,6 @@ module Gamerom
77
77
 
78
78
  def update_database platform
79
79
  games = @repo.games platform
80
- puts
81
80
  FileUtils.mkdir_p("#{Gamerom::CACHE_DIR}/#{@name}")
82
81
  File.write("#{Gamerom::CACHE_DIR}/#{@name}/#{platform}.yml", games.to_yaml)
83
82
  end
@@ -42,9 +42,8 @@ module Gamerom
42
42
  def self.games(platform)
43
43
  games = []
44
44
  sections = ('a'..'z').to_a.unshift("0")
45
-
46
- sections.each do |section|
47
- print "#{section} "
45
+ progress_bar = ProgressBar.new(platform, sections.count)
46
+ sections.each_with_index do |section, index|
48
47
  page = Nokogiri::HTML(RestClient.get("https://coolrom.com.au/roms/#{platform}/#{section}/"))
49
48
  regions = page.css('input.region').map { |i| i["name"] }
50
49
  regions.each do |region|
@@ -56,7 +55,9 @@ module Gamerom
56
55
  }
57
56
  }
58
57
  end
58
+ progress_bar.set(index+1)
59
59
  end
60
+ progress_bar.finish
60
61
  games
61
62
  end
62
63
 
@@ -0,0 +1,98 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'cgi'
4
+ require 'mechanize'
5
+ require 'mechanize/progressbar'
6
+ require 'mechanizeprogress'
7
+ require 'nokogiri'
8
+ require 'rest-client'
9
+
10
+ module Gamerom
11
+ module RepoAdapters
12
+ class Romnation
13
+ PLATFORM = {
14
+ 'amstrad' => 'Amstrad',
15
+ 'atari2600' => 'Atari 2600',
16
+ 'atari5200' => 'Atari 5200',
17
+ 'atari7800' => 'Atari 7800',
18
+ 'atarijaguar' => 'Atari Jaguar',
19
+ 'atarilynx' => 'Atari Lynx',
20
+ 'colecovision' => 'ColecoVision',
21
+ 'commodore64' => 'Commodore 64',
22
+ 'gamegear' => 'Game Gear',
23
+ 'gb' => 'Game Boy',
24
+ 'gbc' => 'Game Boy Color',
25
+ 'gcdvectrex' => 'Vectrex',
26
+ 'genesis' => 'Genesis',
27
+ 'intellivision' => 'Intellivision',
28
+ 'mame' => 'MAME',
29
+ 'msx1' => 'MSX',
30
+ 'msx2' => 'MSX2',
31
+ 'mtx' => 'MTX',
32
+ 'n64' => 'N64',
33
+ 'neogeocd' => 'Neo Geo CD',
34
+ 'neogeopocket' => 'Neo Geo Pocket',
35
+ 'nes' => 'NES',
36
+ 'oric' => 'Oric',
37
+ 'pce' => 'PC Engine',
38
+ 'radioshackcolorcomputer' => 'TRS-80',
39
+ 'samcoupe' => 'SAM Coupé',
40
+ 'segacd' => 'Sega CD',
41
+ 'segamastersystem' => 'Master System',
42
+ 'snes' => 'SNES',
43
+ 'thompsonmo5' => 'Thomson MO5',
44
+ 'virtualboy' => 'Virtual Boy',
45
+ 'watara' => 'Watara Supervision',
46
+ 'wonderswan' => 'WonderSwan',
47
+ }
48
+
49
+ def self.platforms
50
+ PLATFORM
51
+ end
52
+
53
+ def self.games(platform)
54
+ games = []
55
+ sections = ('a'..'z').to_a.unshift("0")
56
+ progress_bar = ProgressBar.new(platform, sections.count)
57
+ sections.each_with_index do |section, index|
58
+ page = Nokogiri::HTML(RestClient.get("https://www.romnation.net/srv/roms/#{platform}/#{section}/sort-title.html"))
59
+ pages = ['1']
60
+ pages = page.css('.pagination').first.css('a').map(&:text).map(&:strip).reject(&:empty?) unless page.css('.pagination').empty?
61
+ pages.each do |p|
62
+ page = Nokogiri::HTML(RestClient.get("https://www.romnation.net/srv/roms/#{platform}/#{section}/page-#{p}_sort-title.html"))
63
+ games.append *page.css('table.listings td.title a').map { |game|
64
+ game_info = GameInfo.new(game.text)
65
+ {
66
+ id: game['href'].split('/')[3].to_i,
67
+ name: game.text,
68
+ region: game_info.region,
69
+ tags: game_info.tags,
70
+ }
71
+ }
72
+ end
73
+ progress_bar.set(index+1)
74
+ end
75
+ progress_bar.finish
76
+ games
77
+ end
78
+
79
+ def self.install(game)
80
+ agent = Mechanize.new
81
+ agent.pluggable_parser.default = Mechanize::Download
82
+ agent.user_agent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.93 Safari/537.36'
83
+ page = agent.get("https://www.romnation.net/download/rom/#{game.id}")
84
+
85
+ response = nil
86
+ agent.progressbar{
87
+ response = page.link_with(:text => 'Download This Rom').click
88
+ }
89
+ if response.code.to_i == 200
90
+ filename = CGI.unescape(response.filename.split('_host=').first)
91
+ FileUtils.mkdir_p(game.filepath)
92
+ response.save!("#{game.filepath}/#{filename}")
93
+ yield [filename]
94
+ end
95
+ end
96
+ end
97
+ end
98
+ end
@@ -36,9 +36,8 @@ module Gamerom
36
36
  def self.games(platform)
37
37
  games = []
38
38
  sections = ('a'..'z').to_a.unshift("number")
39
-
40
- sections.each do |section|
41
- print "#{section} "
39
+ progress_bar = ProgressBar.new(platform, sections.count)
40
+ sections.each_with_index do |section, index|
42
41
  page = Nokogiri::HTML(RestClient.get("https://vimm.net/vault/?p=list&system=#{platform}&section=#{section}"))
43
42
  games.append *page.css('table.hovertable td:first-child a:first-child').map { |game|
44
43
  {
@@ -47,7 +46,9 @@ module Gamerom
47
46
  region: 'USA',
48
47
  }
49
48
  }
49
+ progress_bar.set(index+1)
50
50
  end
51
+ progress_bar.finish
51
52
  games
52
53
  end
53
54
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Gamerom
4
- VERSION = "0.2.2"
4
+ VERSION = "0.3.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gamerom
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lucas Mundim
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-05-10 00:00:00.000000000 Z
11
+ date: 2021-05-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mechanize
@@ -124,8 +124,10 @@ files:
124
124
  - lib/gamerom/cli.rb
125
125
  - lib/gamerom/config.rb
126
126
  - lib/gamerom/game.rb
127
+ - lib/gamerom/game_info.rb
127
128
  - lib/gamerom/repo.rb
128
129
  - lib/gamerom/repo_adapters/coolrom.rb
130
+ - lib/gamerom/repo_adapters/romnation.rb
129
131
  - lib/gamerom/repo_adapters/vimm.rb
130
132
  - lib/gamerom/version.rb
131
133
  - lib/mechanizeprogress.rb