• 1
  • 2(current)
  • 3
  • 4
  • 5
  • 7
Converting skins to 1920x1080
#16
Heh of course that is okay, it's not like I have any saying in that. Just giving an option and a opinion.
Reply
#17
Quote:i hope it´s ok to release it windows-only.
so that's not for meConfused
Reply
#18
fmronan Wrote:so that's not for meConfused

then send me your files, I´ll convert them for you.
Donate: https://kodi.tv/contribute/donate (foundation), 146Gr48FqHM7TPB9q33HHv6uWpgQqdz1yk (BTC personal)
Estuary: Kodis new default skin - ExtendedInfo Script - KodiDevKit
Reply
#19
is this enough for an UTF- 8 Header?
Code:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
Donate: https://kodi.tv/contribute/donate (foundation), 146Gr48FqHM7TPB9q33HHv6uWpgQqdz1yk (BTC personal)
Estuary: Kodis new default skin - ExtendedInfo Script - KodiDevKit
Reply
#20
Ok, here it is Smile
http://www.gtwf-koeln.de/xmlconvertgui.exe
Please report bugs, missing tags etc...
feedback is always welcome.

current limiitations:
does net convert <posx>400r</posx> for example
no conversion of attributes (for example for animation and border tags)
seems to hang when adding a lot of files... just wait a bit

made some changes some minutes ago, i hope everything works ok.

and here´s the code

Code:
Imports System.Xml
Imports System.Text
Imports System
Imports System.IO
Public Class Filechooser
    Public strOutputFolder As String = ""
    Public StrArray As String() = {"posx", "posy", "width", "height", "textoffsetx", "textoffsety", "radiowidth", "radioheight", "radioposx", "radioposy", "textwidth", "border"}
    Public doc As New XmlDocument()
    Public multiplyFactor As Double = 1.5
    Public Filenames As String() = {}
    Public SafeFilenames As String() = {}
    Public elementlist As XmlNodeList ' must be seperate for all ??
    Public TempLetter As String
    Public ElementCounter As String
    Private Sub Filechooser_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        ConversionDropDown.Items.Add("720p --> 1080p")
        ConversionDropDown.Items.Add("No Change")
        ConversionDropDown.SelectedIndex = 0
        EncodingDropDown.Items.Add("UTF-8")
        EncodingDropDown.Items.Add("ANSI")
        EncodingDropDown.SelectedIndex = 0
        OutputLog.AppendText("Program started" & vbCrLf)
    End Sub

    Private Sub ChooseButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ChooseButton.Click

        OpenFileDialog.Title = "Choose XML file"
        OpenFileDialog.Filter = "XML Files|*.xml"
        Dim DidWork As Integer = OpenFileDialog.ShowDialog()
        If DidWork = DialogResult.Cancel Then

        Else
            OutputButton.Visible = True
            Filenames = OpenFileDialog.FileNames
            SafeFilenames = OpenFileDialog.SafeFileNames
            If Filenames.Length = 1 Then
                OutputLog.AppendText("XML File chosen: " + SafeFilenames(0) & vbCrLf)
                xmlname.Text = SafeFilenames(0)
            Else
                OutputLog.AppendText("Amount Of Files Chosen: " + Filenames.Length.ToString & vbCrLf)
                For i = 0 To Filenames.Length - 1
                    OutputLog.AppendText(SafeFilenames(i) & vbCrLf)
                Next i
                xmlname.Text = Filenames.Length.ToString + " Files chosen"
            End If
            If strOutputFolder <> "" Then
                ConvertButton.Enabled = True
            End If
        End If
    End Sub

    Sub changeElements(ByVal tag As String, ByVal counter As Integer)
        OutputLog.AppendText("Changing " + tag + " values..." & vbCrLf)
        elementlist = doc.GetElementsByTagName(tag)
        For i = 0 To elementlist.Count - 1
            Dim number As Integer
            If Int32.TryParse(elementlist(i).InnerXml, number) Then
                elementlist(i).InnerXml = number
                OutputLog.AppendText(elementlist(i).InnerXml)
                OutputLog.AppendText(" => ")
                elementlist(i).InnerXml = Math.Round(elementlist(i).InnerXml * multiplyFactor)
                OutputLog.AppendText(elementlist(i).InnerXml & vbCrLf)
            Else
                OutputLog.AppendText("Attempted conversion of " + elementlist(i).InnerXml + " failed." & vbCrLf)
                If elementlist(i).InnerXml.Length > 0 Then
                    ' TempLetter = elementlist(i).InnerXml.ToString.Substring(0, 1)
                    elementlist(i).InnerXml = elementlist(i).InnerXml.ToString.Substring(0, elementlist(i).InnerXml.Length - 1)
                    OutputLog.AppendText("Removed last letter... " & vbCrLf)
                    OutputLog.AppendText(elementlist(i).InnerXml & vbCrLf)
                    If Int32.TryParse(elementlist(i).InnerXml, number) Then
                        OutputLog.AppendText("success " & vbCrLf)
                        elementlist(i).InnerXml = Math.Round(elementlist(i).InnerXml * multiplyFactor)
                        OutputLog.AppendText(elementlist(i).InnerXml & vbCrLf)
                    End If
                End If
            End If

        Next i
    End Sub

    Public Sub ConvertButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ConvertButton.Click
        Try
            ' Create an XML declaration.
            Dim xmldecl As XmlDeclaration
            xmldecl = doc.CreateXmlDeclaration("1.0", Nothing, Nothing)
            Select Case EncodingDropDown.SelectedIndex
                Case 0
                    xmldecl.Encoding = "UTF-8"
                Case 1
                    xmldecl.Encoding = "ISO-8859-1"
            End Select
            xmldecl.Standalone = "yes"
            Select Case ConversionDropDown.SelectedIndex
                Case 0
                    multiplyFactor = 1.5
                    OutputLog.AppendText("converting 720 ==> 1080: Factor 1.5" & vbCrLf)
                Case 1
                    multiplyFactor = 1
                    OutputLog.AppendText("only converting Encoding / adding Headers" & vbCrLf)
            End Select
            ElementCounter = 0
            For j = 0 To Filenames.Length - 1
                OutputLog.AppendText("Processing " + SafeFilenames(j) & vbCrLf)
                'Create the XmlDocument.
                doc.Load(Filenames(j))
                If HeaderOption.Checked Then
                    Dim root As XmlElement = doc.DocumentElement
                    doc.InsertBefore(xmldecl, root)
                End If
                If multiplyFactor <> 1 Then
                    For i = 0 To StrArray.Length - 1
                        changeElements(StrArray(i), j)
                    Next i
                End If
                '   If EncodingDropDown.SelectedIndex = 0 Then
                Dim wrtr As XmlTextWriter = Nothing

                Select Case EncodingDropDown.SelectedIndex
                    Case 0
                        wrtr = New XmlTextWriter(strOutputFolder + "\" + SafeFilenames(j), Encoding.UTF8)
                    Case 1
                        wrtr = New XmlTextWriter(strOutputFolder + "\" + SafeFilenames(j), Encoding.ASCII)
                End Select
                wrtr.Formatting = Formatting.Indented
                doc.WriteTo(wrtr)
                wrtr.Close()
                OutputLog.AppendText(SafeFilenames(j) + " created successfully" & vbCrLf)
                ElementCounter = ElementCounter + 1
            Next j

        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
        OutputLog.AppendText("All Files converted" & vbCrLf)
        MsgBox(ElementCounter + " XML Files converted." & vbCrLf & "Please adjust the remaining tags by hand")
        ReDim Filenames(0)
        ReDim SafeFilenames(0)
        xmlname.Text = ""
        ConvertButton.Enabled = False

    End Sub

    Private Sub OutputButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OutputButton.Click
        Do
            FolderBrowserDialog.Description = "Choose Output Folder"

            Dim DidWork As Integer = FolderBrowserDialog.ShowDialog()
            If DidWork = DialogResult.Cancel Then

            Else
                strOutputFolder = FolderBrowserDialog.SelectedPath
                If Filenames(0) <> "" Then
                    ConvertButton.Enabled = True
                End If
                OutputLabel.Text = strOutputFolder + "\"
                OutputLog.AppendText("Output Folder chosen:" & vbCrLf)
                OutputLog.AppendText(strOutputFolder & vbCrLf)
            End If
            If (strOutputFolder + "\" + SafeFilenames(0) = Filenames(0)) Then
                MsgBox("You´ve chosen the soure directory. please change the output path.")
            End If
        Loop While (strOutputFolder + "\" + SafeFilenames(0) = Filenames(0))


    End Sub
End Class

If someone wants to have the project files, just ask.
Donate: https://kodi.tv/contribute/donate (foundation), 146Gr48FqHM7TPB9q33HHv6uWpgQqdz1yk (BTC personal)
Estuary: Kodis new default skin - ExtendedInfo Script - KodiDevKit
Reply
#21
phil65 Wrote:Ok, here it is Smile
http://www.gtwf-koeln.de/xmlconvertgui.exe
Please report bugs, missing tags etc...
feedback is always welcome.

current limiitations:
does net convert <posx>400r</posx> for example
no conversion of attributes (for example for animation and border tags)
seems to hang when adding a lot of files... just wait a bit

made some changes some minutes ago, i hope everything works ok.

If someone wants to have the project files, just ask.
phil65,

I had someone write me a perl script that did something similar, but only looked after height, width, posx and posy. Only downside I can see with what you have (other than being windows only) is that the fixed conversion factors. If you allowed the user to input them, this could be used to convert from one resolution to any other (ie 720p to iPad native).

Just a thought.
Wyrm (xTV-SAF)
If required a FULL debug log can now be submitted from the skin in settings->skin settings->support. Or follow instructions here if you can't access skin settings.

FAQ's located at :- http://kodi.wiki/view/Add-on:AppTV
Reply
#22
wyrm Wrote:phil65,

I had someone write me a perl script that did something similar, but only looked after height, width, posx and posy. Only downside I can see with what you have (other than being windows only) is that the fixed conversion factors. If you allowed the user to input them, this could be used to convert from one resolution to any other (ie 720p to iPad native).

Just a thought.
Wyrm (xTV-SAF)

would take one minute to change that Smile if someone wants it i could do that.
Donate: https://kodi.tv/contribute/donate (foundation), 146Gr48FqHM7TPB9q33HHv6uWpgQqdz1yk (BTC personal)
Estuary: Kodis new default skin - ExtendedInfo Script - KodiDevKit
Reply
#23
iPad isn't 16:9, is it ?
Admin @ Passion-XBMC
(official french community)
Reply
#24
Maxoo Wrote:iPad isn't 16:9, is it ?

i also think that the 16:9 skins are scaled to Retina display ratio by XBMC, so no need to adjust the skins.

EDIT: updated the .exe, should convert <posx>400r</posx> properly now Smile (removing r --> scaling --> adding r)
Donate: https://kodi.tv/contribute/donate (foundation), 146Gr48FqHM7TPB9q33HHv6uWpgQqdz1yk (BTC personal)
Estuary: Kodis new default skin - ExtendedInfo Script - KodiDevKit
Reply
#25
phil65 Wrote:i also think that the 16:9 skins are scaled to Retina display ratio by XBMC, so no need to adjust the skins.

phil65,

XBMC will convert to any resolution really. Point was more that you be able to produce a skin that was coded to your target devices native res. Resulting skin would still run fine on any XBMC device, just that you could use your utility to fine tune for particular target. Touched runs just fine on most platforms, it's just targeted at the iPad.

Wyrm (xTV-SAF)
If required a FULL debug log can now be submitted from the skin in settings->skin settings->support. Or follow instructions here if you can't access skin settings.

FAQ's located at :- http://kodi.wiki/view/Add-on:AppTV
Reply
#26
wyrm Wrote:phil65,

XBMC will convert to any resolution really. Point was more that you be able to produce a skin that was coded to your target devices native res. Resulting skin would still run fine on any XBMC device, just that you could use your utility to fine tune for particular target. Touched runs just fine on most platforms, it's just targeted at the iPad.

Wyrm (xTV-SAF)

so you want seperate x and y scaling? could be implemented easily, if someone really wants to use it.
Donate: https://kodi.tv/contribute/donate (foundation), 146Gr48FqHM7TPB9q33HHv6uWpgQqdz1yk (BTC personal)
Estuary: Kodis new default skin - ExtendedInfo Script - KodiDevKit
Reply
#27
phil65 Wrote:so you want seperate x and y scaling? could be implemented easily, if someone really wants to use it.
I know it could get a work out on the constantly threatened "Slab" project of mine.

Wyrm (xTV-SAF)
If required a FULL debug log can now be submitted from the skin in settings->skin settings->support. Or follow instructions here if you can't access skin settings.

FAQ's located at :- http://kodi.wiki/view/Add-on:AppTV
Reply
#28
I took a sample skin XML file from google for XBMC and put together a quick XSL based on the rules in the above VB source code. You may need to do a bit of work to get it perfect for you...

Matches the specified element list and for each replaces their value with the previous value * 1.5, rounded up/down as appropriate.

[edit] This didn't satsfy all values, see Post #37 for an updated copy [/edit]

Code:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output method="xml" indents="yes"/>

<xsl:variable name="MULTIPLIER">1.5</xsl:variable>

  <!-- template (copies input file as-is) -->
  <xsl:template match="@*|node()">
    <xsl:copy>
      <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
  </xsl:template>

  <!-- specific overrides -->
  <xsl:template match="posx|posy|width|height|textoffsetx|textoffsety|radiowidth|radioheight|radioposx|radioposy|textwidth|border">
    <xsl:element name="{local-name()}">
      <xsl:value-of select="round(number(.) * number($MULTIPLIER))"/>
    </xsl:element>
  </xsl:template>

</xsl:stylesheet>
Reply
#29
nice. for linux users,
Code:
for file in *xml; do xsltproc ~/foo.xslt "$file" > foo && mv foo "$file"; done
will transform all xmls in the current directory, assuming the xslt from the previous post is available as ~/foo.xslt
Reply
#30
Sinnocence Wrote:I took a sample skin XML file from google for XBMC and put together a quick XSL based on the rules in the above VB source code. You may need to do a bit of work to get it perfect for you...

Matches the specified element list and for each replaces their value with the previous value * 1.5, rounded up/down as appropriate.

Code:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output method="xml" indents="yes"/>

<xsl:variable name="MULTIPLIER">1.5</xsl:variable>

  <!-- template (copies input file as-is) -->
  <xsl:template match="@*|node()">
    <xsl:copy>
      <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
  </xsl:template>

  <!-- specific overrides -->
  <xsl:template match="posx|posy|width|height|textoffsetx|textoffsety|radiowidth|radioheight|radioposx|radioposy|textwidth|border">
    <xsl:element name="{local-name()}">
      <xsl:value-of select="round(number(.) * number($MULTIPLIER))"/>
    </xsl:element>
  </xsl:template>

</xsl:stylesheet>

spiff Wrote:nice. for linux users,
Code:
for file in *xml; do xsltproc ~/foo.xslt "$file" > foo && mv foo "$file"; done
will transform all xmls in the current directory, assuming the xslt from the previous post is available as ~/foo.xslt

nice. will try to implement changing the attributes now.
Donate: https://kodi.tv/contribute/donate (foundation), 146Gr48FqHM7TPB9q33HHv6uWpgQqdz1yk (BTC personal)
Estuary: Kodis new default skin - ExtendedInfo Script - KodiDevKit
Reply
  • 1
  • 2(current)
  • 3
  • 4
  • 5
  • 7

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