[XBOX] T3CH Upgrader (Python Script)

  Thread Rating:
  • 1 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
jmarshall Offline
Team-XBMC Developer
Posts: 24,520
Joined: Oct 2003
Reputation: 138
Post: #11
Writing to the shortcut on C: sounds like trouble to me - perhaps I misunderstood the process, though.

Cheers,
Jonathan

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


[Image: badge.gif]
find quote
blittan Offline
Team-XBMC Handyman
Posts: 1,714
Joined: Jun 2004
Reputation: 11
Location: Sweden
Post: #12
jmarshall: it rewrites only the cfg, but copies the .xbe if it doesn't exist.

BBB: let me put this in a friendly way.. your swedish translation sucks Smile

Here is a new one: http://pastebin.com/mab367e4

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
If you don't have the time to read them, please don't take the time to post in this forum!
For troubleshooting and bug reporting please make sure you read this first.
find quote
jmarshall Offline
Team-XBMC Developer
Posts: 24,520
Joined: Oct 2003
Reputation: 138
Post: #13
Rewriting the cfg is enough to brick an xbox if anything happens while you are rewriting it. Not saying it will happen - just that IMO it's not worth the risk. If it's optional, then no problem Smile

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


[Image: badge.gif]
find quote
BigBellyBilly Offline
Skilled Python Coder
Posts: 959
Joined: Feb 2005
Reputation: 2
Location: UK
Post: #14
lol. Guess I won't be using http://www.tranexp.com again then! Thanks for the file.

However using your file fails with error 'can't be parsed' (from language.py)
If I swap any accented characters (eg å, ä to a and ö to o) It does parse ok.
I'll look into the language.py file see if theres anything that can be done.

Any users from other countries want to help provide a translate for say, French , German .... ?

My Addons (myTV, T3CH Upgrader, DVDProfiler, BBCPodRadio, Comics, Football, GoogleReader, reeplay.it, Metacritic, Phonebin, FileViewer,SVN Repo Installer (contributor)) available at Box.net
find quote
BigBellyBilly Offline
Skilled Python Coder
Posts: 959
Joined: Feb 2005
Reputation: 2
Location: UK
Post: #15
tbh. During the course of deving this I've not had a bad reboot ever. but, ...

Even if I write cfg to .cfg_new instead, the user would still have to rename it (via ftp) to .cfg inorder to see if the installation works. So they end up in the same position.

I understand your concerns thou. but any booting failure simply requires the user to boot from a dash on a disc and ftp in to swap the cfg_old back in.

My Addons (myTV, T3CH Upgrader, DVDProfiler, BBCPodRadio, Comics, Football, GoogleReader, reeplay.it, Metacritic, Phonebin, FileViewer,SVN Repo Installer (contributor)) available at Box.net
find quote
blittan Offline
Team-XBMC Handyman
Posts: 1,714
Joined: Jun 2004
Reputation: 11
Location: Sweden
Post: #16
jmarshall: potential risk there, but then again, whatever you do with bootstuff might break.. wont say its safe to do anything, but agree it would be made optional.


BBB: think you need to change the fileformat to UTF-8 for it to work..

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
If you don't have the time to read them, please don't take the time to post in this forum!
For troubleshooting and bug reporting please make sure you read this first.
find quote
BigBellyBilly Offline
Skilled Python Coder
Posts: 959
Joined: Feb 2005
Reputation: 2
Location: UK
Post: #17
blitten: the XML file does already have encoding="utf-8" Is that what you meant ?


In the language.py I've added this function:

Code:
def unicodeToAscii(txt, charset='utf8'):
    print "unicodeToAscii()"
    try:
        newtxt = txt.decode(charset)
        newtxt = unicodedata.normalize('NFKD', newtxt).encode('ASCII','replace')
        return newtxt
    except:
        print "unicodeToAscii() except"
        traceback.print_exc()
        return txt

and changed the language.py to load the doc throu it:

Code:
uni_doc = unicodeToAscii( file(language_path).read(), charset='latin-1' )
doc = xml.dom.minidom.parseString( uni_doc )
Now it does read the file, but substitutes accented chars with '?' (cos of the enocde replace)

Is there a better way ?

My Addons (myTV, T3CH Upgrader, DVDProfiler, BBCPodRadio, Comics, Football, GoogleReader, reeplay.it, Metacritic, Phonebin, FileViewer,SVN Repo Installer (contributor)) available at Box.net
find quote
BigBellyBilly Offline
Skilled Python Coder
Posts: 959
Joined: Feb 2005
Reputation: 2
Location: UK
Post: #18
I've amended the shortcut creation to now create both _old and _new

Then prompts user if they wish to Switch to new, only if they choose to is the new copied to the bootable shortcut name.

Some new msgs as a result, could you translate these for me, then I'll post the amended code up here.

<string id="404">Switch</string>
<string id="405">Manual</string>


<string id="507">Copy existing data to T3CH ?</string>


<string id="519">_NEW and _OLD Shortcuts Created.</string>
<string id="520">_Switch to it NEW Now ?</string>
<string id="521">(Manual rename required otherwise)</string>


Thanks

My Addons (myTV, T3CH Upgrader, DVDProfiler, BBCPodRadio, Comics, Football, GoogleReader, reeplay.it, Metacritic, Phonebin, FileViewer,SVN Repo Installer (contributor)) available at Box.net
find quote
stanley87 Offline
Skilled Python Coder
Posts: 555
Joined: Sep 2006
Reputation: 2
Location: Chch, New Zealand
Post: #19
try this:

XML

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<string id="10">Päävalikko</string> #this is finnish not swedish tho
etc etc.

return yourstring.decode("utf-8")

i find doing this for english does funny things tho.
So i added:

if self.language == "swedish":
return yourstring.decode("utf-8")
find quote
Nuka1195 Offline
Skilled Python Coder
Posts: 3,914
Joined: Dec 2004
Reputation: 17
Post: #20
BBB, blittans new file imports fine. make sure you saved it as utf-8 and not utf-8 cookie if your editor has that.

Also make sure you don't print or output to a device that only supports ascii, like xbmc debug window, with any of those characters in it.

And you can take my name out of the script and language file, but thanks for the mention.

I'll wait for your pm, but you could put other scripts in svn too, so if you want added. let me know.

Stanley, that decode() should not be necessary unless your doing as I said and outputting language strings to the debug window.

For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
find quote
Post Reply