cleaner code

This commit is contained in:
Nimble 2023-01-29 15:26:07 -06:00
parent ce176f417f
commit 59357db03d
11 changed files with 7 additions and 86 deletions

1
.gitignore vendored
View File

@ -2,5 +2,6 @@
/lib/
/bin/
/.shards/
/specs/files/
*.dwarf
*.lock

View File

@ -12,6 +12,6 @@ dependencies:
m3u8:
github: akiicat/m3u8
crystal: 1.6.2
crystal: 1.7.1
license: AGPL

View File

@ -4,10 +4,10 @@
# Output
require "m3u8"
module m3u8
module ComposeM3U8
include M3U8
# Read Playlist
file = File.read "spec/playlists/master.m3u8"
file = File.read "spec/files/Playlist6.m3u"
playlist = Playlist.parse(file)
playlist.master? # => true

View File

@ -22,9 +22,9 @@ module API_XSPF
# </playlist>
#Read FROM
file = File.new("Playlist5.xspf")
file = File.new("spec/files/Playlist5.xspf")
content = file.gets_to_end
filez = "Playlist5.xspf"
filez = "spec/files/Playlist5.xspf"
#puts content
xml_file = XML::Reader.new(content)
file.close

View File

@ -1,49 +0,0 @@
require "option_parser"
require "colorize"
the_beatles = [
"John Lennon",
"Paul McCartney",
"George Harrison",
"Ringo Starr",
]
say_hi_to = ""
OptionParser.parse do |parser|
parser.banner = "These are the options for playper-cli: "
#parser.banner = "#{"The Beatles"App"
parser.on "-v", "--version", "Show version" do
puts "version 0.1.0"
exit
end
parser.on "-h", "--help", "Show help" do
puts parser
exit
end
parser.on "-sp", "--spotify", "Show version" do
puts "Make use of spotify info."
exit
end
parser.on "-g NAME", "--goodbye_hello=NAME", "Say hello to whoever you want" do |name|
say_hi_to = name
end
# Exception Handling
parser.missing_option do |option_flag|
STDERR.puts "ERROR: #{option_flag} is missing something.".colorize(:green).on(:black)
STDERR.puts ""
STDERR.puts parser
exit(1)
end
parser.invalid_option do |option_flag|
STDERR.puts "ERROR: #{option_flag} is not a valid option.".colorize(:yellow).on(:black)
STDERR.puts parser
exit(1)
end
#puts parser
end
unless say_hi_to.empty?
puts ""
puts "You say goodbye, and #{the_beatles.sample} says hello to #{say_hi_to}!"
end

View File

@ -1,18 +0,0 @@
# M3U8
# Input
# swapper.cr
# Output
require "m3u8"
module Local_M3U8
include M3U8
# Read Playlist
file = File.read "spec/playlists/master.m3u8"
playlist = Playlist.parse(file)
playlist.master? # => true
# Generate playlist/stream
playlist = Playlist.new
playlist.items << SegmentItem.new(duration: 10.991, segment: "test_01.ts")
playlist.to_s
end

View File

@ -1,5 +0,0 @@
# XSPF
# Input
# swapper.cr
# Output
require "xml"

View File

@ -1,4 +0,0 @@
# Spotify API interactions
# GET
# POST
# Need to read deep into the API and make it the most user friendly possible.

View File

@ -1,3 +0,0 @@
# Youtube API
# Get
# Post

View File

@ -6,4 +6,3 @@ module Playper
# TODO: Put your code here
print("Hello world")
end

View File

@ -1,5 +1,5 @@
require "colorize"
require "./hosts/*"
#require "./bridges/*"
# This is a bit of a metaclass for now