The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

WWW::Subsonic - Interface with the Subsonic API

VERSION

version 0.001

SYNOPSIS

This module provides a very simple interface to using the Subsonic API.

use Path::Tiny;
use WWW::Subsonic;

my $subsonic = WWW::Subsonic->new(
    username => 'user1',
    password => 'Assw0rd1P',
);

my $pinged = $subsonic->api_request('ping.view');

my $starred = $subsonic->api_request('getStarred2');

foreach my $song (@{ $starred->{song} }) {
    my $dst = path($song->{path});
    $dst->parent->mkpath;
    $dst->spew_raw( $subsonic->api_request(download => { id => $song->{id} }) );
}

ATTRIBUTES

protocol

Subsonic protocol, https (the default) or http.

server

Subsonic server name, defaults to localhost

port

Subsonic server port, default 4000

username

Subsonic username, required.

password

Subsonic user's password, required. This is never sent over the wire, instead it's hashed using a salt for the server to verify.

salt

Salt for interacting with the server, regenerated each object instantiation. Will be randomly generated.

token

Generated from the salt and password.

ua

UserAgent object used to interface with the Subsonic server. Needs to be an instance of Mojo::UserAgent.

api_version

The Subsonic API verion to target, currently defaults to the latest, Subsonic 6.1, API version 1.15.0.

client_id

The identifier to use for interfacing with the server, defaults to perl(WWW::Subsonic).

METHODS

api_request

Builds an API request using the parameters.

This method provides the following arguments to all API calls so you don't have to: u - username, s - salt, t - token, v - API version, c - client identified, f - format (json).

SEE ALSO

Subsonic API Docs

AUTHOR

Brad Lhotsky brad@divisionbyzero.net

COPYRIGHT AND LICENSE

This software is Copyright (c) 2017 by Brad Lhotsky.

This is free software, licensed under:

The (three-clause) BSD License

CONTRIBUTOR

Brad Lhotsky brad.lhotsky@gmail.com

SUPPORT

Websites

The following websites have more information about this module, and may be of help to you. As always, in addition to those websites please use your favorite search engine to discover more resources.

Source Code

This module's source code is available by visiting: https://github.com/reyjrar/WWW-Subsonic