• 1(current)
  • 2
  • 3
  • 4
  • 5
  • 7
Converting skins to 1920x1080
#1
Any skilled coder here who can quickly write a program to convert 720p xmls to 1080? had a chat about that with someone from team blackbolt some time ago, but it never became reality.
all <posx> und <posy> tags would have to be multiplied by 1.5 and then rounded up, and if possible, the same for the animation tags, which are probably a bit more difficult to parse/modify.
I´m tryin it with perl myself atm, just didn´t get it till now.
thanks in advance

EDIT: wrote a program myself now, here it is:

https://github.com/phil65/xmlconvertgui/

Converts ALL skin coordinates/font sizes to their corresponding 1920x1080 values. you only have to adjust the addon.xml yourself.

Can also detect unused textures.
Donate: https://kodi.tv/contribute/donate (foundation), 146Gr48FqHM7TPB9q33HHv6uWpgQqdz1yk (BTC personal)
Estuary: Kodis new default skin - ExtendedInfo Script - KodiDevKit
Reply
#2
The question I got to ask is why ? xbmc automatically does what your trying to do anyway when you turn it to 1080p, so whats the point ?

Now making one from scratch in 1080p is a different thing alltogether and it more comes down to the images than the xmls
Reply
#3
One reason for doing this is if you already have 1080p textures, but a skin coded in 720p. For instance using border= on textures works good on native resolution of textures, but when you are coding 720p with 1080p textures that really screws that up.
Reply
#4
i just created this in VB:

Code:
Sub Main()
        Try
            'Create the XmlDocument.
            Dim doc As New XmlDocument()
            doc.Load("C:\test_in.xml")

            'Change x Values
            Console.WriteLine("Changing posx values...")
            Dim elemList As XmlNodeList = doc.GetElementsByTagName("posx")
            Dim i As Integer
            For i = 0 To elemList.Count - 1
                Console.Write(elemList(i).InnerXml)
                Console.Write(" => ")
                elemList(i).InnerXml = Math.Round(elemList(i).InnerXml * 1.5)
                Console.WriteLine(elemList(i).InnerXml)
            Next i
            'Change y Values
            Console.WriteLine("Changing posy values...")
            Dim elemList2 As XmlNodeList = doc.GetElementsByTagName("posy")
            For i = 0 To elemList2.Count - 1
                Console.Write(elemList2(i).InnerXml)
                Console.Write(" => ")
                elemList2(i).InnerXml = Math.Round(elemList2(i).InnerXml * 1.5)
                Console.WriteLine(elemList2(i).InnerXml)
            Next i

            ' 2. Save the modified XML to a file in Unicode format.
            doc.PreserveWhitespace = True
            Dim wrtr As XmlTextWriter = New XmlTextWriter("C:\test_Out.xml", Encoding.Unicode)
            doc.WriteTo(wrtr)
            wrtr.Close()
            Console.WriteLine("C:\test_Out.xml is created")
            Console.ReadLine()

        Catch xmlex As XmlException                  ' Handle the Xml Exceptions here.
            Console.WriteLine("{0}", xmlex.Message)
        Catch ex As Exception                        ' Handle the generic Exceptions here.
            Console.WriteLine("{0}", ex.Message)
        End Try
    End Sub

can anyone help me to write the output file with the correct encoding?
is Unicode right? How can I choose ANSI?
when I convert an XML (taken from confluence) with that, all line breaks are removed....

EDIT: I think I got it Smile
here´s the code to convert the posx, posy, width and height values to 1080p. the animations have to be tweaked by hand, don´t know if i will get that running too.
Code:
Imports System.Xml
Imports System.Text
Imports System
Imports System.IO

Module Module1

    Sub Main()
        Try
            'Create the XmlDocument.
            Dim doc As New XmlDocument()
            doc.Load("C:\test_in.xml")

            'Change x Values
            Console.WriteLine("Changing posx values")
            Dim elemList As XmlNodeList = doc.GetElementsByTagName("posx")
            Dim i As Integer
            For i = 0 To elemList.Count - 1
                Console.Write(elemList(i).InnerXml)
                Console.Write(" => ")
                elemList(i).InnerXml = Math.Round(elemList(i).InnerXml * 1.5)
                Console.WriteLine(elemList(i).InnerXml)
            Next i
            'Change y Values
            Console.WriteLine("Changing posy values")
            Dim elemListposy As XmlNodeList = doc.GetElementsByTagName("posy")
            For i = 0 To elemListposy.Count - 1
                Console.Write(elemListposy(i).InnerXml)
                Console.Write(" => ")
                elemListposy(i).InnerXml = Math.Round(elemListposy(i).InnerXml * 1.5)
                Console.WriteLine(elemListposy(i).InnerXml)
            Next i
            'Change width Values
            Console.WriteLine("Changing width values")
            Dim elemListwidth As XmlNodeList = doc.GetElementsByTagName("width")
            For i = 0 To elemListwidth.Count - 1
                Console.Write(elemListwidth(i).InnerXml)
                Console.Write(" => ")
                elemListwidth(i).InnerXml = Math.Round(elemListwidth(i).InnerXml * 1.5)
                Console.WriteLine(elemListwidth(i).InnerXml)
            Next i
            'Change height Values
            Console.WriteLine("Changing height values")
            Dim elemListheight As XmlNodeList = doc.GetElementsByTagName("height")
            For i = 0 To elemListheight.Count - 1
                Console.Write(elemListheight(i).InnerXml)
                Console.Write(" => ")
                elemListheight(i).InnerXml = Math.Round(elemListheight(i).InnerXml * 1.5)
                Console.WriteLine(elemListheight(i).InnerXml)
            Next i
            'Change textwidth Values
            Console.WriteLine("Changing textwidth values")
            Dim elemListTextWidth As XmlNodeList = doc.GetElementsByTagName("textwidth")
            For i = 0 To elemListTextWidth.Count - 1
                Console.Write(elemListTextWidth(i).InnerXml)
                Console.Write(" => ")
                elemListTextWidth(i).InnerXml = Math.Round(elemListTextWidth(i).InnerXml * 1.5)
                Console.WriteLine(elemListTextWidth(i).InnerXml)
            Next i
            'Change textoffsetx Values
            Console.WriteLine("Changing textoffsetx values")
            Dim elemListTextoffsetx As XmlNodeList = doc.GetElementsByTagName("textoffsetx")
            For i = 0 To elemListTextoffsetx.Count - 1
                Console.Write(elemListTextoffsetx(i).InnerXml)
                Console.Write(" => ")
                elemListTextoffsetx(i).InnerXml = Math.Round(elemListTextoffsetx(i).InnerXml * 1.5)
                Console.WriteLine(elemListTextoffsetx(i).InnerXml)
            Next i
            'Change textoffsety Values
            Console.WriteLine("Changing textoffsety values")
            Dim elemListTextoffsety As XmlNodeList = doc.GetElementsByTagName("textoffsety")
            For i = 0 To elemListTextoffsety.Count - 1
                Console.Write(elemListTextoffsety(i).InnerXml)
                Console.Write(" => ")
                elemListTextoffsety(i).InnerXml = Math.Round(elemListTextoffsety(i).InnerXml * 1.5)
                Console.WriteLine(elemListTextoffsety(i).InnerXml)
            Next i
            'Change radioposx Values
            Console.WriteLine("Changing radioposx values")
            Dim elemListradioposx As XmlNodeList = doc.GetElementsByTagName("radioposx")
            For i = 0 To elemListradioposx.Count - 1
                Console.Write(elemListradioposx(i).InnerXml)
                Console.Write(" => ")
                elemListradioposx(i).InnerXml = Math.Round(elemListradioposx(i).InnerXml * 1.5)
                Console.WriteLine(elemListradioposx(i).InnerXml)
            Next i
            'Change radioposy Values
            Console.WriteLine("Changing radioposy values")
            Dim elemListradioposy As XmlNodeList = doc.GetElementsByTagName("radioposy")
            For i = 0 To elemListradioposy.Count - 1
                Console.Write(elemListradioposy(i).InnerXml)
                Console.Write(" => ")
                elemListradioposy(i).InnerXml = Math.Round(elemListradioposy(i).InnerXml * 1.5)
                Console.WriteLine(elemListradioposy(i).InnerXml)
            Next i
            'Change radiowidth Values
            Console.WriteLine("Changing radiowidth values")
            Dim elemListradiowidth As XmlNodeList = doc.GetElementsByTagName("radiowidth")
            For i = 0 To elemListradiowidth.Count - 1
                Console.Write(elemListradiowidth(i).InnerXml)
                Console.Write(" => ")
                elemListradiowidth(i).InnerXml = Math.Round(elemListradiowidth(i).InnerXml * 1.5)
                Console.WriteLine(elemListradiowidth(i).InnerXml)
            Next i
            'Change radioheight Values
            Console.WriteLine("Changing radioheight values")
            Dim elemListradioheight As XmlNodeList = doc.GetElementsByTagName("radioheight")
            For i = 0 To elemListradioheight.Count - 1
                Console.Write(elemListradioheight(i).InnerXml)
                Console.Write(" => ")
                elemListradioheight(i).InnerXml = Math.Round(elemListradioheight(i).InnerXml * 1.5)
                Console.WriteLine(elemListradioheight(i).InnerXml)
            Next i
            ' 2. Save the modified XML to a file in Unicode format.
            doc.PreserveWhitespace = True
            Dim wrtr As XmlTextWriter = New XmlTextWriter("C:\test_Out.xml", Encoding.Unicode)
            wrtr.Formatting = Formatting.Indented
            doc.WriteTo(wrtr)
            wrtr.Close()
            Console.WriteLine("C:\test_Out.xml is created")
            Console.ReadLine()

        Catch xmlex As XmlException                  ' Handle the Xml Exceptions here.
            Console.WriteLine("{0}", xmlex.Message)
        Catch ex As Exception                        ' Handle the generic Exceptions here.
            Console.WriteLine("{0}", ex.Message)
        End Try
    End Sub

End Module

EDIT: added some more elements:
it now converts posx,posy,width,height,textwidth,textoffsetx,textoffsety,radioposx,radioposy,radiowidth,radioheight.
can post an exe if someone wants it.
Donate: https://kodi.tv/contribute/donate (foundation), 146Gr48FqHM7TPB9q33HHv6uWpgQqdz1yk (BTC personal)
Estuary: Kodis new default skin - ExtendedInfo Script - KodiDevKit
Reply
#5
Phil your the man i dont know how long i have needed this exact thing
Reply
#6
ZombieRobot Wrote:Phil your the man i dont know how long i have needed this exact thing

no problem. let me know if it works for you.
Donate: https://kodi.tv/contribute/donate (foundation), 146Gr48FqHM7TPB9q33HHv6uWpgQqdz1yk (BTC personal)
Estuary: Kodis new default skin - ExtendedInfo Script - KodiDevKit
Reply
#7
Nice work. Some notes to improve your program (feel free to ignore!)

1. Put the 1.5 in a (constant) variable, so you can more easily change it later should a different transformation be required.

2. Put the tag names into an array at the top, and cycle through that array rather than c&p the code multiple times. Alternatively, make the bit you've c&p'd a function that takes in the info it needs to do the conversion and then just call that function with each different tag you need to convert. Much faster to change then, and it makes sure all the code blocks are identical.

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
Reply
#8
jmarshall Wrote:Nice work. Some notes to improve your program (feel free to ignore!)

1. Put the 1.5 in a (constant) variable, so you can more easily change it later should a different transformation be required.

2. Put the tag names into an array at the top, and cycle through that array rather than c&p the code multiple times. Alternatively, make the bit you've c&p'd a function that takes in the info it needs to do the conversion and then just call that function with each different tag you need to convert. Much faster to change then, and it makes sure all the code blocks are identical.

Cheers,
Jonathan

thx for feedback.
I will try to set up a small gui to make things easier to use and optimize the code as you said.
I just don´t succeed with transforming the animation attributes "start" and "end" at the moment because they can have different amount of coordinates. any help is greatly appreciated.
Donate: https://kodi.tv/contribute/donate (foundation), 146Gr48FqHM7TPB9q33HHv6uWpgQqdz1yk (BTC personal)
Estuary: Kodis new default skin - ExtendedInfo Script - KodiDevKit
Reply
#9
phil65 Wrote:Any skilled coder here who can quickly write a program to convert 720p xmls to 1080? had a chat about that with someone from team blackbolt some time ago, but it never became reality.
It became reality, you have to ask Equinox, he is the man wrote one script.
Reply
#10
did this tool convert the animation tags, too?

EDIT: optimized code and created a gui. i can upload it if someone wants it.

Image
Donate: https://kodi.tv/contribute/donate (foundation), 146Gr48FqHM7TPB9q33HHv6uWpgQqdz1yk (BTC personal)
Estuary: Kodis new default skin - ExtendedInfo Script - KodiDevKit
Reply
#11
I'm intresting for my skin
Reply
#12
one question to jmarshall before releasing: which encoding should i set: unicode or ASCII?
got batch converting implemented now Smile i´m starting to like Visual Basic Big Grin
Donate: https://kodi.tv/contribute/donate (foundation), 146Gr48FqHM7TPB9q33HHv6uWpgQqdz1yk (BTC personal)
Estuary: Kodis new default skin - ExtendedInfo Script - KodiDevKit
Reply
#13
an alternative, and imo better solution than a platform dependent visual basic application, would be to use a xslt transformation. don't have time to give an example right now but google around..
Reply
#14
ANSI or UTF-8?
Reply
#15
spiff Wrote:an alternative, and imo better solution than a platform dependent visual basic application, would be to use a xslt transformation. don't have time to give an example right now but google around..

I agree that multiplatform would be nicer, but after googling around I decided that VB would be the easiest for me. (I´m no programmer)
and since this is a one-time-use tool, i hope it´s ok to release it windows-only.
Donate: https://kodi.tv/contribute/donate (foundation), 146Gr48FqHM7TPB9q33HHv6uWpgQqdz1yk (BTC personal)
Estuary: Kodis new default skin - ExtendedInfo Script - KodiDevKit
Reply
  • 1(current)
  • 2
  • 3
  • 4
  • 5
  • 7

Logout Mark Read Team Forum Stats Members Help
Converting skins to 1920x10801