2011-01-12, 17:43
Hi,
I'm trying to update one field of the database with a new information.
Explanation: I'm updating the Filmaffinity scraper. Trailers are youtube urls (not playable with XBMC) but time ago there was a webpage that returned FLV urls with the youtube id. Now I want to change all the urls (http://www.yobajo.com/&watch="YOUTUBEID") to plugin://youtubeplugin...)
This is what I've done, but I don't know how to perform the UPDATE SQL consults.
Please, anyone can help me
This is the error it returns:
Thanks!
I'm trying to update one field of the database with a new information.
Explanation: I'm updating the Filmaffinity scraper. Trailers are youtube urls (not playable with XBMC) but time ago there was a webpage that returned FLV urls with the youtube id. Now I want to change all the urls (http://www.yobajo.com/&watch="YOUTUBEID") to plugin://youtubeplugin...)
This is what I've done, but I don't know how to perform the UPDATE SQL consults.
Please, anyone can help me
Quote:import xbmc
import xbmcgui
from urllib import quote_plus, unquote_plus
import re
import sys
import os
import random
class Main:
def __init__( self ):
finalurl = ""
Youcode = ""
consulta= "SELECT movie.c19 FROM movie"
consulta_xml= xbmc.executehttpapi( "QueryVideoDatabase(%s)" % quote_plus( consulta ), )
urls = re.findall("<record>(.+?)</record>", consulta_xml)
for trailerurl in urls:
YouCode = re.search('http://www.yobajo.com/watch?v=(.*?)', trailerurl)
finalurl += "plugin://plugin.video.youtube/?action=play_video&videoid="
finalurl += Youcode
nuevaconsulta = "UPDATE movie SET movie.c19 ='" + finalurl + "' WHERE movie.c19 = '" + trailerurl + "'"
escribir_consulta= xbmc.executehttpapi( "QueryVideoDatabase(%s)" % quote_plus( nuevaconsulta ), )
if ( __name__ == "__main__" ):
Main()
This is the error it returns:
Quote:16:28:27 T:3352 M:382279680 ERROR: SQL: MUST be select SQL!
16:28:27 T:3352 M:382279680 ERROR: CVideoDatabase::GetArbitraryQuery failed
Thanks!