reformating
This commit is contained in:
parent
964c9b12a4
commit
ce176f417f
13 changed files with 207 additions and 3 deletions
|
@ -12,6 +12,6 @@ dependencies:
|
|||
m3u8:
|
||||
github: akiicat/m3u8
|
||||
|
||||
crystal: 1.4.0
|
||||
crystal: 1.6.2
|
||||
|
||||
license: AGPL
|
||||
|
|
7
src/base.cr
Normal file
7
src/base.cr
Normal file
|
@ -0,0 +1,7 @@
|
|||
# This is the base functionality code interchangeable between cli and server program
|
||||
module Base
|
||||
VERSION = "0.1.0"
|
||||
|
||||
# TODO: Put your code here
|
||||
print("Hello world")
|
||||
end
|
7
src/bridges/connector.cr
Normal file
7
src/bridges/connector.cr
Normal file
|
@ -0,0 +1,7 @@
|
|||
# TODO: Write documentation for `Playper`
|
||||
module API_Connect
|
||||
VERSION = "0.1.0"
|
||||
|
||||
# TODO: Put your code here
|
||||
print("Hello world")
|
||||
end
|
18
src/bridges/m3u8.cr
Normal file
18
src/bridges/m3u8.cr
Normal file
|
@ -0,0 +1,18 @@
|
|||
# M3U8
|
||||
# Input
|
||||
# swapper.cr
|
||||
# Output
|
||||
require "m3u8"
|
||||
|
||||
module 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
|
9
src/bridges/metadata.cr
Normal file
9
src/bridges/metadata.cr
Normal file
|
@ -0,0 +1,9 @@
|
|||
# This is the Musicbrainz API
|
||||
# API for collecting and connecting to metadata providers as well as parsing that
|
||||
# And return it for other functions
|
||||
module Metadata
|
||||
VERSION = "0.1.0"
|
||||
|
||||
# TODO: Put your code here
|
||||
print("Hello world")
|
||||
end
|
11
src/bridges/spotify.cr
Normal file
11
src/bridges/spotify.cr
Normal file
|
@ -0,0 +1,11 @@
|
|||
# Spotify API interactions
|
||||
# GET
|
||||
# POST
|
||||
# Need to read deep into the API and make it the most user friendly possible.
|
||||
|
||||
module API_Spotify
|
||||
VERSION = "0.1.0"
|
||||
|
||||
# TODO: Put your code here
|
||||
print("Hello world")
|
||||
end
|
91
src/bridges/xspf.cr
Normal file
91
src/bridges/xspf.cr
Normal file
|
@ -0,0 +1,91 @@
|
|||
require "xml"
|
||||
# Interacting with XSPF playlist files used by clementine
|
||||
# XSPF
|
||||
# Input
|
||||
# swapper.cr
|
||||
# Output
|
||||
|
||||
module API_XSPF
|
||||
VERSION = "0.1.0"
|
||||
|
||||
# TODO: Put your code here
|
||||
#<?xml version="1.0" encoding="UTF-8"?>
|
||||
# <playlist version="1" xmlns="http://xspf.org/ns/0/">
|
||||
# <trackList>
|
||||
# <track>
|
||||
|
||||
# <location>/media/Plex/Music/11. KOMM,SUSSER TOD(M-10 DIRECTOR'S EDIT.VERSION).flac</location>
|
||||
# <title>11. KOMM,SUSSER TOD(M-10 DIRECTOR'S EDIT.VERSION)</title>
|
||||
# <duration>463000</duration>
|
||||
# <image>/media/Plex/Music/692b6cb2e35e18c27b32e0632a07dd47.sync-conflict-20220110-215510-IRXNWES.png</image>
|
||||
# </track>
|
||||
# </playlist>
|
||||
|
||||
#Read FROM
|
||||
file = File.new("Playlist5.xspf")
|
||||
content = file.gets_to_end
|
||||
filez = "Playlist5.xspf"
|
||||
#puts content
|
||||
xml_file = XML::Reader.new(content)
|
||||
file.close
|
||||
#def self.new(io : IO, options : XML::ParserOptions = XML::ParserOptions.default) end
|
||||
|
||||
#files = File.read("path/to/doc.xml")
|
||||
#xml = XML.parse(files)
|
||||
#node = xml.xpath_node("//foo/@ID")
|
||||
#node.text
|
||||
|
||||
reader = Char::Reader.new("aé")
|
||||
puts "#{typeof(xml_file)} <- Tipo de XML"
|
||||
#puts "IO READTEST #{xml_file.read}"
|
||||
puts "IO TEST #{xml_file.inspect}"
|
||||
#puts "IO READ INNER #{xml_file.read_inner_xml}"
|
||||
puts "IO DEPTH #{xml_file.depth}"
|
||||
puts "IO READ OUTER #{xml_file.read_outer_xml}"
|
||||
#xml_file = XML.Reader.new(io : IO, options : XML::ParserOptions = XML::ParserOptions.default)
|
||||
#def self.parse(io : IO, options : ParserOptions = ParserOptions.default) : Node
|
||||
#end
|
||||
|
||||
xml = <<-XML
|
||||
<person id="id-1">
|
||||
<firstname>Jane</firstname>
|
||||
<lastname>Doe</lastname>
|
||||
</person>
|
||||
<person id="id-2">
|
||||
<firstname>Albert</firstname>
|
||||
<lastname>Doe</lastname>
|
||||
</person>
|
||||
XML
|
||||
|
||||
document = XML.parse(xml) # : XML::Node
|
||||
person = document.first_element_child # : XML::Node?
|
||||
persons = document.children # XML::NodeSet
|
||||
if person
|
||||
puts person["id"] # "1" : String?
|
||||
|
||||
puts typeof(person.children) # XML::NodeSet
|
||||
person.children.select(&.element?).each do |child| # Select only element children
|
||||
#document.children.select(&.element?).each do |child| # Select only element children
|
||||
#puts child["id"]
|
||||
puts typeof(child) # XML::Node
|
||||
puts child.name # firstname : String
|
||||
puts child.content # Jane : String?
|
||||
end
|
||||
persona = person.next
|
||||
puts "#{typeof(person)} <- Tipo de person"
|
||||
puts "#{typeof(persona)} <- Tipo de persona "
|
||||
puts "#{typeof(persons)} <- Tipo de persons"
|
||||
#puts persona["id"]
|
||||
end
|
||||
|
||||
#Write TO
|
||||
string = XML.build(indent: " ") do |xml|
|
||||
xml.element("person", id: 3) do
|
||||
xml.element("firstname") { xml.text "Jean" }
|
||||
xml.element("lastname") { xml.text "D'Arc" }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
3
src/bridges/youtube.cr
Normal file
3
src/bridges/youtube.cr
Normal file
|
@ -0,0 +1,3 @@
|
|||
# Youtube API
|
||||
# Get
|
||||
# Post
|
|
@ -1,2 +1,10 @@
|
|||
# TODO: Write documentation for `Playper`
|
||||
# Here everything for supporting persistent storage will be saved
|
||||
# Being it postgresql or sqlite
|
||||
|
||||
module Database
|
||||
VERSION = "0.1.0"
|
||||
|
||||
# TODO: Put your code here
|
||||
print("Hello world")
|
||||
end
|
||||
|
|
|
@ -4,6 +4,6 @@ module Playper
|
|||
VERSION = "0.1.0"
|
||||
|
||||
# TODO: Put your code here
|
||||
|
||||
print("Hello world")
|
||||
end
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
require "colorize"
|
||||
require "./hosts/*"
|
||||
|
||||
|
||||
# This is a bit of a metaclass for now
|
||||
# Its going to be abstract class for input also working with cases
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
# Actual swaping of playlist from one format to another
|
||||
# Different cases for different hosts
|
||||
# Make use of the metadata class for concurrency
|
||||
|
|
49
src/tryerror/help.cr
Normal file
49
src/tryerror/help.cr
Normal file
|
@ -0,0 +1,49 @@
|
|||
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
|
Loading…
Reference in a new issue