home *** CD-ROM | disk | FTP | other *** search
/ Chip 2011 November / CHIP_2011_11.iso / Programy / Narzedzia / Calibre / calibre-0.8.18.msi / file_281 < prev    next >
Text File  |  2011-01-25  |  7KB  |  170 lines

  1. @echo OFF
  2. REM Batch File to start a Calibre configuration on Windows
  3. REM giving explicit control of the location of:
  4. REM  - Calibe Program Files
  5. REM  - Calibre Library Files
  6. REM  - Calibre Config Files
  7. REM  - Calibre Metadata database
  8. REM  - Calibre Source files
  9. REM  - Calibre Temp Files
  10. REM By setting the paths correctly it can be used to run:
  11. REM  - A "portable calibre" off a USB stick.
  12. REM  - A network installation with local metadata database
  13. REM    (for performance) and books stored on a network share 
  14. REM  - A local installation using customised settings
  15. REM
  16. REM If trying to run off a USB stick then the folder structure
  17. REM shown below is recommended (relative to the location of 
  18. REM this batch file).  This can structure can also be used
  19. REM when running of a local hard disk if you want to get the
  20. REM level of control this batch file provides.
  21. REM  - Calibre2            Location of program files
  22. REM  - CalibreConfig        Location of Configuration files
  23. REM  - CalibreLibrary        Location of Books and metadata
  24. REM  - CalibreSource         Location of Calibre Source files (Optional)
  25. REM
  26. REM This batch file is designed so that if you create the recommended
  27. REM folder structure then it can be used 'as is' without modification.
  28.  
  29.  
  30. REM -------------------------------------
  31. REM Set up Calibre Config folder
  32. REM
  33. REM This is where user specific settings
  34. REM are stored.
  35. REM -------------------------------------
  36.  
  37. IF EXIST CalibreConfig (
  38.     SET CALIBRE_CONFIG_DIRECTORY=%cd%\CalibreConfig
  39.     ECHO CONFIG FILES:    %cd%\CalibreConfig
  40. )
  41.  
  42.  
  43. REM --------------------------------------------------------------
  44. REM Specify Location of ebooks
  45. REM
  46. REM Location where Book files are located
  47. REM Either set explicit path, or if running from a USB stick
  48. REM a relative path can be used to avoid need to know the
  49. REM drive letter of the USB stick.
  50. REM
  51. REM Comment out any of the following that are not to be used
  52. REM (although leaving them in does not really matter)
  53. REM --------------------------------------------------------------
  54.  
  55. IF EXIST U:\eBooks\CalibreLibrary (
  56.     SET CALIBRE_LIBRARY_DIRECTORY=U:\eBOOKS\CalibreLibrary
  57.     ECHO LIBRARY FILES:   U:\eBOOKS\CalibreLibrary
  58. )
  59. IF EXIST CalibreLibrary (
  60.     SET CALIBRE_LIBRARY_DIRECTORY=%cd%\CalibreLibrary
  61.     ECHO LIBRARY FILES:   %cd%\CalibreLibrary
  62. )
  63.  
  64.  
  65. REM --------------------------------------------------------------
  66. REM Specify Location of metadata database (optional)
  67. REM
  68. REM Location where the metadata.db file is located.  If not set
  69. REM the same location as Books files will be assumed.  This.
  70. REM options is used to get better performance when the Library is
  71. REM on a (slow) network drive.  Putting the metadata.db file 
  72. REM locally then makes gives a big performance improvement.
  73. REM
  74. REM NOTE.  If you use this option, then the ability to switch
  75. REM        libraries within Calibre will be disabled.  Therefore
  76. REM        you do not want to set it if the metadata.db file
  77. REM        is at the same location as the book files.
  78. REM --------------------------------------------------------------
  79.  
  80. IF EXIST %cd%\CalibreMetadata\metadata.db (
  81.     IF NOT "%CALIBRE_LIBRARY_DIRECTORY%" == "%cd%\CalibreMetadata" (
  82.         SET CALIBRE_OVERRIDE_DATABASE_PATH=%cd%\CalibreMetadata\metadata.db
  83.         ECHO DATABASE:        %cd%\CalibreMetadata\metadata.db
  84.         ECHO '
  85.         ECHO ***CAUTION*** Library Switching will be disabled 
  86.         ECHO '
  87.     )
  88. )
  89.  
  90. REM --------------------------------------------------------------
  91. REM Specify Location of source (optional)
  92. REM
  93. REM It is easy to run Calibre from source
  94. REM Just set the environment variable to where the source is located
  95. REM When running from source the GUI will have a '*' after the version.
  96. REM number that is displayed at the bottom of the Calibre main screen.
  97. REM --------------------------------------------------------------
  98.  
  99. IF EXIST CalibreSource\src (
  100.     SET CALIBRE_DEVELOP_FROM=%cd%\CalibreSource\src
  101.     ECHO SOURCE FILES:    %cd%\CalibreSource\src
  102. )
  103.  
  104.  
  105. REM --------------------------------------------------------------
  106. REM Specify Location of calibre binaries (optional)
  107. REM
  108. REM To avoid needing Calibre to be set in the search path, ensure
  109. REM that Calibre Program Files is current directory when starting.
  110. REM The following test falls back to using search path .
  111. REM This folder can be populated by copying the Calibre2 folder from
  112. REM an existing installation or by installing direct to here.
  113. REM --------------------------------------------------------------
  114.  
  115. IF EXIST %cd%\Calibre2 (
  116.     CD %cd%\Calibre2
  117.     ECHO PROGRAM FILES:   %cd%
  118. )
  119.  
  120.  
  121. REM --------------------------------------------------------------
  122. REM Location of Calibre Temporary files  (optional)
  123. REM
  124. REM Calibre creates a lot of temproary files while running
  125. REM In theory these are removed when Calibre finishes, but
  126. REM in practise files can be left behind (particularily if
  127. REM any errors occur.  Using this option allows some
  128. REM explicit clean-up of these files.
  129. REM If not set Calibre uses the normal system TEMP location
  130. REM --------------------------------------------------------------
  131.  
  132. SET CALIBRE_TEMP_DIR=%TEMP%\CALIBRE_TEMP
  133. ECHO TEMPORARY FILES: %CALIBRE_TEMP_DIR%
  134.  
  135. IF NOT "%CALIBRE_TEMP_DIR%" == "" (
  136.     IF EXIST "%CALIBRE_TEMP_DIR%" RMDIR /s /q "%CALIBRE_TEMP_DIR%"
  137.     MKDIR "%CALIBRE_TEMP_DIR%"
  138.     REM set the following for any components that do
  139.     REM not obey the CALIBRE_TEMP_DIR setting
  140.     SET TMP=%CALIBRE_TEMP_DIR%
  141.     SET TEMP=%CALIBRE_TEMP_DIR%
  142. )
  143.  
  144.  
  145. REM ----------------------------------------------------------
  146. REM  The following gives a chance to check the settings before
  147. REM  starting Calibre.  It can be commented out if not wanted.
  148. REM ----------------------------------------------------------
  149.  
  150. ECHO '
  151. ECHO "Press CTRL-C if you do not want to continue"
  152. PAUSE
  153.  
  154.  
  155. REM --------------------------------------------------------
  156. REM Start up the calibre program.
  157. REM
  158. REM The use of 'belownormal' priority helps keep the system
  159. REM responsive while Calibre is running.  Within Calibre itself
  160. REM the backgound processes should be set to run with 'low' priority.
  161.  
  162. REM Using the START command starts up Calibre in a separate process.
  163. REM If used without /WAIT opotion launches Calibre and contines batch file.
  164. REM Use with /WAIT to wait until Calibre completes to run a task on exit
  165. REM --------------------------------------------------------
  166.  
  167. ECHO "Starting up Calibre"
  168. ECHO OFF
  169. ECHO %cd%
  170. START /belownormal Calibre --with-library "%CALIBRE_LIBRARY_DIRECTORY%"