-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Leonardo Gatica
committed
Jan 2, 2015
1 parent
8ac9752
commit e4e1d6a
Showing
8 changed files
with
157 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,2 @@ | ||
# Logs | ||
logs | ||
*.log | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
|
||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# Compiled binary addons (http://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directory | ||
# Commenting this out is preferred by some people, see | ||
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git- | ||
node_modules | ||
|
||
# Users Environment Variables | ||
.lock-wscript | ||
lib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
node_modules | ||
src | ||
Gulpfile.coffee | ||
Gulpfile.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
"use strict" | ||
|
||
gulp = require "gulp" | ||
plugins = require("gulp-load-plugins")() | ||
runSequence = require "run-sequence" | ||
|
||
gulp.task "coffeelint", -> | ||
gulp.src("./src/index.coffee") | ||
.pipe plugins.coffeelint() | ||
.pipe plugins.coffeelint.reporter() | ||
|
||
gulp.task "coffee", -> | ||
gulp.src("./src/index.coffee") | ||
.pipe(plugins.coffee(bare: true).on("error", plugins.util.log)) | ||
.pipe(plugins.header("#!/usr/bin/env node\n")) | ||
.pipe(gulp.dest("./lib")) | ||
|
||
gulp.task "build", (cb) -> | ||
runSequence( | ||
"coffeelint" | ||
"coffee" | ||
cb | ||
) | ||
|
||
inc = (importance) -> | ||
gulp.src("./package.json") | ||
.pipe(bump(type: importance)) | ||
.pipe(gulp.dest("./")) | ||
.pipe(git.commit("bumps package version")) | ||
.pipe(filter("package.json")) | ||
.pipe(tag_version()) | ||
|
||
gulp.task "patch", -> | ||
inc("patch") | ||
|
||
gulp.task "feature", -> | ||
inc("minor") | ||
|
||
gulp.task "release", -> | ||
inc("major") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// Note the new way of requesting CoffeeScript since 1.7.x | ||
require('coffee-script/register'); | ||
// This bootstraps your Gulp's main file | ||
require('./Gulpfile.coffee'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
anime-dl | ||
======== | ||
|
||
CLI for show anime whit subs in spanish. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
{ | ||
"name": "anime-dl", | ||
"version": "1.0.0", | ||
"description": "CLI for show anime whit subs in spanish.", | ||
"main": "lib", | ||
"dependencies": { | ||
"cheerio": "^0.18.0", | ||
"inquirer": "^0.8.0", | ||
"lodash": "^2.4.1", | ||
"urllib": "^2.2.1" | ||
}, | ||
"devDependencies": { | ||
"coffee-script": "^1.8.0", | ||
"gulp": "^3.8.10", | ||
"gulp-bump": "^0.1.11", | ||
"gulp-coffee": "^2.2.0", | ||
"gulp-coffeelint": "^0.4.0", | ||
"gulp-filter": "^2.0.0", | ||
"gulp-git": "^0.5.5", | ||
"gulp-header": "^1.2.2", | ||
"gulp-load-plugins": "^0.8.0", | ||
"gulp-tag-version": "^1.2.1", | ||
"gulp-util": "^3.0.1", | ||
"run-sequence": "^1.0.2" | ||
}, | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/leonciokof/anime-dl.git" | ||
}, | ||
"author": "Leonardo Gatica <[email protected]>", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/leonciokof/anime-dl/issues" | ||
}, | ||
"homepage": "https://github.com/leonciokof/anime-dl", | ||
"bin": { | ||
"anime-dl": "lib" | ||
}, | ||
"preferGlobal": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
"use strict" | ||
|
||
spawn = require("child_process").spawn | ||
urllib = require "urllib" | ||
cheerio = require "cheerio" | ||
_ = require "lodash" | ||
inquirer = require "inquirer" | ||
url = "http://jkanime.net/" | ||
|
||
searchAnime = (search, cb) -> | ||
urllib.request "#{url}buscar/#{search}", | ||
method: "GET" | ||
, (err, data, response) -> | ||
if not err and response.statusCode is 200 | ||
$ = cheerio.load data.toString() | ||
animes = [] | ||
$(".listpage .titl").each -> | ||
animes.push | ||
value: $(this).attr("href") | ||
name: $(this).text() | ||
cb err, animes | ||
else | ||
cb err, null | ||
|
||
getUrlVideo = (animeUrl, chapter, cb) -> | ||
urllib.request "#{animeUrl}#{chapter}", | ||
method: "GET" | ||
, (err, data, response) -> | ||
if not err and response.statusCode is 200 | ||
$ = cheerio.load data.toString() | ||
try | ||
value = $(".player_conte param")[19].attribs.value | ||
url = value.split("file=")[1].split("/&provider")[0] | ||
catch err | ||
url = null | ||
cb err, url | ||
else | ||
cb err, null | ||
|
||
options = | ||
type: "input" | ||
name: "search" | ||
message: "Enter a anime name" | ||
inquirer.prompt options, (answer) -> | ||
searchAnime answer.search, (err, animes) -> | ||
options = | ||
type: "list" | ||
name: "anime" | ||
message: "Select a anime" | ||
choices: animes | ||
inquirer.prompt options, (answer) -> | ||
animeUrl = answer.anime | ||
options = | ||
type: "input" | ||
name: "chapter" | ||
message: "Entre a number chapter" | ||
default: "1" | ||
inquirer.prompt options, (answer) -> | ||
getUrlVideo animeUrl, answer.chapter, (err, url) -> | ||
prc = spawn("mpv", [url]) | ||
console.log "mpv #{url}" | ||
prc.on "close", (code) -> | ||
console.log "process exit code #{code}" |