GithubHelp home page GithubHelp logo

svrooij / sonos-net Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 493 KB

Control Sonos from dotnet

Home Page: https://www.nuget.org/packages/Sonos.Base/

License: Apache License 2.0

C# 98.62% Handlebars 1.38%
dotnet sonos sonos-api hacktoberfest

sonos-net's Introduction

Control sonos speakers from dotnet

Follow on Twitter Star on Github Support me on Github Check my blog

Always wanted to control sonos speakers right from your dotnet application? I've created this library for you to do just that.

Warning This library is far from complete at the moment, it's just an experiment for now.

Developer

A lot in this library is generated by the sonos generator. You can use the following script to regenerate the pre-generated models.

# Install the generator (once)
npm install -g @svrooij/sonos-docs

# Combine the different sources to one simple file (once, unless service definition changed)
sonos-docs combine

# Generate library (windows)
sonos-docs generate .\src\sonos-net-template\ .\src\

# Generate library (linux/mac)
sonos-docs generate ./src/sonos-net-template/ ./src/

# Fix formatting
# dotnet tool install -g dotnet-format
dotnet-format

sonos-net's People

Contributors

svrooij avatar

Stargazers

 avatar

Watchers

 avatar  avatar

sonos-net's Issues

No access to string-based StreamContent

My Sonos is playing a radio station and apparently the current title is provided via the streamContent tag:

<DIDL-Lite xmlns:dc="http://purl.org/dc/elements/1.1/"
    xmlns:upnp="urn:schemas-upnp-org:metadata-1-0/upnp/"
    xmlns:r="urn:schemas-rinconnetworks-com:metadata-1-0/"
    xmlns="urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/">
    <item id="-1" parentID="-1" restricted="true">
        <res protocolInfo="aac:*:application/octet-stream:*">
            aac://http://stream.srg-ssr.ch/m/drs3/aacp_96</res>
        <r:streamContent>ANDRYY - BRUCHPILOT</r:streamContent>
        <dc:title>aacp_96</dc:title>
        <upnp:class>object.item</upnp:class>
    </item>
</DIDL-Lite>

Because the

GetPositionInfoResponse.TrackMetaDataObject.Items[0].StreamContent 

is an empty class without properties there is no way to access this string. For now I have to parse the TrackMetaData manually:

xml?.Root?
    .Elements()
    .FirstOrDefault()?
    .Element(XName.Get("streamContent", "urn:schemas-rinconnetworks-com:metadata-1-0/"))?
    .Value;

I dont know what the correct schema for streamcontent is but the current class is a bit useless (should at least have some sort of rawContent property in it)

public class StreamContent
{
}

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.