1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
extern crate chrono;
extern crate futures;
extern crate indicatif;
#[macro_use]
extern crate log;
extern crate md5;
extern crate regex;
extern crate serde;
#[macro_use]
extern crate serde_derive;
extern crate serde_json;
extern crate serde_urlencoded;
extern crate tokio;
extern crate http;
extern crate hls_m3u8;
extern crate reqwest;
extern crate parking_lot;
extern crate url;

use utils::error::StreamError;

pub trait Streamable {
    /// Creates a new streamable
    fn new(url: String) -> Result<Box<Self>, StreamError>
    where
        Self: Sized;
    /// Returns the title of the stream if possible
    fn get_title(&self) -> Option<String>;
    /// Returns the author of the stream if possible
    fn get_author(&self) -> Option<String>;
    /// Returns if the stream is online
    fn is_online(&self) -> bool;
    /// Gets the url of the stream
    fn get_stream(&self) -> String; // May be rewritten to no longer be a string but a enum to differentiate between types of stream
    //fn get_stream(&self) -> <T: Stream>
    /// Returns what extension the stream should be
    fn get_ext(&self) -> String;
    /// Gets the default name of the stream
    fn get_default_name(&self) -> String;
    /// Downloads the stream to a file
    fn download(&self, path: String) -> Result<(), StreamError>;
}

/*
enum StreamType {
    FileStream(url: &str),
    Hls(url: &str, master: &str),
}

pub trait Stream {
    fn new(stream: StreamType) -> Result<(), StreamError>;
    fn download(&self, path: &str) -> Result<(), StreamError>;
}
*/
pub mod utils;
pub mod plugins;