Compare commits
21 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8cf70e57cf | ||
|
|
2545c36241 | ||
|
|
e2a4ba738f | ||
|
|
e4e0fc3ea7 | ||
|
|
c56998312c | ||
|
|
3ac1f4ee9e | ||
|
|
c2e9449630 | ||
|
|
fb14020a7f | ||
|
|
5a51d888b8 | ||
|
|
301fa1c860 | ||
|
|
7e32028195 | ||
|
|
dea2c38dc4 | ||
|
|
cdf7f223db | ||
|
|
bb70161652 | ||
|
|
7f2f983f55 | ||
|
|
8dab83b3ef | ||
|
|
cbafa5bc90 | ||
|
|
67735fb52a | ||
|
|
7d6f762f59 | ||
|
|
f3a0d0129d | ||
|
|
65c9032839 |
0
.github/CONTRIBUTING.md
vendored
Normal file
0
.github/CONTRIBUTING.md
vendored
Normal file
31
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
31
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
---
|
||||||
|
name: Bug report
|
||||||
|
about: Create a report to help us improve
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Describe the bug**
|
||||||
|
A clear and concise description of what the bug is.
|
||||||
|
|
||||||
|
**Expected behavior**
|
||||||
|
A clear and concise description of what you expected to happen.
|
||||||
|
|
||||||
|
**Screenshots**
|
||||||
|
If applicable, add screenshots to help explain your problem.
|
||||||
|
|
||||||
|
**Please fill theses informations:**
|
||||||
|
(Add a X between brackets to make them ticked)
|
||||||
|
- OS: [e.g:. Windows 10, Mac OS X 10.13, ...]
|
||||||
|
- [ ] I'm using the latest version of Crunchy
|
||||||
|
- Serie you get a problem with (and specify which episode if it is specific to one):
|
||||||
|
- The command line you are running Crunchy with:
|
||||||
|
- The message Crunchy is giving you, if any:
|
||||||
|
|
||||||
|
**Please be careful to remove your real account login and password if they appear!**
|
||||||
|
|
||||||
|
|
||||||
|
**Additional context**
|
||||||
|
Add any other context about the problem here.
|
||||||
|
|
||||||
|
|
||||||
|
_Also don't hesitate to add labels you feel apropriate on your report._
|
||||||
17
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
17
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
---
|
||||||
|
name: Feature request
|
||||||
|
about: Suggest an idea for this project
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Is your feature request related to a problem? Please describe.**
|
||||||
|
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||||
|
|
||||||
|
**Describe the solution you'd like**
|
||||||
|
A clear and concise description of what you want to happen.
|
||||||
|
|
||||||
|
**Describe alternatives you've considered**
|
||||||
|
A clear and concise description of any alternative solutions or features you've considered.
|
||||||
|
|
||||||
|
**Additional context**
|
||||||
|
Add any other context or screenshots about the feature request here.
|
||||||
11
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
11
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
*Goal for this pull request*
|
||||||
|
A clear and concise description of pull request
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Checklist
|
||||||
|
[ ] I've run `npm run compile` and it produce no error
|
||||||
|
[ ] I've run `npm run test` and it produce no error
|
||||||
|
[ ] I've not pushing more than one feature in that pull request
|
||||||
|
[ ] My branch is updated with the latest from main when I make that pull request
|
||||||
|
[ ] I've tested as much as I can my changes
|
||||||
72
README.md
72
README.md
@@ -66,18 +66,24 @@ The [command-line interface](http://en.wikipedia.org/wiki/Command-line_interface
|
|||||||
|
|
||||||
Options:
|
Options:
|
||||||
|
|
||||||
-h, --help output usage information
|
-V, --version output the version number
|
||||||
-V, --version output the version number
|
-p, --pass <s> The password.
|
||||||
-p, --pass <s> The password.
|
-u, --user <s> The e-mail address or username.
|
||||||
-u, --user <s> The e-mail address or username.
|
-c, --cache Disables the cache.
|
||||||
-c, --cache Disables the cache.
|
-m, --merge Disables merging subtitles and videos.
|
||||||
-m, --merge Disables merging subtitles and videos.
|
-e, --episode <i> The episode filter.
|
||||||
-e, --episode <i> The episode filter.
|
-v, --volume <i> The volume filter.
|
||||||
-v, --volume <i> The volume filter.
|
-f, --format <s> The subtitle format. (Default: ass)
|
||||||
-f, --format <s> The subtitle format. (Default: ass)
|
-o, --output <s> The output path.
|
||||||
-o, --output <s> The output path.
|
-s, --series <s> The series override.
|
||||||
-s, --series <s> The series override.
|
-n, --filename <s> The name override.
|
||||||
-t, --tag <s> The subgroup. (Default: CrunchyRoll)
|
-t, --tag <s> The subgroup. (Default: CrunchyRoll) (default: CrunchyRoll)
|
||||||
|
-r, --resolution <s> The video resolution. (Default: 1080 (360, 480, 720, 1080)) (default: 1080)
|
||||||
|
-g, --rebuildcrp Rebuild the crpersistant file.
|
||||||
|
-b, --batch <s> Batch file (default: CrunchyRoll.txt)
|
||||||
|
--verbose Make tool verbose
|
||||||
|
--retry <i> Number or time to retry fetching an episode. Default: 5 (default: 5)
|
||||||
|
-h, --help output usage information
|
||||||
|
|
||||||
#### Batch-mode
|
#### Batch-mode
|
||||||
|
|
||||||
@@ -97,7 +103,7 @@ Download *Fairy Tail* to `C:\Anime`:
|
|||||||
|
|
||||||
crunchy --output C:\Anime http://www.crunchyroll.com/fairy-tail
|
crunchy --output C:\Anime http://www.crunchyroll.com/fairy-tail
|
||||||
|
|
||||||
#### Switches
|
#### Command line parameters
|
||||||
|
|
||||||
##### Authentication
|
##### Authentication
|
||||||
|
|
||||||
@@ -108,7 +114,7 @@ Download *Fairy Tail* to `C:\Anime`:
|
|||||||
|
|
||||||
##### Disables
|
##### Disables
|
||||||
|
|
||||||
* `-c or --cache` disables the cache.
|
* `-c or --cache` disables the cache in batch mode.
|
||||||
* `-m or --merge` disables merging subtitles and videos.
|
* `-m or --merge` disables merging subtitles and videos.
|
||||||
|
|
||||||
##### Filters
|
##### Filters
|
||||||
@@ -116,12 +122,23 @@ Download *Fairy Tail* to `C:\Anime`:
|
|||||||
* `-e or --episode <i>` filters episodes (positive is greater than, negative is smaller than).
|
* `-e or --episode <i>` filters episodes (positive is greater than, negative is smaller than).
|
||||||
* `-v or --volume <i>` filters volumes (positive is greater than, negative is smaller than).
|
* `-v or --volume <i>` filters volumes (positive is greater than, negative is smaller than).
|
||||||
|
|
||||||
|
_These parameters are probably extremely buggy at the moment..._
|
||||||
|
|
||||||
##### Settings
|
##### Settings
|
||||||
|
|
||||||
* `-f or --format <s>` sets the subtitle format. (Default: ass)
|
* `-f or --format <s>` sets the subtitle format. (Default: ass)
|
||||||
* `-o or --output <s>` sets the output path.
|
* `-o or --output <s>` sets the output path.
|
||||||
* `-s or --series <s>` sets the series override.
|
* `-s or --series <s>` sets the series override.
|
||||||
* `-t or --tag <s>` sets The subgroup. (Default: CrunchyRoll)
|
* `-t or --tag <s>` sets The subgroup. (Default: CrunchyRoll)
|
||||||
|
* `-r or --resolution <s>` sets the resolutoin you want to download (360, 480, 720, 1080)
|
||||||
|
* `--retry <i>` set the number of try Crunchy will use if downloading a serie or episode fail
|
||||||
|
|
||||||
|
##### Others
|
||||||
|
|
||||||
|
* `-b or --batch <s>` specify the batch file to use. Default to "CrunchyRoll.txt"
|
||||||
|
* `--verbose` make Crunchy really verbose. You should use it only for bug reporting or to try to see why it does not work
|
||||||
|
* `-g or --rebuildcrp` use that parameter only if the .crpersistent file has been corrupted and Crunchy try to redownload everything. It will try to rebuild the cache file from the file if find. If you renamed of move any file they will be ignored and not added to the cache file.
|
||||||
|
|
||||||
|
|
||||||
## When things goes wrong
|
## When things goes wrong
|
||||||
|
|
||||||
@@ -131,27 +148,14 @@ Second thing to check, you have to give your credentials (-u and -p parameters)
|
|||||||
|
|
||||||
Third, is it a recently released episode? If yes, sometimes CR have issues were the requested format is not available, and Crunchy is not able to get it. When in doubt, try to watch CR website, if it does not work there, Crunchy will not either. This is valid in all cases even on non recently released.
|
Third, is it a recently released episode? If yes, sometimes CR have issues were the requested format is not available, and Crunchy is not able to get it. When in doubt, try to watch CR website, if it does not work there, Crunchy will not either. This is valid in all cases even on non recently released.
|
||||||
|
|
||||||
Fourth, sometimes, CR website does weird things, and there are some transient errors, wait a couple of minutes (or hours) and try again. It often solved the issue on my side (yes I know that's not really a way of fixing, but if the error is on CR side, Crunchy can't do anything)
|
Fourth, sometimes, CR website does weird things, and there are some transient errors, wait a couple of minutes (or hours) and try again. It has really often solved lots of weird issue on my side (yes I know that's not really a way of fixing, but if the error is on CR side, Crunchy can't do anything)
|
||||||
|
|
||||||
If really nothing works or you find a problem with Crunchy, then you can go and fill an Issue, first read the already open and closed one to make sure you are not reporting an existing problem. If your problem has been already reported, what you can do is to either:
|
If really nothing works or you find a problem with Crunchy, then you can go and fill an Issue, first read the already open and closed one to make sure you are not reporting an existing problem. If your problem has been already reported, what you can do is to either:
|
||||||
- Add a comment saying you also have the same issue
|
- Add a comment saying you also have the same issue
|
||||||
- Add a Thumbs Up reaction to the original entry in the issue, they will are used as a metric to know how many people are annoyed by that issue
|
- Add a Thumbs Up reaction to the original entry in the issue, I use them as a metric to know how many people are annoyed by that issue
|
||||||
If you find one which correspond and is close, don't hesitate to add a comment, the issue may have not be fully solved.
|
If you find one which correspond and it is close, don't hesitate to add a comment, the issue may have not be fully solved.
|
||||||
|
|
||||||
If there is no comparable opened or close issue, you can create a new one.
|
If there is no comparable opened or close issue, you are welcome to create a new one.
|
||||||
|
|
||||||
### What to put in a bug report
|
|
||||||
It is really important for me to know:
|
|
||||||
- on which Operating System you are running Crunchy,
|
|
||||||
- which anime you want to fetch if it is related to a specific one,
|
|
||||||
- The command line you use to run Crunchy
|
|
||||||
- What message Crunchy is giving you if any
|
|
||||||
|
|
||||||
**Please be careful to remove your real account login and password if they appear!**
|
|
||||||
|
|
||||||
Also don't hesitate to add labels you feel apropriate on your report.
|
|
||||||
|
|
||||||
_Note: You can also use a bug report for a feature requests._
|
|
||||||
|
|
||||||
## Developers
|
## Developers
|
||||||
|
|
||||||
@@ -159,9 +163,5 @@ More information will be added at a later point. For now the recommendations are
|
|||||||
|
|
||||||
* Atom with `atom-typescript` and `linter-tslint` (and dependencies).
|
* Atom with `atom-typescript` and `linter-tslint` (and dependencies).
|
||||||
|
|
||||||
Since this project uses TypeScript, compile with `node ts` or `npm install`.
|
Since this project uses TypeScript, compile with `node run compile` to build the tool and `npm run test` to run the linter.
|
||||||
|
|
||||||
#### A note about pull requests:
|
|
||||||
If you want to help working on this project, Pull request are welcome, but please explain the goal of your changes, and do a pull request per change: you want to add support for _X_, _Y_ and _Z_, make a pull request for X, one for Y and one for Z. I'm not saying a pull request per commit that would be idiotic.
|
|
||||||
The idea is if your pull request changes lots of thing at the same time, if just a single part can't be accepted, if will delay the acceptation of the whole pull request where some of the feature could be integrated quicker is they were requested alone.
|
|
||||||
Also if for example the change _Y_ depends on _X_, you can wait for _X_ to be accepted before requesting for _Y_, if they are independant you can send a pull request for each at the same time.
|
|
||||||
|
|||||||
85
package-lock.json
generated
85
package-lock.json
generated
@@ -1,40 +1,46 @@
|
|||||||
{
|
{
|
||||||
"name": "crunchy",
|
"name": "crunchy",
|
||||||
"version": "1.3.0",
|
"version": "1.3.2",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/bluebird": {
|
"@types/bluebird": {
|
||||||
"version": "3.5.20",
|
"version": "3.5.20",
|
||||||
"resolved": "https://registry.npmjs.org/@types/bluebird/-/bluebird-3.5.20.tgz",
|
"resolved": "https://registry.npmjs.org/@types/bluebird/-/bluebird-3.5.20.tgz",
|
||||||
"integrity": "sha1-9jYxcq3W9Oq7jK2lPKmvJ4Ho1qE=",
|
"integrity": "sha512-Wk41MVdF+cHBfVXj/ufUHJeO3BlIQr1McbHZANErMykaCWeDSZbH5erGjNBw2/3UlRdSxZbLfSuQTzFmPOYFsA==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"@types/caseless": {
|
"@types/caseless": {
|
||||||
"version": "0.12.1",
|
"version": "0.12.1",
|
||||||
"resolved": "https://registry.npmjs.org/@types/caseless/-/caseless-0.12.1.tgz",
|
"resolved": "https://registry.npmjs.org/@types/caseless/-/caseless-0.12.1.tgz",
|
||||||
"integrity": "sha1-l5TGnIOF0BkqzEcaVA0fjg0WIYo=",
|
"integrity": "sha512-FhlMa34NHp9K5MY1Uz8yb+ZvuX0pnvn3jScRSNAb75KHGB8d3rEU6hqMs3Z2vjuytcMfRg6c5CHMc3wtYyD2/A==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"@types/cheerio": {
|
"@types/cheerio": {
|
||||||
"version": "0.22.7",
|
"version": "0.22.7",
|
||||||
"resolved": "https://registry.npmjs.org/@types/cheerio/-/cheerio-0.22.7.tgz",
|
"resolved": "https://registry.npmjs.org/@types/cheerio/-/cheerio-0.22.7.tgz",
|
||||||
"integrity": "sha1-SpLq/t+yufRDfTpEEABtgRFMZs4=",
|
"integrity": "sha512-+T9qBbqe/jXtTjzVddArZExahoPPmt8eq3O1ZuCKZXjBVxf/ciUYNXrIDZJEVgYvpELnv6VlPRCfLzufRxpAag==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"@types/events": {
|
||||||
|
"version": "1.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/events/-/events-1.2.0.tgz",
|
||||||
|
"integrity": "sha512-KEIlhXnIutzKwRbQkGWb/I4HFqBuUykAdHgDED6xqwXJfONCjF5VoE0cXEiurh3XauygxzeDzgtXUqvLkxFzzA==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"@types/form-data": {
|
"@types/form-data": {
|
||||||
"version": "2.2.1",
|
"version": "2.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/@types/form-data/-/form-data-2.2.1.tgz",
|
"resolved": "https://registry.npmjs.org/@types/form-data/-/form-data-2.2.1.tgz",
|
||||||
"integrity": "sha1-7is7jqoRwJOCiZU2BrdFtzjFSx4=",
|
"integrity": "sha512-JAMFhOaHIciYVh8fb5/83nmuO/AHwmto+Hq7a9y8FzLDcC1KCU344XDOMEmahnrTFlHjgh4L0WJFczNIX2GxnQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@types/node": "*"
|
"@types/node": "*"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@types/fs-extra": {
|
"@types/fs-extra": {
|
||||||
"version": "5.0.2",
|
"version": "5.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-5.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-5.0.3.tgz",
|
||||||
"integrity": "sha512-Q3FWsbdmkQd1ib11A4XNWQvRD//5KpPoGawA8aB2DR7pWKoW9XQv3+dGxD/Z1eVFze23Okdo27ZQytVFlweKvQ==",
|
"integrity": "sha512-m2QKoRrJnei1s10e1ZfMIa7QcABBVLdQhVUv5+bMRaHhPzxO/IWMmREiags59AqFbI+piWPq/PupTahNS/0kyA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@types/node": "*"
|
"@types/node": "*"
|
||||||
@@ -43,22 +49,21 @@
|
|||||||
"@types/mkdirp": {
|
"@types/mkdirp": {
|
||||||
"version": "0.5.2",
|
"version": "0.5.2",
|
||||||
"resolved": "https://registry.npmjs.org/@types/mkdirp/-/mkdirp-0.5.2.tgz",
|
"resolved": "https://registry.npmjs.org/@types/mkdirp/-/mkdirp-0.5.2.tgz",
|
||||||
"integrity": "sha1-UDqs/lzCcD1UhDJrGyfvpnoznB8=",
|
"integrity": "sha512-U5icWpv7YnZYGsN4/cmh3WD2onMY0aJIiTE6+51TwJCttdHvtCYmkBNOobHlXwrJRL0nkH9jH4kD+1FAdMN4Tg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@types/node": "*"
|
"@types/node": "*"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@types/node": {
|
"@types/node": {
|
||||||
"version": "8.5.2",
|
"version": "10.3.3",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-8.5.2.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-10.3.3.tgz",
|
||||||
"integrity": "sha512-KA4GKOpgXnrqEH2eCVhiv2CsxgXGQJgV1X0vsGlh+WCnxbeAE1GT44ZsTU1IN5dEeV/gDupKa7gWo08V5IxWVQ==",
|
"integrity": "sha512-/gwCgiI2e9RzzZTKbl+am3vgNqOt7a9fJ/uxv4SqYKxenoEDNVU3KZEadlpusWhQI0A0dOrZ0T68JYKVjzmgdQ=="
|
||||||
"dev": true
|
|
||||||
},
|
},
|
||||||
"@types/request": {
|
"@types/request": {
|
||||||
"version": "2.47.0",
|
"version": "2.47.1",
|
||||||
"resolved": "https://registry.npmjs.org/@types/request/-/request-2.47.0.tgz",
|
"resolved": "https://registry.npmjs.org/@types/request/-/request-2.47.1.tgz",
|
||||||
"integrity": "sha1-dqZmzuTLhdz/6mzUZFInkm2eEU4=",
|
"integrity": "sha512-TV3XLvDjQbIeVxJ1Z3oCTDk/KuYwwcNKVwz2YaT0F5u86Prgc4syDAp6P96rkTQQ4bIdh+VswQIC9zS6NjY7/g==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@types/caseless": "*",
|
"@types/caseless": "*",
|
||||||
@@ -70,7 +75,7 @@
|
|||||||
"@types/request-promise": {
|
"@types/request-promise": {
|
||||||
"version": "4.1.41",
|
"version": "4.1.41",
|
||||||
"resolved": "https://registry.npmjs.org/@types/request-promise/-/request-promise-4.1.41.tgz",
|
"resolved": "https://registry.npmjs.org/@types/request-promise/-/request-promise-4.1.41.tgz",
|
||||||
"integrity": "sha1-HiVNUTYtfty3FLYM3jA7y+CrHuA=",
|
"integrity": "sha512-qlx6COxSTdSFHY9oX9v2zL1I05hgz5lwqYiXa2SFL2nDxAiG5KK8rnllLBH7k6OqzS3Ck0bWbxlGVdrZhS6oNw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@types/bluebird": "*",
|
"@types/bluebird": "*",
|
||||||
@@ -78,17 +83,18 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@types/tough-cookie": {
|
"@types/tough-cookie": {
|
||||||
"version": "2.3.2",
|
"version": "2.3.3",
|
||||||
"resolved": "https://registry.npmjs.org/@types/tough-cookie/-/tough-cookie-2.3.2.tgz",
|
"resolved": "https://registry.npmjs.org/@types/tough-cookie/-/tough-cookie-2.3.3.tgz",
|
||||||
"integrity": "sha512-vOVmaruQG5EatOU/jM6yU2uCp3Lz6mK1P5Ztu4iJjfM4SVHU9XYktPUQtKlIXuahqXHdEyUarMrBEwg5Cwu+bA==",
|
"integrity": "sha512-MDQLxNFRLasqS4UlkWMSACMKeSm1x4Q3TxzUC7KQUsh6RK1ZrQ0VEyE3yzXcBu+K8ejVj4wuX32eUG02yNp+YQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"@types/xml2js": {
|
"@types/xml2js": {
|
||||||
"version": "0.4.2",
|
"version": "0.4.3",
|
||||||
"resolved": "https://registry.npmjs.org/@types/xml2js/-/xml2js-0.4.2.tgz",
|
"resolved": "https://registry.npmjs.org/@types/xml2js/-/xml2js-0.4.3.tgz",
|
||||||
"integrity": "sha1-pLhLOHn/1HEJU/2Syr/emopOhFY=",
|
"integrity": "sha512-Pv2HGRE4gWLs31In7nsyXEH4uVVsd0HNV9i2dyASvtDIlOtSTr1eczPLDpdEuyv5LWH5LT20GIXwPjkshKWI1g==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
|
"@types/events": "*",
|
||||||
"@types/node": "*"
|
"@types/node": "*"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -118,7 +124,7 @@
|
|||||||
"argparse": {
|
"argparse": {
|
||||||
"version": "1.0.10",
|
"version": "1.0.10",
|
||||||
"resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",
|
"resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",
|
||||||
"integrity": "sha1-vNZ5HqWuCXJeF+WtmIE0zUCz2RE=",
|
"integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"sprintf-js": "~1.0.2"
|
"sprintf-js": "~1.0.2"
|
||||||
@@ -199,14 +205,14 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"big-integer": {
|
"big-integer": {
|
||||||
"version": "1.6.30",
|
"version": "1.6.31",
|
||||||
"resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.30.tgz",
|
"resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.31.tgz",
|
||||||
"integrity": "sha512-LGDF7k/8yjS+GTbfFRGiSdcPnIwcjM6kQ0lmbja3tKJzVMmqHmUFnTuUOm/Lt2KVQ3mAZVupf9KNcsew0QV8Kw=="
|
"integrity": "sha512-lDbZNHHwxDKnjP7LWg2leO+tjs4SyVs2Z83dsR1Idbe2urRnxZAUdeQ8YBhHaGaWK/4WM3mz+RlbZsgqck17CA=="
|
||||||
},
|
},
|
||||||
"bluebird": {
|
"bluebird": {
|
||||||
"version": "3.5.1",
|
"version": "3.5.1",
|
||||||
"resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.1.tgz",
|
"resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.1.tgz",
|
||||||
"integrity": "sha1-2VUfnemPH82h5oPRfukaBgLuLrk="
|
"integrity": "sha512-MKiLiV+I1AA596t9w1sQJ8jkiSr5+ZKi0WKrYGUn6d1Fx+Ij4tIj+m2WMQSGczs5jZVxV339chE8iwk6F64wjA=="
|
||||||
},
|
},
|
||||||
"boolbase": {
|
"boolbase": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
@@ -291,7 +297,7 @@
|
|||||||
"cloudscraper": {
|
"cloudscraper": {
|
||||||
"version": "1.5.0",
|
"version": "1.5.0",
|
||||||
"resolved": "https://registry.npmjs.org/cloudscraper/-/cloudscraper-1.5.0.tgz",
|
"resolved": "https://registry.npmjs.org/cloudscraper/-/cloudscraper-1.5.0.tgz",
|
||||||
"integrity": "sha1-NfcLS+q+aE/ECjczrYmgP7CFb0s=",
|
"integrity": "sha512-bZagLhj59+N6Z6lD9zRksYu87GthLwXdKARULi4RZ6UVpotH39ruSFN3UQmw3uuqoj00iDxkGrapAvxeurmlQA==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"request": "^2.49.0"
|
"request": "^2.49.0"
|
||||||
}
|
}
|
||||||
@@ -304,7 +310,7 @@
|
|||||||
"color-convert": {
|
"color-convert": {
|
||||||
"version": "1.9.1",
|
"version": "1.9.1",
|
||||||
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.1.tgz",
|
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.1.tgz",
|
||||||
"integrity": "sha1-wSYRB66y8pTr/+ye2eytUppgl+0=",
|
"integrity": "sha512-mjGanIiwQJskCC18rPR6OmrZ6fm2Lc7PeGFYwCmy5J34wC6F1PzdGL6xeMfmgicfYcNLGuVFA3WzXtIDCQSZxQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"color-name": "^1.1.1"
|
"color-name": "^1.1.1"
|
||||||
@@ -333,7 +339,7 @@
|
|||||||
"commander": {
|
"commander": {
|
||||||
"version": "2.15.1",
|
"version": "2.15.1",
|
||||||
"resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz",
|
"resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz",
|
||||||
"integrity": "sha1-30boZ9D8Kuxmo0ZitAapzK//Ww8="
|
"integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag=="
|
||||||
},
|
},
|
||||||
"concat-map": {
|
"concat-map": {
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
@@ -442,7 +448,7 @@
|
|||||||
"esprima": {
|
"esprima": {
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.0.tgz",
|
||||||
"integrity": "sha1-RJnt3NERDgshi6zy+n9/WfVcqAQ=",
|
"integrity": "sha512-oftTcaMu/EGrEIu904mWteKIv8vMuOgGYo7EhVJJN00R/EED9DCua/xxHRdYnKtcECzVg7xOWhflvJMnqcFZjw==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"esutils": {
|
"esutils": {
|
||||||
@@ -854,6 +860,11 @@
|
|||||||
"resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz",
|
||||||
"integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns="
|
"integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns="
|
||||||
},
|
},
|
||||||
|
"pjson": {
|
||||||
|
"version": "1.0.9",
|
||||||
|
"resolved": "https://registry.npmjs.org/pjson/-/pjson-1.0.9.tgz",
|
||||||
|
"integrity": "sha512-4hRJH3YzkUpOlShRzhyxAmThSNnAaIlWZCAb27hd0pVUAXNUAHAO7XZbsPPvsCYwBFEScTmCCL6DGE8NyZ8BdQ=="
|
||||||
|
},
|
||||||
"process-nextick-args": {
|
"process-nextick-args": {
|
||||||
"version": "1.0.7",
|
"version": "1.0.7",
|
||||||
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz",
|
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz",
|
||||||
@@ -946,7 +957,7 @@
|
|||||||
"sax": {
|
"sax": {
|
||||||
"version": "1.2.4",
|
"version": "1.2.4",
|
||||||
"resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz",
|
"resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz",
|
||||||
"integrity": "sha1-KBYjTiN4vdxOU1T6tcqold9xANk="
|
"integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw=="
|
||||||
},
|
},
|
||||||
"semver": {
|
"semver": {
|
||||||
"version": "5.5.0",
|
"version": "5.5.0",
|
||||||
@@ -1105,9 +1116,9 @@
|
|||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
"typescript": {
|
"typescript": {
|
||||||
"version": "2.9.1",
|
"version": "2.9.2",
|
||||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-2.9.1.tgz",
|
"resolved": "https://registry.npmjs.org/typescript/-/typescript-2.9.2.tgz",
|
||||||
"integrity": "sha512-h6pM2f/GDchCFlldnriOhs1QHuwbnmj6/v7499eMHqPeW4V2G0elua2eIc2nu8v2NdHV0Gm+tzX83Hr6nUFjQA==",
|
"integrity": "sha512-Gr4p6nFNaoufRIY4NMdpQRNmgxVIGMs4Fcu/ujdYk3nAZqk7supzBE9idmvfZIlH/Cuj//dvi+019qEue9lV0w==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"underscore.string": {
|
"underscore.string": {
|
||||||
@@ -1160,7 +1171,7 @@
|
|||||||
"xml2js": {
|
"xml2js": {
|
||||||
"version": "0.4.19",
|
"version": "0.4.19",
|
||||||
"resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.19.tgz",
|
"resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.19.tgz",
|
||||||
"integrity": "sha1-aGwg8hMgnpSr8NG88e+qKRx4J6c=",
|
"integrity": "sha512-esZnJZJOiJR9wWKMyuvSE1y6Dq5LCuJanqhxslH2bxM6duahNZ+HMpCLhBQGZkbX6xRf8x1Y2eJlgt2q3qo49Q==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"sax": ">=0.6.0",
|
"sax": ">=0.6.0",
|
||||||
"xmlbuilder": "~9.0.1"
|
"xmlbuilder": "~9.0.1"
|
||||||
|
|||||||
14
package.json
14
package.json
@@ -15,19 +15,21 @@
|
|||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=5.0"
|
"node": ">=5.0"
|
||||||
},
|
},
|
||||||
"version": "1.3.0",
|
"version": "1.3.2",
|
||||||
"bin": {
|
"bin": {
|
||||||
"crunchy": "./bin/crunchy",
|
"crunchy": "./bin/crunchy",
|
||||||
"crunchy.sh": "./bin/crunchy.sh"
|
"crunchy.sh": "./bin/crunchy.sh"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"big-integer": "^1.6.30",
|
"@types/node": "^10.3.3",
|
||||||
|
"big-integer": "^1.6.31",
|
||||||
"bluebird": "^3.5.1",
|
"bluebird": "^3.5.1",
|
||||||
"cheerio": "^0.22.0",
|
"cheerio": "^0.22.0",
|
||||||
"cloudscraper": "^1.5.0",
|
"cloudscraper": "^1.5.0",
|
||||||
"commander": "^2.15.1",
|
"commander": "^2.15.1",
|
||||||
"fs-extra": "^6.0.1",
|
"fs-extra": "^6.0.1",
|
||||||
"mkdirp": "^0.5.0",
|
"mkdirp": "^0.5.0",
|
||||||
|
"pjson": "^1.0.9",
|
||||||
"request": "^2.87.0",
|
"request": "^2.87.0",
|
||||||
"request-promise": "^4.2.2",
|
"request-promise": "^4.2.2",
|
||||||
"xml2js": "^0.4.5"
|
"xml2js": "^0.4.5"
|
||||||
@@ -35,14 +37,14 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/bluebird": "^3.5.20",
|
"@types/bluebird": "^3.5.20",
|
||||||
"@types/cheerio": "^0.22.7",
|
"@types/cheerio": "^0.22.7",
|
||||||
"@types/fs-extra": "^5.0.2",
|
"@types/fs-extra": "^5.0.3",
|
||||||
"@types/mkdirp": "^0.5.2",
|
"@types/mkdirp": "^0.5.2",
|
||||||
"@types/request": "^2.47.0",
|
"@types/request": "^2.47.1",
|
||||||
"@types/request-promise": "^4.1.41",
|
"@types/request-promise": "^4.1.41",
|
||||||
"@types/xml2js": "^0.4.2",
|
"@types/xml2js": "^0.4.3",
|
||||||
"tsconfig-lint": "^0.12.0",
|
"tsconfig-lint": "^0.12.0",
|
||||||
"tslint": "^5.10.0",
|
"tslint": "^5.10.0",
|
||||||
"typescript": "^2.9.1"
|
"typescript": "^2.9.2"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"prepublishOnly": "npm run build",
|
"prepublishOnly": "npm run build",
|
||||||
|
|||||||
26
src/batch.ts
26
src/batch.ts
@@ -64,9 +64,25 @@ export default function(args: string[], done: (err?: Error) => void)
|
|||||||
{
|
{
|
||||||
if (errin)
|
if (errin)
|
||||||
{
|
{
|
||||||
return done(errin);
|
if (tasksArr[i].retry <= 0)
|
||||||
|
{
|
||||||
|
console.error(err);
|
||||||
|
log.error('Cannot get episodes from "' + tasksArr[i].address + '", please rerun later');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (config.verbose)
|
||||||
|
{
|
||||||
|
console.error(err);
|
||||||
|
}
|
||||||
|
log.warn('Retrying to fetch episodes ' + tasksArr[i].retry + ' / ' + config.retry);
|
||||||
|
tasksArr[i].retry -= 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
i += 1;
|
||||||
}
|
}
|
||||||
i += 1;
|
|
||||||
next();
|
next();
|
||||||
});
|
});
|
||||||
})();
|
})();
|
||||||
@@ -118,7 +134,7 @@ function tasks(config: IConfigLine, batchPath: string, done: (err: Error, tasks?
|
|||||||
|
|
||||||
return done(null, config.args.map((addressIn) =>
|
return done(null, config.args.map((addressIn) =>
|
||||||
{
|
{
|
||||||
return {address: addressIn, config: configIn};
|
return {address: addressIn, config: configIn, retry: config.retry};
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -154,7 +170,7 @@ function tasks(config: IConfigLine, batchPath: string, done: (err: Error, tasks?
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
map.push({address: addressIn, config: lineConfig});
|
map.push({address: addressIn, config: lineConfig, retry: config.retry});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
done(null, map);
|
done(null, map);
|
||||||
@@ -187,5 +203,7 @@ function parse(args: string[]): IConfigLine
|
|||||||
'1080')
|
'1080')
|
||||||
.option('-g, --rebuildcrp', 'Rebuild the crpersistant file.')
|
.option('-g, --rebuildcrp', 'Rebuild the crpersistant file.')
|
||||||
.option('-b, --batch <s>', 'Batch file', 'CrunchyRoll.txt')
|
.option('-b, --batch <s>', 'Batch file', 'CrunchyRoll.txt')
|
||||||
|
.option('--verbose', 'Make tool verbose')
|
||||||
|
.option('--retry <i>', 'Number or time to retry fetching an episode. Default: 5', 5)
|
||||||
.parse(args);
|
.parse(args);
|
||||||
}
|
}
|
||||||
|
|||||||
30
src/cli.ts
30
src/cli.ts
@@ -1,11 +1,39 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
import batch from './batch';
|
import batch from './batch';
|
||||||
|
import request = require('request');
|
||||||
|
import log = require('./log');
|
||||||
|
import pjson = require('pjson');
|
||||||
|
|
||||||
|
const current_version = pjson.version;
|
||||||
|
|
||||||
|
/* Check if the current version is the latest */
|
||||||
|
log.info('Crunchy version ' + current_version);
|
||||||
|
request.get({ uri: 'https://raw.githubusercontent.com/Godzil/Crunchy/master/package.json' },
|
||||||
|
(error: Error, response: any, body: any) =>
|
||||||
|
{
|
||||||
|
const onlinepkg = JSON.parse(body);
|
||||||
|
let tmp = current_version.split('.');
|
||||||
|
const cur = (Number(tmp[0]) * 10000) + (Number(tmp[1]) * 100) + Number(tmp[2]);
|
||||||
|
tmp = onlinepkg.version.split('.');
|
||||||
|
const dist = (Number(tmp[0]) * 10000) + (Number(tmp[1]) * 100) + Number(tmp[2]);
|
||||||
|
if (dist > cur)
|
||||||
|
{
|
||||||
|
log.warn('There is a newer version of crunchy (v' + onlinepkg.version + '), you should update!');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
batch(process.argv, (err: any) =>
|
batch(process.argv, (err: any) =>
|
||||||
{
|
{
|
||||||
if (err)
|
if (err)
|
||||||
{
|
{
|
||||||
console.error(err.stack || err);
|
if (err.stack)
|
||||||
|
{
|
||||||
|
console.error(err.stack || err);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
console.error(err);
|
||||||
|
}
|
||||||
process.exit(-1);
|
process.exit(-1);
|
||||||
}
|
}
|
||||||
console.info('Done!');
|
console.info('Done!');
|
||||||
|
|||||||
@@ -100,10 +100,13 @@ function download(config: IConfig, page: IEpisodePage, player: IEpisodePlayer, d
|
|||||||
} while (fileExist(filePath + '.mkv'));
|
} while (fileExist(filePath + '.mkv'));
|
||||||
|
|
||||||
log.warn('Renaming to \'' + fileName + '\'...');
|
log.warn('Renaming to \'' + fileName + '\'...');
|
||||||
|
|
||||||
|
config.filename = fileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.rebuildcrp)
|
if (config.rebuildcrp)
|
||||||
{
|
{
|
||||||
|
log.warn('Ignoring \'' + fileName + '\' as it does not exist...');
|
||||||
return done(null, true);
|
return done(null, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -141,7 +144,7 @@ function download(config: IConfig, page: IEpisodePage, player: IEpisodePlayer, d
|
|||||||
const isSubtited = Boolean(player.subtitle);
|
const isSubtited = Boolean(player.subtitle);
|
||||||
|
|
||||||
log.dispEpisode(fileName, 'Merging...', false);
|
log.dispEpisode(fileName, 'Merging...', false);
|
||||||
video.merge(config, isSubtited, player.video.file, filePath, player.video.mode, (errVM) =>
|
video.merge(config, isSubtited, player.video.file, filePath, player.video.mode, config.verbose, (errVM) =>
|
||||||
{
|
{
|
||||||
if (errVM)
|
if (errVM)
|
||||||
{
|
{
|
||||||
@@ -198,11 +201,11 @@ function downloadSubtitle(config: IConfig, player: IEpisodePlayer, filePath: str
|
|||||||
/**
|
/**
|
||||||
* Streams the video to disk.
|
* Streams the video to disk.
|
||||||
*/
|
*/
|
||||||
function downloadVideo(ignored/*config*/: IConfig, page: IEpisodePage, player: IEpisodePlayer,
|
function downloadVideo(config: IConfig, page: IEpisodePage, player: IEpisodePlayer,
|
||||||
filePath: string, done: (err: Error) => void)
|
filePath: string, done: (err: Error) => void)
|
||||||
{
|
{
|
||||||
video.stream(player.video.host, player.video.file, page.swf, filePath,
|
video.stream(player.video.host, player.video.file, page.swf, filePath,
|
||||||
path.extname(player.video.file), player.video.mode, done);
|
path.extname(player.video.file), player.video.mode, config.verbose, done);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
2
src/interface/IConfig.d.ts
vendored
2
src/interface/IConfig.d.ts
vendored
@@ -19,4 +19,6 @@ interface IConfig {
|
|||||||
video_quality?: string;
|
video_quality?: string;
|
||||||
rebuildcrp?: boolean;
|
rebuildcrp?: boolean;
|
||||||
batch?: string;
|
batch?: string;
|
||||||
|
verbose?: boolean;
|
||||||
|
retry?: number;
|
||||||
}
|
}
|
||||||
|
|||||||
1
src/interface/IConfigTask.d.ts
vendored
1
src/interface/IConfigTask.d.ts
vendored
@@ -1,4 +1,5 @@
|
|||||||
interface IConfigTask {
|
interface IConfigTask {
|
||||||
address: string;
|
address: string;
|
||||||
config: IConfigLine;
|
config: IConfigLine;
|
||||||
|
retry: number;
|
||||||
}
|
}
|
||||||
|
|||||||
1
src/interface/ISeriesEpisode.d.ts
vendored
1
src/interface/ISeriesEpisode.d.ts
vendored
@@ -2,4 +2,5 @@ interface ISeriesEpisode {
|
|||||||
address: string;
|
address: string;
|
||||||
episode: string;
|
episode: string;
|
||||||
volume: number;
|
volume: number;
|
||||||
|
retry: number;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
import cheerio = require('cheerio');
|
import cheerio = require('cheerio');
|
||||||
import episode from './episode';
|
import episode from './episode';
|
||||||
import fs = require('fs');
|
// import fs = require('fs');
|
||||||
import fse = require('fs-extra');
|
import fs = require('fs-extra');
|
||||||
import my_request = require('./my_request');
|
import my_request = require('./my_request');
|
||||||
import path = require('path');
|
import path = require('path');
|
||||||
import url = require('url');
|
import url = require('url');
|
||||||
@@ -34,7 +34,7 @@ export default function(config: IConfig, address: string, done: (err: Error) =>
|
|||||||
/* Make a backup of the persistent file in case of */
|
/* Make a backup of the persistent file in case of */
|
||||||
if (fileExist(persistentPath))
|
if (fileExist(persistentPath))
|
||||||
{
|
{
|
||||||
fse.copySync(persistentPath, persistentPath + '.backup');
|
fs.copySync(persistentPath, persistentPath + '.backup');
|
||||||
}
|
}
|
||||||
|
|
||||||
fs.readFile(persistentPath, 'utf8', (err: Error, contents: string) =>
|
fs.readFile(persistentPath, 'utf8', (err: Error, contents: string) =>
|
||||||
@@ -56,27 +56,47 @@ export default function(config: IConfig, address: string, done: (err: Error) =>
|
|||||||
{
|
{
|
||||||
if (errD)
|
if (errD)
|
||||||
{
|
{
|
||||||
return done(errD);
|
if (page.episodes[i].retry <= 0)
|
||||||
}
|
|
||||||
|
|
||||||
if ((ignored === false) || (ignored === undefined))
|
|
||||||
{
|
|
||||||
const newCache = JSON.stringify(cache, null, ' ');
|
|
||||||
fs.writeFile(persistentPath, newCache, (errW: Error) =>
|
|
||||||
{
|
{
|
||||||
if (errW)
|
log.dispEpisode(config.filename, 'Error...', true);
|
||||||
|
console.error(err);
|
||||||
|
log.error('Cannot fetch episode "s' + page.episodes[i].volume + 'e' + page.episodes[i].episode +
|
||||||
|
'", please rerun later');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
log.dispEpisode(config.filename, 'Error...', true);
|
||||||
|
if (config.verbose)
|
||||||
{
|
{
|
||||||
return done(errW);
|
console.error(errD);
|
||||||
}
|
}
|
||||||
|
log.warn('Retrying to fetch episode "s' + page.episodes[i].volume + 'e' + page.episodes[i].episode +
|
||||||
i += 1;
|
'" - Retry ' + page.episodes[i].retry + ' / ' + config.retry);
|
||||||
next();
|
page.episodes[i].retry -= 1;
|
||||||
});
|
}
|
||||||
|
next();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
i += 1;
|
if ((ignored === false) || (ignored === undefined))
|
||||||
next();
|
{
|
||||||
|
const newCache = JSON.stringify(cache, null, ' ');
|
||||||
|
fs.writeFile(persistentPath, newCache, (errW: Error) =>
|
||||||
|
{
|
||||||
|
if (errW)
|
||||||
|
{
|
||||||
|
return done(errW);
|
||||||
|
}
|
||||||
|
|
||||||
|
i += 1;
|
||||||
|
next();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
i += 1;
|
||||||
|
next();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
})();
|
})();
|
||||||
@@ -152,6 +172,7 @@ function page(config: IConfig, address: string, done: (err: Error, result?: ISer
|
|||||||
address: address.substr(1),
|
address: address.substr(1),
|
||||||
episode: '',
|
episode: '',
|
||||||
volume: 0,
|
volume: 0,
|
||||||
|
retry: config.retry,
|
||||||
});
|
});
|
||||||
done(null, {episodes: episodes.reverse(), series: ''});
|
done(null, {episodes: episodes.reverse(), series: ''});
|
||||||
}
|
}
|
||||||
@@ -191,6 +212,7 @@ function page(config: IConfig, address: string, done: (err: Error, result?: ISer
|
|||||||
address: url,
|
address: url,
|
||||||
episode: episode[1],
|
episode: episode[1],
|
||||||
volume: volume ? parseInt(volume[0], 10) : 1,
|
volume: volume ? parseInt(volume[0], 10) : 1,
|
||||||
|
retry: config.retry,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
if (episodeCount === 0)
|
if (episodeCount === 0)
|
||||||
|
|||||||
@@ -24,8 +24,8 @@ export default function(id: number, iv: Buffer|string, data: Buffer|string,
|
|||||||
*/
|
*/
|
||||||
function decrypt(id: number, iv: Buffer|string, data: Buffer|string)
|
function decrypt(id: number, iv: Buffer|string, data: Buffer|string)
|
||||||
{
|
{
|
||||||
const ivBuffer = typeof iv === 'string' ? new Buffer(iv, 'base64') : iv;
|
const ivBuffer = typeof iv === 'string' ? Buffer.from(iv, 'base64') : iv;
|
||||||
const dataBuffer = typeof data === 'string' ? new Buffer(data, 'base64') : data;
|
const dataBuffer = typeof data === 'string' ? Buffer.from(data, 'base64') : data;
|
||||||
const decipher = crypto.createDecipheriv('aes-256-cbc', key(id), ivBuffer);
|
const decipher = crypto.createDecipheriv('aes-256-cbc', key(id), ivBuffer);
|
||||||
|
|
||||||
decipher.setAutoPadding(false);
|
decipher.setAutoPadding(false);
|
||||||
@@ -53,7 +53,7 @@ function decompress(data: Buffer, done: (err: Error, result?: Buffer) => void)
|
|||||||
function key(subtitleId: number): Buffer
|
function key(subtitleId: number): Buffer
|
||||||
{
|
{
|
||||||
const hash = secret(20, 97, 1, 2) + magic(subtitleId);
|
const hash = secret(20, 97, 1, 2) + magic(subtitleId);
|
||||||
const result = new Buffer(32);
|
const result = Buffer.allocUnsafe(32);
|
||||||
|
|
||||||
result.fill(0);
|
result.fill(0);
|
||||||
crypto.createHash('sha1').update(hash).digest().copy(result);
|
crypto.createHash('sha1').update(hash).digest().copy(result);
|
||||||
|
|||||||
@@ -10,10 +10,11 @@ import subtitle from '../subtitle/index';
|
|||||||
* Merges the subtitle and video files into a Matroska Multimedia Container.
|
* Merges the subtitle and video files into a Matroska Multimedia Container.
|
||||||
*/
|
*/
|
||||||
export default function(config: IConfig, isSubtitled: boolean, rtmpInputPath: string, filePath: string,
|
export default function(config: IConfig, isSubtitled: boolean, rtmpInputPath: string, filePath: string,
|
||||||
streamMode: string, done: (err: Error) => void)
|
streamMode: string, verbose: boolean, done: (err: Error) => void)
|
||||||
{
|
{
|
||||||
const subtitlePath = filePath + '.' + (subtitle.formats[config.format] ? config.format : 'ass');
|
const subtitlePath = filePath + '.' + (subtitle.formats[config.format] ? config.format : 'ass');
|
||||||
let videoPath = filePath;
|
let videoPath = filePath;
|
||||||
|
let cp;
|
||||||
|
|
||||||
if (streamMode === 'RTMP')
|
if (streamMode === 'RTMP')
|
||||||
{
|
{
|
||||||
@@ -24,7 +25,7 @@ export default function(config: IConfig, isSubtitled: boolean, rtmpInputPath: st
|
|||||||
videoPath += '.mp4';
|
videoPath += '.mp4';
|
||||||
}
|
}
|
||||||
|
|
||||||
childProcess.exec(command() + ' ' +
|
cp = childProcess.exec(command() + ' ' +
|
||||||
'-o "' + filePath + '.mkv" ' +
|
'-o "' + filePath + '.mkv" ' +
|
||||||
'"' + videoPath + '" ' +
|
'"' + videoPath + '" ' +
|
||||||
(isSubtitled ? '"' + subtitlePath + '"' : ''), {
|
(isSubtitled ? '"' + subtitlePath + '"' : ''), {
|
||||||
@@ -46,6 +47,13 @@ export default function(config: IConfig, isSubtitled: boolean, rtmpInputPath: st
|
|||||||
done(null);
|
done(null);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (verbose === true)
|
||||||
|
{
|
||||||
|
cp.stdin.pipe(process.stdin);
|
||||||
|
cp.stdout.pipe(process.stdout);
|
||||||
|
cp.stderr.pipe(process.stderr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -9,33 +9,42 @@ import log = require('../log');
|
|||||||
* Streams the video to disk.
|
* Streams the video to disk.
|
||||||
*/
|
*/
|
||||||
export default function(rtmpUrl: string, rtmpInputPath: string, swfUrl: string, filePath: string,
|
export default function(rtmpUrl: string, rtmpInputPath: string, swfUrl: string, filePath: string,
|
||||||
fileExt: string, mode: string, done: (err: Error) => void)
|
fileExt: string, mode: string, verbose: boolean, done: (err: Error) => void)
|
||||||
{
|
{
|
||||||
|
let cp;
|
||||||
|
let cmd;
|
||||||
if (mode === 'RTMP')
|
if (mode === 'RTMP')
|
||||||
{
|
{
|
||||||
childProcess.exec(command('rtmpdump') + ' ' +
|
cmd = command('rtmpdump') + ' ' +
|
||||||
'-r "' + rtmpUrl + '" ' +
|
'-r "' + rtmpUrl + '" ' +
|
||||||
'-y "' + rtmpInputPath + '" ' +
|
'-y "' + rtmpInputPath + '" ' +
|
||||||
'-W "' + swfUrl + '" ' +
|
'-W "' + swfUrl + '" ' +
|
||||||
'-o "' + filePath + fileExt + '"', {
|
'-o "' + filePath + fileExt + '"';
|
||||||
maxBuffer: Infinity,
|
|
||||||
}, done);
|
|
||||||
}
|
}
|
||||||
else if (mode === 'HLS')
|
else if (mode === 'HLS')
|
||||||
{
|
{
|
||||||
const cmd = command('ffmpeg') + ' ' +
|
cmd = command('ffmpeg') + ' ' +
|
||||||
|
'-y -xerror ' +
|
||||||
'-i "' + rtmpInputPath + '" ' +
|
'-i "' + rtmpInputPath + '" ' +
|
||||||
'-c copy -bsf:a aac_adtstoasc ' +
|
'-c copy -bsf:a aac_adtstoasc ' +
|
||||||
'"' + filePath + '.mp4"';
|
'"' + filePath + '.mp4"';
|
||||||
childProcess.exec(cmd,
|
|
||||||
{
|
|
||||||
maxBuffer: Infinity,
|
|
||||||
}, done);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
log.error('No such mode: ' + mode);
|
log.error('No such mode: ' + mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cp = childProcess.exec(cmd,
|
||||||
|
{
|
||||||
|
maxBuffer: Infinity,
|
||||||
|
}, done);
|
||||||
|
|
||||||
|
if (verbose === true)
|
||||||
|
{
|
||||||
|
cp.stdin.pipe(process.stdin);
|
||||||
|
cp.stdout.pipe(process.stdout);
|
||||||
|
cp.stderr.pipe(process.stderr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user