Kolifanes / plugin.video.youtube

YouTube for Kodi with API fixed
GNU General Public License v2.0
119 stars 44 forks source link

Add support for library integration #50

Open imsodin opened 8 years ago

imsodin commented 8 years ago

The idea would be that there is a context menu option like "Add to library" which then creates a strm and nfo file in e.g. addon_data/plugin.video.youtube/streams/. I am aware of the youtube library addon, but this addon focuses on integrating playlists/channels like tv shows. My use case is that when I encounter a great video (in my case often documentaries) I want to collect it somehow. Currently I do this by creating these files manually, automating this would be really convenient.

It seems like this should be fairly straight forward to implement and I would like to help. However I have no experience with kodi plugins, your plugin code is quite extensive and I failed to find an "entry point" to start understanding the parts relevant for such a feature. If you can point me to relevant code or to some resource on a "general kodi plugin design" (if it exists, probably not), I may look into it (within time constraints...).

vlmaksime commented 8 years ago

Russsian: Хорошая идея. В дополнении хочу попросить реализовать такую функцию для плейлистов. Аддон должен автоматически следить за изменением состава плейлиста и добавлять изменения в библиотеку.

Google Translate: A good idea. In addition I want to ask to implement such a function for playlists. The addon should automatically follow the change in the composition of the playlist, and add the changes to the library.

h0d3nt3uf3l commented 8 years ago

Sorry but I don't understand your proposal completely. Do you want do download the file or just saving the link? Think you mean saving the link to the video (like https://www.youtube.com/watch?v=mMMRGJCFsQE ?)

If you can let me have some of your generated files I would understand it better, than I would be able to point you the "entry points"

vlmaksime commented 8 years ago

Here is example of my library. example.zip Both folders is a series "Heroes of the City" have just episodes, imformation loaded from http://thetvdb.com/ "Волшебный Грузовичок Пик" have episodes and nfo files.

Here is more information about STRM: http://kodi.wiki/view/internet_video_and_audio_streams and NFO http://kodi.wiki/view/NFO_files

imsodin commented 8 years ago

As vlmasime already explained, I do not want to download, I want to add youtube videos to my kodi library. This can be done as explained on your wiki page and with nfo files. Lets look at an example: I want to add the following youtube video to my library: https://www.youtube.com/watch?v=GASFa7rkLtM Somewhere in one of my kodi sources (a dir called "youtube" makes sense) I create a file called "Dream Lines IV.strm". Its content is:

plugin://plugin.video.youtube/?path=/root/video&action=play_video&videoid=GASFa7rkLtM

In the same folder I also place a "Dream Lines IV.nfo" which minimally contains

<movie>
  <title>Dream Lines IV - Wingsuit proximity by Ludovic Woerth & Jokke Sommer</title>
</movie>

Now I can simply browse my library for a video called "Cream Lines IV" to play this video with your addon. More information can be added to the .nfo file to make finding it easier (e.g. genre).

The idea is to automate this process by adding the context menu option "Add to library" which then creates these files. The location where they are created could be configured in the addon settings or just be a hardcoded directory in addon_data/plugin.video.youtube/.

h0d3nt3uf3l commented 8 years ago

Okay I got it. After this line in yt_play.py The Video-Item is filled with the information of the video. To get the information out of the video_item you have to had a look in the video_item.py (Functions given like video_item.get_title())

Not all fields are filled with informations. The best is if you going through with an debugger and have a look in the variable at realtime.

To Add an Item in the context menu I don't know either yet. It's not my code :) Sadly I don't have time now to get through it an explain it to you. Think you can do an hardcoded file and I would add the context menu if you don't get it.

Hope this will help you.

imsodin commented 8 years ago

Just do not expect too much, I do not have much time myself. I will be away next week, after that I may try to do this. Thanks for the infos.

imsodin commented 8 years ago

I am trying to understand the code. While I am certainly not competent to judge code, this seems like a real mess (almost no comments or docstrings anywhere) and lots of code seems unused. Long story short, I am struggling. One general question: There are unittests, however they all fail because they can' t import the kodi modules (xbmcaddon et al). As far as I read there is no option to use these modules outside of kodi. And in the kodi repos I could not find the python source of these modules to do it manually. So how are these unittest supposed to work?

jdf76 commented 8 years ago

This code was originally done from bromix. We've just kept it alive, though I'm (jdf76) not really participating anymore. I'm just replying to your first comment. Feel free to modify the code as you see fit. Bromix when he retired said fork his code and do with it what you want.

Jeff

Sent from my iPhone

On Aug 5, 2016, at 1:10 PM, imsodin notifications@github.com wrote:

I am trying to understand the code. While I am certainly not competent to judge code, this seems like a real mess (almost no comments or docstrings anywhere) and lots of code seems unused. Long story short, I am struggling. One general question: There are unittests, however they all fail because they can' t import the kodi modules (xbmcaddon et al). As far as I read there is no option to use these modules outside of kodi. And in the kodi repos I could not find the python source of these modules to do it manually. So how are these unittest supposed to work?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

imsodin commented 8 years ago

`Regarding the import of the xmbc modules: I found the following project which solves it (as long as these modules are not actually used in tests): https://github.com/romanvm/Kodistubs

h0d3nt3uf3l commented 8 years ago

Because of the difficult and part time unused code I talk to a few people in a german forum. Maybe we will rewrite the code for a better understanding and a better documentation. YouTube has a few changes in the future and its hard to get new functions implemented in the code. I use eclipse to debug the code. This was a day of work to get it working but you can debug in realtime. search for PyUnit I think. (I'm on the mobile Phone, can't have a look now)

h0d3nt3uf3l commented 8 years ago

PyDev its called.

imsodin commented 8 years ago

@h0d3nt3uf3l Thanks for the information. I may look at eclipse, currently I am just using emacs/gdb. I am a bit hesitant to work on this due to the state of the code. Can you refer my to that forum so that I can stay up-to-date with what is happening on that front (I am German speaking).

h0d3nt3uf3l commented 8 years ago

www.kodinerds.net/index.php/Thread/51924-Team-für-neues-YouTube-Addon-gesucht/