Coder Social home page Coder Social logo

m3ukit's Introduction

M3UKit

This light utility written in Swift allows you to work with M3U/M3U8 lists.

Usage

Just add M3UKit to you project using Swift Package Manager.

public struct M3U: Codable {
    
    public struct Channel: Codable {
        /// Title of the channel
        public var title: String
        /// Duration of stream in seconds. -1 for live streams. 0 unknown.
        public var duration: Int = 0
        /// Custom attributes for the channel
        public var attributes: [String:String] = [:]
        /// Playback URL
        public var url: String
    }
    
    public var channels: [Channel] = []
    
}

The usage of this utility is very similar as you use Codable to encode/decode JSON files. To decode a M3U list, you must to download it and pass it as Data using a M3UDecoder instance and decode(_:) -> M3U method. To encode an existing M3U instance, you only need to call encode(_:) -> Data from a M3UEncoder instance.

Contact

Made by Rubén Fernández in Spain. Twitter: @RubenApps

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.