Calibre OPDS (and HTML) PHP Server : web-based light alternative to Calibre content server / Calibre2OPDS to serve ebooks (epub, mobi, pdf, ...) http://blog.slucas.fr/en/oss/calibre-opds-php-server
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

205 lines
6.7KB

  1. <?php
  2. /**
  3. * COPS (Calibre OPDS PHP Server) class file
  4. *
  5. * @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
  6. * @author Sébastien Lucas <sebastien@slucas.fr>
  7. */
  8. if (!isset($config))
  9. $config = array();
  10. /*
  11. * The directory containing calibre's metadata.db file, with sub-directories
  12. * containing all the formats.
  13. * BEWARE : it has to end with a /
  14. * You can enable multiple database with this notation instead of a simple string :
  15. * $config['calibre_directory'] = array ("My database name" => "/home/directory/calibre1/", "My other database name" => "/home/directory/calibre2/");
  16. */
  17. $config['calibre_directory'] = './';
  18. /*
  19. * SPECIFIC TO NGINX
  20. * The internal directory set in nginx config file
  21. * Leave empty if you don't know what you're doing
  22. */
  23. $config['calibre_internal_directory'] = '';
  24. /*
  25. * Full URL prefix (with trailing /)
  26. * usefull especially for Opensearch where a full URL is sometimes required
  27. * For example Mantano requires it.
  28. */
  29. $config['cops_full_url'] = '';
  30. /*
  31. * Number of recent books to show
  32. */
  33. $config['cops_recentbooks_limit'] = '50';
  34. /*
  35. * Catalog's title
  36. */
  37. $config['cops_title_default'] = "COPS";
  38. /*
  39. * Catalog's subtitle
  40. */
  41. $config['cops_subtitle_default'] = "";
  42. /*
  43. * Wich header to use when downloading books outside the web directory
  44. * Possible values are :
  45. * X-Accel-Redirect : For Nginx
  46. * X-Sendfile : For Lightttpd or Apache (with mod_xsendfile)
  47. * No value (default) : Let PHP handle the download
  48. */
  49. $config['cops_x_accel_redirect'] = "";
  50. /*
  51. * Height of thumbnail image for OPDS
  52. */
  53. $config['cops_opds_thumbnail_height'] = "70";
  54. /*
  55. * Height of thumbnail image for HTML
  56. */
  57. $config['cops_html_thumbnail_height'] = "164";
  58. /*
  59. * Icon for both OPDS and HTML catalog
  60. * Note that this has to be a real icon (.ico)
  61. */
  62. $config['cops_icon'] = "favicon.ico";
  63. /*
  64. * Show icon for authors, series, tags and books on OPDS feed
  65. * 1 : enable
  66. * 0 : disable
  67. */
  68. $config['cops_show_icons'] = "1";
  69. /*
  70. * Default timezone
  71. * Check following link for other timezones :
  72. * http://www.php.net/manual/en/timezones.php
  73. */
  74. $config['default_timezone'] = "Europe/Paris";
  75. /*
  76. * Prefered format for HTML catalog
  77. * The two first will be displayed in book entries
  78. * The other only appear in book detail
  79. */
  80. $config['cops_prefered_format'] = array ("EPUB", "PDF", "AZW3", "MOBI", "CBR", "CBZ");
  81. /*
  82. * use URL rewriting for downloading of ebook in HTML catalog
  83. * See Github wiki for more information
  84. * 1 : enable
  85. * 0 : disable
  86. */
  87. $config['cops_use_url_rewriting'] = "0";
  88. /*
  89. * generate a invalid OPDS stream to allow bad OPDS client to use search
  90. * Example of non compliant OPDS client : FBReader (was working in May 2012), Moon+ Reader
  91. * Example of good OPDS client : Mantano
  92. * 1 : enable support for non compliant OPDS client
  93. * 0 : always generate valid OPDS code
  94. */
  95. $config['cops_generate_invalid_opds_stream'] = "0";
  96. /*
  97. * Max number of items per page
  98. * -1 unlimited
  99. */
  100. $config['cops_max_item_per_page'] = "-1";
  101. /*
  102. * split authors by first letter
  103. * 1 : Yes
  104. * 0 : No
  105. */
  106. $config['cops_author_split_first_letter'] = "1";
  107. /*
  108. * Enable of Fancyapps (for popups)
  109. * 1 : Yes (enable)
  110. * 0 : No
  111. */
  112. $config['cops_use_fancyapps'] = "1";
  113. /*
  114. * Update Epub metadata before download
  115. * 1 : Yes (enable)
  116. * 0 : No
  117. */
  118. $config['cops_update_epub-metadata'] = "0";
  119. /*
  120. * Filter on tags to book list
  121. * Only works with the OPDS catalog
  122. * Usage : array ("I only want to see books using the tag : Tag1" => "Tag1",
  123. * "I only want to see books not using the tag : Tag1" => "!Tag1",
  124. * "I want to see every books" => "",
  125. *
  126. * Example : array ("All" => "", "Unread" => "!Read", "Read" => "Read")
  127. */
  128. $config['cops_books_filter'] = array ();
  129. /*
  130. * Custom Columns to add as an array containing the lookup names
  131. * configured in Calibre
  132. *
  133. * For example : array ("genre", "mycolumn");
  134. *
  135. * Note that for now only the first, second and forth type of custom columns are supported
  136. */
  137. $config['cops_calibre_custom_column'] = array ();
  138. /*
  139. * Rename .epub to .kepub.epub if downloaded from a Kobo eReader
  140. * The ebook will then be recognized a Kepub so with chaptered paging, statistics, ...
  141. * You have to enable URL rewriting if you want to enable kepup.epub download
  142. * 1 : Yes (enable)
  143. * 0 : No
  144. */
  145. $config['cops_provide_kepub'] = "0";
  146. /*
  147. * Enable and configure Send To Kindle (or Email) feature.
  148. *
  149. * Don't forget to authorize the sender email you configured in your Kindle's Approved Personal Document E-mail List.
  150. *
  151. * If you want to use a simple smtp server (provided by your ISP for example), you can configure it like that :
  152. * $config['cops_mail_configuration'] = array( "smtp.host" => "smtp.free.fr",
  153. * "smtp.username" => "",
  154. * "smtp.password" => "",
  155. * "smtp.secure" => "",
  156. * "address.from" => "cops@slucas.fr"
  157. * );
  158. *
  159. * For Gmail :
  160. * $config['cops_mail_configuration'] = array( "smtp.host" => "smtp.gmail.com",
  161. * "smtp.username" => "YOUR GMAIL ADRESS",
  162. * "smtp.password" => "YOUR GMAIL PASSWORD",
  163. * "smtp.secure" => "ssl",
  164. * "address.from" => "cops@slucas.fr"
  165. * );
  166. */
  167. $config['cops_mail_configuration'] = array( "smtp.host" => "smtp.free.fr",
  168. "smtp.username" => "",
  169. "smtp.password" => "",
  170. "smtp.secure" => "",
  171. "address.from" => "cops@slucas.fr"
  172. );
  173. /*
  174. * Use filter in HTML catalog
  175. * 1 : Yes (enable)
  176. * 0 : No
  177. */
  178. $config['cops_html_tag_filter'] = "0";