I-A-C / plugin.video.exodusredux

GNU General Public License v3.0
20 stars 13 forks source link

Language Notes #1

Closed I-A-C closed 5 years ago

I-A-C commented 5 years ago

I've uploaded providers and language strings for German and Polish language.

1) In the Lambdascrapers Module settings, enable the Foreign Provider(s) of choice. 2) In Exdous Redux Settigs, change the General>Providers Language to either German or Polish.

Is this normal behavior? Initially, I had General>Providers Language set to English and these foreign provider weren't loading. For some reason, I was expecting all Foreign Providers to play since I had "Enable All Foreign Providers".

Tikipeter commented 5 years ago

ALL ENABLED SOURCES within the chosen provider folder will originally get imported to ExodusRedux (ER). So all enabled sources from the 'eng' folder, all enabled sources from the 'de' folder etc. Around line 317 in 'sources.py' of ER, it will ascertain the language chosen in it's settings, and will get from each scraper what language it is for (each scraper assigns a self.language variable upon initiation, which ER queries to determine the language of the scraper.) If the language returned by the scraper is within the list of languages chosen in settings (you can choose for example 'English & German'), ER will keep those scrapers and discard the ones that don't match. Basically, lines 317-319 of sources.py in ER filters the scrapers by language. So even if you have all foreign providers enabled in Lambdascrapers, they will eventually get filtered out by ER based on the settings from ER. I'm sure this behaviour could be changed to have Lambdascrapers filter by language if that was your desired outcome.

I-A-C commented 5 years ago

Basically, lines 317-319 of sources.py in ER filters the scrapers by language.

I commented out the those lines for testing and ER returns everything regardless of language. I can't believe I missed that language filter on the sourceDict. (It was right above previously edited lines).
Thanks for clarifying how ER handles languages. No need to change anything, I just have to remember include some instructions for using foreign language when I release to public

Tikipeter commented 5 years ago

Since I have your attention here, because you have removed the suffixes on the source files (eg the _PLAC etc), that will break ExodusRedux identifying the correct scraper module used when displaying the search progress. A more permanent fix would be to include a simple function in init.py of lambdascrapers that can be called to get the source module currently selected. The following would work (placed within lib/lamdascrapers/init.py):

def getProviderName():
    return __addon__.getSetting('module.provider')

Then the import section for sources.py (within getConstants) in ExodusRedux would be this:

try:
    if xbmc.getCondVisibility('System.HasAddon(%s)' % 'script.module.lambdascrapers') and not scraperSetting == 'Default':
        from lambdascrapers import sources, getProviderName
        try: self.module_name = getProviderName()
        except: self.module_name = 'Unknown'
    else:
        from resources.lib.sources import sources
        self.module_name = 'Default'
        control.setSetting('module.provider', 'Default')
    self.sourceDict = sources()
except: return

Great work on the module btw, you are doing a great job. :)