more breadcrumbs
added a default value for format quality selection fixed app not downloading files with bad characters like : ' " , . added default video format added worst video quality as selection
This commit is contained in:
parent
4d8fba461a
commit
8dff21bc8a
8 changed files with 27 additions and 6 deletions
|
|
@ -311,6 +311,8 @@ public class DownloaderService extends Service {
|
||||||
}
|
}
|
||||||
|
|
||||||
request.addOption("--no-mtime");
|
request.addOption("--no-mtime");
|
||||||
|
video.setTitle(video.getTitle().replaceAll(":|'|\"|[.]|,", ""));
|
||||||
|
video.setAuthor(video.getAuthor().replaceAll(":|'|\"|[.]|,", ""));
|
||||||
|
|
||||||
if (type.equals("audio")) {
|
if (type.equals("audio")) {
|
||||||
request.addOption("-x");
|
request.addOption("-x");
|
||||||
|
|
@ -355,13 +357,16 @@ public class DownloaderService extends Service {
|
||||||
String videoQuality = video.getVideoQuality();
|
String videoQuality = video.getVideoQuality();
|
||||||
if (videoQuality == null) videoQuality = sharedPreferences.getString("video_quality", "");
|
if (videoQuality == null) videoQuality = sharedPreferences.getString("video_quality", "");
|
||||||
String formatArgument = "bestvideo+bestaudio/best";
|
String formatArgument = "bestvideo+bestaudio/best";
|
||||||
if (!videoQuality.isEmpty() && !videoQuality.equals("Best Quality")) {
|
if(videoQuality.equals("Worst Quality")){
|
||||||
|
formatArgument = "worst";
|
||||||
|
}else if (!videoQuality.isEmpty() && !videoQuality.equals("Best Quality")) {
|
||||||
formatArgument = "bestvideo[height<="+videoQuality.substring(0, videoQuality.length()-1)+"]+bestaudio/best";
|
formatArgument = "bestvideo[height<="+videoQuality.substring(0, videoQuality.length()-1)+"]+bestaudio/best";
|
||||||
}
|
}
|
||||||
|
|
||||||
request.addOption("-f", formatArgument);
|
request.addOption("-f", formatArgument);
|
||||||
String format = video.getVideoFormat();
|
String format = video.getVideoFormat();
|
||||||
if (format == null) format = sharedPreferences.getString("video_format", "");
|
if (format == null) format = sharedPreferences.getString("video_format", "");
|
||||||
request.addOption("--merge-output-format", format);
|
if(!format.equals("DEFAULT")) request.addOption("--merge-output-format", format);
|
||||||
|
|
||||||
if(!format.equals("webm")){
|
if(!format.equals("webm")){
|
||||||
boolean embedThumb = sharedPreferences.getBoolean("embed_thumbnail", false);
|
boolean embedThumb = sharedPreferences.getBoolean("embed_thumbnail", false);
|
||||||
|
|
@ -369,7 +374,7 @@ public class DownloaderService extends Service {
|
||||||
request.addOption("--embed-thumbnail");
|
request.addOption("--embed-thumbnail");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
request.addOption("-o", youtubeDLDir.getAbsolutePath() + "/"+video.getTitle()+"."+format);
|
request.addOption("-o", youtubeDLDir.getAbsolutePath() + "/"+video.getAuthor() + " - " + video.getTitle()+"."+format);
|
||||||
}
|
}
|
||||||
|
|
||||||
Disposable disposable = Observable.fromCallable(() -> YoutubeDL.getInstance().execute(request, downloadProcessID, callback))
|
Disposable disposable = Observable.fromCallable(() -> YoutubeDL.getInstance().execute(request, downloadProcessID, callback))
|
||||||
|
|
|
||||||
|
|
@ -635,6 +635,10 @@ public class HomeFragment extends Fragment implements HomeRecyclerViewAdapter.On
|
||||||
String[] audioFormats = context.getResources().getStringArray(R.array.music_formats);
|
String[] audioFormats = context.getResources().getStringArray(R.array.music_formats);
|
||||||
|
|
||||||
TextInputLayout audioFormat = bottomSheet.findViewById(R.id.audio_format);
|
TextInputLayout audioFormat = bottomSheet.findViewById(R.id.audio_format);
|
||||||
|
AutoCompleteTextView autoCompleteTextView = bottomSheet.findViewById(R.id.audio_format_textview);
|
||||||
|
String preference = sharedPreferences.getString("audio_format", "mp3");
|
||||||
|
autoCompleteTextView.setText(preference, false);
|
||||||
|
|
||||||
((AutoCompleteTextView)audioFormat.getEditText()).setOnItemClickListener((adapterView, view, i, l) -> {
|
((AutoCompleteTextView)audioFormat.getEditText()).setOnItemClickListener((adapterView, view, i, l) -> {
|
||||||
vid.setAudioFormat(audioFormats[i]);
|
vid.setAudioFormat(audioFormats[i]);
|
||||||
editor.putString("audio_format", vid.getAudioFormat());
|
editor.putString("audio_format", vid.getAudioFormat());
|
||||||
|
|
@ -664,6 +668,10 @@ public class HomeFragment extends Fragment implements HomeRecyclerViewAdapter.On
|
||||||
String[] videoQualities = context.getResources().getStringArray(R.array.video_quality);
|
String[] videoQualities = context.getResources().getStringArray(R.array.video_quality);
|
||||||
|
|
||||||
TextInputLayout videoFormat = bottomSheet.findViewById(R.id.video_format);
|
TextInputLayout videoFormat = bottomSheet.findViewById(R.id.video_format);
|
||||||
|
AutoCompleteTextView autoCompleteTextView = bottomSheet.findViewById(R.id.video_format_textview);
|
||||||
|
String preference = sharedPreferences.getString("video_format", "webm");
|
||||||
|
autoCompleteTextView.setText(preference, false);
|
||||||
|
|
||||||
((AutoCompleteTextView)videoFormat.getEditText()).setOnItemClickListener((adapterView, view, i, l) -> {
|
((AutoCompleteTextView)videoFormat.getEditText()).setOnItemClickListener((adapterView, view, i, l) -> {
|
||||||
vid.setVideoFormat(videoFormats[i]);
|
vid.setVideoFormat(videoFormats[i]);
|
||||||
editor.putString("video_format", vid.getVideoFormat());
|
editor.putString("video_format", vid.getVideoFormat());
|
||||||
|
|
@ -671,6 +679,9 @@ public class HomeFragment extends Fragment implements HomeRecyclerViewAdapter.On
|
||||||
});
|
});
|
||||||
|
|
||||||
TextInputLayout videoQuality = bottomSheet.findViewById(R.id.video_quality);
|
TextInputLayout videoQuality = bottomSheet.findViewById(R.id.video_quality);
|
||||||
|
autoCompleteTextView = bottomSheet.findViewById(R.id.video_quality_textview);
|
||||||
|
preference = sharedPreferences.getString("video_quality", "Best Quality");
|
||||||
|
autoCompleteTextView.setText(preference, false);
|
||||||
((AutoCompleteTextView)videoQuality.getEditText()).setOnItemClickListener((adapterView, view, i, l) -> {
|
((AutoCompleteTextView)videoQuality.getEditText()).setOnItemClickListener((adapterView, view, i, l) -> {
|
||||||
vid.setVideoQuality(videoQualities[i]);
|
vid.setVideoQuality(videoQualities[i]);
|
||||||
editor.putString("video_quality", vid.getVideoQuality());
|
editor.putString("video_quality", vid.getVideoQuality());
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@
|
||||||
tools:ignore="MissingConstraints">
|
tools:ignore="MissingConstraints">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:background="@drawable/ic_app_icon" />
|
android:background="@drawable/ic_app_icon" />
|
||||||
|
|
|
||||||
|
|
@ -95,6 +95,7 @@
|
||||||
android:hint="@string/audio_format">
|
android:hint="@string/audio_format">
|
||||||
|
|
||||||
<AutoCompleteTextView
|
<AutoCompleteTextView
|
||||||
|
android:id="@+id/audio_format_textview"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:inputType="none"
|
android:inputType="none"
|
||||||
|
|
|
||||||
|
|
@ -77,6 +77,7 @@
|
||||||
android:hint="@string/video_format">
|
android:hint="@string/video_format">
|
||||||
|
|
||||||
<AutoCompleteTextView
|
<AutoCompleteTextView
|
||||||
|
android:id="@+id/video_format_textview"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:inputType="none"
|
android:inputType="none"
|
||||||
|
|
@ -95,6 +96,7 @@
|
||||||
android:hint="@string/video_quality">
|
android:hint="@string/video_quality">
|
||||||
|
|
||||||
<AutoCompleteTextView
|
<AutoCompleteTextView
|
||||||
|
android:id="@+id/video_quality_textview"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:inputType="none"
|
android:inputType="none"
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
<string-array name="video_formats">
|
<string-array name="video_formats">
|
||||||
|
<item>DEFAULT</item>
|
||||||
<item>mp4</item>
|
<item>mp4</item>
|
||||||
<item>mkv</item>
|
<item>mkv</item>
|
||||||
<item>webm</item>
|
<item>webm</item>
|
||||||
|
|
@ -24,6 +25,7 @@
|
||||||
<item>720p</item>
|
<item>720p</item>
|
||||||
<item>480p</item>
|
<item>480p</item>
|
||||||
<item>360p</item>
|
<item>360p</item>
|
||||||
|
<item>Worst Quality</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
@ -124,7 +124,7 @@
|
||||||
android:entryValues="@array/video_formats"
|
android:entryValues="@array/video_formats"
|
||||||
android:icon="@drawable/ic_code"
|
android:icon="@drawable/ic_code"
|
||||||
app:key="video_format"
|
app:key="video_format"
|
||||||
app:summary="mkv"
|
app:summary="DEFAULT"
|
||||||
app:title="@string/video_format" />
|
app:title="@string/video_format" />
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ buildscript {
|
||||||
|
|
||||||
def versionMajor = 1
|
def versionMajor = 1
|
||||||
def versionMinor = 4
|
def versionMinor = 4
|
||||||
def versionPatch = 3
|
def versionPatch = 5
|
||||||
def versionBuild = 0 // bump for dogfood builds, public betas, etc.
|
def versionBuild = 0 // bump for dogfood builds, public betas, etc.
|
||||||
|
|
||||||
ext {
|
ext {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue