Skip to content

Commit

Permalink
bug fix for video containing '/'; changed msg on download
Browse files Browse the repository at this point in the history
  • Loading branch information
tastelessjolt committed Sep 15, 2018
1 parent c80fee0 commit 6c9ce02
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 6 additions & 2 deletions app/src/main/java/me/harshithgoka/youtubedl/Format.java
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,14 @@ public void writeToParcel(Parcel parcel, int flags) {
parcel.writeString(type);
}

public String sanitizeFilename() {
return title.replaceAll("/", "_");
}

public void download (Context context) {
String extension = Utils.getExtension(this);
String name = title;
Log.d("Filename", title + "." + extension);
String name = sanitizeFilename();
Log.d("Filename", name + "." + extension);

DownloadManager.Request req = new DownloadManager.Request(Uri.parse(url));
req.setTitle(name)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ public void onClick(View view) {
assert clipboard != null;
ClipData clip = ClipData.newRawUri("DownloadURL", Uri.parse(finalurl));
clipboard.setPrimaryClip(clip);

Toast.makeText(context, String.format("(%s) Quality link copied to Clipboard", ((TextView) view.findViewById(R.id.format_quality)).getText().toString()), Toast.LENGTH_SHORT).show();
Toast.makeText(context, String.format("Your video \"%s\" is now downloading. Check the notification area.", formats.get(getLayoutPosition()).title), Toast.LENGTH_SHORT).show();
// Toast.makeText(context, String.format("(%s) Quality link copied to Clipboard", ((TextView) view.findViewById(R.id.format_quality)).getText().toString()), Toast.LENGTH_SHORT).show();

formats.get(getLayoutPosition()).download(context);
}
Expand Down

0 comments on commit 6c9ce02

Please sign in to comment.