The branch, dharma has been updated
       via  9f698165bed7dc31bc947763971cbd7ff9fb196b (commit)
       via  35a3e43c877c8285ca723844e788af4bbb63f56a (commit)
      from  82537160d7e8337e425366fae609e1ee58ef59b6 (commit)

- Log -----------------------------------------------------------------
http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/scripts;a=commit;h=9f698165bed7dc31bc947763971cbd7ff9fb196b

commit 9f698165bed7dc31bc947763971cbd7ff9fb196b
Author: amet <a...@nospam>
Date:   Thu Dec 23 16:34:49 2010 +0400

    [script.sharethetv]  -v1.1.0
    - Leaving XBMC running for long periods of time would slow down system. 
Method of checking the movie count has changed to fix this.

diff --git a/script.sharethetv/addon.xml b/script.sharethetv/addon.xml
index a4f6a6c..51429d2 100644
--- a/script.sharethetv/addon.xml
+++ b/script.sharethetv/addon.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 <addon id="script.sharethetv"
        name="ShareThe.TV"
-       version="1.0.6"
+       version="1.1.0"
        provider-name="nmunson">
   <requires>
     <import addon="xbmc.python" version="1.0"/>
diff --git a/script.sharethetv/changelog.txt b/script.sharethetv/changelog.txt
index ef9926f..b9b5f59 100644
--- a/script.sharethetv/changelog.txt
+++ b/script.sharethetv/changelog.txt
@@ -1,3 +1,6 @@
+Version 1.1.0
+               * Leaving XBMC running for long periods of time would slow down 
system.  Method of checking the movie count has changed to fix this.
+
 Version 1.0.6
                * Fixed bug related to slow shutdowns when autorun enabled
 
@@ -14,4 +17,4 @@ Version 1.0.0
                * Updated description, disclaimer
 
 Version 0.9.0
-    * Initial working version
+               * Initial working version
diff --git a/script.sharethetv/default.py b/script.sharethetv/default.py
index c5fe9db..288ecbc 100644
--- a/script.sharethetv/default.py
+++ b/script.sharethetv/default.py
@@ -11,7 +11,7 @@ import sys
 
 # Global settings
 __plugin__             = "ShareThe.TV"
-__version__            = "1.0.6"
+__version__            = "1.1.0"
 __addonID__            = "script.sharethetv"
 __settings__ = xbmcaddon.Addon(__addonID__)
 __apiurl__ = 'http://sharethe.tv/api/'
@@ -104,10 +104,11 @@ def sendUpdate():
        sendRequest(params)
 
 def getMovieCount():
-       query = '{"jsonrpc": "2.0", "method": "VideoLibrary.GetMovies", "id": 
"1"}'
-       result = xbmc.executeJSONRPC(query)
-       match = re.compile('"end" : (.+?),').findall(result)
-       return match[0]
+       query = "SELECT movie.c00 FROM movie"
+       queryResult = xbmc.executehttpapi("QueryVideoDatabase(%s)" % 
urllib.quote_plus(query))
+       count = str(queryResult.count("<field>"))
+       debug("Movie count: " + count)
+       return count
 
 
 def waiter(seconds):
@@ -188,7 +189,8 @@ if (not startup):
 
 
 oldCount = getMovieCount()
-timeDelay = 60
+intervalDelay = 300
+updateDelay = 60
 
 if autorun:
        debug('Waiting to send updates')
@@ -199,18 +201,18 @@ if autorun:
                
                if oldCount == newCount:
                        debug('No change in movie count')
-                       waiter(timeDelay)
+                       waiter(intervalDelay)
                else:
                        
                        while (oldCount != newCount):
                                debug('Change in count found, sleep to let 
update finish')
-                               waiter(timeDelay)
+                               waiter(updateDelay)
                                oldCount = newCount
                                newCount = getMovieCount()
                        
                        debug('Counts stopped changing, sending update now')
                        sendUpdate()
-                       waiter(timeDelay)
+                       waiter(intervalDelay)
                
                oldCount = newCount
 

http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/scripts;a=commit;h=35a3e43c877c8285ca723844e788af4bbb63f56a

commit 35a3e43c877c8285ca723844e788af4bbb63f56a
Author: amet <a...@nospam>
Date:   Thu Dec 23 16:30:59 2010 +0400

    [script.games.rom.collection.browser] -v0.7.10
    Online Scraping
        * improvements to sequel and subtitle handling

diff --git a/script.games.rom.collection.browser/addon.xml 
b/script.games.rom.collection.browser/addon.xml
index 76c492f..8e8bc6d 100644
--- a/script.games.rom.collection.browser/addon.xml
+++ b/script.games.rom.collection.browser/addon.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <addon
   id="script.games.rom.collection.browser"
-  version="0.7.9"
+  version="0.7.10"
   name="Rom Collection Browser"
   provider-name="malte">
   <requires>
diff --git a/script.games.rom.collection.browser/changelog.txt 
b/script.games.rom.collection.browser/changelog.txt
index ac242f5..e712297 100644
--- a/script.games.rom.collection.browser/changelog.txt
+++ b/script.games.rom.collection.browser/changelog.txt
@@ -1,4 +1,10 @@
 

+0.7.10 (12/2010)

+~~~~~~~~~~~~~

+Online Scraping

+    * improvements to sequel and subtitle handling

+       

+

 0.7.9 (12/2010)

 ~~~~~~~~~~~~~

 Online Scraping

diff --git a/script.games.rom.collection.browser/default.py 
b/script.games.rom.collection.browser/default.py
index c107ff0..0b6ebce 100644
--- a/script.games.rom.collection.browser/default.py
+++ b/script.games.rom.collection.browser/default.py
@@ -32,6 +32,8 @@ sys.path.append( os.path.join( BASE_RESOURCE_PATH, "lib", 
"pyparsing" ) )
 sys.path.append( os.path.join( BASE_RESOURCE_PATH, "lib", "pyscraper" ) )
 
 
+
+
 # append the proper platforms folder to our path, xbox is the same as win32
 env = ( os.environ.get( "OS", "win32" ), "win32", )[ os.environ.get( "OS", 
"win32" ) == "xbox" ]
 
diff --git a/script.games.rom.collection.browser/resources/lib/config.py 
b/script.games.rom.collection.browser/resources/lib/config.py
index 5b70aa7..da786eb 100644
--- a/script.games.rom.collection.browser/resources/lib/config.py
+++ b/script.games.rom.collection.browser/resources/lib/config.py
@@ -314,7 +314,8 @@ class Config:
                                pass

                                                

                        if(romCollection.scraperSites == None or 
len(romCollection.scraperSites) == 0):

-                               SubElement(romCollectionXml, 'scraper', {'name' 
: 'thevideogamedb.com'})

+                               #TODO: enable again when site is more complete 
and responses are faster

+                               #SubElement(romCollectionXml, 'scraper', 
{'name' : 'thevideogamedb.com'})

                                SubElement(romCollectionXml, 'scraper', {'name' 
: 'thegamesdb.net', 'replaceKeyString' : '', 'replaceValueString' : ''})

                                SubElement(romCollectionXml, 'scraper', {'name' 
: 'giantbomb.com', 'replaceKeyString' : '', 'replaceValueString' : ''})

                                SubElement(romCollectionXml, 'scraper', {'name' 
: 'mobygames.com', 'replaceKeyString' : '', 'replaceValueString' : '', 
'platform' : mobyConsoleId})

@@ -364,7 +365,7 @@ class Config:
                SubElement(site, 'Scraper', {'parseInstruction' : '04.02 - 
mobygames - details.xml', 'source' : '1'})                           

                SubElement(site, 'Scraper', {'parseInstruction' : '04.03 - 
mobygames - coverlink.xml', 'source' : '1', 'returnUrl' : 'true'})

                SubElement(site, 'Scraper', {'parseInstruction' : '04.04 - 
mobygames - coverart.xml', 'source' : '2'})

-               SubElement(site, 'Scraper', {'parseInstruction' : '04.05 - 
mobygames - screenshotlink.xml', 'source' : '1', 'returnUrl' : 'true'})

+               SubElement(site, 'Scraper', {'parseInstruction' : '04.05 - 
mobygames - screenshotlink.xml', 'source' : '1', 'returnUrl' : 'true'})         
     

                #use short name on xbox

                if (os.environ.get( "OS", "xbox" ) == "xbox"):  

                        SubElement(site, 'Scraper', {'parseInstruction' : 
'04.06 - mobygames - screenoriglink.xml', 'source' : '3', 'returnUrl' : 'true'})

diff --git 
a/script.games.rom.collection.browser/resources/lib/configxmlupdater.py 
b/script.games.rom.collection.browser/resources/lib/configxmlupdater.py
index 2b8168b..05fa630 100644
--- a/script.games.rom.collection.browser/resources/lib/configxmlupdater.py
+++ b/script.games.rom.collection.browser/resources/lib/configxmlupdater.py
@@ -186,11 +186,12 @@ class ConfigxmlUpdater:
                SubElement(site, 'Scraper', {'parseInstruction' : '04.02 - 
mobygames - details.xml', 'source' : '1'})                           

                SubElement(site, 'Scraper', {'parseInstruction' : '04.03 - 
mobygames - coverlink.xml', 'source' : '1', 'returnUrl' : 'true'})

                SubElement(site, 'Scraper', {'parseInstruction' : '04.04 - 
mobygames - coverart.xml', 'source' : '2'})

-               SubElement(site, 'Scraper', {'parseInstruction' : '04.05 - 
mobygames - screenshotlink.xml', 'source' : '1', 'returnUrl' : 'true'})

+               SubElement(site, 'Scraper', {'parseInstruction' : '04.05 - 
mobygames - screenshotlink.xml', 'source' : '1', 'returnUrl' : 'true'})         
     

                #use short name on xbox

                if (os.environ.get( "OS", "xbox" ) == "xbox"):

                        SubElement(site, 'Scraper', {'parseInstruction' : 
'04.06 - mobygames - screenoriglink.xml', 'source' : '3', 'returnUrl' : 'true'})

                else:

                        SubElement(site, 'Scraper', {'parseInstruction' : 
'04.06 - mobygames - screenshotoriginallink.xml', 'source' : '3', 'returnUrl' : 
'true'})

+               

                SubElement(site, 'Scraper', {'parseInstruction' : '04.07 - 
mobygames - screenshots.xml', 'source' : '4'})                                  
             

                                        
\ No newline at end of file
diff --git a/script.games.rom.collection.browser/resources/lib/dbupdate.py 
b/script.games.rom.collection.browser/resources/lib/dbupdate.py
index faaeb44..d06aaef 100644
--- a/script.games.rom.collection.browser/resources/lib/dbupdate.py
+++ b/script.games.rom.collection.browser/resources/lib/dbupdate.py
@@ -5,7 +5,6 @@ import codecs
 import zipfile

 import zlib

 import time

-import difflib

 from pysqlite2 import dbapi2 as sqlite

 

 from config import *

@@ -13,8 +12,7 @@ from gamedatabase import *
 from descriptionparserfactory import *

 import util

 from util import *

-

-import xbmc

+from pyscraper import *

 

 

 

@@ -140,6 +138,13 @@ class DBUpdate:
 

                        Logutil.log("Building file crcs done", 
util.LOG_LEVEL_INFO)

                        

+                       #get fuzzyFactor before scraping

+                       matchingRatioIndex = 
self.Settings.getSetting(util.SETTING_RCB_FUZZYFACTOR)

+                       if (matchingRatioIndex == ''):

+                               matchingRatioIndex = 2

+                       fuzzyFactor = 
util.FUZZY_FACTOR_ENUM[int(matchingRatioIndex)]

+                       

+                       

                        if(not romCollection.descFilePerGame and 
len(romCollection.scraperSites) > 0):

                                Logutil.log("Searching for game in parsed 
results:", util.LOG_LEVEL_INFO)

                                

@@ -194,7 +199,8 @@ class DBUpdate:
                                                                        
urlsFromPreviousScrapers = []

                                                                        
doContinue = False

                                                                        for 
scraper in scraperSite.scrapers:

-                                                                               
results, urlsFromPreviousScrapers, doContinue = self.scrapeResults(result, 
scraper, urlsFromPreviousScrapers, gamenameFromFile, foldername, filecrc, 
filenamelist[0])

+                                                                               
pyScraper = PyScraper()

+                                                                               
results, urlsFromPreviousScrapers, doContinue = pyScraper.scrapeResults(result, 
scraper, urlsFromPreviousScrapers, gamenameFromFile, foldername, filecrc, 
filenamelist[0], fuzzyFactor)

                                                                        
if(doContinue):

                                                                                
continue                                                                        
        

                                                else:

@@ -259,8 +265,9 @@ class DBUpdate:
                                        for scraperSite in 
romCollection.scraperSites:

                                                Logutil.log('using scraper: ' 
+scraperSite.name, util.LOG_LEVEL_INFO)

                                                urlsFromPreviousScrapers = []   
                                        

-                                               for scraper in 
scraperSite.scrapers:                                                    

-                                                       results, 
urlsFromPreviousScrapers, doContinue = self.scrapeResults(results, scraper, 
urlsFromPreviousScrapers, gamenameFromFile, foldername, filecrc, filename)      
                                           

+                                               for scraper in 
scraperSite.scrapers:

+                                                       pyScraper = PyScraper() 
                                                

+                                                       results, 
urlsFromPreviousScrapers, doContinue = pyScraper.scrapeResults(results, 
scraper, urlsFromPreviousScrapers, gamenameFromFile, foldername, filecrc, 
filename, fuzzyFactor)                                                       

                                                        if(doContinue):

                                                                continue

                                        

@@ -281,64 +288,7 @@ class DBUpdate:
                return True, ''

                                        

        

-       def scrapeResults(self, results, scraper, urlsFromPreviousScrapers, 
gamenameFromFile, foldername, filecrc, romFile):            

-               Logutil.log("using parser file: " +scraper.parseInstruction, 
util.LOG_LEVEL_DEBUG)              

-               Logutil.log("using game description: " +scraper.source, 
util.LOG_LEVEL_DEBUG)

-               

-               scraperSource = scraper.source

-               

-               #url to scrape may be passed from the previous scraper

-               if(scraper.source.isdigit()):

-                       if(len(urlsFromPreviousScrapers) == 0):

-                               Logutil.log("Configuration error: scraper 
source is numeric and there is no previous scraper that returned an url to 
scrape.", util.LOG_LEVEL_ERROR)

-                               return results, urlsFromPreviousScrapers, True  
                

-                       if(len(urlsFromPreviousScrapers) < int(scraper.source)):

-                               Logutil.log("Configuration error: no url found 
at index " +str(scraper.source), util.LOG_LEVEL_ERROR)

-                               return results, urlsFromPreviousScrapers, True

-                       

-                       url = urlsFromPreviousScrapers[int(scraper.source) -1]

-                       Logutil.log("using url from previous scraper: " 
+str(url), util.LOG_LEVEL_INFO)

-                       scraperSource = url

-                       

-               if(scraper.source == 'nfo'):

-                       romDir = os.path.dirname(romFile)

-                       Logutil.log('Romdir: ' +str(romDir), 
util.LOG_LEVEL_INFO)

-                       nfoFile = os.path.join(romDir, gamenameFromFile +'.nfo')

-                       Logutil.log('Using nfoFile: ' +str(nfoFile), 
util.LOG_LEVEL_INFO)

-                       scraperSource = nfoFile

-                                                                               
                                

-               tempResults = self.parseDescriptionFile(scraper, scraperSource, 
gamenameFromFile, foldername, filecrc)

-               

-               if(tempResults == None):

-                       if(scraper.returnUrl):

-                               urlsFromPreviousScrapers.append('')

-                       return results, urlsFromPreviousScrapers, True

-               

-               if(scraper.returnUrl):                  

-                       try:                                                    
        

-                               tempUrl = self.resolveParseResult(tempResults, 
'url')

-                               urlsFromPreviousScrapers.append(tempUrl)

-                               Logutil.log("pass url to next scraper: " 
+str(tempUrl), util.LOG_LEVEL_INFO)

-                               return results, urlsFromPreviousScrapers, True

-                       except:

-                               Logutil.log("Should pass url to next scraper, 
but url is empty.", util.LOG_LEVEL_WARNING)

-                               return results, urlsFromPreviousScrapers, True

-                       

-               if(tempResults != None):

-                       for resultKey in tempResults.keys():

-                               Logutil.log("resultKey: " +resultKey, 
util.LOG_LEVEL_INFO)

-                               resultValue = []

-                               resultValueOld = results.get(resultKey, [])

-                               resultValueNew = tempResults.get(resultKey, [])

-

-                               if(len(resultValueOld) == 0 and 
(len(resultValueNew) != 0 and resultValueNew != [None,] and resultValueNew != 
None and resultValueNew != '')):

-                                       results[resultKey] = resultValueNew

-                                       resultValue = resultValueNew

-                               else:

-                                       resultValue = resultValueOld

-                               Logutil.log("resultValue: " +str(resultValue), 
util.LOG_LEVEL_INFO)

-                                       

-               return results, urlsFromPreviousScrapers, False

+       

        

        

        def getRomFilesByRomCollection(self, romPaths, maxFolderDepth):

@@ -570,267 +520,10 @@ class DBUpdate:
                return gameId

        

        

-       def parseDescriptionFile(self, scraper, scraperSource, 
gamenameFromFile, foldername, crc):

-                       

-               try:                            

-                       #replace configurable tokens

-                       replaceKeys = scraper.replaceKeyString.split(',')

-                       Logutil.log("replaceKeys: " +str(replaceKeys), 
util.LOG_LEVEL_DEBUG)                                            

-                       replaceValues = scraper.replaceValueString.split(',')

-                       Logutil.log("replaceValues: " +str(replaceValues), 
util.LOG_LEVEL_DEBUG)

-                       

-                       if(len(replaceKeys) != len(replaceValues)):

-                               Logutil.log("Configuration error: 
replaceKeyString (%s) and replaceValueString(%s) does not have the same number 
of ','-separated items." %(scraper.replaceKeyString, 
scraper.replaceValueString), util.LOG_LEVEL_ERROR)

-                               return None

-                       

-                       for i in range(0, len(replaceKeys)):

-                               scraperSource = 
scraperSource.replace(replaceKeys[i], replaceValues[i])

-                               #also replace in gamename for later result 
matching

-                               gamenameFromFile = 
gamenameFromFile.replace(replaceKeys[i], replaceValues[i])

-                               

-                       #remove (*) and [*]

-                       gamenameFromFile = 
re.sub('\s\(.*\)|\s\[.*\]|\(.*\)|\[.*\]','',gamenameFromFile)

-                       

-                       #redo sorting

-                       if (gamenameFromFile.find(', The') != -1):

-                               gamenameFromFile = 'The ' + 
gamenameFromFile.replace(', The', '')

-                               

-                       if(scraperSource.startswith('http://')):

-                               gamenameToParse = 
util.html_escape(gamenameFromFile)

-                       else:

-                               gamenameToParse = gamenameFromFile              
                        

-                               

-                       scraperSource = scraperSource.replace("%GAME%", 
gamenameToParse)

-                       

-                       replaceTokens = ['%FILENAME%', '%FOLDERNAME%', '%CRC%']

-                       for key in util.API_KEYS.keys():

-                               replaceTokens.append(key)

-                               

-                       replaceValues = [gamenameFromFile, foldername, crc]

-                       for value in util.API_KEYS.values():

-                               replaceValues.append(value)

-                               

-                       for i in range(0, len(replaceTokens)):

-                               scraperSource = 
scraperSource.replace(replaceTokens[i], replaceValues[i])

-                       

-                       if(not scraperSource.startswith('http://') and not 
os.path.exists(scraperSource)):

-                               Logutil.log("description file for game " 
+gamenameFromFile +" could not be found. "\

-                               "Check if this path exists: " +scraperSource, 
util.LOG_LEVEL_WARNING)

-                               return None

-                       

-                       parser = 
DescriptionParserFactory.getParser(str(scraper.parseInstruction))

-                       Logutil.log("description file (tokens replaced): " 
+scraperSource, util.LOG_LEVEL_INFO)

-                       results = parser.parseDescription(str(scraperSource))

-               except Exception, (exc):

-                       Logutil.log("an error occured while parsing game 
description: " +scraperSource, util.LOG_LEVEL_WARNING)

-                       Logutil.log("Parser complains about: " +str(exc), 
util.LOG_LEVEL_WARNING)

-                       return None                     

-

-               results = self.getBestResults(results, gamenameFromFile)

-               return results

-                                                       

-

-       def getBestResults(self, results, gamenameFromFile):

-       

-               matchingRatioIndex = 
self.Settings.getSetting(util.SETTING_RCB_FUZZYFACTOR)

-               if (matchingRatioIndex == ''):

-                       matchingRatioIndex = 2

-               fuzzyFactor = util.FUZZY_FACTOR_ENUM[int(matchingRatioIndex)]   
        

-               

-               digits = [' 10', ' 9', ' 8', ' 7', ' 6', ' 5', ' 4', ' 3', ' 
2', ' 1']

-               romes = [' X', ' IX', ' VIII', ' VII', ' VI', ' V', ' IV', ' 
III', ' II', ' I']

-               lastChar = gamenameFromFile[len(gamenameFromFile) -1:]

-               

-               if (results != None and len(results) >= 1):

-                       Logutil.log('Searching for game: ' +gamenameFromFile, 
util.LOG_LEVEL_INFO)

-                       Logutil.log('%s results found. Try to find best match.' 
%str(len(results)), util.LOG_LEVEL_INFO)

-                       

-                       highestRatio = 0.0

-                       bestIndex = 0

-                       

-                       #search for best matching game with original title

-                       bestIndex, highestRatio = 
self.findBestGameMatch(results, gamenameFromFile, bestIndex, highestRatio)      
                                      

-                       

-                       bestMatchingGame = 
self.resolveParseResult(results[bestIndex], 'SearchKey')

-                       if(bestMatchingGame != ''):

-                               Logutil.log('Best matching game is "%s" with 
ratio "%s": ' %(bestMatchingGame, str(highestRatio)), util.LOG_LEVEL_INFO)

-                       

-                       if(highestRatio == 1.0):

-                               if(bestMatchingGame != ''):

-                                       Logutil.log('Perfect match. Using 
result %s' %bestMatchingGame, util.LOG_LEVEL_INFO)

-                               return results[bestIndex]

-                       

-                       #if gamename ends with digit or rome it may be a sequel

-                       if(lastChar.isdigit() or lastChar.upper() in ('I', 'V', 
'X')):                                                                          
        

-                               bestIndex, highestRatio = 
self.doSequelChecking(gamenameFromFile, results, lastChar, digits, romes, 
fuzzyFactor, bestIndex, highestRatio)

-                               if(highestRatio == 1.0):

-                                       bestMatchingGame = 
self.resolveParseResult(results[bestIndex], 'SearchKey')

-                                       Logutil.log('Perfect match. Using 
result %s' %bestMatchingGame, util.LOG_LEVEL_INFO)

-                                       return results[bestIndex]

-                               

-                       #alternate titles : whole title must be found in result 
and result must contain "-" or ":"

-                       bestIndex, highestRatio = 
self.checkForAlternateTitles(gamenameFromFile, results, lastChar, digits, 
romes, bestIndex, highestRatio)

-                       bestMatchingGame = 
self.resolveParseResult(results[bestIndex], 'SearchKey')

-                               

-                       if(highestRatio < fuzzyFactor):

-                               Logutil.log('No result found with a ratio 
better than %s. Result will be skipped.' %(str(fuzzyFactor),), 
LOG_LEVEL_WARNING)

-                               return None

-                       

-                       if(bestIndex == -1):

-                               return None

-                       

-                       Logutil.log('Using result %s' %bestMatchingGame, 
util.LOG_LEVEL_INFO)

-                       return results[bestIndex]

-               else:

-                       Logutil.log('No results found with current scraper', 
util.LOG_LEVEL_INFO)

-                       return None

-

-

-       def doSequelChecking(self, gamenameFromFile, results, lastChar, digits, 
romes, fuzzyFactor, bestIndex, highestRatio):

-               #special sequel handling

-               if(lastChar.isdigit()):

-                       

-                       #check if we have a game like NFL 98 instead of a sequel

-                       #TODO: this starts to get really weird here

-                       numbers = re.findall(r"\d+", gamenameFromFile)

-                       number = numbers[len(numbers)-1]

-                       if (number > 10):

-                               Logutil.log('Number %s seems to be too large 
for a sequel number. Skip sequel checking.' %str(number), util.LOG_LEVEL_INFO)

-                               return bestIndex, highestRatio

-                       

-                       replaceKeys = digits

-                       replaceValues = romes

-                       

-               elif(lastChar.upper() in ('I', 'V', 'X')):

-                       replaceKeys = romes

-                       replaceValues = digits

-               

-               #search again with replaced sequel numbers

-               bestIndex, highestRatio = 
self.searchWithReplacedSequelNumbers(gamenameFromFile, results, replaceKeys, 
replaceValues, lastChar, bestIndex, highestRatio)

-               bestMatchingGame = self.resolveParseResult(results[bestIndex], 
'SearchKey')

-               Logutil.log('Result game with best match (after sequel 
handling): ' +bestMatchingGame, util.LOG_LEVEL_INFO)

-               

-               if(highestRatio == 1.0):

-                       return bestIndex, highestRatio

-               

-               seqNoIsEqual = self.checkSequelNoIsEqual(gamenameFromFile, 
bestMatchingGame, digits, romes)

-               if (not seqNoIsEqual):

-                       Logutil.log('Comparing "%s" and "%s". Sequel numbers 
don\'t match. Result will be skipped' %(gamenameFromFile, bestMatchingGame), 
util.LOG_LEVEL_INFO)

-                       return -1, -1

-               

-               return bestIndex, highestRatio

        

+                                                       

 

-       def searchWithReplacedSequelNumbers(self, gamenameFromFile, results, 
replaceKeys, replaceValues, lastChar, bestIndex, highestRatio):

-               #TODO may lead to errors with games like FIFA 10, Fifa 11

-               Logutil.log('Game may belong to a sequel. Start extra 
handling.', util.LOG_LEVEL_INFO)

-               gamename = gamenameFromFile

-               for i in range(0, len(replaceKeys)):

-                       gamename = gamename.replace(replaceKeys[i], 
replaceValues[i])                                           

-               

-               Logutil.log('Searching for game (sequel number replaced): ' 
+gamename, util.LOG_LEVEL_INFO)

-               bestIndex, highestRatio = self.findBestGameMatch(results, 
gamename, bestIndex, highestRatio)

-                               

-               #Extra Handling for episode 1

-               if(highestRatio != 1.0):

-                       if(lastChar == '1'):

-                               gamename = gamenameFromFile.replace(' 1', '')

-                               Logutil.log('Searching for game (sequel number 
1 removed): ' +gamename, util.LOG_LEVEL_INFO)

-                               bestIndex, highestRatio = 
self.findBestGameMatch(results, gamename, bestIndex, highestRatio)

-                       else:

-                               #Extra Handling for episode 1                   
        

-                               lastTwoChars = 
gamenameFromFile[len(gamenameFromFile) -2:]

-                               if(lastTwoChars.upper() == ' I'):               
                                        

-                                       gamename = gamenameFromFile.replace(' 
I', '')

-                                       Logutil.log('Searching for game (sequel 
number I removed): ' +gamename, util.LOG_LEVEL_INFO)

-                                       bestIndex, highestRatio = 
self.findBestGameMatch(results, gamename, bestIndex, highestRatio)

-                       

-               return bestIndex, highestRatio

-

-               

-       def checkSequelNoIsEqual(self, gamenameFromFile, searchKey, digits, 
romes):

-               indexGamename = self.getSequelNoIndex(gamenameFromFile, digits, 
romes)

-               indexSearchKey = self.getSequelNoIndex(searchKey, digits, romes)

-                       

-               if(indexGamename == -1 and indexSearchKey == -1):

-                       Logutil.log('"%s" and "%s" both don\'t contain a sequel 
number. Skip checking sequel number match.' %(gamenameFromFile, searchKey), 
util.LOG_LEVEL_INFO)

-                       return True

-               

-               return indexGamename == indexSearchKey

-               

-               

-       def getSequelNoIndex(self, gamename, digits, romes):            

-               indexGamename = -1

-               

-               for i in range(0, len(digits)): 

-                       if(gamename.find(digits[i]) != -1):

-                               indexGamename = i

-                               break

-                       if(gamename.find(romes[i]) != -1):

-                               indexGamename = i

-                               break

-                               

-               return indexGamename

-       

        

-       def checkForAlternateTitles(self, gamenameFromFile, results, lastChar, 
digits, romes, bestIndex, highestRatio):

-               

-               for i in range(0, len(results)):

-                       result = results[i]

-                       searchKey = self.resolveParseResult(result, 'SearchKey')

-                       if(searchKey.find(gamenameFromFile) > -1 and 
(searchKey.find(':') > -1 or searchKey.find('-') > -1)):

-                               Logutil.log('"%s" seems to be an alternate 
title of "%s". Use it as result.' %(searchKey, gamenameFromFile), 
util.LOG_LEVEL_INFO)

-                               bestIndex = i

-                               highestRatio = 1.0

-                               break

-                       else:                           

-                               #try again with replaced Sequel Numbers

-                               if(lastChar.isdigit()):

-                                       replaceKeys = digits

-                                       replaceValues = romes

-                               elif(lastChar.upper() in ('I', 'V', 'X')):

-                                       replaceKeys = romes

-                                       replaceValues = digits

-                               else:

-                                       continue

-                                       

-                               gamename = gamenameFromFile

-                               for j in range(0, len(replaceKeys)):

-                                       gamename = 
gamename.replace(replaceKeys[j], replaceValues[j])

-                               

-                               if(searchKey.find(gamename) > -1 and 
(searchKey.find(':') > -1 or searchKey.find('-') > -1)):

-                                       Logutil.log('"%s" seems to be an 
alternate title of "%s" (sequel number replaced). Use it as result.' 
%(searchKey, gamename), util.LOG_LEVEL_INFO)

-                                       bestIndex = i

-                                       highestRatio = 1.0

-                                       break

-                               

-               return bestIndex, highestRatio

-                                       

-                       

-       def findBestGameMatch(self, results, gamenameFromFile, bestIndex, 
highestRatio):

-               

-               for i in range(0, len(results)):

-                       result = results[i]

-                       try:

-                               searchKey = self.resolveParseResult(result, 
'SearchKey')

-                               if(searchKey == ''):

-                                       Logutil.log('No searchKey found. Using 
first result', util.LOG_LEVEL_INFO)

-                                       highestRatio = 1.0

-                                       bestIndex = i 

-                                       break                                   

-                               #TODO gamenameFromFile is not always correct

-                               ratio = difflib.SequenceMatcher(None, 
gamenameFromFile.upper(), searchKey.upper()).ratio()

-                               Logutil.log('Comparing with %s, ratio: %s' 
%(searchKey, str(ratio)), util.LOG_LEVEL_INFO)

-                               if(ratio > highestRatio):

-                                       highestRatio = ratio

-                                       bestIndex = i

-                                       if(ratio == 1.0):

-                                               #perfect match

-                                               break

-                       except Exception, (exc):

-                               Logutil.log("parseDescription returned more 
than 1 result. An error occured while matching the best result: " +str(exc), 
util.LOG_LEVEL_WARNING)                

-               

-               return bestIndex, highestRatio

 

                        

        def insertData(self, gamedescription, gamenameFromFile, romCollection, 
romFiles, foldername, isUpdate, gameId):

diff --git a/script.games.rom.collection.browser/resources/lib/util.py 
b/script.games.rom.collection.browser/resources/lib/util.py
index efb852d..440afb4 100644
--- a/script.games.rom.collection.browser/resources/lib/util.py
+++ b/script.games.rom.collection.browser/resources/lib/util.py
@@ -9,7 +9,7 @@ import xbmc, time
 

 SCRIPTNAME = 'Rom Collection Browser'

 SCRIPTID = 'script.games.rom.collection.browser'

-CURRENT_SCRIPT_VERSION = "0.7.9"

+CURRENT_SCRIPT_VERSION = "0.7.10"

 CURRENT_DB_VERSION = "0.7.4"

 ISTESTRUN = False

 

@@ -33,7 +33,8 @@ LOG_LEVEL_DEBUG = 3
 CURRENT_LOG_LEVEL = LOG_LEVEL_INFO

 

 API_KEYS = {'%VGDBAPIKey%' : 'Zx5m2Y9Ndj6B4XwTf83JyKz7r8WHt3i4',

-                       '%GIANTBOMBAPIKey%' : 
'279442d60999f92c5e5f693b4d23bd3b6fd8e868'}

+                       '%GIANTBOMBAPIKey%' : 
'279442d60999f92c5e5f693b4d23bd3b6fd8e868',

+                       '%ARCHIVEAPIKEY%' : 'VT7RJ960FWD4CC71L0Z0K4KQYR4PJNW8'}

 

 FUZZY_FACTOR_ENUM = [0.5, 0.6, 0.7, 0.8, 0.9, 1.0]

 

diff --git a/script.games.rom.collection.browser/resources/settings.xml 
b/script.games.rom.collection.browser/resources/settings.xml
index 74c59e5..a6efb1a 100644
--- a/script.games.rom.collection.browser/resources/settings.xml
+++ b/script.games.rom.collection.browser/resources/settings.xml
@@ -29,4 +29,5 @@
        </category>

        

        <setting id="rcb_view_mode" visible="false" value="" type="text"/>

+

 </settings>
\ No newline at end of file

-----------------------------------------------------------------------

Summary of changes:
 script.games.rom.collection.browser/addon.xml      |    2 +-
 script.games.rom.collection.browser/changelog.txt  |    6 +
 script.games.rom.collection.browser/default.py     |    2 +
 .../resources/lib/config.py                        |    5 +-
 .../resources/lib/configxmlupdater.py              |    3 +-
 .../resources/lib/dbupdate.py                      |  337 +------------------
 .../resources/lib/pyscraper/pyscraper.py           |  350 ++++++++++++++++++++
 .../resources/lib/util.py                          |    5 +-
 .../resources/settings.xml                         |    1 +
 script.sharethetv/addon.xml                        |    2 +-
 script.sharethetv/changelog.txt                    |    5 +-
 script.sharethetv/default.py                       |   20 +-
 12 files changed, 399 insertions(+), 339 deletions(-)
 create mode 100644 
script.games.rom.collection.browser/resources/lib/pyscraper/pyscraper.py


hooks/post-receive
-- 
Scripts

------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and, 
should the need arise, upgrade to a full multi-node Oracle RAC database 
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Xbmc-addons mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xbmc-addons

Reply via email to