rmd 0.0.1
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 +7 -0
- data/.bundle/config +2 -0
- data/.gitignore +5 -0
- data/.rspec +2 -0
- data/Gemfile +6 -0
- data/LICENSE.txt +22 -0
- data/README.md +57 -0
- data/Rakefile +2 -0
- data/bin/rmd +4 -0
- data/fixtures/vcr_cassettes/song_download.yml +186 -0
- data/lib/rmd.rb +8 -0
- data/lib/rmd/downloader.rb +51 -0
- data/lib/rmd/factory.rb +29 -0
- data/lib/rmd/main.rb +12 -0
- data/lib/rmd/nct/getter/base.rb +31 -0
- data/lib/rmd/nct/getter/key_from_page.rb +50 -0
- data/lib/rmd/nct/getter/key_from_url.rb +44 -0
- data/lib/rmd/nct/playlist.rb +63 -0
- data/lib/rmd/nct/song.rb +36 -0
- data/lib/rmd/processor.rb +44 -0
- data/lib/rmd/song_playlist_adapter.rb +20 -0
- data/lib/rmd/version.rb +3 -0
- data/rmd.gemspec +31 -0
- data/spec/rmd/downloader_spec.rb +33 -0
- data/spec/rmd/factory_spec.rb +31 -0
- data/spec/rmd/nct/getter/key_from_page_spec.rb +140 -0
- data/spec/rmd/nct/getter/key_from_url_spec.rb +113 -0
- data/spec/rmd/nct/playlist_spec.rb +100 -0
- data/spec/rmd/nct/song_spec.rb +57 -0
- data/spec/rmd/processor_spec.rb +62 -0
- data/spec/rmd/song_playlist_adapter_spec.rb +35 -0
- data/spec/spec_helper.rb +102 -0
- metadata +211 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 0a1e54a10c83c25b327ad3e66e92c75c2fdb51e3
|
4
|
+
data.tar.gz: 245f266bc289d6f49d31217e83e0fadeef2c44a4
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 26b45cc05505b77963087e42088f797220fd169a9817de5a5ca6bec48835636a216d3bae271f694e9ef9a07a37b09b6509c7fe4f16b7332117c194488c41f6e8
|
7
|
+
data.tar.gz: 7de0c319fbcf8865a209213f71cbbef2d96113a0e4d0585c7fc97bf1803c7de6b3420147d8fe64b6640419c7957d1a0ebe5a89547a55d3195c914ccf874dac9e
|
data/.bundle/config
ADDED
data/.gitignore
ADDED
data/.rspec
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 Hieu Nguyen
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
# Rmd
|
2
|
+
|
3
|
+
This is a simple CLI music downloader for Vietnamese music site.
|
4
|
+
|
5
|
+
This gem support MacOS / Linux (I'm not sure if it can run on Windows).
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Install it as:
|
10
|
+
|
11
|
+
$ gem install rmd
|
12
|
+
|
13
|
+
## Usage
|
14
|
+
|
15
|
+
```shell
|
16
|
+
Commands:
|
17
|
+
rmd download [LINK] # Dowload your music from a specific link
|
18
|
+
rmd help [COMMAND] # Describe available commands or one specific command
|
19
|
+
```
|
20
|
+
|
21
|
+
##### Download a song
|
22
|
+
|
23
|
+
```shell
|
24
|
+
$ rmd download http://www.nhaccuatui.com/bai-hat/dors-mon-ange-mozart-lopera-rock.dDXGBGls3Rik.html
|
25
|
+
Start processing http://www.nhaccuatui.com/bai-hat/dors-mon-ange-mozart-lopera-rock.dDXGBGls3Rik.html...
|
26
|
+
DorsMonAnge-MozartLoperaRock_4cxzy.mp3
|
27
|
+
Time: 00:00:02 ============================================================================================== 100% 1185 KB/sec
|
28
|
+
```
|
29
|
+
|
30
|
+
##### Download a playlist
|
31
|
+
|
32
|
+
```shell
|
33
|
+
$ rmd download http://www.nhaccuatui.com/playlist/fullmetal-alchemist-dang-cap-nhat.ekoGnMrFlQfA.html
|
34
|
+
Start processing http://www.nhaccuatui.com/playlist/fullmetal-alchemist-dang-cap-nhat.ekoGnMrFlQfA.html...
|
35
|
+
2 / 2 Songs ================================================================================================= 100%
|
36
|
+
DorsMonAnge-MozartLoperaRock_4cxzy.mp3
|
37
|
+
Time: 00:00:02 ============================================================================================== 100% 1185 KB/sec
|
38
|
+
LeBeinQiuFailMal-MozartLoperaRock_4asqw.mp3
|
39
|
+
Time: 00:00:03 ============================================================================================== 100% 902 KB/sec
|
40
|
+
```
|
41
|
+
|
42
|
+
## Features
|
43
|
+
|
44
|
+
- [x] Download songs/playlists from NCT
|
45
|
+
- [ ] Download songs/playlist from Zing MP3
|
46
|
+
- [ ] Read a file to get list of links to download
|
47
|
+
- [x] Visual progress bar for download
|
48
|
+
- [ ] Specify download folder
|
49
|
+
- [ ] Cache data
|
50
|
+
|
51
|
+
## Contributing
|
52
|
+
|
53
|
+
1. Fork it ( https://github.com/hieuk09/rmd/fork )
|
54
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
55
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
56
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
57
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/bin/rmd
ADDED
@@ -0,0 +1,186 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://db.gamefaqs.com/portable/3ds/file/fire_emblem_awakening_shop.txt
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept-Encoding:
|
11
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
12
|
+
Accept:
|
13
|
+
- "*/*"
|
14
|
+
User-Agent:
|
15
|
+
- Ruby
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: OK
|
20
|
+
headers:
|
21
|
+
Date:
|
22
|
+
- Sun, 11 Jan 2015 03:50:11 GMT
|
23
|
+
Server:
|
24
|
+
- Apache
|
25
|
+
Last-Modified:
|
26
|
+
- Tue, 25 Nov 2014 20:35:34 GMT
|
27
|
+
Etag:
|
28
|
+
- '"2f86-508b4da5e8458"'
|
29
|
+
Accept-Ranges:
|
30
|
+
- bytes
|
31
|
+
Vary:
|
32
|
+
- Accept-Encoding
|
33
|
+
Content-Length:
|
34
|
+
- '2802'
|
35
|
+
Content-Type:
|
36
|
+
- text/plain; charset=ISO-8859-1
|
37
|
+
body:
|
38
|
+
encoding: UTF-8
|
39
|
+
string: "----------------------------------------------\r\n+Fire Emblem Awakening,
|
40
|
+
3DS - Map Shops Guide+\r\n----------------------------------------------\r\n
|
41
|
+
\ \r\nVersion 1.0 \r\n+++++++++++++++++++++++++++++++++++++++++++++\r\nIndex
|
42
|
+
\ \r\n1: Version History [HISTOR]\r\n2:
|
43
|
+
Introduction [INTRO1]\r\n3:Main Chapters [MAIN00]\r\nSouthtown
|
44
|
+
\ [MAIN01]\r\nWest of Yisstol [MAIN02]\r\nThe
|
45
|
+
Northroad [MAIN03]\r\nThe Longfort [MAIN04]\r\nArena
|
46
|
+
Ferox [MAIN05]\r\nBorder Pass [MAIN06]\r\nYisstol
|
47
|
+
\ [MAIN07]\r\nBreakneck Pass [MAIN08]\r\nBorder
|
48
|
+
Sands [MAIN09]\r\nPlegia Courtyard [MAIN10]\r\nThe
|
49
|
+
Midmire [MAIN11]\r\nBorder Wastes [MAIN12]\r\nCarrion
|
50
|
+
Isle [MAIN13]\r\nThe Searoad [MAIN14]\r\nValm
|
51
|
+
Harbor [MAIN15]\r\nThe Mila Tree [MAIN16]\r\nFort
|
52
|
+
Steiger [MAIN17]\r\nThe Demon's Ingle [MAIN18]\r\nValm
|
53
|
+
Approach [MAIN19]\r\nValm Castle [MAIN20]\r\nPlegia
|
54
|
+
Castle [MAIN21]\r\nTable Approach [MAIN22]\r\nThe
|
55
|
+
Dragon's Table [MAIN23]\r\nMount Prism [MAIN24]\r\nOrigin
|
56
|
+
Peak [MAIN25]\r\n4:Paraloue Chapters [PARA00]\r\nThe
|
57
|
+
Farfort [PARA01]\r\nThe Twins' Turf [PARA02]\r\nPeacful
|
58
|
+
Village [PARA03]\r\nThe Twin's Hideout [PARA04]\r\nSage
|
59
|
+
Hamlet [PARA05]\r\nGreat Gate [PARA06]\r\nMila
|
60
|
+
Shrine Ruins [PARA07]\r\nDualing Grounds [PARA08]\r\nVerant
|
61
|
+
Forest [PARA09]\r\nMercenary Fortress [PARA10]\r\nWyern
|
62
|
+
Valley [PARA11]\r\nThe Ruins of Time [PARA12]\r\nLaw's
|
63
|
+
End [PARA13]\r\nDesert Oasis [PARA14]\r\nKidnapper's
|
64
|
+
Keep [PARA15]\r\nManor of Lost Souls [PARA16]\r\nDivine
|
65
|
+
Dragon Grounds [PARA17]\r\nSea-king's Throne [PARA18]\r\nConqueror's
|
66
|
+
Whetstone [PARA19]\r\nMountain Village [PARA20]\r\nWarrior's
|
67
|
+
Tomb [PARA21]\r\nWellspring of Truth [PARA22]\r\nGarden
|
68
|
+
of Giants [PARA23]\r\n5:Credits/Legal/Contact Info [ENDING]\r\n+++++++++++++++++++++++++++++++++++++++++++++\r\nVersion
|
69
|
+
History [HISTOR]\r\n0.1:Made the Index and Legal Information\r\n1.0
|
70
|
+
Completed guide\r\n+++++++++++++++++++++++++++++++++++++++++++++\r\nIntroduction
|
71
|
+
\ [INTRO1]\r\nThis guide is to help those with wanting
|
72
|
+
to\r\nknow where items can be bought.Ctrl f will \r\nhelp you find a specific
|
73
|
+
shop.\r\n+++++++++++++++++++++++++++++++++++++++++++++\r\nMain Chapters [MAIN00]\r\n
|
74
|
+
\ [MAIN01]\r\n:Southtown :\r\nBronze Sword\r\nBronze
|
75
|
+
Lance\r\nBronze Axe \r\nBronze Bow \r\nFire \r\n: :\r\n
|
76
|
+
\ [MAIN02]\r\n:West of Yisstol:\r\nHeal
|
77
|
+
\ \r\nVulnerary \r\n: :\r\n [MAIN03]\r\n:The
|
78
|
+
Northroad:\r\nFire \r\nThunder \r\nWind \r\nFlux \r\n:
|
79
|
+
\ :\r\n\r\n [MAIN04]\r\n:The
|
80
|
+
Longfort :\r\nHeal \r\nVulnerary \r\nStrength Tonic\r\nDefense
|
81
|
+
Tonic \r\nReeking Box \r\n: :\r\n [MAIN05]\r\n:Arena
|
82
|
+
Ferox:\r\nIron Lance \r\nIron Bow \r\nThunder \r\n: :\r\n
|
83
|
+
\ [MAIN06]\r\n:Border Pass:\r\nIron Sword
|
84
|
+
\ \r\nIron Axe \r\nWind \r\n: :\r\n\r\n [MAIN07]\r\n:Yisstol
|
85
|
+
\ :\r\nHeal \r\nMend \r\nVulnerary \r\nMagic
|
86
|
+
Tonic \r\nResistance Tonic \r\n: :\r\n [MAIN08]\r\n:Breakneck
|
87
|
+
Pass:\r\nIron Sword \r\nJavelin \r\nHand Axe \r\nIron Bow
|
88
|
+
\ \r\nFire \r\n: :\r\n [MAIN09]\r\n:Border
|
89
|
+
Sands:\r\nMend \r\nConcoxtion \r\nSkill tonic \r\nSpeed tonic \r\nLuck
|
90
|
+
tonic \r\n: :\r\n [MAIN10]\r\n:Plegia
|
91
|
+
Courtyard:\r\nSteel Sword \r\nSteel Lance \r\nSteel Axe \r\nSteel
|
92
|
+
Bow \r\nFlux \r\n: :\r\n\r\n [MAIN11]\r\n:The
|
93
|
+
Midmire:\r\nIron Lance \r\nJavelin \r\nHand Axe \r\nIron Bow \r\n:
|
94
|
+
\ :\r\n\r\n [MAIN12]\r\n:Border
|
95
|
+
Wastes:\r\nIron Sword \r\nIron Bow \r\nFire \r\nThunder \r\nWind
|
96
|
+
\ \r\n: :\r\n [MAIN13]\r\n:Port
|
97
|
+
Ferox:\r\nMend \r\nRescue \r\nDragonstone\r\nBeaststone \r\nMaster
|
98
|
+
Seal\r\n: :\r\n\r\n [MAIN14]\r\n:Carrion
|
99
|
+
Isle:\r\nElFire \r\nElThunder \r\nElWind \r\nNosferatu \r\nReeking
|
100
|
+
Box \r\n: :\r\n [MAIN15]\r\n:The
|
101
|
+
Searoad:\r\nSteel Lance \r\nSilver Lance\r\nJavelin \r\nSteel Bow \r\nSilver
|
102
|
+
Bow \r\n: :\r\n [MAIN16]\r\n:Valm
|
103
|
+
Harbor:\r\nSteel Sword \r\nSilver Sword\r\nSteel Axe \r\nSilver Axe \r\nHand
|
104
|
+
Axe \r\n: :\r\n [MAIN17]\r\n:The
|
105
|
+
Mila Tree:\r\nHeal \r\nWard \r\nPure Water \r\nHP Tonic
|
106
|
+
\ \r\nSecond Seal \r\n: :\r\n [MAIN18]\r\n:Fort
|
107
|
+
Steiger:\r\nSilver Sword \r\nSilver Lance \r\nSilver Axe \r\nSilver Bow
|
108
|
+
\ \r\nArcfire \r\n: :\r\n [MAIN19]\r\n:The
|
109
|
+
Demon's Ingle:\r\nPhyic \r\nRecover \r\nWard \r\nDragonstone
|
110
|
+
\ \r\nBeaststone \r\n: :\r\n [MAIN20]\r\n:Valm
|
111
|
+
Castle Approach:\r\nSilver Sword \r\nKilling Edge \r\nSilver
|
112
|
+
Bow \r\nKiller Bow \r\nRuin \r\n: :\r\n
|
113
|
+
\ [MAIN21]\r\n:Valm Castle:\r\nSilver Lance\r\nKiller
|
114
|
+
Lance\r\nSilver Axe \r\nKiller Axe \r\n: :\r\n [MAIN22]\r\n:Plegia
|
115
|
+
Castle:\r\nJavelin \r\nHand Axe \r\nArcfire \r\nArcthunder
|
116
|
+
\ \r\nArcwind \r\n: :\r\n [MAIN23]\r\n:Table
|
117
|
+
Approach:\r\nHeal \r\nMend \r\nRescue \r\nWard
|
118
|
+
\ \r\nConcoction \r\n: :\r\n [MAIN24]\r\n:The
|
119
|
+
Dragon's Table:\r\nPhyic \r\nRecover \r\nDragonstone+
|
120
|
+
\ \r\nBeaststone+ \r\nElxir \r\n: :\r\n
|
121
|
+
\ [MAIN25]\r\n:Mount Prism:\r\nBolganone
|
122
|
+
\ \r\nThoron \r\nReexcalibur \r\nWaste \r\n: :\r\n [MAIN26]\r\n:Origin
|
123
|
+
Peak:\r\nBrave Sword \r\nBrave Lance \r\nBrave Axe \r\nBrave Bow\r\nReeking
|
124
|
+
Box\r\n: :\r\n+++++++++++++++++++++++++++++++++++++++++++++\r\nParaloue
|
125
|
+
Chapters [PARA00]\r\n [PARA01]\r\n:The
|
126
|
+
Farfort:\r\nIron Sword\r\nIron Lance\r\nIron Axe\r\nIron Bow\r\n: :\r\n
|
127
|
+
\ [PARA02]\r\n:The Twins' Turf:\r\nJavelin
|
128
|
+
\ \r\nHand Axe \r\nFire \r\nThunder \r\nWind
|
129
|
+
\ \r\n: :\r\n [PARA03]\r\n:Peacful
|
130
|
+
Village:\r\nHeal \r\nMend \r\nVulnerary \r\nConcoction\r\n:
|
131
|
+
\ :\r\n [PARA04]\r\n:The
|
132
|
+
Twin's Hideout:\r\nSteel Sword \r\nSteel Lance \r\nSteel Axe
|
133
|
+
\ \r\nSteel Bow \r\n: :\r\n [PARA05]\r\n:Sage
|
134
|
+
Hamlet:\r\nIron Sword \r\nSteel Sword \r\nSilver Sword\r\nKilling Edge\r\n:
|
135
|
+
\ :\r\n [PARA06]\r\n:Great Gate:\r\nHeal
|
136
|
+
\ \r\nRescue \r\nConcoction\r\nElixer \r\nSecond Seal\r\n: :\r\n
|
137
|
+
\ [PARA07]\r\n:Mila Shrine Ruins:\r\nHeal
|
138
|
+
\ \r\nMend \r\nPhyic \r\nRescue \r\nWard
|
139
|
+
\ \r\n: :\r\n [PARA08]\r\n:Dualing
|
140
|
+
Grounds:\r\nPhyic\r\nElixer\r\nHP Tonic\r\nLuck Tonic\r\nMaster Seal\r\n:
|
141
|
+
\ :\r\n [PARA09]\r\n:Verant
|
142
|
+
Forest:\r\nIron Lance\r\nSteel Lance\r\nSliver Lance\r\nJavelin\r\nKiller
|
143
|
+
Lance\r\n: :\r\n [PARA10]\r\n:Mercenary
|
144
|
+
Fortress:\r\nRecover\r\nElixer\r\nMagic Tonic \r\nResistance Tonic\r\nSecond
|
145
|
+
Seal\r\n: :\r\n [PARA11]\r\n:Wyern
|
146
|
+
Valley:\r\nIron Axe\r\nSteel Axe\r\nSliver Axe\r\nHand Axe\r\nKiller Axe\r\n:
|
147
|
+
\ :\r\n [PARA12]\r\n:The Ruins
|
148
|
+
of Time:\r\nHeal \r\nMend\r\nConcoction\r\nElixer\r\nMaster Seal\r\n:
|
149
|
+
\ :\r\n [PARA13]\r\n:Law's
|
150
|
+
End:\r\nBeaststone\r\nConcoction\r\nSkill tonic\r\nSpeed tonic\r\nMaster Seal\r\n:
|
151
|
+
\ :\r\n\r\n [PARA14]\r\n:Desert
|
152
|
+
Oasis:\r\nElfire \r\nElthunder \r\nElwind \r\nFlux \r\nNosferatu
|
153
|
+
\ \r\n: :\r\n [PARA15]\r\n:Kidnapper's
|
154
|
+
Keep:\r\nIron Bow\r\nSteel Bow\r\nSilver Bow\r\nKiller Bow\r\n: :\r\n
|
155
|
+
\ [PARA16]\r\n:Manor of Lost Souls:\r\nDragonstone\r\nConcoction\r\nStrength
|
156
|
+
Tonic\r\nDefense Tonic\r\nSecond Seal\r\n: :\r\n [PARA17]\r\n:Divine
|
157
|
+
Dragon Grounds:\r\nArcfire \r\nArcthunder \r\nArcwind \r\nNosferatu\r\nRuin\r\n:
|
158
|
+
\ :\r\n [PARA18]\r\n:Sea-king's
|
159
|
+
Throne:\r\nSilver Axe\r\nBrave Axe\r\nHammer\r\nDragonstone+ \r\nBeaststone+\r\n:
|
160
|
+
\ :\r\n [PARA19]\r\n:Conqueror's
|
161
|
+
Whetstone:\r\nSilver Lance\r\nBrave Lance\r\nBeast Killer\r\nBlessed Lance\r\nThoron\r\n:
|
162
|
+
\ :\r\n [PARA20]\r\n:Mountain
|
163
|
+
Village:\r\nSilver Bow\r\nBrave Bow\r\nBlessed Bow\r\nRexcalibur\r\nWaste\r\n:
|
164
|
+
\ :\r\n [PARA21]\r\n:Warrior's
|
165
|
+
Tomb:\r\nSliver Sword \r\nBrave Sword \r\nAmrorslayer \r\nWyrmslayer
|
166
|
+
\ \r\nBolganone \r\n: :\r\n [PARA22]\r\n:Wellspring
|
167
|
+
of Truth:\r\nPhyic \r\nRecover \r\nRescue \r\nWard
|
168
|
+
\ \r\nElixer \r\n: :\r\n [PARA23]\r\n:Garden
|
169
|
+
of Giants:\r\nLevin Sword\r\nNoble Rapier\r\nShort Spear\r\nShort Axe\r\nLongbow\r\n:
|
170
|
+
\ :\r\n+++++++++++++++++++++++++++++++++++++++++++++\r\nConclusion/Contact
|
171
|
+
Info/Legal [ENDING]\r\n+++++++++++++++++++++++++++++++++++++++++++++\r\nConclusion\r\n-----------------------------------------------------------------\r\nWell
|
172
|
+
felt like it took forever, again this was to help those find\r\nitems from
|
173
|
+
the shops because memorizing it is a pain.\r\n-----------------------------------------------------------------\r\nContact
|
174
|
+
Info\r\n-----------------------------------------------------------------\r\nIf
|
175
|
+
you have any questions or suggestions contact me at\r\noratigames@yahoo.com\r\n-----------------------------------------------------------------\r\nLegal
|
176
|
+
Stuff\r\n-----------------------------------------------------------------\r\nThis
|
177
|
+
may not be reproduced under any circumstances except for personal,\r\nprivate
|
178
|
+
use. It may not be placed on any web site or otherwise distributed\r\npublicly
|
179
|
+
without advance written permission. Use of this guide on any other \r\nwebsite
|
180
|
+
or as a part of any public display is strictly prohibited, and a \r\nviolation
|
181
|
+
of copyright. Do not copy or alter information slightly from this \r\nguide,
|
182
|
+
and do not present it as your own. The only sites allowed to host this \r\ndocument
|
183
|
+
are GameFAQs.com and its affiliates."
|
184
|
+
http_version:
|
185
|
+
recorded_at: Sun, 11 Jan 2015 03:50:27 GMT
|
186
|
+
recorded_with: VCR 2.9.3
|
data/lib/rmd.rb
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
require 'open-uri'
|
2
|
+
require 'ruby-progressbar'
|
3
|
+
|
4
|
+
module RMD
|
5
|
+
class Downloader
|
6
|
+
attr_reader :link
|
7
|
+
|
8
|
+
def initialize(link)
|
9
|
+
@link = link
|
10
|
+
end
|
11
|
+
|
12
|
+
def download
|
13
|
+
puts file_name.green
|
14
|
+
|
15
|
+
progress_bar = ProgressBar.create(
|
16
|
+
starting_at: 0,
|
17
|
+
total: nil,
|
18
|
+
format: "%a %B %p%% %r KB/sec",
|
19
|
+
rate_scale: lambda { |rate| rate / 1024 }
|
20
|
+
)
|
21
|
+
|
22
|
+
content_length_proc = Proc.new { |content_length|
|
23
|
+
progress_bar.total = content_length
|
24
|
+
}
|
25
|
+
|
26
|
+
progress_proc = Proc.new { |bytes_transferred|
|
27
|
+
if progress_bar.total && progress_bar.total < bytes_transferred
|
28
|
+
progress_bar.total = nil
|
29
|
+
end
|
30
|
+
progress_bar.progress = bytes_transferred
|
31
|
+
}
|
32
|
+
|
33
|
+
open(link, "rb", content_length_proc: content_length_proc, progress_proc: progress_proc) do |page|
|
34
|
+
File.open(file_name, "wb") do |file|
|
35
|
+
file.write(page.read)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.download(link)
|
41
|
+
new(link).download
|
42
|
+
end
|
43
|
+
|
44
|
+
private
|
45
|
+
|
46
|
+
def file_name
|
47
|
+
uri = URI.parse(link)
|
48
|
+
File.basename(uri.path)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
data/lib/rmd/factory.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'rmd/song_playlist_adapter'
|
2
|
+
require 'rmd/nct/song'
|
3
|
+
require 'rmd/nct/playlist'
|
4
|
+
|
5
|
+
module RMD
|
6
|
+
class Factory
|
7
|
+
attr_reader :link
|
8
|
+
|
9
|
+
def initialize(link)
|
10
|
+
@link = link
|
11
|
+
end
|
12
|
+
|
13
|
+
def build
|
14
|
+
case link
|
15
|
+
when /nhaccuatui/
|
16
|
+
case link
|
17
|
+
when /bai-hat/
|
18
|
+
RMD::SongPlaylistAdapter.new(RMD::NCT::Song.new(link))
|
19
|
+
when /playlist/
|
20
|
+
RMD::NCT::Playlist.new(link)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.build(link)
|
26
|
+
new(link).build
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/lib/rmd/main.rb
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'mechanize'
|
2
|
+
|
3
|
+
module RMD
|
4
|
+
module NCT
|
5
|
+
module Getter
|
6
|
+
class Base
|
7
|
+
attr_reader :url, :data_link, :errors
|
8
|
+
|
9
|
+
def initialize(url)
|
10
|
+
@url = url
|
11
|
+
end
|
12
|
+
|
13
|
+
def fetch; end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def key
|
18
|
+
@key ||= uncached_key
|
19
|
+
end
|
20
|
+
|
21
|
+
def uncached_key; end
|
22
|
+
def new_link; end
|
23
|
+
def page; end
|
24
|
+
|
25
|
+
def agent
|
26
|
+
@agent ||= Mechanize.new
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|