Your 2nd Add-On: Online Videos!
#46
Wink 
great guys Big Grin
Reply
#47
It's 2017 now and im checking the updated code in github. I noticed that for this example, setArt is called once the ListItem is created. What if I don't have those information / data yet (image url)? when do i call setArt() ?

while checking for docs, I can see some snippets like: self.list.getSelectedItem().setArt({ 'poster': 'poster.png', 'banner' : 'banner.png' }) but they its always 1-liner and i don't know what class this refers to? At first i was thinking to do a while look at the end of the script and keep checking what is the current selected item, but for obvious reasons, its just wrong.

Thanks in advance. Great sample!
Reply
#48
(2017-06-02, 19:04)jaywidanem Wrote: It's 2017 now and im checking the updated code in github. I noticed that for this example, setArt is called once the ListItem is created. What if I don't have those information / data yet (image url)? when do i call setArt() ?

If you are creating your media listing, it is assumed that you have gathered all possible information by then.
Raspberry PI 2 + LibreELEC 8 (Kodi 17)
Samsung Galaxy Tab A 10.1 + Kodi 17 for Android
Reply
#49
(2017-06-02, 23:45)Roman_V_M Wrote: If you are creating your media listing, it is assumed that you have gathered all possible information by then.

oh.... so i can't update them once i called xbmcplugin.addDirectoryItem() ? alright. thanks!
no wonder, i tried to creating a thread that would get additional information after i finalized the directory, passed the list item as an argument to the thread and updated afterwards. but it doesn't reflect.

Thanks for the info Roman_V_M
Reply
#50
How to add the video info in this addon i try make a video addon only no info show up from movie i have only thumb poster wokring wich code to use for the info from 1 movie ?
Reply
#51
Thanks for this tutorial, it's really great ! 
It has almost everything I want to do in it, I want to add one more option to the list of the videos : subtitles !
So I searched the function I can use for that and I found this :
Code:
listitem.setSubtitles(['special://temp/example.srt', 'http://example.com/example.srt'])

I don't understand the first parameter, if you can help me please it will be really great !
This tutorial is really awesome, hope I can add more features to my very first Kodi plugin !
Reply
#52
(2017-10-23, 23:16)Gama41 Wrote: Thanks for this tutorial, it's really great ! 
It has almost everything I want to do in it, I want to add one more option to the list of the videos : subtitles !
So I searched the function I can use for that and I found this :
Code:
listitem.setSubtitles(['special://temp/example.srt', 'http://example.com/example.srt'])

I don't understand the first parameter, if you can help me please it will be really great !
This tutorial is really awesome, hope I can add more features to my very first Kodi plugin !

setSubtitles method takes exactly one argument that is the list of subtitle paths. If you mean the 1st item in the list, Kodi support special path syntax to access its special directories.
Raspberry PI 2 + LibreELEC 8 (Kodi 17)
Samsung Galaxy Tab A 10.1 + Kodi 17 for Android
Reply
#53
Thanks !
Reply
#54
Roman, Excellent work on the example addon for Videos. It works quite well and is easy to understand.

The only thing I really need to change for my use is that instead of using <content target="videos"> I want to use my Custom XML. I don't mind creating it as a static file or within a script using xbmcgui. 

I have spent the last week trying to get it to work with a Custom XML though and at best I can get the first page/folder to display. But subsequent clicks on the list items do not do anything.

<content target="1131">plugin://plugin.video.example/</content>

Please advise on how to get it to work with custom XML or how to replicate "Videos" and customize it ? Thanks in advance.
Reply
#55
@ ajiratech

I'm a Python guy and have very limited knowledge of Kodi skinning and skin XML syntax, so I don't even understand what you are trying to accomplish.
Raspberry PI 2 + LibreELEC 8 (Kodi 17)
Samsung Galaxy Tab A 10.1 + Kodi 17 for Android
Reply
#56
Hello, can you help me making every category's thumb and fanart different?

I believe that my problem is that the code is inside a for loop. The loop gets the first thumb of each category, but what I want is the loop to get different files, for example icon1.png, icon2.png, icon3.png.

Code:
# Iterate through categories
for category in categories:
# Create a list item with a text label and a thumbnail image.
list_item = xbmcgui.ListItem(label=category, thumbnailImage=VIDEOS[category][0]['thumb'])
# Set a fanart image for the list item.
# Here we use the same image as the thumbnail for simplicity's sake.
list_item.setProperty('fanart_image', VIDEOS[category][0]['thumb'])

I have tried this for the thumb but I can't get the for to increment the values:

Code:
icons = ++1
list_item = xbmcgui.ListItem(label=category, thumbnailImage='special://home/addons/plugin.video.myaddon/resources/icon' + str(icons) + '.png')

Is there a better way of doing it or can you help me fix the problem with my code?
Reply
#57
@Petes Python does not have ++ increment operator. Also, please use the current version of plugin.video.example. Passing images to ListItem constructor is deprecated. You should use setArt instead.
Raspberry PI 2 + LibreELEC 8 (Kodi 17)
Samsung Galaxy Tab A 10.1 + Kodi 17 for Android
Reply
#58
I updated the version, never managed to get the iteration working (I'm too new with Python), I tried many things but I had to do it by removing the for and adding the folders one by one, anybody with any suggestions is greatly appreciated but at least I got it running.

Thank you.
Reply
#59
For anybody trying to do this by iterating variables, I finally managed to do it, here's how I did it.
All you need is to make a for with 2 variables.

Code:

.
.
.
categories = get_categories()
numbers = [0, 1, 2]
# Iterate through categories
for category, number in zip(categories, numbers):
    # Create a list item with a text label and a thumbnail image.
    list_item = xbmcgui.ListItem(label=category)
    # Set graphics (thumbnail, fanart, banner, poster, landscape etc.) for the list item.
    # Here we use the same image for all items for simplicity's sake.
    # In a real-life plugin you need to set each image accordingly.
    list_item.setArt({'thumb': 'special://home/addons/plugin.video.myaddon/resources/icon' + str(number) + '.png',
                      'icon': 'special://home/addons/plugin.video.myaddon/resources/icon' + str(number) + '.png',
                      'fanart': 'special://home/addons/plugin.video.myaddon/resources/media/background.jpg'})
.
.
.
Reply
#60
Hello and thank for this tutorial.
I'm new at addon dev, and i've reused your code for testing and understanding how it work. And for testing, i've tried to adapt and display my trakt.tv list of current shows

But i have a question.
On the category page, when i open the sideblade menu, the viewType is set to list, and i can't change it, in other addon, i can change it to wall, large etc.
And i can't figure out why. By reading doc and other forums thread, i've tried to add this line:
xbmc.executebuiltin('Container.SetViewMode(57)')

just before
xbmcplugin.endOfDirectory(__handle__)

but it do nothing, i've tried with lot of other id (501,510,51 etc)

Do i need to add something in the addon code to support different ViewType? My google search give me nothing about this part, except this 'Container.SetviewMode' line. Can't understand what i'm doing wrong
Reply
 
Thread Rating:
  • 2 Vote(s) - 5 Average



Logout Mark Read Team Forum Stats Members Help
Your 2nd Add-On: Online Videos!52