Merge pull request #58 from cooperhammond/crystal-port

Updated to v1.0.0
This commit is contained in:
Cooper Hammond 2020-02-25 19:49:58 -07:00 committed by GitHub
commit a24703d7bf
22 changed files with 52 additions and 27 deletions

0
.editorconfig Normal file → Executable file
View file

6
.gitignore vendored Normal file → Executable file
View file

@ -4,4 +4,8 @@
/.shards/ /.shards/
*.dwarf *.dwarf
*.mp3 *.mp3
.ripper.log
ffmpeg
ffprobe
youtube-dl

0
.travis.yml Normal file → Executable file
View file

0
LICENSE Normal file → Executable file
View file

10
README.md Normal file → Executable file
View file

@ -2,13 +2,19 @@
TODO: Write a description here TODO: Write a description here
## Usage
<p align="center">
<img src="https://i.imgur.com/G783tKA.png" height="450" />
</p>
TODO: Write usage instructions here
## Installation ## Installation
TODO: Write installation instructions here TODO: Write installation instructions here
## Usage
TODO: Write usage instructions here
## Development ## Development

2
shard.lock Normal file → Executable file
View file

@ -2,5 +2,5 @@ version: 1.0
shards: shards:
ydl_binaries: ydl_binaries:
github: cooperhammond/ydl-binaries github: cooperhammond/ydl-binaries
commit: 8a622bf9d2c0b848db8d8db2f46f09334a1f03f8 commit: 3108c8ce9456bbde24baba64b2372b431a010558

4
shard.yml Normal file → Executable file
View file

@ -1,5 +1,5 @@
name: irs name: irs
version: 0.1.0 version: 1.0.0
authors: authors:
- Cooper Hammond <kepoorh@gmail.com> - Cooper Hammond <kepoorh@gmail.com>
@ -8,8 +8,6 @@ targets:
irs: irs:
main: src/irs.cr main: src/irs.cr
crystal: 0.28.0
license: MIT license: MIT
dependencies: dependencies:

0
spec/irs_spec.cr Normal file → Executable file
View file

0
spec/spec_helper.cr Normal file → Executable file
View file

21
src/bottle/cli.cr Normal file → Executable file
View file

@ -1,5 +1,8 @@
require "./version" require "ydl_binaries"
require "./config"
require "./styles" require "./styles"
require "./version"
require "../glue/song" require "../glue/song"
@ -11,6 +14,7 @@ class CLI
@options = [ @options = [
[["-h", "--help"], "help", "bool"], [["-h", "--help"], "help", "bool"],
[["-v", "--version"], "version", "bool"], [["-v", "--version"], "version", "bool"],
[["-i", "--install"], "install", "bool"],
[["-s", "--song"], "song", "string"], [["-s", "--song"], "song", "string"],
[["-a", "--artist"], "artist", "string"] [["-a", "--artist"], "artist", "string"]
] ]
@ -28,22 +32,23 @@ class CLI
def help def help
msg = <<-EOP msg = <<-EOP
#{Style.bold "Usage: irs [-h] [-v] [-s <song> -a <artist>]"} #{Style.bold "Usage: irs [-h] [-v] [-i] [-s <song> -a <artist>]"}
Arguments: #{Style.bold "Arguments:"}
#{Style.blue "-h, --help"} Show this help message and exit #{Style.blue "-h, --help"} Show this help message and exit
#{Style.blue "-v, --version"} Show the program version 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 <song>"} Specify song name for downloading #{Style.blue "-s, --song <song>"} Specify song name for downloading
#{Style.blue "-a, --artist <artist>"} Specify artist name for downloading #{Style.blue "-a, --artist <artist>"} Specify artist name for downloading
Examples: #{Style.bold "Examples:"}
$ #{Style.green %(irs --song "Bohemian Rhapsody" --artist "Queen")} $ #{Style.green %(irs --song "Bohemian Rhapsody" --artist "Queen")}
#{Style.dim %(# => downloads the song "Bohemian Rhapsody" by "Queen")} #{Style.dim %(# => downloads the song "Bohemian Rhapsody" by "Queen")}
$ #{Style.green %(irs --album "Demon Days" --artist "Gorillaz")} $ #{Style.green %(irs --album "Demon Days" --artist "Gorillaz")}
#{Style.dim %(# => downloads the album "Demon Days" by "Gorillaz")} #{Style.dim %(# => downloads the album "Demon Days" by "Gorillaz")}
This project is licensed under the GNU GPL. #{Style.bold "This project is licensed under the MIT license."}
Project page: <github.com/cooperhammond/irs> #{Style.bold "Project page: <github.com/cooperhammond/irs>"}
EOP EOP
puts msg puts msg
@ -56,10 +61,14 @@ class CLI
elsif @args["version"]? elsif @args["version"]?
version version
exit exit
elsif @args["install"]?
YdlBinaries.get_both(Config.binary_location)
exit
elsif @args["song"]? && @args["artist"]? elsif @args["song"]? && @args["artist"]?
s = Song.new(@args["song"], @args["artist"]) s = Song.new(@args["song"], @args["artist"])
s.provide_client_keys("e4198f6a3f7b48029366f22528b5dc66", "ba057d0621a5496bbb64edccf758bde5") s.provide_client_keys("e4198f6a3f7b48029366f22528b5dc66", "ba057d0621a5496bbb64edccf758bde5")
s.grab_it() s.grab_it()
exit
end end
end end

9
src/bottle/config.cr Normal file → Executable file
View file

@ -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

0
src/bottle/styles.cr Normal file → Executable file
View file

0
src/bottle/version.cr Normal file → Executable file
View file

2
src/glue/album.cr Normal file → Executable file
View file

@ -21,5 +21,3 @@ class Album < SpotifyList
# pass # pass
end end
end end
puts Album.new("A Night At The Opera", "Queen").find_it()

0
src/glue/list.cr Normal file → Executable file
View file

0
src/glue/song.cr Normal file → Executable file
View file

0
src/interact/logger.cr Normal file → Executable file
View file

3
src/interact/ripper.cr Normal file → Executable file
View file

@ -1,10 +1,11 @@
require "./logger" require "./logger"
require "../bottle/config"
module Ripper module Ripper
extend self 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 # 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* # Will create any directories that don't exist specified in *output_filename*

0
src/interact/tagger.cr Normal file → Executable file
View file

0
src/irs.cr Normal file → Executable file
View file

22
src/search/spotify.cr Normal file → Executable file
View file

@ -217,14 +217,14 @@ class SpotifySearcher
end end
puts SpotifySearcher.new() # puts SpotifySearcher.new()
.authorize("e4198f6a3f7b48029366f22528b5dc66", # .authorize("e4198f6a3f7b48029366f22528b5dc66",
"ba057d0621a5496bbb64edccf758bde5") # "ba057d0621a5496bbb64edccf758bde5")
.find_item("playlist", { # .find_item("playlist", {
"name" => "Brain Food", # "name" => "Brain Food",
"username" => "spotify" # "username" => "spotify"
# "name " => "A Night At The Opera", # # "name " => "A Night At The Opera",
# "artist" => "Queen" # # "artist" => "Queen"
# "track" => "Bohemian Rhapsody", # # "track" => "Bohemian Rhapsody",
# "artist" => "Queen" # # "artist" => "Queen"
}) # })

0
src/search/youtube.cr Normal file → Executable file
View file