From ff1b30b845726891b8e6ae133a08131af7eb6248 Mon Sep 17 00:00:00 2001 From: Cooper Hammond Date: Fri, 21 Feb 2020 12:00:27 -0700 Subject: [PATCH] Updated to v1.0.0 Added -i flag to install youtube-dl, ffmpeg, and ffprobe --- .editorconfig | 0 .gitignore | 6 +++++- .travis.yml | 0 LICENSE | 0 README.md | 10 ++++++++-- shard.lock | 2 +- shard.yml | 4 +--- spec/irs_spec.cr | 0 spec/spec_helper.cr | 0 src/bottle/cli.cr | 21 +++++++++++++++------ src/bottle/config.cr | 9 +++++++++ src/bottle/styles.cr | 0 src/bottle/version.cr | 0 src/glue/album.cr | 2 -- src/glue/list.cr | 0 src/glue/song.cr | 0 src/interact/logger.cr | 0 src/interact/ripper.cr | 3 ++- src/interact/tagger.cr | 0 src/irs.cr | 0 src/search/spotify.cr | 22 +++++++++++----------- src/search/youtube.cr | 0 22 files changed, 52 insertions(+), 27 deletions(-) mode change 100644 => 100755 .editorconfig mode change 100644 => 100755 .gitignore mode change 100644 => 100755 .travis.yml mode change 100644 => 100755 LICENSE mode change 100644 => 100755 README.md mode change 100644 => 100755 shard.lock mode change 100644 => 100755 shard.yml mode change 100644 => 100755 spec/irs_spec.cr mode change 100644 => 100755 spec/spec_helper.cr mode change 100644 => 100755 src/bottle/cli.cr mode change 100644 => 100755 src/bottle/config.cr mode change 100644 => 100755 src/bottle/styles.cr mode change 100644 => 100755 src/bottle/version.cr mode change 100644 => 100755 src/glue/album.cr mode change 100644 => 100755 src/glue/list.cr mode change 100644 => 100755 src/glue/song.cr mode change 100644 => 100755 src/interact/logger.cr mode change 100644 => 100755 src/interact/ripper.cr mode change 100644 => 100755 src/interact/tagger.cr mode change 100644 => 100755 src/irs.cr mode change 100644 => 100755 src/search/spotify.cr mode change 100644 => 100755 src/search/youtube.cr diff --git a/.editorconfig b/.editorconfig old mode 100644 new mode 100755 diff --git a/.gitignore b/.gitignore old mode 100644 new mode 100755 index b48c7f5..2da7df7 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,8 @@ /.shards/ *.dwarf -*.mp3 \ No newline at end of file +*.mp3 +.ripper.log +ffmpeg +ffprobe +youtube-dl \ No newline at end of file diff --git a/.travis.yml b/.travis.yml old mode 100644 new mode 100755 diff --git a/LICENSE b/LICENSE old mode 100644 new mode 100755 diff --git a/README.md b/README.md old mode 100644 new mode 100755 index 38f9dfa..f2fd4e9 --- a/README.md +++ b/README.md @@ -2,13 +2,19 @@ TODO: Write a description here +## Usage + +

+ +

+ +TODO: Write usage instructions here + ## Installation TODO: Write installation instructions here -## Usage -TODO: Write usage instructions here ## Development diff --git a/shard.lock b/shard.lock old mode 100644 new mode 100755 index d04a714..33cbfa9 --- a/shard.lock +++ b/shard.lock @@ -2,5 +2,5 @@ version: 1.0 shards: ydl_binaries: github: cooperhammond/ydl-binaries - commit: 8a622bf9d2c0b848db8d8db2f46f09334a1f03f8 + commit: 3108c8ce9456bbde24baba64b2372b431a010558 diff --git a/shard.yml b/shard.yml old mode 100644 new mode 100755 index 2064a6d..9782be4 --- a/shard.yml +++ b/shard.yml @@ -1,5 +1,5 @@ name: irs -version: 0.1.0 +version: 1.0.0 authors: - Cooper Hammond @@ -8,8 +8,6 @@ targets: irs: main: src/irs.cr -crystal: 0.28.0 - license: MIT dependencies: diff --git a/spec/irs_spec.cr b/spec/irs_spec.cr old mode 100644 new mode 100755 diff --git a/spec/spec_helper.cr b/spec/spec_helper.cr old mode 100644 new mode 100755 diff --git a/src/bottle/cli.cr b/src/bottle/cli.cr old mode 100644 new mode 100755 index fcff393..13bb5a6 --- a/src/bottle/cli.cr +++ b/src/bottle/cli.cr @@ -1,5 +1,8 @@ -require "./version" +require "ydl_binaries" + +require "./config" require "./styles" +require "./version" require "../glue/song" @@ -11,6 +14,7 @@ class CLI @options = [ [["-h", "--help"], "help", "bool"], [["-v", "--version"], "version", "bool"], + [["-i", "--install"], "install", "bool"], [["-s", "--song"], "song", "string"], [["-a", "--artist"], "artist", "string"] ] @@ -28,22 +32,23 @@ class CLI def help msg = <<-EOP - #{Style.bold "Usage: irs [-h] [-v] [-s -a ]"} + #{Style.bold "Usage: irs [-h] [-v] [-i] [-s -a ]"} - Arguments: + #{Style.bold "Arguments:"} #{Style.blue "-h, --help"} Show this help message and exit #{Style.blue "-v, --version"} Show the program version and exit + #{Style.blue "-i, --install"} Download ffmpeg and youtube_dl binaries to #{Style.green Config.binary_location} #{Style.blue "-s, --song "} Specify song name for downloading #{Style.blue "-a, --artist "} Specify artist name for downloading - Examples: + #{Style.bold "Examples:"} $ #{Style.green %(irs --song "Bohemian Rhapsody" --artist "Queen")} #{Style.dim %(# => downloads the song "Bohemian Rhapsody" by "Queen")} $ #{Style.green %(irs --album "Demon Days" --artist "Gorillaz")} #{Style.dim %(# => downloads the album "Demon Days" by "Gorillaz")} - This project is licensed under the GNU GPL. - Project page: + #{Style.bold "This project is licensed under the MIT license."} + #{Style.bold "Project page: "} EOP puts msg @@ -56,10 +61,14 @@ class CLI elsif @args["version"]? version exit + elsif @args["install"]? + YdlBinaries.get_both(Config.binary_location) + exit elsif @args["song"]? && @args["artist"]? s = Song.new(@args["song"], @args["artist"]) s.provide_client_keys("e4198f6a3f7b48029366f22528b5dc66", "ba057d0621a5496bbb64edccf758bde5") s.grab_it() + exit end end diff --git a/src/bottle/config.cr b/src/bottle/config.cr old mode 100644 new mode 100755 index e69de29..a13bb2c --- a/src/bottle/config.cr +++ b/src/bottle/config.cr @@ -0,0 +1,9 @@ +module Config + + extend self + + def binary_location : String + path = "~/.irs/bin" + return Path[path].expand(home: true).to_s + end +end \ No newline at end of file diff --git a/src/bottle/styles.cr b/src/bottle/styles.cr old mode 100644 new mode 100755 diff --git a/src/bottle/version.cr b/src/bottle/version.cr old mode 100644 new mode 100755 diff --git a/src/glue/album.cr b/src/glue/album.cr old mode 100644 new mode 100755 index 2298bd1..6608c86 --- a/src/glue/album.cr +++ b/src/glue/album.cr @@ -21,5 +21,3 @@ class Album < SpotifyList # pass end end - -puts Album.new("A Night At The Opera", "Queen").find_it() \ No newline at end of file diff --git a/src/glue/list.cr b/src/glue/list.cr old mode 100644 new mode 100755 diff --git a/src/glue/song.cr b/src/glue/song.cr old mode 100644 new mode 100755 diff --git a/src/interact/logger.cr b/src/interact/logger.cr old mode 100644 new mode 100755 diff --git a/src/interact/ripper.cr b/src/interact/ripper.cr old mode 100644 new mode 100755 index e4c2d17..5486cf9 --- a/src/interact/ripper.cr +++ b/src/interact/ripper.cr @@ -1,10 +1,11 @@ require "./logger" +require "../bottle/config" module Ripper extend self - BIN_LOC = Path["~/.irs/bin".sub("~", Path.home)] + BIN_LOC = Path[Config.binary_location] # Downloads the video from the given *video_url* using the youtube-dl binary # Will create any directories that don't exist specified in *output_filename* diff --git a/src/interact/tagger.cr b/src/interact/tagger.cr old mode 100644 new mode 100755 diff --git a/src/irs.cr b/src/irs.cr old mode 100644 new mode 100755 diff --git a/src/search/spotify.cr b/src/search/spotify.cr old mode 100644 new mode 100755 index 1a67342..2c6e537 --- a/src/search/spotify.cr +++ b/src/search/spotify.cr @@ -217,14 +217,14 @@ class SpotifySearcher end -puts SpotifySearcher.new() - .authorize("e4198f6a3f7b48029366f22528b5dc66", - "ba057d0621a5496bbb64edccf758bde5") - .find_item("playlist", { - "name" => "Brain Food", - "username" => "spotify" - # "name " => "A Night At The Opera", - # "artist" => "Queen" - # "track" => "Bohemian Rhapsody", - # "artist" => "Queen" - }) \ No newline at end of file +# puts SpotifySearcher.new() +# .authorize("e4198f6a3f7b48029366f22528b5dc66", +# "ba057d0621a5496bbb64edccf758bde5") +# .find_item("playlist", { +# "name" => "Brain Food", +# "username" => "spotify" +# # "name " => "A Night At The Opera", +# # "artist" => "Queen" +# # "track" => "Bohemian Rhapsody", +# # "artist" => "Queen" +# }) \ No newline at end of file diff --git a/src/search/youtube.cr b/src/search/youtube.cr old mode 100644 new mode 100755