metube icon indicating copy to clipboard operation
metube copied to clipboard

Downloads with the same title / req: manually enter title

Open jaz000 opened this issue 3 years ago • 10 comments

I have links to m3u8 playlists (for a stream) that all give the same title "playlist" (and same output file name) - this means I can only enter one at a time to download list. Presumably title is used for the index of the playlist? and the subsequent ones don't get added because it's the same.

I've set OUTPUT_TEMPLATE to %(epoch-3600>%H-%M-%S)s-%(title)s.%(ext)s which does prefix the downloaded file with a unique timestamp, but still doesn't allow multiple entries in the queue with the same title.

I'm not sure what the best workaround would be, detect and append (1) (2) etc like windows file manager? allow overriding the title with an optional field (awkward UI)?

Currently I have to wait for one to finish before adding another which kind of defeats the purpose.

any help appreciated!

jaz000 avatar Feb 20 '22 16:02 jaz000

The entries in the queue are indexed by ID, not by the title. So it appears that somehow, all your entries have the same ID. Which site are you downloading from? Can you give a sample link?

alexta69 avatar Feb 20 '22 16:02 alexta69

My targets are paid for so here's an example from the same site ..

https://dco4urblvsasc.cloudfront.net/25936/2593553_vEbTbwkW/game/index.m3u8 https://dco4urblvsasc.cloudfront.net/25377/2537613_VTjdgVjR/game/index.m3u8

original sources: https://www.openrec.tv/movie/mlrl9g3w1rg https://www.openrec.tv/movie/em8xqeppwz2

these both have a title of index and I can only add one at a time.

Now you can add those source pages and they are unique, but I can't do that for the paid videos (yt-dl doesn't support login for those pages ...) - so I find and add the m3u8 link (developer mode) and it's those that don't work.

jaz000 avatar Feb 20 '22 17:02 jaz000

Got it. Well, I don't see an obvious solution to this.. Leaving the issue open in case someone comes up with one..

alexta69 avatar Feb 20 '22 17:02 alexta69

On line 226 of ytdl.py it will check if the video id is already in the queue. Maybe you can comment out the relevant code to make it download anyway. While this can cause UI display issues, you don't need to wait

PikuZheng avatar Feb 20 '22 23:02 PikuZheng

@PikuZheng I can't download it without adding to the queue, this is not how the program works.. and I'm not sure what you mean by "you don't need to wait"?

alexta69 avatar Feb 21 '22 11:02 alexta69

sorry I'm bewildered. I tried changing line 226 to if not self.queue.exists(entry['id']) or 1==1: Now even if there are same ID in the queue, it will still start downloading as long as the filename is different.

I recommend @jaz000 to make a private modification, I believe it's the easiest way and doesn't need for other users.

PikuZheng avatar Feb 21 '22 13:02 PikuZheng

This would mean that there'd be two downloads under the same queue entry. I don't know what this will do to the MeTube UI and other behaviors such as cancelation and so on. MeTube for sure isn't designed to work this way. So it will have to be implemented in some other fashion.

alexta69 avatar Feb 21 '22 20:02 alexta69

You are correct but I think the duplicate name is because ytdl doesn't get the ID correctly (m3u8 is not like youtube, it can't provide a "video ID" tag. Maybe it's possible to assign an other information (like file size) as ID when there is no ID , instead of using the filename

PikuZheng avatar Feb 22 '22 02:02 PikuZheng

I put this in front of that if statement. Filename is still the same, but I'm changing that as described above, I'm not sure how to change that automatically any other way.

        if self.queue.exists(entry['id']):
            extra = 2
            temp_id = entry['id'] + "_" + str(extra)
            while self.queue.exists(temp_id):
                extra = extra +1
                temp_id = entry['id'] + "_" +str(extra)
            entry['id'] = temp_id 

jaz000 avatar Feb 22 '22 16:02 jaz000

actually I also added:

           entry['title'] = entry['title'] + "_" + str(extra)

but that only changes what's displayed in the queue. I guess the yt-dl command decides the filename when it's run

jaz000 avatar Feb 22 '22 16:02 jaz000