Giter Club home page Giter Club logo

metabrainz.listenbrainz's Introduction

MetaBrainz.ListenBrainz Build Status NuGet Version

This is a library providing access to the ListenBrainz API.

ListenBrainz keeps track of users' listens of music tracks (similar to sites like last.fm and libre.fm).

Debugging

The ListenBrainz class provides a TraceSource that can be used to configure debug output; its name is MetaBrainz.ListenBrainz.

Configuration

In Code

In code, you can enable tracing like follows:

// Use the default switch, turning it on.
ListenBrainz.TraceSource.Switch.Level = SourceLevels.All;

// Alternatively, use your own switch so multiple things can be
// enabled/disabled at the same time.
var mySwitch = new TraceSwitch("MyAppDebugSwitch", "All");
ListenBrainz.TraceSource.Switch = mySwitch;

// By default, there is a single listener that writes trace events to
// the debug output (typically only seen in an IDE's debugger). You can
// add (and remove) listeners as desired.
var listener = new ConsoleTraceListener {
  Name = "MyAppConsole",
  TraceOutputOptions = TraceOptions.DateTime | TraceOptions.ProcessId,
};
ListenBrainz.TraceSource.Listeners.Clear();
ListenBrainz.TraceSource.Listeners.Add(listener);

In Configuration

Starting from .NET 7 your application can also be set up to read tracing configuration from the application configuration file. To do so, the application needs to add the following to its startup code:

System.Diagnostics.TraceConfiguration.Register();

(Provided by the System.Configuration.ConfigurationManager package.)

The application config file can then have a system.diagnostics section where sources, switches and listeners can be configured.

<configuration>
  <system.diagnostics>
    <sharedListeners>
      <add name="console" type="System.Diagnostics.ConsoleTraceListener" traceOutputOptions="DateTime,ProcessId" />
    </sharedListeners>
    <sources>
      <source name="MetaBrainz.ListenBrainz" switchName="MetaBrainz.ListenBrainz">
        <listeners>
          <add name="console" />
          <add name="lb-log" type="System.Diagnostics.TextWriterTraceListener" initializeData="lb.log" />
        </listeners>
      </source>
    </sources>
    <switches>
      <add name="MetaBrainz.ListenBrainz" value="All" />
    </switches>
  </system.diagnostics>
</configuration>

Release Notes

These are available on GitHub.

metabrainz.listenbrainz's People

Contributors

dependabot[bot] avatar zastai avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

metabrainz.listenbrainz's Issues

Usage example

Very nice addon to c# for ListenBrainz!
Do you have example of usage for this API?
There is non in the readme or the project.

Update processing to match current server behaviour

Some of the endpoints seem to be returning data that does not match the current API documentation:

  • artist info (e.g. user and sitewide artist stats) has a single artist_mbid instead
  • artist map has additional information: for each country, an artists field containing a list of artist info
  • the result of the listens endpoint includes a new timestamp field (oldest_listen_ts)
  • the mbid_mapping field of a recent listen now has several additional fields (artists, caa_id, caa_release_mbid and recording_name)
    • the artists field is a list of artist credits (artist_mbid + artist_credit_name + join_phrase)
    • artists, caa_id and caa_release_mbid also appear in the data for the recording and release statistics

See also LB-1405.

Listens cannot be deserialized

The inserted_at field used to be a string containing an RFC1123 date, but it's now a Unix timestamp, just like all the other timestamps (because of LB-754).
As a result, deserialization now fails (because it gets a number where a string is expected).

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.