-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from Nebulino/track_methods
Huge update. Seventh Pre-Release. One more to go...
- Loading branch information
Showing
25 changed files
with
1,467 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import 'package:scrobblenaut/lastfm.dart'; | ||
/** | ||
* Scrobblenaut - A deadly simple Last.FM API Wrapper for Dart. | ||
* Copyright (c) 2020 Nebulino | ||
*/ | ||
|
||
import 'package:scrobblenaut/scrobblenaut.dart'; | ||
import 'package:scrobblenaut/scrobblenaut_helpers.dart'; | ||
|
||
import 'api_values.dart'; | ||
|
||
// Just an example of use. | ||
void main() async { | ||
final lastFMAuth = await LastFM.authenticate( | ||
apiKey: APIValues.API, | ||
apiSecret: APIValues.secret, | ||
username: APIValues.username, | ||
password: APIValues.password, | ||
sessionKey: APIValues.sessionKey, | ||
); | ||
|
||
// final lastFMnoAuth = await LastFM.noAuth(apiKey: APIValues.API); | ||
// When used a LastFM in noAuth mode, it raises an exception. | ||
|
||
final scrobblenaut = Scrobblenaut(lastFM: lastFMAuth); | ||
|
||
print('Single scrobble.'); | ||
|
||
final response = await scrobblenaut.track.scrobbleOnce( | ||
track: 'Beautiful Moonlight', | ||
artist: 'QU4RTZ', | ||
timestamp: DateTime.now()); | ||
// YAY. IT WORKS! | ||
|
||
response.scrobbleResponses?.forEach((ScrobbledTrack scrobbledTrack) { | ||
print('Scrobbled Title: ${scrobbledTrack.track}'); | ||
}); | ||
|
||
print('Another scrobble method.'); | ||
|
||
final scrobble = Scrobble(track: 'Sunlight', artist: 'PLEEG'); | ||
|
||
final anotherResponse = | ||
await scrobblenaut.track.scrobbleOnceFromObject(scrobble: scrobble); | ||
|
||
anotherResponse.scrobbleResponses?.forEach((ScrobbledTrack scrobbledTrack) { | ||
print('Scrobbled Title: ${scrobbledTrack.track}'); | ||
}); | ||
|
||
print('Multiple scrobble.'); | ||
final scrobble2 = Scrobble(track: 'Missing', artist: 'HoneyComeBear'); | ||
|
||
final lastResponse = | ||
await scrobblenaut.track.scrobble(scrobbleList: [scrobble, scrobble2]); | ||
|
||
lastResponse.scrobbleResponses?.forEach((ScrobbledTrack scrobbledTrack) { | ||
print('Scrobbled Title: ${scrobbledTrack.track}'); | ||
}); | ||
|
||
// final response = await scrobblenaut.track.scrobble(scrobbleList); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
/** | ||
* 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/scrobblenaut_helpers.dart'; | ||
|
||
import 'api_values.dart'; | ||
|
||
// Just an example of use. | ||
void main() async { | ||
print('####################################################################'); | ||
|
||
final lastFMAuth = await LastFM.authenticate( | ||
apiKey: APIValues.API, | ||
apiSecret: APIValues.secret, | ||
username: APIValues.username, | ||
password: APIValues.password, | ||
sessionKey: APIValues.sessionKey, | ||
); | ||
|
||
final scrobblenaut = Scrobblenaut(lastFM: lastFMAuth); | ||
|
||
print('##########################track.addTags#############################'); | ||
|
||
// track.addTags | ||
print('Result of addTag request: ' + | ||
(await scrobblenaut.track | ||
.addTags(track: 'Flay', artist: 'PLEEG', tags: ['anime'])) | ||
.toString()); | ||
|
||
print('######################track.getCorrection###########################'); | ||
|
||
// track.getCorrection | ||
(await scrobblenaut.track.getCorrection(track: 'TOMOYO', artist: 'Zekk')) | ||
?.forEach((Track track) { | ||
print('Track Correction Name: ${track.name} |' | ||
' Track Correction URL: ${track.url}'); | ||
}); | ||
|
||
print('#########################track.getInfo##############################'); | ||
|
||
// track.getInfo | ||
final trackGetInfo = (await scrobblenaut.track.getInfo( | ||
track: 'Tomoyo', | ||
artist: 'Zekk', | ||
username: 'nebulino', | ||
autoCorrect: true, | ||
)); | ||
|
||
print('Track Info Name: ${trackGetInfo.name} ' | ||
'| Track URL: ${trackGetInfo.url} ' | ||
'| Track Duration: ${trackGetInfo.duration}'); | ||
|
||
print('#########################track.getSimilar###########################'); | ||
|
||
// track.getSimilar | ||
(await scrobblenaut.track.getSimilar(track: 'Tomoyo', artist: 'Zekk')) | ||
?.forEach((Track track) { | ||
print('Similar Track Name: ${track.name}'); | ||
}); | ||
|
||
print('###########################track.getTags############################'); | ||
|
||
// track.getTags | ||
(await scrobblenaut.track | ||
.getTags(track: 'Hells Bells', artist: 'AC/DC', user: 'nebulino')) | ||
?.forEach((Tag tag) { | ||
print('Tag name: ${tag.name} | Tag url: ${tag.url}'); | ||
}); | ||
|
||
print('#########################track.getTopTags###########################'); | ||
|
||
// track.getTopTags | ||
(await scrobblenaut.track.getTopTags(track: 'Hells Bells', artist: 'AC/DC')) | ||
?.forEach((Tag tag) { | ||
print('Tag name: ${tag.name} | Tag url: ${tag.url}'); | ||
}); | ||
|
||
print('#############################track.love#############################'); | ||
|
||
// track.love | ||
print('Result of love request: ' + | ||
(await scrobblenaut.track.love(track: 'Sunlight', artist: 'PLEEG')) | ||
.toString()); | ||
|
||
print('########################track.removeTag#############################'); | ||
|
||
// track.removeTag | ||
print('Result of removeTag request: ' + | ||
(await scrobblenaut.track | ||
.removeTag(track: 'Flay', artist: 'PLEEG', tag: 'anime')) | ||
.toString()); | ||
|
||
print('#########################track.scrobble#############################'); | ||
|
||
// track.scrobble | ||
final scrobbleResponse = await scrobblenaut.track.scrobbleOnce( | ||
track: 'Beautiful Moonlight', | ||
artist: 'QU4RTZ', | ||
timestamp: DateTime.now()); | ||
// YAY. IT WORKS! | ||
|
||
scrobbleResponse.scrobbleResponses?.forEach((ScrobbledTrack scrobbledTrack) { | ||
print('Scrobbled Title: ${scrobbledTrack.track}'); | ||
}); | ||
|
||
print('###########################track.search#############################'); | ||
|
||
// track.search | ||
(await scrobblenaut.track.search(track: 'Horizon', artist: 'PLEEG')) | ||
.tracks | ||
?.forEach((Track track) { | ||
print('Track Name from search: ${track.name}'); | ||
}); | ||
|
||
print('##########################track.unlove##############################'); | ||
|
||
// track.unlove | ||
print('Result of unlove request: ' + | ||
(await scrobblenaut.track.unLove(track: 'Sunlight', artist: 'PLEEG')) | ||
.toString()); | ||
|
||
print('#####################track.updateNowPlaying#########################'); | ||
|
||
// track.updateNowPlaying | ||
final nowPlayingResponse = await scrobblenaut.track | ||
.updateNowPlaying(track: 'Beautiful Moonlight', artist: 'QU4RTZ'); | ||
// YAY. IT WORKS! | ||
|
||
print('Result of updateNowPlaying request: ${nowPlayingResponse.status} | ' | ||
'${nowPlayingResponse.track}'); | ||
|
||
print('####################################################################'); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** | ||
* Scrobblenaut - A deadly simple Last.FM API Wrapper for Dart. | ||
* Copyright (c) 2020 Nebulino | ||
*/ | ||
|
||
/// Scrobblenaut Library. | ||
/// Import this if you want to use some helpers. | ||
library scrobblenaut_helpers; | ||
|
||
export 'package:scrobblenaut/src/helpers/scrobble_response.dart'; | ||
export 'package:scrobblenaut/src/helpers/scrobbled_track.dart'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.