(2016-10-11, 02:50)zachmorris Wrote: (2016-10-10, 12:11)UKVaper Wrote: Yup, the TOSEC roms are completely compatible with fuse, is there a way to manually edit the scraper to use that set instead?
There is no scraper in IARL, the metadata / artwork / etc is all pre-scraped (by me) and is included. I'll just have to redo it with the TOSEC archive. This isn't a problem, except for the fact TOSEC has 15 different versions of every game and their naming conventions aren't very standard - makes programming a scraper pretty frustrating
your right about that. since posting here, ive thrown myself into python as id never tried to write it before. i can see why you went with the no intro set. ive been playing around and built something from the ground up using the tosec dat pack. the difference in the spectrum pack is that, no intro seems to use the identifier as the downloaded file and tosec uses the description. but tosec dat files dont have the identifier filename in the dat. so you cant really use one set to reference the other.
it was confusing at first but ive managed to get round it. i didnt want to change your code zacmorris however, i did have a good look at it to help me on my way.
Code:
rom_source_url = "http://archive.org/download/Sinclair_ZX_Spectrum_TOSEC_2012_04_23/Sinclair_ZX_Spectrum_TOSEC_2012_04_23.zip/"
user_agent = 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1468.0 Safari/537.36'
output = ""
rom_path = r"I:\Retro/Sinclair/ZX Spectrum/Games/[Z80]/"
cache_folder = r"I:\retro_spec/cache/"
rom_ext = ".z80"
filename = "3DC (1987)(Encore)"
master_dat_path = addon.getAddonInfo('path')+"/resources/lib/TOSEC"
spec_source_ext = "Sinclair ZX Spectrum [TOSEC]/Games/[Z80]/"+ filename + ".zip"
filename_xml = filename+"_meta.xml"
screenshot_gif = "00_coverscreenshot.jpg"
full_filename = ""
full_filename = filename+rom_ext
sorted_url = ""
sorted_url = rom_source_url + urllib.quote(spec_source_ext)
# we are going to use TOSEC for all our ROM management needs. Its pretty much a complete set of dats for everything. So
# create a list of folders in the TOSEC folder
master_dat_path_contents = os.listdir(master_dat_path) # returns list
# This opens the textviewer window, 10147 is the ID for a custom text window
xbmc.executebuiltin("ActivateWindow(10147)")
# Create a variable called 'controller' and assign it to the kodi command xbmcgui.Window(10147)
controller = xbmcgui.Window(10147)
# Make kodi sleep for a short while, I've set to 500ms but on some slower devices you may possibly need to increase that.
# It needs time to initialise the window otherwise any following bit of code where we manipulate the window will fail.
xbmc.sleep(500)
# We're now telling Kodi to get control of the text box and change the header (1)
controller.getControl(1).setLabel('DufishROM Manager')
#controller.setCoordinateResolution(self, int resolution)
#read dir of rom_path. this will become some kind of caching, xml or other as to not keep reading the dir each time a rom is loaded
rom_path_contents = []
#rom_path_contents = os.listdir(cache_folder) # returns list
rom_path_contents = os.listdir(rom_path) # returns list
success = ""
if rom_path_contents:
output += "contents retrieved\n"
#xbmcgui.Dialog().ok(addonname, "echo 1")
current_item = ""
for current_item in rom_path_contents:
#output += current_item + "\n" + full_filename + "\n"
if current_item in (full_filename):
success = "True"
output += "Rom found locally in " + rom_path + full_filename+"\n"
break
else:
success = "False"
if success == "False":
from StringIO import StringIO
# define downloader class
class download_tools():
def Downloader(self, url, dest):
urllib.urlretrieve(url, dest)
def remove(self, file_):
os.remove(file_)
def extract(self,file_tar, destination):
tar = tarfile.open(file_tar)
tar.extractall(destination)
tar.close()
dl_rom = download_tools().Downloader(sorted_url,cache_folder+filename+".zip")
#xbmcgui.Dialog().ok(addonname,"ok: "+cache_folder+filename+rom_ext)
destDir = mktemp()
thefile = ZipFile(cache_folder + filename + ".zip")
thefile.extractall(rom_path)
thefile.close()
download_tools().remove(cache_folder + filename + ".zip")
# dl_meta =download_tools().Downloader(rom_source_url + filename + "/" + filename_xml , cache_folder + filename_xml)
#dl_screenshot = download_tools().Downloader(rom_source_url + filename + "/" + screenshot_gif, cache_folder + screenshot_gif)
output += "Rom not found locally, so downloaded to " + rom_path+"\n"
output += "meta downloaded" + rom_path+"\n"
output += "screenshot downloaded " + rom_path+"\n"
its messy but it does the trick ha! [/code]