JunkFood02 / Seal

🦭 Video/Audio Downloader for Android, based on yt-dlp, designed with Material You
GNU General Public License v3.0
8.64k stars 403 forks source link

[Feature Request] streaming/internet radio (very easy) #373

Open Noitarud opened 1 year ago

Noitarud commented 1 year ago

Checklist

Is your feature request related to a problem? Please describe.

I paste in an internet radio link and it actually begins downloading! But it will not store it after I stop it.

It is better to download radio because packets can come late and so play stops and then player may discard excess to not be far behind and cycle repeats. On my computer I begin the download and after some time I begin listening behind the downloading.

Describe the solution you'd like

If you wish to show finesse, receive also the 'currently playing' data and create and embed a chapter file.

Video link

No response

Additional context

Some stations to paste into Seal: http://listen.housetime.fm/tunein-aacisdn-pls http://90s-high.rautemusik.fm http://stream.bmr-radio.de:80 https://uni01rtmp.tulix.tv/amazingdtv/amazingdtv/playlist.m3u8 (modern internet TV, this example works in DVD but not Seal, though it has an end sent so DVD saves it)

JunkFood02 commented 1 year ago

Create and use a custom template would be suitable for such radio streams, e.g. --no-part. The audio file would be directly downloaded to the directory.

For fourth case(HLS native livestreams), use --downloader ffmpeg --hls-use-mpegts --no-part

Noitarud commented 1 year ago

I tried Custom Command The way you have written that: says to use --no-part for the first three, and the other for the fourth. Results:

  1. made new entry and copy what you had there originally and adding --no-part. And ran it for BMR. But no item appears in download directory, nor in Seal's downloaded video/audio manager.
  2. Made new entry with --no-part only, ran it, it says unable to resume, and begins downloading. But still no item in download directory.
  3. Tried fourth, appears to work as you described, says it is going into a temporary directory not the specified download directory, i write this directory into Ghost commander, it gives warning it may not be accessible, and it cannot. So, i cannot listen/watch behind the download. When i cancel it is not in the list of downloads either. 😃 this means you must have better access than i to suggest that - how do i get it? Otherwise you will need to supply a browser to look into the temporary/app's folder, to copy/move out of it, and to launch a player (the way Ghost commander does seems possible, the player shows this bizarre location and name instead of the real one fd://56)

Is it possible for me to place in a null entry into the download field and set the Custom Command to contain the url so i can download internet radio without needing to locate the url and paste? Perhaps define a filename and increment a number or place date on it.

I had been using ffmpeg -c copy in a batch file previously.

JunkFood02 commented 1 year ago

But still no item in download directory.

Use your file manager to access the directory to see the file

says it is going into a temporary directory not the specified download directory

Which one? Please use the default download directory or write it down here

JunkFood02 commented 1 year ago

I see. It seems the files are stored in an internal temp directory. I'll take a look at it

Noitarud commented 1 year ago

Another solution (I know it is doable in windows) is a hardlink, which you could use if the temp folder must be used, and applying it at the start of the download should permit listening during download too.

JunkFood02 commented 1 year ago

Try v1.7.0-beta.1

Noitarud commented 1 year ago

HAW HAW HAW😆 I had a big smile on my face when I saw it there in the file list while downloading. VLC does play it as it downloads! (It will crash if seek much). Not all players will play (Just Player).

Now my only request is to distribute those two settings you recommended alongside "command template" this will also advertise that Seal can do internet radio and HLS…Video too!

Only one complaint (I am using beta4), I cannot opt to stop it from GUI as before, the GUI acts as if I had not started it. The option to stop is in the second Android notification. Perhaps needs a page for "Active Downloads (1)"…

As for videos (not really my priority) There appears to be a stopping problem with videos. It will let me press cancel, it will grey, but not remove from android list, or it will remove but either way not stop downloading the file (or was that associated with watching at same time?). In some situations maybe the stream cuts out and after that the sound and video mismatch greatly.

I found another video URL that may be easier to watch https://i.mjh.nz/PlutoTV/all.m3u8 Perhaps deserves a selector, each entry of that one is a different genre.

JunkFood02 commented 1 year ago

It will let me press cancel, it will grey, but not remove from android list

This is an known bug and will get fixed in next beta version

I cannot opt to stop it from GUI as before

Redesigning another UI needs much effort so I didn't plan to do it now, it works at least 😉

Noitarud commented 1 year ago

I have hit an Error.

I was downloading radio at the time, then it quit of itself. Each subsequent attempt at downloading radio failed with this message Traceback most recent call last: file "data/user/0 com.junkfood.seal/no_backup/YouTubedl-android… Told it to delete temporary files, says 0 deleted. No YouTube videos allowed either. Updated to current. Same. Please note I missed message "error log copied to clipboard" due to blackening of screen that android does (I noticed button went grey as "cancel" did (above) and thought same issue (perhaps change grey text to "on clipboard" is more useful…)).

Traceback (most recent call last): File "/data/user/0/com.junkfood.seal/no_backup/youtubedl-android/packages/python/usr/lib/python3.8/runpy.py", line 192, in _run_module_as_main return _run_code(code, main_globals, None, File "/data/user/0/com.junkfood.seal/no_backup/youtubedl-android/packages/python/usr/lib/python3.8/runpy.py", line 85, in _run_code exec(code, run_globals) File "/data/user/0/com.junkfood.seal/no_backup/youtubedl-android/yt-dlp/yt-dlp/main.py", line 14, in File "", line 991, in _find_and_load File "", line 975, in _find_and_load_unlocked File "", line 655, in _load_unlocked File "", line 618, in _load_backward_compatible File "", line 259, in load_module File "/data/user/0/com.junkfood.seal/no_backup/youtubedl-android/yt-dlp/yt-dlp/yt_dlp/init.py", line 19, in File "", line 991, in _find_and_load File "", line 975, in _find_and_load_unlocked File "", line 655, in _load_unlocked File "", line 618, in _load_backward_compatible File "", line 259, in load_module File "/data/user/0/com.junkfood.seal/no_backup/youtubedl-android/yt-dlp/yt-dlp/yt_dlp/downloader/init.py", line 26, in File "", line 991, in _find_and_load File "", line 975, in _find_and_load_unlocked File "", line 655, in _load_unlocked File "", line 618, in _load_backward_compatible File "", line 259, in load_module File "/data/user/0/com.junkfood.seal/no_backup/youtubedl-android/yt-dlp/yt-dlp/yt_dlp/downloader/external.py", line 12, in File "", line 991, in _find_and_load File "", line 975, in _find_and_load_unlocked File "", line 655, in _load_unlocked File "", line 618, in _load_backward_compatible File "", line 259, in load_module File "/data/user/0/com.junkfood.seal/no_backup/youtubedl-android/yt-dlp/yt-dlp/yt_dlp/postprocessor/init.py", line 38, in File "/data/user/0/com.junkfood.seal/no_backup/youtubedl-android/yt-dlp/yt-dlp/yt_dlp/plugins.py", line 136, in load_plugins File "/data/user/0/com.junkfood.seal/no_backup/youtubedl-android/yt-dlp/yt-dlp/yt_dlp/plugins.py", line 120, in iter_modules File "/data/user/0/com.junkfood.seal/no_backup/youtubedl-android/packages/python/usr/lib/python3.8/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1014, in _gcd_import File "", line 991, in _find_and_load File "", line 971, in _find_and_load_unlocked File "", line 914, in _find_spec File "/data/user/0/com.junkfood.seal/no_backup/youtubedl-android/yt-dlp/yt-dlp/yt_dlp/plugins.py", line 97, in find_spec File "/data/user/0/com.junkfood.seal/no_backup/youtubedl-android/yt-dlp/yt-dlp/yt_dlp/plugins.py", line 72, in search_locations File "/data/user/0/com.junkfood.seal/no_backup/youtubedl-android/yt-dlp/yt-dlp/yt_dlp/plugins.py", line 62, in _get_package_paths File "/data/user/0/com.junkfood.seal/no_backup/youtubedl-android/packages/python/usr/lib/python3.8/pathlib.py", line 1389, in is_dir return S_ISDIR(self.stat().st_mode) File "/data/user/0/com.junkfood.seal/no_backup/youtubedl-android/packages/python/usr/lib/python3.8/pathlib.py", line 1180, in stat return self._accessor.stat(self) PermissionError: [Errno 13] Permission denied: '/data/data/com.termux/files/home/yt-dlp-plugins'

JunkFood02 commented 1 year ago

Did you install termux with yt-dlp?

Noitarud commented 1 year ago

I installed termux with F-droid, never really used it and it was on device before seal. I presume that message comes up because i can browse to such a directory as shown here.

Screenshot_20230106-113056

JunkFood02 commented 1 year ago

fixed in v1.7.2

Noitarud commented 1 year ago

It works again (though I am confused it didn't happen sooner, and began apparently during download (or between: I might have bumped cable)) The only thing I can report now was that "command template" was duplicated, new on the end of list. Would you consider including templates for internet radio/Tv? Or have you decided against it?

JunkFood02 commented 1 year ago

The only thing I can report now was that "command template" was duplicated, new on the end of list.

We changed the way we store the templates in v1.7.1, you can delete it without worry

Built in templates is under consideration, but it'll be hard to meet everyone's need so not a priority

Noitarud commented 1 year ago

I am having a problem with http://listen.technobase.fm/tunein-aacisdn-pls The resultant file plays but in some players is not seekable. It may only require radio template adjustment or its own AAC template.

Ps. This one is an example of how bad radio can be, one time it was lagging as far back as 13s, so radio "players" would need to behave better than 'blank and skip'.

Noitarud commented 1 year ago

Perhaps have it check for duplicate destination in concurrent tasks (same destination file, named after m3u8) or perhaps resume function is not picking up that it is engaged, does not change to "…(1)"

Concurrent downloading creates frankenstien file, what is seekable in overlap depends on player. Also subsequent files may be franken too ~ first: started A then B, I stopped both(result:B part was a little glitchy in parts); second: started B for a bit I stopped; third: started A and server resent part in first and seal stopped on its own; fourth: started A and has A but result file ends with length of B (not anything like content of second or first B tasks, thought was stopped).

JunkFood02 commented 1 year ago

yt-dlp use filename to continue duplicated downloads, the issue might be the two tasks is trying to write media to the same file. You can add -o "media_title.%(ext)s" to rename the file by modifying media_title

Noitarud commented 1 year ago

That's good.

V1.8.2 problem: I have another problem. It appears the stopped video's file handle is not being released. I download in Seal then delete in Ghost commander, and my free space is still not increased. It releases it if I kill Seal (last case: only needed to remove from app bar). Already says no temp files. It also had edited a video after I A)stopped download then B)renamed then C)started another (it did create a new file but it seemed to add or move onto renamed file).

Maybe the fault was I did not verify that seal had actually stopped downloading when I pressed cancel. or even closing (v1.9 test, kept going)

Perhaps (if it must), keep it open for a determined span, until a time you know there's no way it could resume(stream only)… though, I was trying to stop and restart to have multiple files to reduce file sizes, but there could be a better way to do it: instead of stopping download, perhaps you could allow user to trigger new containers to divide up the destination file to smaller files (and, even better, allow fine-adjustment correction of division by moving data between end of one and start of next, I can remove ad-breaks this way)

V1.9.0 problem: You have reversed the fix that I initially began this post for. Log: [download] Destination: /data/user/0/com.junkfood.seal/files/tmp/master [master].mp4

JunkFood02 commented 1 year ago

Go to Download directory, and turn off temporary directory

Noitarud commented 1 year ago

Thx. (I might have been still editing my last comment still) The media split may be too niche-y to bother with.

Noitarud commented 1 year ago

To follow up on what I wrote in the first post (to add chapters), I contacted a radio app developer, he said “'many radio streams deliver metadata such as the currently playing song via icecast” and he uses media and the app listens to callback messages that this module sends to their app. So would need to see how 'media' acquires this info from the stream (but this will probably require a modification of YouTube-dl).