scrobblenaut 2.0.4

  • Readme
  • Changelog
  • Example
  • Installing
  • 75

Scrobblenaut

Just a Last.FM API Wrapper for Dart. A package to interact with the official

Last.FM API.

Dart Version Build Status Last.FM Nebulino

Disclaimer #

I'm doing it just for fun, so... use at your own risk.

I hope it will become something great.

^-^

Usage #

First build the .g files for Serializable (if you clone the repo):

pub run build_runner build

A simple usage example:

import 'package:scrobblenaut/scrobblenaut.dart';

// A simple example...
// For more, check the example folder.
void main() async {
  final lastFMAuth = await LastFM.noAuth(apiKey: APIValues.API);
  final scrobblenaut = Scrobblenaut(lastFM: lastFMAuth);
  
  // Start using the Wrapper...
}

Get Scrobblenaut #

Add Scrobblenaut dependency on pubspec.yaml:

From GitHub (for example: branch-name >> dev-build):

dependencies:
  scrobblenaut:
    git: https://github.com/Nebulino/Scrobblenaut.git
      ref: branch-name

From pub.dev:

dependencies:
  scrobblenaut: ^version-number

Features and bugs #

Status #

All the methods are available. Needs more time to check for problems caused by a bad information management from the API side. For example:

  • Tracks duration information taken from an album like method is different from a Track duration taken from a track info query.

  • Some variables can have strange content such as FIXME on some Track duration.

  • Many more. For now with my tests, this is the best I can handle. I just need more track and usage of my package to track different type of errors that can occurs.

Future of the package after all methods implemented #

It's still a long way. I have some ideas, and I'm going to continue to support it, just stay tuned.

For the documentation #

For now, You have to download the repo and run dartdoc on the console, on the root of the package. When I upload this package on pub.dev you can use the documentation from there directly.

There's 2 type of usage:

  • with authentication;
  • without authentication.

Please file feature requests and bugs at the issue tracker.

2.0.4 #

Small version bump #

  • Add the possibility to login with already a md5 password.
  • Removed deprecation.
  • Update example.

2.0.3 #

  • Updated Copyright headline for a bump to Dart 2.8.0.
  • Updated the README.md.
  • Updated the pubspec.yaml.

2.0.2 #

Small bug-fix #

  • Remove remained print().
  • Fix README.md.
  • Fix CHANGELOG.md.
  • Fix build.ps1.
  • Fix clean.ps1.

2.0.1 #

  • Fix Artists in Tracks gained from user.getRecentTracks().

2.0.0 #

Major Update #

Status
  • Album object supported.
  • Artist object supported.
  • Tag object supported. (TagMethods.getTopTags not supported because is useless, no Tag attribute used)
  • Track object supported.
  • User object supported.
Dev Changelog
  • Add capability of applying UserMethods in User.
  • Created example-related. Watch them on ./example.
  • Fixed clean.sh.
  • Added .g.dart to make possible the usage from git in pubspec.yaml
  • Updated the README.md for Major Update.
  • Updated the CHANGELOG.md. This thing You're reading right now

1.0.5 #

Add capability of applying TrackMethods in Track #

  • Created new track example.
  • Fixed TrackMethods.getTags.
  • Changed lang in Methods into language
  • Updated CHANGELOG.md.
  • TrackMethods.scrobbleOnce() into TrackMethods.scrobble()
  • TrackMethods.scrobbleOnceFromObject() into TrackMethods.scrobbleFromObject()
  • TrackMethods.scrobble() into TrackMethods.multiScrobble()

1.0.4 #

Add capability of applying TagMethods in Tag #

  • Created new tag example.
  • Changed lang in Methods into language
  • Updated CHANGELOG.md.

1.0.3 #

Add capability of applying ArtistMethods in Artist #

  • Created new artist example.
  • Fixed some Future
  • Fixed some examples.
  • Updated CHANGELOG.md.

1.0.2 #

Add capability of applying AlbumMethods in Albums #

  • Created new album example.
  • Fixed version number
  • Updated CHANGELOG.md.

1.0.1 #

Fix Documentation #

  • Created lastfm_methods library.

1.0.0 #

Finally! First Release! #

All methods implemented

Status
  • Auth and No Auth method supported.
  • Album Methods supported.
  • Artist Methods supported.
  • Chart Methods supported.
  • Geo Methods supported.
  • Library Methods supported.
  • Tag Methods supported.
  • Track Methods supported.
  • User Methods supported.
Dev Changelog
  • Fixed Exception Handling on Spaceship.
  • Created ScrobbleObject() for helping in scrobbling.
  • Fixed linksExtractor() Helper.
  • Added timestampToSecondsSinceEpoch() for TrackMethods.scrobble() and derivatives.
  • Fixed Track.topTags.
  • Fixed LastFMException.generate().
  • Created POSTResponse Helper and ScrobbleResponseHelper.
  • Added a 'FIXME' bypass on duration parsing in Tracks.
  • Fixed Geo.getTopTracks() for the Track Duration problem.
  • Fixed Tag.count.
  • Created Taggings for User.getPersonalTags.
  • Modified some examples. Watch them on ./example.
  • Updated the README.md for First Release.
  • Updated the CHANGELOG.md. This thing You're reading right now

0.1.6 #

Huge update #

Seventh Pre-Release. One more to go...

  • Implemented Track Methods.
  • Fixed Artist toJson() missing method.
  • Updated the changelog.
  • Created NowPlayed Track helper.
  • Created NowPlaying Object.
  • Created Scrobble Response (renamed from Scrobble Response Helper).
  • Created Scrobbled Track helper.
  • Created helper library.
  • Created Track Result Object.
  • Added track example.
  • Added scrobble example.
  • Updated the README.

0.1.5 #

Sixth Pre-Release. Still, a long way... #

  • Implemented Tag Methods.
  • Fixed Tag attributes.
  • Updated the changelog.
  • Added tag example.
  • Updated the README.

0.1.4 #

Fifth Pre-Release. Still, a long way... #

  • Implemented Library Methods.
  • Updated the changelog.
  • Added library example.
  • Updated the README.

0.1.3 #

Fourth Pre-Release. Still, a long way... #

  • Implemented Geo Methods.
  • Updated the changelog.
  • Fixed the README.
  • Added geo example.

0.1.2 #

Third Pre-Release. Still, a long way... #

  • Implemented Chart Methods.
  • Updated the changelog.
  • Added chart example.

0.1.1 #

Second Pre-Release. Still, a long way... #

  • Implemented Artist Methods.
  • More documentation.
  • Created and modified the examples.
  • Fixed the CHANGELOG.md.
  • Fixed some objects.
  • Added ArtistSearchResults.
  • Added more Helpers.

0.1.0 #

First Pre-Release. Still, a long way... #

  • Created a solid base for request. Now it's just a copy-paste, I hope.
  • Only Album Methods implemented.
  • Fixed the methods that uses authentication in album_methods.dart.
  • Created first LastFM objects.
  • Modified the example.
  • Implemented a way to manage XML response.
  • Added some documentation.

0.0.1 #

  • Initial version. Created the Package's repo structure.

example/scrobblenaut_example.dart

//                                                              //
// Scrobblenaut - A deadly simple Last.FM API Wrapper for Dart. //
//                  Copyright (c) 2020 Nebulino                 //
//                                                              //

import 'package:scrobblenaut/lastfm.dart';
import 'package:scrobblenaut/scrobblenaut.dart';
import 'package:scrobblenaut/src/core/lastfm.dart';

import 'api_values.dart';

// Just an example of use.
void main() async {
  var lastFM = await LastFM.noAuth(
    apiKey: APIValues.API,
  );

  var scrobblenaut = Scrobblenaut(lastFM: lastFM);

  final albumGetInfo = (await scrobblenaut.album.getInfo(
    album: 'Your Name.',
    artist: 'RADWIMPS',
    username: 'nebulino',
    autoCorrect: true,
  ));

  print('Album Name: ${albumGetInfo.name} |'
      ' Album Artist: ${albumGetInfo.artist.name}');

  albumGetInfo.tracks?.forEach((Track track) {
    print('Track Title: ${track.name} | Track Duration: ${track.duration}');
  });

  lastFM = await LastFM.authenticate(
    apiKey: APIValues.API,
    apiSecret: APIValues.secret,
    username: APIValues.username,
    passwordHash: APIValues.passwordHash,
  );

  scrobblenaut = Scrobblenaut(lastFM: lastFM);

  print(
    'Username: ${(await scrobblenaut.user.getInfo(
      user: APIValues.username,
    )).name}',
  );
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  scrobblenaut: ^2.0.4

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:scrobblenaut/scrobblenaut.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
50
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
75
Learn more about scoring.

We analyzed this package on Jul 11, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.15

Analysis suggestions

Package not compatible with runtime flutter-web on Web

Because:

  • package:scrobblenaut/scrobblenaut.dart that imports:
  • package:scrobblenaut/src/extensions/user_extension.dart that imports:
  • package:scrobblenaut/lastfm_methods.dart that imports:
  • package:scrobblenaut/src/methods/user_methods.dart that imports:
  • package:scrobblenaut/src/core/request.dart that imports:
  • package:scrobblenaut/src/core/lastfm.dart that imports:
  • package:scrobblenaut/src/tools/spaceship.dart that imports:
  • package:dio/adapter.dart that imports:
  • package:dio/src/adapters/io_adapter.dart that imports:
  • dart:io

Package not compatible with runtime js

Because:

  • package:scrobblenaut/scrobblenaut.dart that imports:
  • package:scrobblenaut/src/extensions/user_extension.dart that imports:
  • package:scrobblenaut/lastfm_methods.dart that imports:
  • package:scrobblenaut/src/methods/user_methods.dart that imports:
  • package:scrobblenaut/src/core/request.dart that imports:
  • package:scrobblenaut/src/core/lastfm.dart that imports:
  • package:scrobblenaut/src/tools/spaceship.dart that imports:
  • package:dio/adapter.dart that imports:
  • package:dio/src/adapters/io_adapter.dart that imports:
  • dart:io

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.7.0 <3.0.0
convert ^2.1.1 2.1.1
crypto ^2.1.5 2.1.5
dio ^3.0.9 3.0.9
json_annotation ^3.0.1 3.0.1
meta ^1.1.8 1.2.2 1.3.0-nullsafety
xml ^4.2.0 4.2.0
Transitive dependencies
charcode 1.1.3
collection 1.14.13 1.15.0-nullsafety
http_parser 3.1.4
path 1.7.0
petitparser 3.0.4
source_span 1.7.0
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.2.0 1.3.0-nullsafety
Dev dependencies
build_runner ^1.10.0
json_serializable ^3.3.0
pedantic ^1.9.0
test ^1.14.6