From 83055c0a424fff58e57923298f99468700de73bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denis=20=C3=87erri?= <64997243+deniscerri@users.noreply.github.com> Date: Wed, 12 Oct 2022 22:12:17 +0200 Subject: [PATCH] fixed updating items when downloads cancel and fixed item downloading the same type (again) --- BUILD_FFMPEG.md | 41 ---------- BUILD_PYTHON.md | 50 ------------ .../deniscerri/ytdlnis/DownloaderService.java | 61 ++++++++++----- .../com/deniscerri/ytdlnis/MainActivity.java | 8 +- .../adapter/HomeRecyclerViewAdapter.java | 1 + .../ytdlnis/database/DBManager.java | 10 +++ .../deniscerri/ytdlnis/database/Video.java | 7 +- .../ytdlnis/page/CustomCommandActivity.java | 3 + .../ytdlnis/page/DownloadsFragment.java | 50 +++++++++--- .../deniscerri/ytdlnis/page/HomeFragment.java | 77 ++++++++++--------- .../ytdlnis/service/IDownloaderListener.java | 3 + .../ytdlnis/service/IDownloaderService.java | 2 +- .../com/deniscerri/ytdlnis/util/InfoUtil.java | 7 +- .../ytdlnis/util/NotificationUtil.java | 14 +++- app/src/main/res/menu/downloads_menu.xml | 6 ++ app/src/main/res/values-sq-rAL/strings.xml | 2 + app/src/main/res/values/strings.xml | 2 + 17 files changed, 178 insertions(+), 166 deletions(-) delete mode 100644 BUILD_FFMPEG.md delete mode 100644 BUILD_PYTHON.md diff --git a/BUILD_FFMPEG.md b/BUILD_FFMPEG.md deleted file mode 100644 index 5e1e0ab4..00000000 --- a/BUILD_FFMPEG.md +++ /dev/null @@ -1,41 +0,0 @@ - -## FFmpeg for Android - -FFmpeg can be built for android using the termux ffmpeg package. - -Prerequisites : git, docker - - git clone git@github.com:termux/termux-packages.git - cd termux-packages - -create a file `build-ffmpeg.sh` with below content - - #!/bin/bash - # use i686 for x86 - export TERMUX_ARCH=arm - export TERMUX_PREFIX=/data/youtubedl-android/usr - export TERMUX_ANDROID_HOME=/data/youtubedl-android/home - ./build-package.sh ffmpeg - -Make file executable - - chmod +x ./build-ffmpeg.sh - -Build Package - - ./scripts/run-docker.sh ./clean.sh - ./scripts/run-docker.sh ./build-ffmpeg.sh - -This will create several `.deb` files in `debs/` directory. -`debs/*dev*.deb` debs can be safely removed as we don't need them. -`debs/*static*.deb` debs can be safely removed as we don't need them. -`libicu_66.1-1_arm.deb` can be removed (?) - - -The ffmpeg zip archive as used in youtubedl-android can be created using the following commands. - - cd debs - find . -type f -exec dpkg-deb -xv {} . \; - cd data/youtubedl-android - zip --symlinks -r /tmp/ffmpeg_arm.zip usr/lib - diff --git a/BUILD_PYTHON.md b/BUILD_PYTHON.md deleted file mode 100644 index d89b0528..00000000 --- a/BUILD_PYTHON.md +++ /dev/null @@ -1,50 +0,0 @@ - -## Python for Android - -Python can be built for android using the termux python package. - -Prerequisites : git, docker - - git clone git@github.com:termux/termux-packages.git - cd termux-packages - -create a file `build-python.sh` with below content - - #!/bin/bash - # use i686 for x86 - export TERMUX_ARCH=arm - export TERMUX_PREFIX=/data/youtubedl-android/usr - export TERMUX_ANDROID_HOME=/data/youtubedl-android/home - ./build-package.sh python - -Make file executable - - chmod +x ./build-python.sh - -Build Package - - ./scripts/run-docker.sh ./clean.sh - ./scripts/run-docker.sh ./build-python.sh - -This will create several `.deb` files in `debs/` directory. -I have found the following packages to be sufficient for youtube-dl to work. - - python_3.7.2-1_arm.deb - libandroid-support_24_arm.deb - libutil_0.4_arm.deb - libffi_3.2.1-2_arm.deb - openssl_1.1.1a_arm.deb - ca-certificates_20180124_all.deb - -The python zip archive as used in youtubedl-android can be created using the following commands. - - cd debs - dpkg-deb -xv python_3.7.2-1_arm.deb . - dpkg-deb -xv libandroid-support_24_arm.deb . - dpkg-deb -xv libutil_0.4_arm.deb . - dpkg-deb -xv libffi_3.2.1-2_arm.deb . - dpkg-deb -xv openssl_1.1.1a_arm.deb . - dpkg-deb -xv ca-certificates_20180124_all.deb . - cd data/youtubedl-android - zip --symlinks -r /tmp/python3_7_arm.zip usr/lib usr/etc - diff --git a/app/src/main/java/com/deniscerri/ytdlnis/DownloaderService.java b/app/src/main/java/com/deniscerri/ytdlnis/DownloaderService.java index 3ef0c596..79700225 100644 --- a/app/src/main/java/com/deniscerri/ytdlnis/DownloaderService.java +++ b/app/src/main/java/com/deniscerri/ytdlnis/DownloaderService.java @@ -25,6 +25,7 @@ import com.yausername.youtubedl_android.YoutubeDLRequest; import java.io.File; import java.io.FileOutputStream; import java.util.ArrayList; +import java.util.Collection; import java.util.Collections; import java.util.LinkedList; import java.util.Map; @@ -149,13 +150,19 @@ public class DownloaderService extends Service { } public void updateQueue(ArrayList