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");
|
||||
video.setTitle(video.getTitle().replaceAll(":|'|\"|[.]|,", ""));
|
||||
video.setAuthor(video.getAuthor().replaceAll(":|'|\"|[.]|,", ""));
|
||||
|
||||
if (type.equals("audio")) {
|
||||
request.addOption("-x");
|
||||
|
|
@ -355,13 +357,16 @@ public class DownloaderService extends Service {
|
|||
String videoQuality = video.getVideoQuality();
|
||||
if (videoQuality == null) videoQuality = sharedPreferences.getString("video_quality", "");
|
||||
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";
|
||||
}
|
||||
|
||||
request.addOption("-f", formatArgument);
|
||||
String format = video.getVideoFormat();
|
||||
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")){
|
||||
boolean embedThumb = sharedPreferences.getBoolean("embed_thumbnail", false);
|
||||
|
|
@ -369,7 +374,7 @@ public class DownloaderService extends Service {
|
|||
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))
|
||||
|
|
|
|||
|
|
@ -635,6 +635,10 @@ public class HomeFragment extends Fragment implements HomeRecyclerViewAdapter.On
|
|||
String[] audioFormats = context.getResources().getStringArray(R.array.music_formats);
|
||||
|
||||
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) -> {
|
||||
vid.setAudioFormat(audioFormats[i]);
|
||||
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);
|
||||
|
||||
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) -> {
|
||||
vid.setVideoFormat(videoFormats[i]);
|
||||
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);
|
||||
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) -> {
|
||||
vid.setVideoQuality(videoQualities[i]);
|
||||
editor.putString("video_quality", vid.getVideoQuality());
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@
|
|||
tools:ignore="MissingConstraints">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:background="@drawable/ic_app_icon" />
|
||||
|
|
|
|||
|
|
@ -95,6 +95,7 @@
|
|||
android:hint="@string/audio_format">
|
||||
|
||||
<AutoCompleteTextView
|
||||
android:id="@+id/audio_format_textview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="none"
|
||||
|
|
|
|||
|
|
@ -77,6 +77,7 @@
|
|||
android:hint="@string/video_format">
|
||||
|
||||
<AutoCompleteTextView
|
||||
android:id="@+id/video_format_textview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="none"
|
||||
|
|
@ -95,6 +96,7 @@
|
|||
android:hint="@string/video_quality">
|
||||
|
||||
<AutoCompleteTextView
|
||||
android:id="@+id/video_quality_textview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="none"
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
</string-array>
|
||||
|
||||
<string-array name="video_formats">
|
||||
<item>DEFAULT</item>
|
||||
<item>mp4</item>
|
||||
<item>mkv</item>
|
||||
<item>webm</item>
|
||||
|
|
@ -24,6 +25,7 @@
|
|||
<item>720p</item>
|
||||
<item>480p</item>
|
||||
<item>360p</item>
|
||||
<item>Worst Quality</item>
|
||||
</string-array>
|
||||
|
||||
</resources>
|
||||
|
|
@ -124,7 +124,7 @@
|
|||
android:entryValues="@array/video_formats"
|
||||
android:icon="@drawable/ic_code"
|
||||
app:key="video_format"
|
||||
app:summary="mkv"
|
||||
app:summary="DEFAULT"
|
||||
app:title="@string/video_format" />
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ buildscript {
|
|||
|
||||
def versionMajor = 1
|
||||
def versionMinor = 4
|
||||
def versionPatch = 3
|
||||
def versionPatch = 5
|
||||
def versionBuild = 0 // bump for dogfood builds, public betas, etc.
|
||||
|
||||
ext {
|
||||
|
|
|
|||
Loading…
Reference in a new issue