KenT2 / tboplayer

Raspberry Pi. A GUI for OMXPlayer
Other
158 stars 43 forks source link

Load Youtube Playlist doesn't add their respective URLs #200

Open fabianmendes opened 3 years ago

fabianmendes commented 3 years ago

And It can't be re-loaded as List, because, when you Save List, it saves them without any URL at all. You can see on #199 The good news is that it's still possible to play them as Playlist. When you Save List, and Load list then, you can't play anything because there is not any URL!

(Adding track by URL or Searching it with Youtube Browser, TBOPlayer Add the tracks' URL. When it is added as a YouTube playlist, it doesn't --but you can still play them. Kind of weird). Help, please. 'Cause I don't know how go_ytdl & ytdl actually work on code. 2021-05-05-005128_800x480_scrot

fabianmendes commented 3 years ago

I want to help to improve Save List or getting the tracks URLs fro YouTube playlist :$

heniotierra commented 3 years ago

@fabianmendes Ok, I'll help you with some pointers.

heniotierra commented 3 years ago

@fabianmendes Ok, I thought about this, and the easiest way to implement this feature would be by modifying the "Add youtube playlist" dialog adding a "Save playlist to file" checkbox. If the user ticks the checkbox, this will enable a second text field labeled "File name" that would allow the user to enter a file name, and when the user click "Ok", if the File name has been provided, create a new file in same folder as the normal playlist is being saved with CSV extension named with the value provided by the user, and write the url as contents of the file. Then, to open the file, create a new option in the "Playlist" menu to "Load Youtube playlist from file", use tkinter's "open file dialog" (as seen here) to get that file, then open it as a normal text file, and then just read the url and call tboplayer.go_ytdl (as seen here) passing the url to it and specifying playlist=True.

There are other alternatives to implement playlist saving for youtube playlist, but those are more difficult and will take a lot more effort.

fabianmendes commented 3 years ago

Ok, I got a little lost, I've tried to follow the action of the functions and methods, I'll try again tomorrow.

Anyways, I didn't get very well how the playlist is read, I saw that a track with URL HTTP link reading is very similar. but, how does the program put the tracks from a playlist youtube loaded can turn on the list? I'm trying to aim at how tracks are listed in the TBOplayer and how are from a Youtube playlist link. There should be a way, also, I understand that the software stores the map or mp4 file temporarily or in streaming, right?

I'm thinking of scrapping again haha but only because I'm thinking now that the tracks youtube URLs are well saved or listed because we pasted their URLs while in Load Youtube Playlist we don't. And that's why you're suggesting to add to "Save [play]list" a script when it was from youtube playlist (because we would save the playlist's link itself to then being read as a playlist link too. Am I right?

I think scrapping may ain't be that bad but if you say we could do it better well let's do it. Also, I don't know if scrapping works on python 2 nor if Youtube let us scrap each track links from the playlist website page (I think yes it does, but I want to confirm all the above from this comment of mine first)

heniotierra commented 3 years ago

FIrst of all, about my suggestion, I thought of an improvement:

If the user ticks the checkbox, this will enable a second text field labeled "File name" that would allow the user to enter a file name, and when the user click "Ok"

Instead of adding both the checkbox and a second text field, only add the checkbox, and after the user clicked "OK", if the user ticked the checkbox, then open tikinter's file dialog for saving the file (as seen here).

Now, to your questions.

how does the program put the tracks from a playlist youtube loaded can turn on the list?

We use a state machine to watch for the output of youtube-dl.

There should be a way, also, I understand that the software stores the map or mp4 file temporarily or in streaming, right?

Youtube uses temporary url for the media stream (which is not the same as Youtube's site url for the video). Since they are temporary, if we save them to the file and try to restore the list later on, these link won't work.

And that's why you're suggesting to add to "Save [play]list" a script when it was from youtube playlist (because we would save the playlist's link itself to then being read as a playlist link too. Am I right?

Yes.

For an alternative, I wouldn't go with scraping. If you do on your teminal:

youtube-dl --get-id https://www.youtube.com/watch?list=RDMMbmVZDopspPU

This will give you the full list of single video identifiers that belong in the list. So, create a routine to fetch this list and then save those to a file. When opening the playlist file (in a new menu item for "Load Youtube playlist from file"), use the identifiers and concatenate them with Youtube's url for watching videos, then call tboplayer.go_ytdl for each.

fabianmendes commented 3 years ago

I was having so many troubles debugging it. Getting errors from dependencies (I installed all of them properly but finally, I got an error from them unfixable. What do you suggest to me? I use Pycharm editor.

Otherwise, as everything is in python 2.7, some dependencies are only for python 2.7; so is that why it can't be converted to Python 3 right?

heniotierra commented 3 years ago

It can be converted to Python 3. The reason I decided to drop the Python 3 port is because it wasn't 100% working, and the development for omxplayer was discotinued, so if the software that's the base of TBOPlayer is now discotinued, there's not much reason to invest lots of efforts in a Python 3 port. Unless we modify TBOPlayer's dependency on omxplayer and make it use vlc or some other software.

fabianmendes commented 3 years ago

Oh, Ok I get it, nice. Alright, got it! ~V. Fabian T· Mendes C.

El vie, 2 jul 2021 a las 14:23, heniotierra @.***>) escribió:

It can be converted to Python 3. The reason I decided to drop the Python 3 port is because it wasn't 100% working, and the development for omxplayer was discotinued, so if the software that's the base of TBOPlayer is now discotinued, there's not much reason to invest lots of efforts in a Python 3 port. Unless we modify TBOPlayer's dependency on omxplayer and make it use vlc or some other software.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/KenT2/tboplayer/issues/200#issuecomment-873179727, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHOIWF55X5QTQMXZNPH5ISDTVX727ANCNFSM44F5X4LQ .

heniotierra commented 3 years ago

Which dependencies are you having problems with? And which errors? I don't think I can be much of a help if you added some new dependency that's causing errors.

fabianmendes commented 3 years ago

urllibs, error from importing "Request" :L ~V. Fabian T· Mendes C.

El vie, 2 jul 2021 a las 15:57, heniotierra @.***>) escribió:

Which dependencies are you having problems with? And which errors? I don't think I can be much of a help if you added some new dependency that's causing errors.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/KenT2/tboplayer/issues/200#issuecomment-873228017, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHOIWFY4KGIQKYAW5LNFI3TTVYK2FANCNFSM44F5X4LQ .

heniotierra commented 3 years ago

What does sudo apt-get -y install python-requests give you?

fabianmendes commented 3 years ago

python-requests is on its latest version (2.21.0-1)

2021-07-02 16:26 GMT-04:00, heniotierra @.***>:

What does sudo apt-get -y install python-requests give you?

-- You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub: https://github.com/KenT2/tboplayer/issues/200#issuecomment-873240629

--

~V. Fabian T· Mendes C.