Any help with a batch script please?

  Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
Hitcher Offline
Skilled Skinner
Posts: 10,779
Joined: Aug 2007
Reputation: 100
Location: Eastleigh, UK
Post: #1
I'm trying to combine the contents of the addon.xml files into one using a batch file.

I've got as far as getting the correct info but can't output it to another xml.

Here's what I'm using to get the contents (skipping the first line of each) -

Code:
@echo off
FOR /F "skip=1 delims=" %%A IN (plugin.video.iplayer\addon.xml skin.foundation\addon.xml skin.xeebo\addon.xml xbmc.repo.hitcher\addon.xml) DO ECHO %%A
pause

This results in -

Code:
<addon id="plugin.video.iplayer"
       name="iPlayer"
       version="2.4.13"
       provider-name="BuZz, Dink">
    <requires>
        <import addon="xbmc.python" version="1.0"/>
    </requires>
    <extension point="xbmc.python.pluginsource"
               library="default.py">
        <provides>video audio</provides>
    </extension>
    <extension point="xbmc.addon.metadata">
        <platform>all</platform>
        <summary>Watch TV and listen to radio from the BBC's iPlayer website</summary>
        <description>This XBMC plugin enables (UK only) the playing of TV and Radio catchup content
from the BBC IPlayer website. Live radio and TV feeds are also supported.</description>
    </extension>
</addon>
<addon
        id="skin.foundation"
        version="2.0.1"
        name="Foundation"
        provider-name="Hitcher">
        <requires>
                <import addon="xbmc.gui" version="3.00"/>
        </requires>
        <extension
    point="xbmc.gui.skin"
    defaultthemename="textures.xbt"
    debugging="false"
    effectslowdown="0.75">
                <res width="1280" height="720" aspect="16:9" default="true" folder="720p" />
                <res width="1920" height="1080" aspect="16:9" default="true" folder="1080i" />
        </extension>
        <extension point="xbmc.addon.metadata">
                <platform>all</platform>
                <summary>Created by Hitcher / Textures courtesy of Jezz_X</summary>
                <description>'Foundation' is a basic, fully functional XBMC skin designed to be used
as a base for creating a new skin; or simply as a learning tool for the beginner.</description>
        </extension>
</addon>
<addon
        id="skin.xeebo"
        version="4.0.0"
        name="XeeBo"
        provider-name="Hitcher">
        <requires>
                <import addon="xbmc.gui" version="3.00"/>
                <import addon="script.playalbum" version="0.0.3"/>
                <import addon="script.watchlist" version="0.0.4"/>
                <import addon="script.favourites" version="3.1.0"/>
                <import addon="script.randomitems" version="3.0.2"/>
                <import addon="script.globalsearch" version="0.1.5"/>
                <import addon="script.artwork.downloader" version="1.0.3"/>
                <import addon="script.tv.show.next.aired" version="3.0.2"/>
        </requires>
        <extension
                point="xbmc.gui.skin"
                defaultthemename="Textures.xbt"
                effectslowdown="1.00"
                debugging="false">
                <res width="1280" height="720" aspect="16:9" default="true" folder="720p" />
        </extension>
        <extension point="xbmc.addon.metadata">
                <platform>all</platform>
                <minversion app="xbmc">28000</minversion>
                <summary>Boxee style skin</summary>
                <description>Designed for ease of use with remote, mouse or touchscreen.[CR][CR]Supp
orts -[CR][CR]Cinema Experience / Extra Artwork / Global Search / PVR / TV Next Aired / TV Tunes / W
atchlist / Weather Plus</description>
                <disclaimer>Originally coded by Wir3d/Jezz_X</disclaimer>
        </extension>
</addon>
<addon
        id="xbmc.repo.hitcher"
        name="Hitcher's repository"
        version="2.0.0"
        provider-name="Hitcher">
        <extension point="xbmc.addon.repository"
        name="Hitcher's Add-on Repository">
                <info>https://bitbucket.org/Hitcher/xbmc.repo.hitcher/raw/57094dbd903a/addons.xml</i
nfo>
                <checksum>https://bitbucket.org/Hitcher/xbmc.repo.hitcher/raw/57094dbd903a/addons.md
5</checksum>
                <datadir zip="true">https://bitbucket.org/Hitcher/xbmc.repo.hitcher/src/585aad574523
</datadir>
        </extension>
        <extension point="xbmc.addon.metadata">
                <summary>Hitcher's Add-ons for XBMC</summary>
                <description>Download and install Add-ons for XBMC.</description>
                <disclaimer>If it breaks, you get to keep the pieces</disclaimer>
                <platform>all</platform>
        </extension>
</addon>
Press any key to continue . . .

If I make this a variable and try to output it to the addons.xml it doesn't work.

Any help appreciated.

Thanks.
find quote
Sinnocence Offline
Donor
Posts: 97
Joined: Oct 2007
Reputation: 4
Post: #2
Will redirecting the output satisfy your needs (i.e. remove the pause and run: mybatch.bat > addons.xml) ?
find quote
tree_jammer Offline
Team-Kodi Member
Posts: 50
Joined: Apr 2009
Reputation: 17
Post: #3
Sinnocense is correct! this will work


@echo off
FOR /F "skip=1 delims=" %%A IN (plugin.video.iplayer\addon.xml skin.foundation\addon.xml skin.xeebo\addon.xml xbmc.repo.hitcher\addon.xml) DO ECHO %%A
mybatch.bat > addons.xml
(This post was last modified: 2012-03-13 11:26 by tree_jammer.)
find quote
Hitcher Offline
Skilled Skinner
Posts: 10,779
Joined: Aug 2007
Reputation: 100
Location: Eastleigh, UK
Post: #4
Thanks guys, worked great.

Now how can I add text to the top and bottom of the output files?

Top -

PHP Code:
<?xml version="1.0" encoding="UTF-8"?>
<addons> 

Bottom -

PHP Code:
</addons
find quote
Sinnocence Offline
Donor
Posts: 97
Joined: Oct 2007
Reputation: 4
Post: #5
You can just 'echo' it out, something like:

Code:
@echo off
echo ^<?xml version="1.0" encoding="UTF-8"?^>
echo ^<addons^>
FOR /F "skip=1 delims=" %%A IN (plugin.video.iplayer\addon.xml skin.foundation\addon.xml skin.xeebo\addon.xml xbmc.repo.hitcher\addon.xml) DO ECHO %%A
echo ^</addons^>

Note the inclusion of '^' before characters that have special meaning in dos. If you're adding more content to the bat file and start getting errors like "The syntax of the command is incorrect." then you're likely missing a '^' somewhere.
(This post was last modified: 2012-03-13 13:00 by Sinnocence.)
find quote
Hitcher Offline
Skilled Skinner
Posts: 10,779
Joined: Aug 2007
Reputation: 100
Location: Eastleigh, UK
Post: #6
Cool, I'm slowly learning it.

So far I've managed build, zip, add the version number to the zipped skin and changelog file, and finally move them to my repo folder. This is the next step and I've worked out how to make a MD5 file from the addons.xml but actually making it had me stuck.

If you don't mind there a couple of other things I'd like to achieve -

1. Would it be possible to search the sub folders for their addon.xml files without using their actually names?

2. Can the addons.xml build bat be run from another bat file?

Many thanks.
find quote
Sinnocence Offline
Donor
Posts: 97
Joined: Oct 2007
Reputation: 4
Post: #7
(2012-03-13 12:11)Hitcher Wrote:  1. Would it be possible to search the sub folders for their addon.xml files without using their actually names?

You can list all the addon.xml files in all subdirectories by doing something like
Code:
dir addon.xml /s /b

(2012-03-13 12:11)Hitcher Wrote:  2. Can the addons.xml build bat be run from another bat file?

You can use 'call' or just the bat file name (path depending) to execute another bat file.

Putting the above together you might end up with something like:

Code:
for /f %%f in ('dir /s /b addon.xml') do mybatch.bat %%f

in a file called wrapper.bat (where /s includes subdirectories and /b strips other file info from the output of the dir command). Both wrapper.bat and mybatch.bat (your other file) should exist in parent directory for all addons you want to include (presumably your 'addon' directory).

If you have spaces in your file/directory names you may need to use a slightly more complicated version of the command, e.g.:

current directory & subdirectories
Code:
for /f "usebackq delims=|" %%f in (`dir /b /s "." ^| findstr /i addon.xml`) do mybatch.bat %%f

or

c:\xbmc\addons & subdirectories
Code:
for /f "usebackq delims=|" %%f in (`dir /b /s "C:\XBMC\addons" ^| findstr /i addon.xml`) do mybatch.bat %%f

[edit] the above is only an example answer for the question you asked. Assuming for the moment that you're trying to scan all addon.xml files under the addons directory and dump the concatinated output into addons.xml you can use a single.bat file. Recycling the above content gives us:

Code:
@echo off
SETLOCAL EnableDelayedExpansion
echo ^<?xml version="1.0" encoding="UTF-8"?^>
echo ^<addons^>
for /f "usebackq delims=|" %%f in (`dir /b /s "D:\programs\xbmc\portable_data\" ^| findstr /i addon.xml`) do (
   echo %%f
   SET "path=%%f"
   Call:DumpAddonXML !path!
   )
)
goto :END

:DumpAddonXML
echo %*
for /f "skip=1 delims=" %%a in (%*) do echo %%a
goto :eof

:END
echo ^</addons^>


If you wanted to make it less verbose, and automatically output into the directory where the .bat file is called (into addons.xml) you could make the following changes. This would mean that you could drop the .bat file into an addon directory & double click the file. Once finished addons.xml should exist in the directory with the desired content.
Code:
@echo off
SETLOCAL EnableDelayedExpansion
echo ^<?xml version="1.0" encoding="UTF-8"?^> >addons.xml
echo ^<addons^> >>addons.xml
for /f "usebackq delims=|" %%f in (`dir /b /s "." ^| findstr /i addon.xml`) do (
   SET "path=%%f"
   Call:DumpAddonXML !path!
   )
)
goto :END

:DumpAddonXML
for /f "skip=1 delims=" %%a in (%*) do echo %%a >>addons.xml
goto :eof

:END
echo ^</addons^> >>addons.xml

Please note that the ">addons.xml" is used on the first output line to either a) create a new file or b) overwrite an existing addons.xml file. Successive output lines use ">>addons.xml" in order to append content to the file.

[/edit]
(This post was last modified: 2012-03-13 13:18 by Sinnocence.)
find quote
Hitcher Offline
Skilled Skinner
Posts: 10,779
Joined: Aug 2007
Reputation: 100
Location: Eastleigh, UK
Post: #8
That's awesome, thanks for all the help and have some rep.

EDIT: Almost there unfortunately it's not stripping the first line from each addon.xml <?xml version="1.0" encoding="UTF-8"?>

EDIT2: Actually it is but for some reason they're getting listed twice - once with that and once without.

Code:
<?xml version="1.0" encoding="UTF-8"?>
<addons>
<addon id="plugin.video.iplayer"
       name="iPlayer"
       version="2.4.13"
       provider-name="BuZz, Dink">
    <requires>
        <import addon="xbmc.python" version="1.0"/>
    </requires>
    <extension point="xbmc.python.pluginsource"
               library="default.py">
        <provides>video audio</provides>
    </extension>
    <extension point="xbmc.addon.metadata">
        <platform>all</platform>
        <summary>Watch TV and listen to radio from the BBC's iPlayer website</summary>
        <description>This XBMC plugin enables (UK only) the playing of TV and Radio catchup content from the BBC IPlayer website. Live radio and TV feeds are also supported.</description>
    </extension>
</addon>
<?xml version="1.0" encoding="UTF-8"?>
<addon
    id="skin.foundation"
    version="2.0.1"
    name="Foundation"
    provider-name="Hitcher">
    <requires>
        <import addon="xbmc.gui" version="3.00"/>
    </requires>
    <extension
    point="xbmc.gui.skin"
    defaultthemename="textures.xbt"
    debugging="false"
    effectslowdown="0.75">
        <res width="1280" height="720" aspect="16:9" default="true" folder="720p" />
        <res width="1920" height="1080" aspect="16:9" default="true" folder="1080i" />
    </extension>
    <extension point="xbmc.addon.metadata">
        <platform>all</platform>
        <summary>Created by Hitcher / Textures courtesy of Jezz_X</summary>
        <description>'Foundation' is a basic, fully functional XBMC skin designed to be used as a base for creating a new skin; or simply as a learning tool for the beginner.</description>
    </extension>
</addon><?xml version="1.0" encoding="UTF-8"?>
<addon
    id="skin.xeebo"
    version="4.0.0"
    name="XeeBo"
    provider-name="Hitcher">
    <requires>
        <import addon="xbmc.gui" version="3.00"/>
        <import addon="script.playalbum" version="0.0.3"/>
        <import addon="script.watchlist" version="0.0.4"/>
        <import addon="script.favourites" version="3.1.0"/>
        <import addon="script.randomitems" version="3.0.2"/>
        <import addon="script.globalsearch" version="0.1.5"/>
        <import addon="script.artwork.downloader" version="1.0.3"/>
        <import addon="script.tv.show.next.aired" version="3.0.2"/>
    </requires>
    <extension
        point="xbmc.gui.skin"
        defaultthemename="Textures.xbt"
        effectslowdown="1.00"
        debugging="false">
        <res width="1280" height="720" aspect="16:9" default="true" folder="720p" />
    </extension>
    <extension point="xbmc.addon.metadata">
        <platform>all</platform>
        <minversion app="xbmc">28000</minversion>
        <summary>Boxee style skin</summary>
        <description>Designed for ease of use with remote, mouse or touchscreen.[CR][CR]Supports -[CR][CR]Cinema Experience / Extra Artwork / Global Search / PVR / TV Next Aired / TV Tunes / Watchlist / Weather Plus</description>
        <disclaimer>Originally coded by Wir3d/Jezz_X</disclaimer>
    </extension>
</addon>
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon
    id="xbmc.repo.hitcher"
    name="Hitcher's repository"
    version="2.0.0"
    provider-name="Hitcher">
    <extension point="xbmc.addon.repository"
        name="Hitcher's Add-on Repository">
        <info>https://bitbucket.org/Hitcher/xbmc.repo.hitcher/raw/57094dbd903a/addons.xml</info>  
        <checksum>https://bitbucket.org/Hitcher/xbmc.repo.hitcher/raw/57094dbd903a/addons.md5</checksum>  
        <datadir zip="true">https://bitbucket.org/Hitcher/xbmc.repo.hitcher/src/585aad574523</datadir>  
    </extension>
    <extension point="xbmc.addon.metadata">
        <summary>Hitcher's Add-ons for XBMC</summary>
        <description>Download and install Add-ons for XBMC.</description>
        <disclaimer>If it breaks, you get to keep the pieces</disclaimer>
        <platform>all</platform>
    </extension>
</addon>
<addon id="plugin.video.iplayer"
       name="iPlayer"
       version="2.4.13"
       provider-name="BuZz, Dink">
    <requires>
        <import addon="xbmc.python" version="1.0"/>
    </requires>
    <extension point="xbmc.python.pluginsource"
               library="default.py">
        <provides>video audio</provides>
    </extension>
    <extension point="xbmc.addon.metadata">
        <platform>all</platform>
        <summary>Watch TV and listen to radio from the BBC's iPlayer website</summary>
        <description>This XBMC plugin enables (UK only) the playing of TV and Radio catchup content from the BBC IPlayer website. Live radio and TV feeds are also supported.</description>
    </extension>
</addon>
<addon
    id="skin.alaska.hd"
    version="0.0.5"
    name="Alaska HD"
    provider-name="Hitcher">
    <requires>
        <import addon="xbmc.gui" version="3.00"/>
        <import addon="script.randomitems" version="1.0.1"/>
    </requires>
    <extension
        point="xbmc.gui.skin"
        defaultthemename="Textures.xbt"
        effectslowdown="1.00"
        debugging="false">
        <res width="1920" height="1080" aspect="16:9" default="true" folder="16x9" />
        <res width="1920" height="1200" aspect="16:10" folder="16x10" />
    </extension>
    <extension point="xbmc.addon.metadata">
        <platform>all</platform>
        <summary>Alaska in full hd</summary>
        <description>Built from from the original Alaska design by Duncan Harris</description>
    </extension>
</addon>
<addon
    id="skin.foundation"
    version="2.0.1"
    name="Foundation"
    provider-name="Hitcher">
    <requires>
        <import addon="xbmc.gui" version="3.00"/>
    </requires>
    <extension
    point="xbmc.gui.skin"
    defaultthemename="textures.xbt"
    debugging="false"
    effectslowdown="0.75">
        <res width="1280" height="720" aspect="16:9" default="true" folder="720p" />
        <res width="1920" height="1080" aspect="16:9" default="true" folder="1080i" />
    </extension>
    <extension point="xbmc.addon.metadata">
        <platform>all</platform>
        <summary>Created by Hitcher / Textures courtesy of Jezz_X</summary>
        <description>'Foundation' is a basic, fully functional XBMC skin designed to be used as a base for creating a new skin; or simply as a learning tool for the beginner.</description>
    </extension>
</addon>
<addon
    id="skin.xeebo"
    version="4.0.0"
    name="XeeBo"
    provider-name="Hitcher">
    <requires>
        <import addon="xbmc.gui" version="3.00"/>
        <import addon="script.playalbum" version="0.0.3"/>
        <import addon="script.watchlist" version="0.0.4"/>
        <import addon="script.favourites" version="3.1.0"/>
        <import addon="script.randomitems" version="3.0.2"/>
        <import addon="script.globalsearch" version="0.1.5"/>
        <import addon="script.artwork.downloader" version="1.0.3"/>
        <import addon="script.tv.show.next.aired" version="3.0.2"/>
    </requires>
    <extension
        point="xbmc.gui.skin"
        defaultthemename="Textures.xbt"
        effectslowdown="1.00"
        debugging="false">
        <res width="1280" height="720" aspect="16:9" default="true" folder="720p" />
    </extension>
    <extension point="xbmc.addon.metadata">
        <platform>all</platform>
        <minversion app="xbmc">28000</minversion>
        <summary>Boxee style skin</summary>
        <description>Designed for ease of use with remote, mouse or touchscreen.[CR][CR]Supports -[CR][CR]Cinema Experience / Extra Artwork / Global Search / PVR / TV Next Aired / TV Tunes / Watchlist / Weather Plus</description>
        <disclaimer>Originally coded by Wir3d/Jezz_X</disclaimer>
    </extension>
</addon>
<addon
    id="xbmc.repo.hitcher"
    name="Hitcher's repository"
    version="2.0.0"
    provider-name="Hitcher">
    <extension point="xbmc.addon.repository"
        name="Hitcher's Add-on Repository">
        <info>https://bitbucket.org/Hitcher/xbmc.repo.hitcher/raw/57094dbd903a/addons.xml</info>  
        <checksum>https://bitbucket.org/Hitcher/xbmc.repo.hitcher/raw/57094dbd903a/addons.md5</checksum>  
        <datadir zip="true">https://bitbucket.org/Hitcher/xbmc.repo.hitcher/src/585aad574523</datadir>  
    </extension>
    <extension point="xbmc.addon.metadata">
        <summary>Hitcher's Add-ons for XBMC</summary>
        <description>Download and install Add-ons for XBMC.</description>
        <disclaimer>If it breaks, you get to keep the pieces</disclaimer>
        <platform>all</platform>
    </extension>
</addon>
</addons>
(This post was last modified: 2012-03-13 22:36 by da-anda.)
find quote
Sinnocence Offline
Donor
Posts: 97
Joined: Oct 2007
Reputation: 4
Post: #9
Strange, it works okay for me. That 'skip=1' basically says skip the first line of each file (first line is 0, second is 1, etc). The way we're using FOR should skip blank lines also.

Can you double check you have skip=1 there and that the addon.xml files where '<?xml version="1.0" encoding="UTF-8"?>' is included have '<?xml version="1.0" encoding="UTF-8"?>' on their first line (or, if not, that they only blank lines before it and nothing of substance) ?

Thanks.
(This post was last modified: 2012-03-13 13:38 by Sinnocence.)
find quote
Hitcher Offline
Skilled Skinner
Posts: 10,779
Joined: Aug 2007
Reputation: 100
Location: Eastleigh, UK
Post: #10
Just had a thought - the addon.xml files are also zipped up in the skin folder - does dos read them as well?

EDIT: I think it must do because I edited the un-zipped addon.xml files and they're the ones that are added to the bottom half of the output file, the ones at the top must be from the zipped folders.
(This post was last modified: 2012-03-13 14:37 by Hitcher.)
find quote
Sinnocence Offline
Donor
Posts: 97
Joined: Oct 2007
Reputation: 4
Post: #11
AFAIK If windows is the associated zip editor (i.e. zip files are treated as folders on your system) then it may work but generally no, it shouldn't. You'd need to extract the relevant files before reading them.

I probably should have asked before now but what are you trying to have the batch file accomplish, a complete list of all the addons/dependencies on your system? Is it for your use/reference only or is the batch file for distribution?
find quote
Hitcher Offline
Skilled Skinner
Posts: 10,779
Joined: Aug 2007
Reputation: 100
Location: Eastleigh, UK
Post: #12
Damn it, I can see what's happened now. I had a addon.xml in the main folder that was created during my tests and that was getting added to the output file as well. Deleted it and all's good.

What I'm trying to do it reduce the amount of work needed when I want to push an update to my repo and more importantly reduce the human errors that often happen as well.

So far I've modified Jezz's batch file (see here) so I have build shortcuts on my desktop for each skin.

This then makes the skin folder, builds the texture and theme XBT files, extracts the version number from the addon.xml, zips up the skin folder with the version number added, makes the changelog file (again with the version number added), and finally moves the zip, icon.png, fanart.png, changelog.txt and addon.xml to the relevant repo skin folder.

I then wanted to use another batch file to make an updated addons.xml (note: the addons.xml is required for repos and it must contain the contents of all your addons addon.xml files), then make an updated MD5 file for the new addons.xml.

Then I'd have to do is push the changes.
(This post was last modified: 2012-03-13 15:10 by Hitcher.)
find quote
Sinnocence Offline
Donor
Posts: 97
Joined: Oct 2007
Reputation: 4
Post: #13
With the stale/old/test addons.xml removed the output of the new addons.xml is correct (none of the unnecessary '<?xml version="1.0" encoding="UTF-8"?>' lines included)?

If you have a local copy of the repo from which you produce the skin zip files, can you run the batch file on that directory? In other words you'd call your new batch script either from the existing build-skin batch files (last step) or manually after the build-skin batch jobs finish? This assumes that the addon.xml for a skin exists on the filesystem before being packed into the zip file.

The only reason you would need to extract the addon.xml files from zips then would be if you were hosting addons on your repo that you were not building yourself? We can add support for extracting addon.xml from found zip files and appending that content also but it would mean you having (for example) 7zip's cmd line version somewhere on your path/in the same folder as the batch files.
(This post was last modified: 2012-03-13 15:28 by Sinnocence.)
find quote
Hitcher Offline
Skilled Skinner
Posts: 10,779
Joined: Aug 2007
Reputation: 100
Location: Eastleigh, UK
Post: #14
(2012-03-13 15:25)Sinnocence Wrote:  With the stale/old/test addons.xml removed the output of the new addons.xml is correct (none of the unnecessary '<?xml version="1.0" encoding="UTF-8"?>' lines included)?

Yes, works perfectly now.

(2012-03-13 15:25)Sinnocence Wrote:  If you have a local copy of the repo from which you produce the skin zip files, can you run the batch file on that directory? In other words you'd call your new batch script either from the existing build-skin batch files (last step) or manually after the build-skin batch jobs finish? This assumes that the addon.xml for a skin exists on the filesystem before being packed into the zip file.

I did think of this but as I'm working from within my XBMC userdata folder wouldn't it fill the addons.xml with the info from all my addons? This was my reasoning behind copying the addon.xml files to my repo folder (which is on another drive by the way) but I suppose I could then run the addons.xml build bat at the end?
Here's my build.bat

PHP Code:
@echo off 

Echo .git>exclude.txt
Echo %1\media>>exclude.txt
Echo %1\themes>>exclude.txt

md BUILD
\%1\media\

ECHO ----------------------------------------
Echo 
Building main skin XBT
ECHO ----------------------------------------

START //WAIT TexturePacker\TexturePacker -dupecheck -input %1\media -output BUILD\%1\media\Textures.xbt

ECHO ----------------------------------------
Echo 
Finished building main skin XBT
if exist %1\themes (
    Echo 
Building theme skin XBT Files
    
ECHO ----------------------------------------
    for /
"tokens=*" %%f in ('dir /b/ad %1\themes') do START //WAIT TexturePacker\TexturePacker -dupecheck -input %1\themes\%%-output BUILD\%1\media\%%f.xbt
    
Echo Finished Building theme skin XBT Files
)

del exclude.txt

ECHO ----------------------------------------
Echo 
Copying other files
ECHO ----------------------------------------

xcopy "%1\_screenshots" "BUILD\%1\_screenshots" ////Y
xcopy 
"%1\720p" "BUILD\%1\720p" ////Y
xcopy 
"%1\1080p" "BUILD\%1\1080p" ////Y
xcopy 
"%1\backgrounds" "BUILD\%1\backgrounds" ////Y
xcopy 
"%1\colors" "BUILD\%1\colors" ////Y
xcopy 
"%1\fonts" "BUILD\%1\fonts" ////Y
xcopy 
"%1\language" "BUILD\%1\language" ////Y
xcopy 
"%1\sounds" "BUILD\%1\sounds" ////Y
xcopy 
"%1\extras" "BUILD\%1\extras" ////Y

copy 
"%1\fanart.jpg" "BUILD\%1\"
copy "
%1\icon.png" "BUILD\%1\"
copy "
%1\changelog.txt" "BUILD\%1\"
copy "
%1\License.txt" "BUILD\%1\"
copy "
%1\addon.xml" "BUILD\%1\"

ECHO ----------------------------------------
ECHO Getting current skin version
ECHO ----------------------------------------

FOR /F "
skip=2 Tokens=2 Delims== " %%V IN ('FIND "    version=" "BUILD\%1\addon.xml"') DO SET Version=%%~V

ECHO ----------------------------------------
ECHO Compressing skin directory
ECHO ----------------------------------------

cd BUILD
C:\zip -r -q %1-%Version%.zip %1

ECHO ----------------------------------------
ECHO Moving to repository
ECHO ----------------------------------------

if exist "
F:\xbmc.repo.hitcher\%1\" rmdir "F:\xbmc.repo.hitcher\%1\" /S /Q
md "
F:\xbmc.repo.hitcher\%1\"
copy "
%1-%Version%.zip" "F:\xbmc.repo.hitcher\%1\"
copy "
%1\fanart.jpg" "F:\xbmc.repo.hitcher\%1\fanart.jpg"
copy "
%1\icon.png" "F:\xbmc.repo.hitcher\%1\icon.png"
copy "
%1\addon.xml" "F:\xbmc.repo.hitcher\%1\addon.xml"
copy "
%1\changelog.txt" "F:\xbmc.repo.hitcher\%1\changelog-%Version%.txt"

ECHO ----------------------------------------
ECHO Cleaning up
ECHO ----------------------------------------

cd ..
rmdir BUILD /S /Q

pause 

I did try to use -

PHP Code:
for /"tokens=*" %%c in ('dir /b/ad %1') do xcopy "%1\%%c" "BUILD\%1\%%c" /////EXCLUDE:exclude.txt
for /"tokens=*" %%c in ('dir /b/a-d %1') do copy %1\%%"BUILD\%1\%%c" 

from Jezz's script but couldn't get it to ignore/delete the .svn folder.
(This post was last modified: 2012-03-13 16:51 by Hitcher.)
find quote
Sinnocence Offline
Donor
Posts: 97
Joined: Oct 2007
Reputation: 4
Post: #15
If you're working from your live userdata folder then you would pick up other content too, so yes, running it on your repo folder is the way to go.

The xcopy with excludes command looks correct. You can try specifying the full path to exclude.txt (if not the current directory), e.g. /exclude:c:\exclude.txt, and make sure the file contains the following entries (just to be sure!):
Code:
\.svn\
.svn
*.svn
**\.svn
\_svn\
**\_svn

The correct/recommended way to create a copy of your content (without the .svn junk) is to use the svn export command (assuming you have svn on your system path). The syntax is:
Code:
svn export c:\source.controlled.folders\mywork\alaska\ c:\temporary.location\alaska\

If you don't have the svn command line tools on your path you can use Tortoise/whatever you have to do it graphically/via the UI. You only need the command line guy if you want to integrate it into your batch file(s).
(This post was last modified: 2012-03-13 18:01 by Sinnocence.)
find quote
Post Reply