Your 2nd Add-On: Online Videos!
#16
(2015-11-30, 13:40)Roman_V_M Wrote:
(2015-11-21, 23:56)Martijn Wrote: Seems used code is outdated although it still works.
Should now be done with
.setArt({ 'thumb': iconimage, 'banner' : os.path.join(artfolder,'banner.png'), 'fanart': os.path.join(addonfolder,'fanart.jpg') }) liz.setPath(u)

Code above is sample snippet and needs to be adjusted for use

What is outdated in it? Yes, setArt now provides an alternative way to set item's fanart along with other graphics, but unless there are some serious plans to depreciate setProperty('fanart_image', '/path/to/fanart.jpg') method, using setProperty for fanart is totally legit IMO.

I don't think Martijn was singling out the setProperty call for fanart. According to this: Jarvis_API_changes (wiki) the setting of "thumbnailImage" as a parm on the xbmcgui.ListItem init call is deprecated in Jarvis and setArt() needs to be used instead.
Reply
#17
(2015-12-05, 21:43)learningit Wrote:
(2015-11-30, 13:40)Roman_V_M Wrote:
(2015-11-21, 23:56)Martijn Wrote: Seems used code is outdated although it still works.
Should now be done with
.setArt({ 'thumb': iconimage, 'banner' : os.path.join(artfolder,'banner.png'), 'fanart': os.path.join(addonfolder,'fanart.jpg') }) liz.setPath(u)

Code above is sample snippet and needs to be adjusted for use

What is outdated in it? Yes, setArt now provides an alternative way to set item's fanart along with other graphics, but unless there are some serious plans to depreciate setProperty('fanart_image', '/path/to/fanart.jpg') method, using setProperty for fanart is totally legit IMO.

I don't think Martijn was singling out the setProperty call for fanart. According to this: Jarvis_API_changes (wiki) the setting of "thumbnailImage" as a parm on the xbmcgui.ListItem init call is deprecated in Jarvis and setArt() needs to be used instead.

Thanks for the information. Indeed, setArt is going to be the only way to deal with ListItem images, and I think it will be better than having several overlapping methods.
Raspberry PI 2 + LibreELEC 8 (Kodi 17)
Samsung Galaxy Tab A 10.1 + Kodi 17 for Android
Reply
#18
(2015-11-21, 23:47)moptop Wrote: Also, can someone point out how to make give the main directory(ie animals, food, cars) there own image rather than use an image from in the directory?
which I know the code is here:

Create another thumb in dictionary

Code:
'thumb1': 'http://www.vidsplay.com/vids/crab.jpg',

      list_item.setProperty('fanart_image', VIDEOS[category][0]['thumb1'])
Reply
#19
Someone just posted this in another thread, but here is a very very simple way to do the same thing.

https://github.com/myjamtv/kodi

Code:
import xbmc
import xbmcgui

# Stream URL here
url = "http://108.61.159.243:1935/XStreamEngine-243/smil:MyJamTV.smil/playlist.m3u8"
# Fake List Item for Stream Name
listitem = xbmcgui.ListItem("My Jam TV")
listitem.setInfo('video', {'Title': 'My Jam TV', 'Genre': 'Music Video'})
# Play the Stream
xbmc.Player().play(url, listitem)
Reply
#20
(2016-01-18, 14:37)zag Wrote: Someone just posted this in another thread, but here is a very very simple way to do the same thing.

https://github.com/myjamtv/kodi

Code:
import xbmc
import xbmcgui

# Stream URL here
url = "http://108.61.159.243:1935/XStreamEngine-243/smil:MyJamTV.smil/playlist.m3u8"
# Fake List Item for Stream Name
listitem = xbmcgui.ListItem("My Jam TV")
listitem.setInfo('video', {'Title': 'My Jam TV', 'Genre': 'Music Video'})
# Play the Stream
xbmc.Player().play(url, listitem)

Wow that's very simple but so effective.

A quick newb question: For example the My Jam TV, is there a way to assign two or multiple stream url's to the channel? So that whenever I click on My Jam TV, I get prompted with an option to choose which url to play the stream from?

I have spend countless of sleepless nights trying to figure it out, any help will be hugely appreciated.
Reply
#21
(2016-01-19, 09:11)Rapboy Wrote: A quick newb question: For example the My Jam TV, is there a way to assign two or multiple stream url's to the channel? So that whenever I click on My Jam TV, I get prompted with an option to choose which url to play the stream from?

I have spend countless of sleepless nights trying to figure it out, any help will be hugely appreciated.

You don't need to assign URL at all. If using xbmcplugin.setResolvedUrl, a path can be set just before playback. For example, you can present to a selection dialog to the user.
Raspberry PI 2 + LibreELEC 8 (Kodi 17)
Samsung Galaxy Tab A 10.1 + Kodi 17 for Android
Reply
#22
This is to inform you that the example plugin has been changed according to Kodi Jarvis API (all images moved to setArt method). As I understand, this breaks compatibility with earlier Kodi versions. Previous version of the example plugin is available in "legacy" branch of the plugin's Github repo.
Raspberry PI 2 + LibreELEC 8 (Kodi 17)
Samsung Galaxy Tab A 10.1 + Kodi 17 for Android
Reply
#23
(2016-01-21, 15:51)Roman_V_M Wrote: You don't need to assign URL at all. If using xbmcplugin.setResolvedUrl, a path can be set just before playback. For example, you can present to a selection dialog to the user.

Roman, an immense Thank You. I can't thank you enough for that advice, you saved me so much headache. I almost gave up until I saw your post, so once again thank you.

I was hoping to post back after successfully implementing the setResolvedUrl, but after 4 days I have not had any success. Everything I have been trying/doing leads to an error. I will forever be grateful and hugely appreciative if you can help me out with the following code below. What I was attempting with the script was to show the user both urls, and let them decide which url to view just like you mentionned in your example.


Code:
import xbmc
import xbmcgui

url = [{"http://108.61.159.243:1935/XStreamEngine-243/smil:MyJamTV.smil/playlist.m3u8"},{"http://rt-a.akamaihd.net/[email protected]/%s.m3u8"}]

# Fake List Item for Stream Name
listitem = xbmcgui.ListItem("My Jam TV", "MY TV")
listitem.setProperty('IsPlayable', 'true')
xbmcplugin.setResolvedUrl( handle=int( sys.argv[1]), succeeded=True, listitem=xbmcgui.ListItem() )

#xbmc.Player().play(url, listitem)

Any help will be greatly appreciated, Thanks.
Reply
#24
2 Rapboy

First, your url variable is a weird construction. Why do you use strings inside sets inside a list?

Second, you need to choose which approach to choose: either you are developing a general script addon, then xbmc.Player is fine, or you are developing a plugin. In the latter case you cannot use setResolvedUrl at the top-level route of your plugin: it can be called only from an upper level ListItem of your plugin that has isFolder=False and 'isPlayable'='true' properties (see my example plugin).
Raspberry PI 2 + LibreELEC 8 (Kodi 17)
Samsung Galaxy Tab A 10.1 + Kodi 17 for Android
Reply
#25
Sorry for highjacking this thread.

(2016-01-27, 13:03)Roman_V_M Wrote: 2 Rapboy
First, your url variable is a weird construction. Why do you use strings inside sets inside a list?

I have very little knowledge in python coding (even after the tutorials), hence the weird url construction.

To your second point, I am making a plugin (actually I have made it already apart from this issue). Just a simple plugin to be able to view streams. I was wondering in your example plugin, is there anyway to make the categories playable?
For example:
Making the category (animals) playable, so when I press on animals, it will ask me to play Alligator, Crab or Turtle. As opposed to opening a folder with them sub-listed. So I can favorite animals and use it in an epg guide.

On the example plugin, I tried following your advice and adjusted categories to isFolder=False and adding isPlayable='true' properties. But it did not work. I even adjusted def list_categories(): to make it almost exactly like def list_videos(category):. But all I got were errors or an empty folder.

I think I am too dumb to figure it out, so any help will be greatly appreciated. Thank you already for the help that you have provided, I immensely value it.
Reply
#26
(2016-02-01, 18:20)Rapboy Wrote: Sorry for highjacking this thread.

(2016-01-27, 13:03)Roman_V_M Wrote: 2 Rapboy
First, your url variable is a weird construction. Why do you use strings inside sets inside a list?

I have very little knowledge in python coding (even after the tutorials), hence the weird url construction.

To your second point, I am making a plugin (actually I have made it already apart from this issue). Just a simple plugin to be able to view streams. I was wondering in your example plugin, is there anyway to make the categories playable?
For example:
Making the category (animals) playable, so when I press on animals, it will ask me to play Alligator, Crab or Turtle. As opposed to opening a folder with them sub-listed. So I can favorite animals and use it in an epg guide.

Please read this my post: 2227469 (post)
Hopefully, it will make things more clear for you. What you need is p.2. But inside your playback function and before setResolvedUrl you can do anything you like. It includes presenting to a user a selection dialog. xbmcgui.Dialog().select(...) is enough for simple cases.

BTW, you can store a "category", that is a plugin virtual folder, in Kodi Favorites.
Raspberry PI 2 + LibreELEC 8 (Kodi 17)
Samsung Galaxy Tab A 10.1 + Kodi 17 for Android
Reply
#27
(2016-01-27, 13:03)Roman_V_M Wrote: Please read this my post: 2227469 (post)
Hopefully, it will make things more clear for you. What you need is p.2. But inside your playback function and before setResolvedUrl you can do anything you like. It includes presenting to a user a selection dialog. xbmcgui.Dialog().select(...) is enough for simple cases.

BTW, you can store a "category", that is a plugin virtual folder, in Kodi Favorites.

That was it, I feel so stupid. You are a genuis Roman,xbmcgui.Dialog().select(...) worked perfectly. Thank you so much for all the help, I can stress how much I appreciate it.Thanks

p.2?? Is that play function 2?


Edit:

I am stupid, I got too happy at the sight of seeing the dialog box. I tried various ways in the example plugin, I get the dialog box but it does not play the url selected. It just play the original url, I don't know if it makes sense. I guess that's why you said I need p.2.

May I iterate once more that I am very very new to python coding and kodi commands. I know I may be pushing my luck but is there any possibility that you can rectify the following code: (Trying to figure out what I can put in xbmc.Player(...) to make it play either url or url2)

Code:
url = "http://108.61.159.243:1935/XStreamEngine-243/smil:MyJamTV.smil/playlist.m3u8"
url2 = "http://www.vidsplay.com/vids/alligator.mp4"

listitem = xbmcgui.ListItem("My Jam TV")
listitem.setInfo('video', {'Title': 'My Jam TV', 'Genre': 'Music Video'})
xbmcgui.Dialog().select('Choose a link', [url, url2])
# Play the Stream
xbmc.Player().play('', listitem)

Alternatively, I will be over the moon if you can show me what to add to your example plugin to create the desired effect. Because I can only add strings, anything else and it tells me it is undefined.

And my apologies for making this thread unnecessary long, I was going to inbox you but this was not possibble.


P.S. I can add the category to favourites but this is not a playable item/folder that can be played by a TV-Guide, which is what I am trying to do. I tried adding the isPlayable property but this still did not work with a TV-Guide.
Reply
#28
Hi guys,

I'm following the tutorial and decided to replace the crab video with a different source video (see below). It didn't load anything, and I'm hoping one of you could explain how I could get this to work? They have different embedding options, but I'm not sure which one to use. Any suggestions would be great! Thanks in advance.


EDIT: Figured it out
Reply
#29
2 Rapboy

Why are you insisting on using xbmc.Player class? It is meant for different scenarios. But even if you do want to use it, I don't see from your code that you are providing a playable URL to it.

Again, as I said, you need to choose your approach (a plugin or a general script addon) and stick to it. And you need to understand what you are doing. There are nothing wrong with trial and error approach. After all, I myself learned Kodi addons programming this way from scratch (and I have never worked in IT field, let alone programming, even a day). And general Python manuals, of course. Python may seem easy to learn (and that's true in general), but it's a serious programming languages with its own constructions, patterns and best practices.
Raspberry PI 2 + LibreELEC 8 (Kodi 17)
Samsung Galaxy Tab A 10.1 + Kodi 17 for Android
Reply
#30
(2016-02-10, 12:29)Roman_V_M Wrote: 2 Rapboy

Why are you insisting on using xbmc.Player class? It is meant for different scenarios. But even if you do want to use it, I don't see from your code that you are providing a playable URL to it.

Sorry for the misunderstanding. To be honest I have no interest in using the xbmc.Player class,I am actually just using your example plugin and adjusting it to suit my needs. I used that code as I thought it was simple and can gain a quick response on how to use xbmc.Dialog.

However I am almost certain that my approach is a plugin (your example plugin), i'm just finding it hard to understand how some codes are made up. I am constantly adjusting the code and using kodi.log to help understand the error that is generated, but it is to little avail most of the time. Impressive how you learned programming from scratch with know programming[/code] experience, I doubt I will be the same though.

At the moment I am using the following:
Code:
def play_video(path):
        stream_url=[]
        stream_name=[]
        name= 'name'
        links='video'

        i=1
        for video in links:
                stream_url.append( links )
                stream_name.append( 'Link '+str(i) )
                dialog = xbmcgui.Dialog()
                i=i+1
        select = dialog.select(name,stream_name)
        if select == -1:
                quit()
        else:
                url = stream_url[select]
                listitem=xbmcgui.ListItem(name)
                ok=xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=url,listitem=listitem)
                listitem.setPath(path)
                xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, listitem)

But I am finding it difficult to make kodi realise that I want to use the url('s) in the VIDEOS category, as I don't know the code. As always thank you for your input(s).
Reply
 
Thread Rating:
  • 2 Vote(s) - 5 Average



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