Batch File Archive

Discussion in 'Tools and other software' started by Lightning303, January 30, 2014.

  1. Lightning303
    • Premium Supporter

    Lightning303 MP Donator

    Joined:
    September 12, 2009
    Messages:
    798
    Likes Received:
    384
    Gender:
    Male
    Ratings:
    +578 / 0
    Home Country:
    Germany Germany
    Show System Specs
    Hey,
    im running small batch files on my HTPC on resume to handle stuff like backups and starting epg grabbing. I thought i would share them. Also i think its a nice idea to start a thread where everybody can share their batchfiles, so when somebody is looking for a specific solution they can find it here.



    I hope others will add their batch scripts here aswell, and i will then link them directly in this post. Please dont add them as files, but as text in code tags.

    Batch Scripts:
    • - Allow to start a batch file only once a day
      Show Spoiler

      Code (Text):
      1. @echo off
      2. set LastDate=C:\LastDate.txt
      3. set TempDate=C:\Date.tmp
      4.  
      5. if exist %TempDate% exit
      6.      
      7. echo %date%>%TempDate%
      8. fc %TempDate% %LastDate% >nul
      9. if %ERRORLEVEL%==1 goto NewDay
      10. goto End
      11.      
      12. :NewDay
      13. :: What to do
      14.      
      15. :End
      16. move %TempDate% %LastDate%
      17. exit
    • - Backup Files (e.g. Mediaportal Databases)
      Show Spoiler

      Code (Text):
      1. :: Backing up everything from D:, and keeping the backups for 7 days.
      2. xcopy D:\*.* D:\temp\ /y/q
      3. FOR /F "tokens=1,2 delims=:" %%d IN ('date /t') DO set dat=%%d
      4. FOR /F "tokens=1,2 delims=:" %%i IN ('time /t') DO set zeit=%%i-%%j
      5. rename D:\temp "Backup %dat%%zeit%"
      6. FOR /F "skip=7 tokens=*" %%c IN ('DIR /O-D /B D:\"Backup *"') DO (rd D:\"%%c" /s/q)
    • - Start WebGrab++ and keep TVServer from going crazy
      Show Spoiler

      Code (Text):
      1. "C:\Program Files (x86)\ServerCare\WebGrab+Plus\WebGrab+Plus.exe"
      2. xcopy "C:\ProgramData\Team MediaPortal\MediaPortal TV Server\xmltv\temp.xml" "C:\ProgramData\Team MediaPortal\MediaPortal TV Server\xmltv\tvguide.xml" /Y
    • Comskip by @eisblock
    • Copy ClearArt and ClearLogos to Mediaportal folders by @ixdvc
    • Backup local fanart by @ixdvc
     
    Last edited: March 16, 2014
    • Like Like x 5
  2. Google AdSense Guest Advertisement



    to hide all adverts.
  3. eisblock

    eisblock Portal Pro

    Joined:
    March 19, 2010
    Messages:
    98
    Likes Received:
    11
    Ratings:
    +27 / 0
    Show System Specs
    comskip.4.bat
    Code (Text):
    1. @ECHO OFF
    2.  
    3. SET CS_PATH=C:\Programme\Comskip
    4. SET CS_LOGO=
    5. SET CS_DEF_INI=--ini="%CS_PATH%\Channel_ini\_default.ini"
    6.  
    7.  
    8. CALL :comskipstart %1 %2
    9. GOTO :ende
    10.  
    11.  
    12. :comskipstart
    13. :: ini festlegen
    14.     IF EXIST "%CS_PATH%\Channel_ini\%~2.ini" (
    15.         SET CS_DEF_INI=--ini="%CS_PATH%\Channel_ini\%~2.ini"
    16.     )
    17.    
    18. :: Logo festlegen, falls gewünscht
    19. REM     IF EXIST "%CS_PATH%\Channel_logo\%~2.logo.txt" (
    20. REM         SET CS_LOGO=--logo="%CS_PATH%\Channel_logo\%~2.logo.txt"
    21. REM     )
    22.  
    23. :: Log Ausgabe  
    24.     ECHO.FILE....: %1 >"%~dpn1.bat.log"
    25.     ECHO.CHANNL..: %2    >>"%~dpn1.bat.log"
    26.     ECHO.INI.....: %CS_DEF_INI% >>"%~dpn1.bat.log"
    27.     ECHO.LOGO....: %CS_LOGO% >>"%~dpn1.bat.log"
    28.     ECHO.........: comskip.4.bat, startet nun comskip.exe :........ >>"%~dpn1.bat.log"
    29.  
    30.  
    31. :: Kopiere Timeshift
    32. ::    START /MIN  %CS_PATH%\CopyTimeshift.bat "%~1"
    33.    
    34. :: execute comskip --debugwindow .... START
    35.     %CS_PATH%\comskip.exe --ts %CS_DEF_INI% %CS_LOGO% %1
    36.  
    37. GOTO :ende
    38.  
    39. :ende
     
    • Thank You! Thank You! x 1
  4. ixdvc

    ixdvc Portal Pro

    Joined:
    May 26, 2009
    Messages:
    227
    Likes Received:
    31
    Gender:
    Male
    Ratings:
    +37 / 0
    Home Country:
    Germany Germany
    Show System Specs
    I use Ember Media Manager to scrape nfos and fanart for my TV shows. I also like to download clearart and clearlogos directly from fanart.tv to select the ones I like best and save them to the show folders. Then the XBMC clients are able to find them.
    So I wrote a batch file to copy those cleararts and clearlogos to the MePo thumbs folder. The files have to be renamed to the show id which is read from tvshow.nfo in the show folder.

    Make a backup of your current cleararts and clearlogos from
    Code (Text):
    1. C:\ProgramData\Team MediaPortal\MediaPortal\thumbs\ClearArt\
    2. C:\ProgramData\Team MediaPortal\MediaPortal\thumbs\ClearLogo\
    3. C:\ProgramData\Team MediaPortal\MediaPortal\thumbs\TVSeries\ClearArt\
    4. C:\ProgramData\Team MediaPortal\MediaPortal\thumbs\TVSeries\ClearLogo\
    as those are overwritten without question.
    Show Spoiler
    Code (Text):
    1. @echo off
    2. set thumbspath=C:\ProgramData\Team MediaPortal\MediaPortal\thumbs
    3.  
    4. IF exist "%thumbspath%\ClearArt\Series" ( echo %thumbspath%\ClearArt\Series exists ) ELSE ( mkdir "%thumbspath%\ClearArt\Series" && echo %thumbspath%\ClearArt\Series created )
    5. IF exist "%thumbspath%\ClearLogo\Series" ( echo %thumbspath%\ClearLogo\Series exists ) ELSE ( mkdir "%thumbspath%\ClearLogo\Series" && echo %thumbspath%\ClearLogo\Series created )
    6. IF exist "%thumbspath%\TVSeries\ClearArt\FullSize" ( echo %thumbspath%\TVSeries\ClearArt\FullSize exists ) ELSE ( mkdir "%thumbspath%\TVSeries\ClearArt\FullSize" && echo %thumbspath%\TVSeries\ClearArt\FullSize created )
    7. IF exist "%thumbspath%\TVSeries\ClearLogo\FullSize" ( echo %thumbspath%\TVSeries\ClearLogo\FullSize exists ) ELSE ( mkdir "%thumbspath%\TVSeries\ClearLogo\FullSize" && echo %thumbspath%\TVSeries\ClearLogo\FullSize created )
    8.  
    9. set seriesfolder=%~dp0
    10.  
    11. for /D %%G in (*) do (
    12.     pushd %%G
    13.     set series=%%G
    14.     REM if %cd%==%seriesfolder% goto :eof
    15.     call :getid
    16. )
    17.  
    18. :getid
    19. FOR /F "tokens=1-2 delims=<>, " %%I in (tvshow.nfo) do (
    20.     REM echo %%I
    21.     if %%I==id (
    22.         set tvshowid=%%J
    23.         goto :copying
    24.     )
    25. )
    26.  
    27. :copying
    28. echo ID for %series% is %tvshowid%. Copying images.
    29. copy "clearart.png" "%thumbspath%\clearart\Series\%tvshowid%.png"
    30. copy "logo.png" "%thumbspath%\clearlogo\Series\%tvshowid%.png"
    31. copy "clearart.png" "%thumbspath%\TVSeries\ClearArt\FullSize\%tvshowid%.png"
    32. copy "logo.png" "%thumbspath%\TVSeries\ClearLogo\FullSize\%tvshowid%.png"
    33. popd
    34.  
    35. :eof
    36. cd %~dp0

    And I have another batch file to backup my local fanart (all png and jpg files from the show folder). The backup folder can be set in the second line:
    Show Spoiler
    Code (Text):
    1. @echo off
    2. set backuppath=C:\fanartbkp
    3.  
    4. IF exist "%backuppath%" ( echo %backuppath% exists ) ELSE ( mkdir "%backuppath%" && echo %backuppath% created )
    5.  
    6. set seriesfolder=%~dp0
    7.  
    8. for /D %%G in (*) do (
    9.     pushd %%G
    10.     set series=%%G
    11.     REM if %cd%==%seriesfolder% goto :eof
    12.     call :copying
    13. )
    14.  
    15. :copying
    16. echo Copying images for %series%.
    17. IF exist "%backuppath%\%series%\" ( echo %backuppath%\%series%\ exists ) ELSE ( mkdir "%backuppath%\%series%\" && echo %backuppath%\%series%\ created )
    18. copy "*.png" "%backuppath%\%series%\"
    19. copy "*.jpg" "%backuppath%\%series%\"
    20. popd
    21.  
    22. :eof
    23. cd %~dp0

    Both batch files are meant to be run from your base TV show path, it should be like that:
    Code (Text):
    1. TV Shows
    2. |----TV Show 1
    3. | |--clearart.png
    4. | |--logo.png
    5. |----TV Show 2
    6. | |--files
    7. |----fanart.bat
    8. |----fanart-backup.bat
    9.  
    And those batch files do not like to be run from UNC paths. So your folder has to be mounted as a network drive at least temporarily.
     
    • Thank You! Thank You! x 1
Loading...

Users Viewing Thread (Users: 0, Guests: 0)

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice
  • About The Project

    The vision of the MediaPortal project is to create a free open source media centre application, which supports all advanced media centre functions, and is accessible to all Windows users.

    In reaching this goal we are working every day to make sure our software is one of the best.

             

  • Support MediaPortal!

    The team works very hard to make sure the community is running the best HTPC-software. We give away MediaPortal for free but hosting and software is not for us.

    Care to support our work with a few bucks? We'd really appreciate it!