Jump to content
RealModScene
Gualdimar

[RELEASE] FSD TUs and covers download fix

Recommended Posts

Gualdimar, thanks again for such a wonderful script.  A good friend of mine fixed my problem.  So, I'll explain why I was having issues.  Because of my Telnet Server I need a 32 Bit version of Windows, so my entire machine runs on Windows 10 Professional 32 Bit.  So, he writes PHP scripts and XML files all day for work on both Unix/Linux and Windows servers.  First he updated covers.php, because it double looping when connecting to XboxUnity.net.  I'll let him explain this through a FaceBook Messenger PM.

From my friend, Jay, from our PM message off FaceBook:

It looked like the PHP code of lines 24-31 was totally repeated.
I had to update it, it was missing an end bracket after the options, 
or I accidently erased it, it could have most likely been the later 
PHP newer than 5.4 should be okay using this script.  You're running
Apache/2.4.27 (Win32) PHP/5.6.31 Server on the machine.  So I have
safetly deleted lines 43-51 in the cover.php.  Otherwise it would
read the xml twice when looking up covers on XBoxUnity.net.
You can see where the code is repeated, by looking at the original covers.php.

 

Here is the cleaned up covers.php

<?php
$titleid=strtoupper($_GET['id']);
if($_GET['query'] == "TitleID")
{
    if (file_exists('covers/'.$titleid.".xml"))
    {
        include('covers/'.$titleid.".xml");
    }
    else
    {
        $ch = curl_init();
        $options = [
            CURLOPT_SSL_VERIFYPEER => false,
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_URL            => 'http://xboxunity.net/api/Covers/'.$titleid
          ];
    curl_setopt_array($ch, $options);
    $data = json_decode(curl_exec($ch));
    curl_close($ch);
    
    cover($data);
}
}

function cover($data)
{
    $xml = new SimpleXMLElement('<?xml version="1.0" encoding="ISO-8859-1"?>'.'<covers/>');
        
    if(count($data)>0)
    {
        foreach ($data as &$value) {        
            $title = $xml->addChild('title');
            $title->addAttribute('id',$value->titleid);
            $title->addAttribute('name',$value->name);
            $title->addAttribute('mediaid','');
            $title->addAttribute('filename','Cover.png');
            $title->addAttribute('type','');
            $title->addAttribute('mainlink',$value->url);
            $title->addAttribute('front',$value->front);
            $title->addAttribute('Official',(int)$value->official);    
        }
    }
    
    Header('Content-type: text/xml');
    print($xml->asXML());
}
?>

 

I also learned, that even though I'm using Unix/Linux server software, I'm still using Windows that doesn't like Unix/Linux file names and folder scructors.  So we updated the XML to include the whole path.

<?xml version="1.0" encoding="ISO-8859-1"?>
<covers><title id="07398CDC" name="AfterShock Pool SX" mediaid="" filename="Cover.png" type="" mainlink="http://mylanserverip/xbox360/covers/07398CDC/full/Cover.png" front="http://mylanserverip/xbox360/covers/07398CDC/front/Cover.png" Official="1"/></covers>

It now working for my, and I hope this works for everyone else in the near future is need be on a Windows machine.

  • Like 1

Share this post


Link to post
Share on other sites

rileyil77check the original script once again. there are two types of queries: by titleid and by name. 

if the game has tilteid, fsd will get covers with it:

if($_GET['query'] == "TitleID")

if there is no titleid, fsd will try to get covers with the game`s name:

elseif($_GET['query'] == "SearchTerm")

no loops, just conditions

yes, some parts of the code are repeated and it can be rewritten with functions, buuuuut i don`t have inspiration to do this

Share this post


Link to post
Share on other sites
On 2/11/2018 at 12:52 PM, Gualdimar said:

rileyil77check the original script once again. there are two types of queries: by titleid and by name. 

if the game has tilteid, fsd will get covers with it:


if($_GET['query'] == "TitleID")

if there is no titleid, fsd will try to get covers with the game`s name:


elseif($_GET['query'] == "SearchTerm")

no loops, just conditions

yes, some parts of the code are repeated and it can be rewritten with functions, buuuuut i don`t have inspiration to do this

You know what, I did go over the original script and you are correct.  I don't think Jay realized this when he was helping me.

Again I got it working.  If had not been for your script, I would have never got it working to begin with.  So thank again.

Share this post


Link to post
Share on other sites

Hi all, when I add a scanfolder, no covers are being downloaded (it used to work correctly tho). But afterwards, I can "refresh artwork", and most of the time (not always), it downloads the covers. The xbox passes the internet-router tests.

Any ideas? Thx

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...