Giter Site home page Giter Site logo

Comments (3)

BjoernPetersen avatar BjoernPetersen commented on June 6, 2024

There are three overloaded M3uParser.parse() methods:

  • fun parse(m3uFile: Path, charset: Charset = Charsets.UTF_8): List<M3uEntry>
    • This one loads an .m3u file from your local filesystem
  • fun parse(m3uContentReader: InputStreamReader, baseDir: Path? = null): List<M3uEntry>
    • This one loads the .m3u content through the given InputStreamReader, which is just the abstract notion of a "stream of characters". Those could come from a file, a streamed HTTP response, or basically anywhere, but you as the caller will have to take of this
  • fun parse(m3uContent: String, baseDir: Path? = null): List<M3uEntry>
    • This one expects the content of an .m3u file as a String

What you're doing is passing your URL to the third variant, so it's interpreted as the content of an m3u file, so your result is just a single M3uEntry with the URL you passed in. This behavior is intentional, the parse method is not trying to do anything "smart", it simply parses the content of a single m3u file.

There is the M3uParser.fun resolveNestedPlaylists(entries: List<M3uEntry>): List<M3uEntry> method that will recursively resolve any entries that point to another m3u file. This only works for local files, though. The library will never try to follow HTTP(S) URLs. Implementing that would involve a lot of complexity (retry logic, proper error handling, error communication to the app using the library) and some security/privacy risks (so there should be an opt-in toggle for people that want to avoid us making HTTP calls). Since I'm not actively using this library myself right now, I probably won't take the time to implement remote m3u resolution anytime soon.

As a workaround, you could just download the m3u file in your own app (to a temporary file, or even just in-memory), and pass the content to this library. Looking at your specific example though, the m3u you're referencing just contains a single URL (http://stream.webradio.bz:8000/vivalaradio3), so if that m3u is your only use case, and you're not expecting the m3u to change in the future, you don't need this library at all.

from m3u-parser.

ArcaDone avatar ArcaDone commented on June 6, 2024

Your explanation is absolutely clear. I don't know if it will always remain the same however I have seen that using the link you provided me as a solution everything actually works correctly. Thank you very much for your contribution and I think we can close this issue. Thanks

from m3u-parser.

BjoernPetersen avatar BjoernPetersen commented on June 6, 2024

You're welcome!

from m3u-parser.

Related Issues (13)

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.