Skip to content

Commit

Permalink
Merge pull request Harsh-23#4 from cyberboysumanjay/master
Browse files Browse the repository at this point in the history
Multiple Fixes
  • Loading branch information
cyberboysumanjay authored Aug 12, 2020
2 parents 41df0b1 + 3e0e90d commit d002dcf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
12 changes: 8 additions & 4 deletions lib/API/saavn.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ Future fetchSongDetails(songId) async {
title = (getMain[songId]["title"])
.toString()
.split("(")[0]
.replaceAll("&", "&");
image = (getMain[songId]["image"]);
.replaceAll("&", "&")
.replaceAll(""", "\"");
image = (getMain[songId]["image"]).replaceAll("150x150", "500x500");
artist = (getMain[songId]["more_info"]["artistMap"]["primary_artists"][0]
["name"])
.toString()
Expand Down Expand Up @@ -63,8 +64,11 @@ Future fetchSongDetails(songId) async {
key, getMain[songId]["more_info"]["encrypted_media_url"]);
kUrl = kUrl
.replaceAll("aac.saavncdn.com", "h.saavncdn.com")
.replaceAll("c.saavncdn.com", "h.saavncdn.com")
.replaceAll("_96.mp4", "_320.mp3");
.replaceAll("c.saavncdn.com", "h.saavncdn.com");

if (getMain[songId]["more_info"]["320kbps"] == "true") {
kUrl = kUrl.replaceAll("_96.mp4", "_320.mp4");
}

final client = http.Client();
final request = new http.Request('GET', Uri.parse(kUrl))
Expand Down
3 changes: 1 addition & 2 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,13 @@ class AppState extends State<AppName> {
);
await pr.show();

final filename = title + ".mp3";
final filename = title + ".m4a";
final artname = title + "_artwork.jpg";

String dlPath = await ExtStorage.getExternalStoragePublicDirectory(
ExtStorage.DIRECTORY_MUSIC);
String filepath = dlPath + "/" + filename;
String filepath2 = dlPath + "/" + artname;

var request = await HttpClient().getUrl(Uri.parse(kUrl));
var response = await request.close();
var bytes = await consolidateHttpClientResponseBytes(response);
Expand Down

0 comments on commit d002dcf

Please sign in to comment.