Release script.module.tulip - a fork of lambda's lamlib

twilight

Developer
May 4, 2014
57
1
8
Lamlib is a script addon containing many frequently used routine commands.

I found out it is very easy to utilize and work with, and actually developed a premium addon that uses it. But then I realized it lacked some properties and functions that I think were useful so I forked it and made these additions. I may add new functions, such as the missing progress dialog, and perhaps even add tknorris's url dispatcher and log utils.

GitHub repository:

https://github.com/Twilight0/script.module.tulip

Feel free to add your comments and suggestions.
 

innovaciones

New member
Oct 27, 2013
5
0
0
On trailer.py

Code:
def language():
    if xbmc.getCondVisibility("substring(System.Language,spanish)"):
        return 'spanish'
    elif xbmc.getCondVisibility("substring(System.Language,english)"):
        return 'english'
    else:
        return 'english'

mylanguage = language()
Inside class trailer

Code:
    def worker(self, name, url):
        try:
            if url.startswith(self.base_link):
                url = self.resolve(url)
                if url == None: raise Exception()
                return url
            elif not url.startswith('http://'):
                url = self.youtube_watch % url
                url = self.resolve(url)
                if url == None: raise Exception()
                return url
            else:
                raise Exception()
        except:
            if mylanguage == 'english':
               query = name + ' trailer'
            elif mylanguage == 'spanish':
               query = name + ' trailer subtitulado'
            query = self.youtube_search + query
            url = self.search(query)
            if url == None: return
            return url
And now you have trailers with Spanish subtitles if you are using Kodi in Spanish or without subtitles if you are using Kodi in English, I guess you could do a better code than mine that do this function for all the Kodi languages, but right now Spanish is all I need, thanks to Lambda for coding all this functions from scratch, this is just a little improvement in his code.