2024-06-06, 20:18
I created a simple addon to test how to use label2, i want result like this image :
Or something like youtube addon(left is title,and colored likes and views,on the right duration | date):
But real result is this :
And this is my python code :
addon.xml, if needed :
What's wrong with my code?
Or something like youtube addon(left is title,and colored likes and views,on the right duration | date):
But real result is this :
And this is my python code :
python:import sys
import xbmcgui
import xbmcplugin
_url = sys.argv[0]
_handle = int(sys.argv[1])
def get_videos():
videos_data = [
('njn Ford Coppola Teaser Trailer', '01:31', '14/05/2024', '1K likes', '15K views'),
('Francis Ford Coppola Teaser Trailer', '02:16', '04/05/2024', '1K likes', '15K views'),
('lll Ford Coppola Teaser Trailer', '28:15', '22/02/2022', '1K likes', '15K views'),
]
return videos_data
def list_videos():
for title, duration, date, likes, views in get_videos():
list_item = xbmcgui.ListItem(label=title)
list_item.setLabel2(' | '.join([duration, date]))
list_item.setInfo('video', {'title': title, 'duration': duration})
list_item.setProperty('fanart_image', 'fanart.jpg')
list_item.setProperty('icon', 'icon.png')
xbmcplugin.addDirectoryItem(_handle, _url, list_item, isFolder=False)
xbmcplugin.endOfDirectory(_handle)
list_videos()
addon.xml, if needed :
Code:
<?xml version="1.0" encoding="UTF-8"?>
<addon id="plugin.video.myaddon_w" name="My Movie Addon" version="1.0.0" provider-name="Your Name">
<requires>
<import addon="xbmc.python" version="3.0.0"/>
</requires>
<extension point="xbmc.addon.metadata">
<summary>My Video Addon</summary>
<description>This addon fetches videos with titles, views, likes, date and duration</description>
<fanart>fanart.jpg</fanart>
<icon>icon.png</icon>
</extension>
<extension point="xbmc.python.pluginsource" library="addon.py">
<description>My Movie Addon</description>
<provides>video</provides>
</extension>
</addon>