Newznab Documentation Release 0.2.3-dev Newznab April 23, 2015 Contents 1 2 3 Overview 1.1 About . . . . . . . . . . . . . . . . . . . . . 1.2 How it Works . . . . . . . . . . . . . . . . . 1.3 Choosing Newsgroups . . . . . . . . . . . . 1.4 Updating Index (populating binaries + parts) 1.5 Categorization . . . . . . . . . . . . . . . . 1.6 Missing Parts . . . . . . . . . . . . . . . . . 1.7 Backfilling Groups . . . . . . . . . . . . . . 1.8 Regex Matching . . . . . . . . . . . . . . . 1.9 Regex Details . . . . . . . . . . . . . . . . . 1.10 Regex Updating . . . . . . . . . . . . . . . 1.11 NZB File Storage . . . . . . . . . . . . . . . 1.12 SSL Usenet Connection . . . . . . . . . . . 1.13 Importing & Exporting NZBs . . . . . . . . 1.14 Google Ads/Analytics . . . . . . . . . . . . 1.15 Admin . . . . . . . . . . . . . . . . . . . . 1.16 TvRage . . . . . . . . . . . . . . . . . . . . 1.17 TvRage - Series & Episode Info . . . . . . . 1.18 NFO . . . . . . . . . . . . . . . . . . . . . 1.19 Caching . . . . . . . . . . . . . . . . . . . . 1.20 IMDb, TMDb and Rotten Tomatoes . . . . . 1.21 3rd Party API Keys . . . . . . . . . . . . . . 1.22 Content/CMS . . . . . . . . . . . . . . . . . 1.23 Skinning & Themes . . . . . . . . . . . . . 1.24 Web API . . . . . . . . . . . . . . . . . . . 1.25 Debugging . . . . . . . . . . . . . . . . . . 1.26 Development . . . . . . . . . . . . . . . . . 1.27 Hall of Fame . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 5 6 6 6 6 6 6 6 7 7 7 7 8 Install 2.1 Prerequisites . . . . . . . . . . 2.2 Installation . . . . . . . . . . . 2.3 Updating . . . . . . . . . . . . 2.4 Running Outside of Web Root . 2.5 Sample Apache VirtualHost File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 9 10 10 10 10 Guides 3.1 Memcached with Newznab Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 13 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . i 3.2 3.3 4 FAQ 4.1 4.2 4.3 4.4 4.5 4.6 4.7 4.8 4.9 4.10 4.11 4.12 4.13 4.14 4.15 4.16 4.17 4.18 4.19 4.20 4.21 4.22 4.23 4.24 4.25 4.26 Newznab on Ubuntu 11.10 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Newznab on Ubuntu 14.04.2 x64 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Authorization rejected from nntp server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . White screen instead of web page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Lots of binary headers processed but few releases created . . . . . . . . . . . . . . . . . . . . . . . Search and raws earch requests lose page CSS styling . . . . . . . . . . . . . . . . . . . . . . . . . Error: Server did not return article numbers 1234567 . . . . . . . . . . . . . . . . . . . . . . . . . . Error: Connection timed out . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Error: Session error during install step1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Error in TMDb.php with strstr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Error: PEAR::isError() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Error: 502 Bad Gateway . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Error: curl_init() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Error: “MySQL server has gone away...” . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Movies with a large number of releases are not listing the releases properly . . . . . . . . . . . . . . No previews or media info . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Php cli not seeing that curl is installed on a wamp server . . . . . . . . . . . . . . . . . . . . . . . . Updating releases is taking forever . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Error: Parts failed to insert . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Error: stream_socket_client or “Failed to write to socket” . . . . . . . . . . . . . . . . . . . Error: PHP Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given Error: You must have POSIX and PCNTL functions to use PowerSpawn . . . . . . . . . . . . . . . No releases appear in audio or console view . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Error: “Notice: Trying to get property of non-object in C:xampphtdocsnnpluswwwinstallindex.php on line 50” . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Sphinx not updating Delta index. New releases not visible . . . . . . . . . . . . . . . . . . . . . . . Sphinx error PHP Notice: Undefined index: total-documents in /var/www/newznab/htdocs/www/lib/sphinx.php on line 331 . . . . . . . . . . . . . . . . . . . . . . Script terminating early when using freebsd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . If you are seeing this in your error log: Fatal error: Class ‘COM’ not found . . . . . . . . . . . . . . 15 24 35 35 35 35 35 35 35 36 36 36 36 36 36 37 37 37 37 37 38 38 38 38 38 38 38 39 39 5 Settings 5.1 Admin Hangout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.2 Admin Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 41 41 6 Config 6.1 Config.php . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 43 7 Miscellaneous 7.1 Web API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.2 Sphinx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.3 Update Scripts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 47 73 80 8 Software license for Newznab+ 8.1 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.2 Terms and Conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83 83 83 9 Todo 87 10 Glossary 89 11 Developer Docs 11.1 lib/TMDb.php . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 91 ii 11.2 11.3 11.4 11.5 11.6 11.7 11.8 11.9 11.10 11.11 11.12 11.13 11.14 11.15 11.16 11.17 11.18 11.19 11.20 11.21 11.22 11.23 11.24 11.25 11.26 11.27 11.28 11.29 11.30 11.31 11.32 11.33 11.34 11.35 11.36 11.37 11.38 11.39 11.40 11.41 11.42 11.43 11.44 11.45 11.46 11.47 11.48 11.49 11.50 11.51 11.52 lib/adminpage.php . . . . . lib/amazon.php . . . . . . . lib/anidb.php . . . . . . . . lib/backfill.php . . . . . . . lib/binaries.php . . . . . . . lib/book.php . . . . . . . . lib/category.php . . . . . . lib/console.php . . . . . . . lib/content.php . . . . . . . lib/episode.php . . . . . . . lib/forum.php . . . . . . . . lib/genres.php . . . . . . . lib/groups.php . . . . . . . lib/install.php . . . . . . . . lib/installpage.php . . . . . lib/menu.php . . . . . . . . lib/movie.php . . . . . . . . lib/music.php . . . . . . . . lib/nfo.php . . . . . . . . . lib/nntp.php . . . . . . . . . lib/nzb.php . . . . . . . . . lib/nzbinfo.php . . . . . . . lib/page.php . . . . . . . . lib/postprocess.php . . . . . lib/powerspawn.php . . . . lib/predb.php . . . . . . . . lib/rarinfo.php . . . . . . . lib/recaptchalib.php . . . . lib/releasecomments.php . . lib/releaseextra.php . . . . . lib/releasefiles.php . . . . . lib/releaseimage.php . . . . lib/releaseregex.php . . . . lib/releases.php . . . . . . . lib/rottentomato.php . . . . lib/sabnzbd.php . . . . . . . lib/site.php . . . . . . . . . lib/sitemaps.php . . . . . . lib/sphinx.php . . . . . . . lib/thetvdb.php . . . . . . . lib/trakt.php . . . . . . . . lib/tvrage.php . . . . . . . . lib/usermovies.php . . . . . lib/users.php . . . . . . . . lib/userseries.php . . . . . . lib/util.php . . . . . . . . . lib/zipfile.php . . . . . . . . lib/framework/basepage.php lib/framework/cache.php . . lib/framework/db.php . . . misc/sphinx/nnindexer.php . 12 Indices and tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 95 96 97 97 98 99 103 104 105 105 106 106 107 109 109 110 111 112 113 113 113 114 114 115 116 117 122 123 124 125 125 125 126 129 130 130 131 131 135 136 136 137 138 140 141 141 142 143 143 144 145 iii iv Newznab Documentation, Release 0.2.3-dev Below you’ll find a collection of useful bits of information about setting up and running your own Newznab install. Please be sure to read through the overview, install and FAQs very carefully. Contents 1 Newznab Documentation, Release 0.2.3-dev 2 Contents CHAPTER 1 Overview 1.1 About Newznab+ is a PHP/Smarty application, which supports the indexing of usenet headers into a MySQL database and provides a simple web based search interface onto the data. It includes simple CMS facilities, SEO friendly URLs and is designed with the intention of allowing users to create a community around their index. For information on how to install, please refer to INSTALL.txt To discuss visit us on IRC at irc.synirc.net #newznab, or use the web client. Newznab+ is licensed under a non redistributable license. For details, please refer to LICENCE.txt. An open source (GPLv3) edition of Newznab is freely available for those wishing to create derivative works. 1.2 How it Works Usenet groups are specified, message headers (binaries and parts) are downloaded for the groups, releases are created from completed sets of binaries by applying regex to the message subject. Releases are categorized by regexing the message subject. Metadata from TvRage, TMDb, Rotten Tomatoes, IMDb and Amazon are applied to each created release. After a configurable number of days the header data is deleted from the database, but the releases remain. 1.3 Choosing Newsgroups Groups can be manually entered if you know the name. Groups can also be bulk added when specified as a regular expression. For example if you want to index the groups alt.bin.blah.* and alt.bin.other use the value alt.bin.blah.*|alt.bin.other. 1.4 Updating Index (populating binaries + parts) The recommended way to schedule updates is via the dos and unix start scripts in /path/to/newznab/misc/update_scripts/. Make sure you set the paths correctly for your installation. If you are running on unix environment, there is an experimental multithreaded update binaries script named update_binaries_threaded.php and backfill_threaded.php. You can alter the number of threads used by editing the maxChildren setting. For more information on updating and backfilling, see the docs for update scripts. 3 Newznab Documentation, Release 0.2.3-dev 1.5 Categorization Most categorization of releases is done at the time of applying the regex. However if no category is supplied for a regex then \www\lib\category.php contains the logic which attempts to map a release to a site category. Site categories are used to make browsing NZBs easier. Add new categories by updating the category table, and adding a new Category constant, then map it in the function determineCategory. 1.6 Missing Parts When headers are requested from the usenet provider, they are asked for in number ranges e.g. 1-1000, 1001-2000 etc. For various reasons sometimes the provider does not return a header, this is not always because the header does not exist, there may be some synchronization going on at the providers end. If a header is requested but not returned, we store a record of this in the table partrepair. Each time update_binaries is run an attempt is made to go back and get the missing parts. If after five attempts the parts can still not be obtained, Newznab gives up. When update_releases runs, if a release is seen to have missing parts it will not be released until four hours after it was uploaded to usenet. this is so a chance has been made to repair all missing parts. After four hours a release will be created anyway and its down to the quality of the PAR files to determine whether a release can be correctly unpacked. 1.7 Backfilling Groups Since most usenet providers have 800+ days of retention indexing all that information in one shot is not practical. Newznab provides a backfill feature that allow you to index past articles once your initial index has been built. To use the feature first set the back fill days setting in the group(s) to be backfilled to the number of day you wish to go back, making sure to set it higher than the number of days listed in the first post column. Once set run the backfill.php script in misc/update_scripts. Groups can be backfilled to a particular date using the script misc/update_scripts/backfill_date.php using the syntax: php backfill_date.php 2011-05-15 alt.binaries.groupname.here You can use the _threaded version of this script if on linux. For more information on backfilling, see Update Scripts. 1.8 Regex Matching Releases are created by applying regexs to binary message subjects. Different regexs are applied to binaries from different newsgroups. Catchall regexs are applied to any binaries left unmatched after the group specific matching. A category can be associated with a regex, which will allow the processing of groups like a.b.inner-sanctum which contain a combination of different binary types. 1.9 Regex Details Regexes are used to parse the subject header to create definable release names. There are two named capturing groups used for this, ‘name’ and ‘parts’. The (?P<name>) capturing group is used to define the final release name as well as the text that the binaries are grouped on. It is required to use this named capturing group in the regex. 4 Chapter 1. Overview Newznab Documentation, Release 0.2.3-dev The (?P<parts>) capturing group defines the total number of parts needed in order to make a release. Most posters include the total number of binaries in the subject header however some do not. When the (?P<parts>) capturing group is omitted from the regex, newznab will wait 5? hours after the postdate of the last binary before making them into a release to ensure the final release is complete. This capturing group is optional. 1.10 Regex Updating Regexs in the system with IDs in the range 0-10000 are system defined and are updated centrally and are retrieved from Newznab’s server. Every time processReleases is run, a check will be performed to see if you have the latest regexs. If you do not want this check to be made then set site.latestregexurl to null. 1.11 NZB File Storage NZBs are saved to disk, in a compressed gzip format, at the location specified by site.nzbpath in subdirectories based on the first character of the release guid; this just makes the directories a bit easier to manage when you have thousands of nzb.gz files. The default path is /website/../nzbfiles. 1.12 SSL Usenet Connection Install the OpenSSL extension, set in config.php: define (’NNTP_SSLENABLED’, true); 1.13 Importing & Exporting NZBs NZB files can be imported from the admin interface (or cli). Importing is a convenient way to fill the index without trawling a large backdated number of usenet messages. After running an import the processReleases function must be run to create valid releases. NZBs can also be exported based on system categories. A script is available to simplify a large import here. 1.14 Google Ads/Analytics To integrate Google Analytics and AdSense, provide the AdSense ad module IDs into the site table for the searchbox (bottom of menu). Providing an Analytics ID will include the Analytics javascript in the footer. 1.15 Admin Admin functions all live under the URL /admin/ which is only accessible by users with admin role. users.role to be 2 on the users you wish to be admins. 1.10. Regex Updating Set 5 Newznab Documentation, Release 0.2.3-dev 1.16 TvRage After processReleases is called, an attempt is made to determine the TvRage IDs for every release which looks like its TV. This also works out the series/episode columns. The data in the TvRage table will become populated from best guesses from the TvRage search API. If some of these guesses are wrong, you can manually edit the TvRage data in the admin interface and use the remove link to wipe any releases which have that rageid and then manually call ‘process tv’ which will attempt to relink rage data. When a new release is created it goes in with release.rageid = -1 when TV is processed, the rageid either goes to the best guess, or to -2, which indicates that either no match could be made or the release isn’t perceived to be TV. 1.17 TvRage - Series & Episode Info Information about a particular episode of a series is requested from services.tvrage.com using a shared Newznab api key is used to retrieve this data. It assigns an ‘aired date’ to each release if a match is found. 1.18 NFO NFOs are attempted to be retrieved using a queuing method. There will be a number of attempts to get an NFO before giving up. 1.19 Caching Caching of queries results to aid performance and is supported by using memcache, apc or file. In the config.php file edit the CACHEOPT_METHOD constant to either memcache, apc or file. You can additionally configure the memcache server/port address. There is a default caching TTL of 15 minutes, which when enabled, is applied to queries in the main browsing lists. 1.20 IMDb, TMDb and Rotten Tomatoes If enabled, and if an IMDb ID is found in the NFO, the application will attempt to use that IMDb ID to get general data about the movie (title, year, genre, covers, etc.) from themoviedb.org. If no entry is available from TMDb then an attempt to gather the info from imdb.com is made. Any results are stored in the moveinfo table, with covers/backdrops being saved to the images/covers/ directory. 1.21 3rd Party API Keys In order to do lookups to TMDb, Rotten Tomatoes and Amazon, API keys are used. Newznab ships with some default keys, but due to the restrictions on use of APIs, it is strongly suggested you go and get your own API keys for each service and save them using the site edit page. 1.22 Content/CMS Pages can be added to the site with SEO friendly URLs via the /admin/. 6 Chapter 1. Overview Newznab Documentation, Release 0.2.3-dev 1.23 Skinning & Themes Avoid custom edits to code and stylesheets to make updating painless. Override any styles by creating a folder \www\theme\<yourtheme>\style.css. Stick any custom images in \www\theme\<yourtheme>\images\. Then pick the theme in the admin/site-edit page. Your styles should override the existing style sheet, which should always be loaded in. 1.24 Web API www.sitename.com/api? provides API access to query and retrieve NZBs. Call www.sitename.com/apihelp to see help doc with all available options. Users either have to be logged in or provide their rsstoken. Users can use their rsstoken to access both rss + api. Full details of the API and how to implement it are provided in the Web API docs. 1.25 Debugging Switch php.ini error_reporting to E_ALL and ensure logging to browser is enabled. 1.26 Development Here is a brief overview of the location of various Newznab components. For more detailed information, see the appropriate sections in the docs. \db\schema.sql The latest database schema. You should be able to rerun in and create new blank schema. \db\patch\ Database upgrade patch files. If you update from svn you will need to apply all patches since last update. \db\cache\ If file based caching is enabled the cache objects are stored here. \misc\ Used for general docs and useful info, nothing in here is referenced by the application. \misc\update_scripts\ Shell, batch scripts and php files to call the updating of index from cli \nzbfiles Default folder for all gzipped NZBs to be stored. \www\install\ Installer files. \www\lib\framework A few general classes for db/http code. \www\lib\smarty Copy of a fairly recent Smarty lib, used for template rendering. \www\lib\ All classes used in the app, typically named same as its database entity \www\covers\ All covers downloaded for releases. \www\pages\ Controllers for every frontend page in the system. \www\admin\ All php pages used by the admin. \www\views\templates\admin All templates used by the admin pages. \www\views\templates\frontend All templates used by the user pages. \www\views\themes\<yourtheme> Blank area for implementation specific UI customizations. \www\views\scripts\ Javscript dumping ground. 1.23. Skinning & Themes 7 Newznab Documentation, Release 0.2.3-dev \www\views\styles\ Default theme css (don’t edit, extend with your own theme). 1.27 Hall of Fame (just some of the) people who’ve helped along the way: [email protected] [email protected] fatfecker@newznab [email protected] [email protected] [email protected] pleo@newznab lordgnu@newznab bb@newznab keyvan@newznab troph@bhw [email protected] midgetspy@sickbeard ueland@newznab [email protected] hecks@tvnzb michael@newznab sakarias@newznab pairdime@sabnzbd pmow@sabnzbd poutine@newznab bigdave@newznab duz@sabnzbd inpheaux@sabnzbd spooge@newznab sy@newznab magegminds@newznab trizz@newznab emanon@newznab fubaarr@newznab mobiKalw@newznab crudehung@newznab www.famfamfam.com [email protected] 8 regexs, sessions regexs mediainfo ffmpeg tv password, hash yenc, nntp, bokko, dev anidb sphinx, mobile, docs powerspawn, threading dev backfill performance testing,icons rage integration,api installer api rar api dev testing jquery,css headers,backfill recaptcha testing yenc design, nzb testing testing, regexs, amazon lighttpd rewrite rules lighttpd rewrite rules testing testing testing nginx rewrite rules icons docs Chapter 1. Overview CHAPTER 2 Install 2.1 Prerequisites • PHP – php version 5.2 or higher (5.3 recommended, lower versions may give warnings on some functions) – sessions enabled – memory limit at 256MB or more – minimum execution time of 60+ seconds – make sure you update the php.ini for both web and cli – OpenSSL (if connecting to SSL usenet provider) – php register_globals off – php5-curl library installed • GD Imaging Library w/PHP integration • PEAR • MySQL – max_allowed_packet = 12582912 – group_concat_max_len = 8192 – timezone set to php’s • Apache – script timeout of at least 60 seconds – mod_rewrite enabled – AllowOverride All set in conf to allow .htaccess to specify rewrite rules • 3rd Party API Keys (recommended to get your own api keys) – TMDb (signup @ http://api.themoviedb.org/2.1/) – Amazon (signup @ https://affiliate-program.amazon.com/gp/advertising/api/detail/main.html) – Rotten Tomatoes (signup @ http://developer.rottentomatoes.com) • Deep RAR Password Inspection 9 Newznab Documentation, Release 0.2.3-dev – unrar version 3.9 or higher • Thumbnailing and Media Info (if deep rar inspection is enabled) – ffmpeg – mediainfo 2.2 Installation 1. Unzip/svn checkout the code into a folder in your web directory. do NOT move directories around. 2. Create your website/vhost in apache and point to the /www/ directory. 3. Browse to http://yournewznabserver/install. nb. refer to the list of requirements above if you encounter any errors during install, or the FAQ in the README 4. Once installed activate only one or two groups to test with first (a.b.linux.iso is a good choice), this will save you time if it is not working correctly. 5. Run the update_binaries.php and update_releases.php scripts in miscupdate_scriptsvia command-line. 6. If updating was successful then you can continue to setup your site and configure the update scripts for auto-updating. windows users use the script /misc/update_scripts/win_scripts/runme.bat linux users use the /misc/update_scripts/nix_scripts/newznab_screen.sh 2.3 Updating 1. cd to the root of the newznab directory and run svn update 2. Run misc/update_scripts/update_database_version.php 3. Delete contents of cached smarty files in /www/lib/smarty/templates_c/* 4. DO NOT IMPORT REGEX.SQL or SCHEMA.SQL 2.4 Running Outside of Web Root Set /.htaccess RewriteBase to your virtual directory 2.5 Sample Apache VirtualHost File Add this to your existing VHOST file modifying your values for ServerName, Server Alias, and DocumentRoot. You should find this under /etc/apache2/sites-enabled/ (000-default): <VirtualHost *:80> <Directory /domains/www/example.com/newz/www/> Options FollowSymLinks AllowOverride All Order allow,deny allow from all </Directory> ServerAdmin [email protected] 10 Chapter 2. Install Newznab Documentation, Release 0.2.3-dev ServerName example.com ServerAlias www.example.com DocumentRoot /domains/www/example.com/newz/www LogLevel warn ServerSignature Off </VirtualHost> 2.5. Sample Apache VirtualHost File 11 Newznab Documentation, Release 0.2.3-dev 12 Chapter 2. Install CHAPTER 3 Guides 3.1 Memcached with Newznab Server This guide will help you install memcached on your new server (assuming you’ve just followed the Ubuntu 14.04.2 guide). Note: This assumes you know linux in general, and know how to use CLI. Guide written by Stifler. Find me on synIRC #newznab Version 0.1 - Initial Release Version 0.2 - Added memcache install and confiure; 3.1.1 Step 1: Install Memcached Memcached is in the Ubuntu repository and is up to date.: sudo apt-get install php5-memcached memcached php5-dev Easy!!! You now have memcached. Now it should have automagically started and also restarted your Apache2, but in case: sudo service memcached start 3.1.2 Step 2: Lets get some monitoring INSTALL Lets install phpMemcacheAdmin so we can monitor memcached. It can be found here : http://blog.elijaa.org/ At the time of writing version 1.2.2 was the latest, so in terminal: cd /tmp wget http://phpmemcacheadmin.googlecode.com/files/phpMemcachedAdmin-1.2.2-r262.tar.gz cd /var/www sudo mkdir phpmemcacheadmin cd phpmemcacheadmin sudo tar -zxvf /tmp/phpMemcachedAdmin-1.2.2-r262.tar.gz 13 Newznab Documentation, Release 0.2.3-dev Note: replace phpMemcachedAdmin-1.2.2-r262.tar.gz with whatever the current version is. Serving the page Time to get apache2 to serve the new webpage.: sudo nano /etc/apache2/sites-available/phpmemcacheadmin.conf Now paste this into the file: <VirtualHost *:12323> ServerName phpmemcacheadmin UseCanonicalName Off ServerAdmin "[email protected]" DocumentRoot "/var/www/phpmemcacheadmin" CustomLog /var/log/phpmemcacheadmin-access_log common ErrorLog /var/log/phpmemcacheadmin-error_log </VirtualHost> Save the file. Now we need to listen on the port 12323: sudo nano /etc/apache2/ports.conf Find the line Listen 80 and add Listen 12323 under it. Then save the file. Now we have to enable the site: sudo a2ensite phpmemcacheadmin Finally, we need to enable the phpmemcacheadmin some write permissions: cd /var/www/phpmemcacheadmin/ sudo chmod 777 Config Finally, restart apache so the page is served: sudo service apache2 restart Now you should be able to browse to http://yourserver:12323 and see the monitoring page. 3.1.3 Step 3: Memcache extension for PHP Now we need to install and setup the memcache extension. First we have to install it: sudo pecl install memcache That will build the extension and install it in /var/lib/php5 Next we need to enable the extension in php.ini. Note: There are two php.ini files, edit both of them and make the same changes to both files. sudo nano /etc/php5/cli/php.ini and: 14 Chapter 3. Guides Newznab Documentation, Release 0.2.3-dev sudo nano /etc/php5/apache2/php.ini Find these are labelled Dynamic Extensions and add the following line: extension=memcache.so Save the file. Once you have changed both files, you can now restart apache2. Note: Stop your screen script(s) first. sudo service apache2 restart Now you can restart your screen scripts. 3.1.4 Step 4: Enable Memcached and configuration Firstly we need to enable newznab to use memcache: sudo nano /var/www/newznab/www/config.php Find define(’CACHEOPT_METHOD’, ’none’); and change it to: define(’CACHEOPT_METHOD’, ’memcache’); Save the file and restart apache2: sudo service apache2 restart If you need to tweak the settings for memcached, they are located in this file /etc/memcached.conf Done!! 3.2 Newznab on Ubuntu 11.10 This guide covers installing Newznab+ on a fresh copy of Ubuntu 11.10 64-bit server and assumes a basic knowledge of using Linux via the command line. TODO: Install and configure Memcache? 3.2.1 Install Ubuntu Grab a copy of Ubuntu from their website and install it. Once the install is complete, log in, fire up a terminal window, do a full upgrade and reboot (entering your password when prompted): sudo sudo sudo sudo apt-get update apt-get -y upgrade apt-get -y dist-upgrade reboot You’ll probably want to install SSH if you don’t have it already: sudo apt-get install -y ssh Additionally, we’re going to be compiling some code from source, so we’ll need the tools to do so: 3.2. Newznab on Ubuntu 11.10 15 Newznab Documentation, Release 0.2.3-dev sudo apt-get install build-essential checkinstall 3.2.2 Install Newznab Once Ubuntu is installed and updated, we can begin installing Newznab. Before we get started though, we need to decide where to install Newznab. Typically, web-related stuff goes in /var/www/, so lets put Newznab in /var/www/newznab. Let’s create the directory and set it writeable by our user for now: sudo mkdir -p /var/www/newznab sudo chmod 777 /var/www/newznab Now we can begin installing the prerequisites. Prerequisites Newznab as a few dependencies, so let’s start with installing the required software. According to the install docs, Newznab needs the following software: 1. PHP 5.2+ 2. GD Imaging Library w/PHP integration 3. PEAR 4. Database: MySQL (or Percona) 5. Web Server: Apache (or Nginx) Its worth mentioning a few things at this point. The first is that the default version of MySQL that comes with Ubuntu is kind of old (version 5.1). Therefore, we’ll also cover installing a higher-performance version (Percona version 5.5) instead. Additionally, Apache is listed as a requirement, however it is possible to use a different web server instead. Therefore, we’ll go over how to use the blazing-fast Nginx as well for those who don’t want to use Apache. The following software is optional, but we’ll also cover installing it and setting it up: 1. Unrar 2. FFmpeg 3. Lame 4. MediaInfo 5. Sphinx By the end of this guide we’ll have a fully working Newznab+ install with all optional components working as well. PHP Let’s start by installing PHP and required PHP extensions: sudo apt-get install -y php5 php5-dev php-pear php5-gd php5-mysql php5-curl The install docs also say that PHP needs a few tweaks. Using your favorite text-editor (I’m using nano) open up php.ini: sudo nano /etc/php5/cli/php.ini Scroll down and look for register_globals, make sure it is set to: 16 Chapter 3. Guides Newznab Documentation, Release 0.2.3-dev register_globals = Off Next, look for max_execution_time, and set it to (2 minutes): max_execution_time = 120 Next, look for memory_limit, and either set it to 1024M, or -1 for no limit: memory_limit = 1024M While you’re here, you should also set PHP’s date.timezone (a list of available timezone settings can be found here): date.timezone = Europe/London That should do it for PHP for the time being (we’ll come back to it when we configure the web server). Database You have a few options here, we’ll cover two: 1. Use MySQL 5.1 2. Use Percona 5.5 I’d recommend that you use Percona, but the choice is yours. Pick one and follow one of the sections below (do not install MySQL and Percona). MySQL 5.1 If you decided to use MySQL, simply install it via aptitude: sudo apt-get install mysql-server-5.1 mysql-client-5.1 libmysqlclient-dev Percona 5.5 Installing Percona requires a little extra work upfront, but in the long run it is generally worth it as Percona is a high-tuned fork of MySQL. The first step is to add Percona into aptitude: gpg --keyserver hkp://keys.gnupg.net --recv-keys 1C4CBDCDCD2EFD2A gpg -a --export CD2EFD2A | sudo apt-key add - That retrieves and installs the GPG keys needed to add Percona’s aptitude repository. Now we need to tell aptitude about the repositories: sudo sh -c "echo sudo sh -c "echo sudo sh -c "echo \"\n#Percona\" >> /etc/apt/sources.list" \"deb http://repo.percona.com/apt lenny main\" >> /etc/apt/sources.list" \"deb-src http://repo.percona.com/apt lenny main\" >> /etc/apt/sources.list" Now update and install it: sudo apt-get update sudo apt-get install -y percona-server-client-5.5 \ percona-server-server-5.5 \ libmysqlclient-dev It’ll ask for a password to use for the MySQL root user, so pick one and remember it. 3.2. Newznab on Ubuntu 11.10 17 Newznab Documentation, Release 0.2.3-dev Web Server OK, now for the web server. Once again, you have multiple choices and we’ll cover two: 1. Apache 2. Nginx Apache is “easier” and generally more flexible, but it also tends to be a system hog. So, if you can’t make up your mind it is probably best to take the easy route and install Apache. If you feel like squeezing the most out of your machine and you are a little more skilled with configuring software, Nginx might be a good choice. Again, pick one and follow the steps below (don’t install both). Apache First install it: sudo apt-get install -y apache2 You’ll also need to configure the php.ini for Apache, so follow the section above about configuring PHP (from above), but this time, edit the file /etc/php5/apache2/php.ini: sudo nano /etc/php5/apache2/php.ini Let’s create the site configuration file for Apache. Open up a new file: sudo nano /etc/apache2/sites-available/newznab Here is a template you can use for this file. You should change settings where appropriate for your setup: <VirtualHost *:80> ServerAdmin webmaster@localhost ServerName localhost # You might want to change this # These paths should be fine DocumentRoot /var/www/newznab/www ErrorLog /var/log/apache2/error.log LogLevel warn </VirtualHost> Now we need to disable the default Apache settings, enable the one we just created for Newznab and enable modrewrite: sudo sudo sudo sudo a2dissite default a2ensite newznab a2enmod rewrite service apache2 restart Nginx First install it: sudo apt-get install -y nginx Now, for Nginx there are multiple ways to serve PHP files. Probably the best is php-fpm, which is basically a daemon that runs and serves PHP to Nginx. So, let’s go ahead and install that now: sudo apt-get install -y php5-fpm You’ll also need to configure the php.ini for FPM, so follow the section above about configuring PHP (from above), but this time, edit the file /etc/php5/fpm/php.ini: 18 Chapter 3. Guides Newznab Documentation, Release 0.2.3-dev sudo nano /etc/php5/fpm/php.ini Just for good measure, restart the daemon: sudo /etc/init.d/php5-fpm restart Let’s create the configuration file for Nginx. Open a new file: sudo nano /etc/nginx/sites-available/newznab Here is a template you can use for this file. You should change settings where appropriate for your setup: server { # Change these settings to match your machine listen 80 default_server; server_name localhost; # Everything below here doesn’t need to be changed access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; root /var/www/newznab/www/; index index.html index.htm index.php; location ~* \.(?:ico|css|js|gif|inc|txt|gz|xml|png|jpe?g) { expires max; add_header Pragma public; add_header Cache-Control "public, must-revalidate, proxy-revalidate"; } location / { try_files $uri $uri/ @rewrites; } location @rewrites { rewrite ^/([^/\.]+)/([^/]+)/([^/]+)/? /index.php?page=$1&id=$2&subpage=$3 last; rewrite ^/([^/\.]+)/([^/]+)/?$ /index.php?page=$1&id=$2 last; rewrite ^/([^/\.]+)/?$ /index.php?page=$1 last; } location /admin { } location /install { } location ~ \.php$ { include /etc/nginx/fastcgi_params; fastcgi_pass 127.0.0.1:9000; # The next two lines should go in your fastcgi_params fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; } } Let’s make sure that the Nginx logs directory exists and is writeable: sudo mkdir -p /var/log/nginx sudo chmod 755 /var/log/nginx Now, let’s disable the default Nginx site handler and enable our newznab configuration: sudo unlink /etc/nginx/sites-enabled/default sudo ln -s /etc/nginx/sites-available/newznab /etc/nginx/sites-enabled/newznab 3.2. Newznab on Ubuntu 11.10 19 Newznab Documentation, Release 0.2.3-dev Finally, let’s restart Nginx: sudo service nginx restart Extras unrar Unrar is used to extract files from releases. Installing unrar is trivial: sudo apt-get install -y unrar FFmpeg Once again, the version of FFmpeg in Ubuntu’s repository is old and crusty, so lets build a newer one and also add x264 support. Start by grabbing the source code we need: wget http://ffmpeg.org/releases/ffmpeg-0.8.7.tar.gz wget ftp://ftp.videolan.org/pub/videolan/x264/snapshots/last_stable_x264.tar.bz2 sudo apt-get install -y libfaac-dev libjack-jackd2-dev \ libmp3lame-dev libopencore-amrnb-dev \ libopencore-amrwb-dev libsdl1.2-dev libtheora-dev \ libva-dev libvdpau-dev libvorbis-dev libx11-dev \ libxfixes-dev texi2html yasm zlib1g-dev \ libdirac-dev libxvidcore-dev Let’s build x264 first: mkdir x264 tar --strip-components=1 -jxf last_stable_x264.tar.bz2 -C x264 cd x264 ./configure --enable-static make sudo checkinstall --pkgname=x264 --pkgversion="3:$(./version.sh | \ awk -F’[" ]’ ’/POINT/{print $4$5}’)" \ --backup=no --deldoc=yes --fstrans=no --default Now, onto FFmpeg: cd ../ tar xvfz ffmpeg-0.8.7.tar.gz cd ffmpeg-0.8.7/ ./configure --enable-gpl --enable-libfaac --enable-libmp3lame \ --enable-libopencore-amrnb --enable-libopencore-amrwb \ --enable-libtheora --enable-libvorbis --enable-libx264 \ --enable-nonfree --enable-postproc --enable-version3 \ --enable-x11grab --enable-libdirac --enable-libxvid make sudo checkinstall --pkgname=ffmpeg --pkgversion="5:0.8.7" --backup=no \ --deldoc=yes --fstrans=no --default hash x264 ffmpeg ffplay ffprobe Lame Lame is used for processing audio samples: sudo apt-get install -y lame MediaInfo MediaInfo is used to gain information about various types of media files found in releases. In order to install it we simply need to add the MediaInfo aptitude repository: 20 Chapter 3. Guides Newznab Documentation, Release 0.2.3-dev sudo sudo sudo sudo apt-get install -y python-software-properties add-apt-repository ppa:shiki/mediainfo apt-get update apt-get install -y mediainfo Sphinx Sphinx is used for full-text searching. It is insanely fast and if you really want your Newznab+ install to fly, it is highly recommended. Unfortunately the version in Ubuntu’s aptitude repository is horribly old, so we’ll need to build a newer version. Let’s download the source and extract it: wget http://sphinxsearch.com/files/sphinx-2.0.2-beta.tar.gz tar xvfz sphinx-2.0.2-beta.tar.gz cd sphinx-2.0.2-beta Download and extract libstemmer_c: wet http://snowball.tartarus.org/dist/libstemmer_c.tgz tar --strip-components=1 -zxf libstemmer_c.tgz -C libstemmer_c Configure it: ./configure --prefix=/usr/local --with-libstemmer Now we’re ready to compile Sphinx. For this step you can speed up the compilation on a multi-core system. If you have a 4-core system, for example, you can do (replace j4 with the number of cores your machine has): make -j4 Once that finally finished, install it: sudo checkinstall --pkgname=sphinx --pkgversion="2.0.2-beta" --backup=no \ --deldoc=yes --fstrans=no --default Now we have a nice new version of Sphinx installed in /usr/local. Binaries are installed in /usr/local/bin. Newznab Source Finally, we can now begin installing Newznab! We’ll be grabbing the latest and greatest version, so we’ll need Subversion installed first: sudo apt-get install -y subversion Now we can check out the Newznab code: svn co svn://svn.newznab.com/nn/branches/nnplus /var/www/newznab At this point we might as well set the permissions on a couple of directories as well: sudo sudo sudo sudo sudo sudo sudo chmod chmod chmod chmod chmod chmod chmod 777 777 777 777 777 777 777 /var/www/newznab/www/lib/smarty/templates_c /var/www/newznab/www/covers/movies /var/www/newznab/www/covers/anime /var/www/newznab/www/covers/music /var/www/newznab/www /var/www/newznab/www/install /var/www/newznab/nzbfiles/ 3.2. Newznab on Ubuntu 11.10 21 Newznab Documentation, Release 0.2.3-dev 3.2.3 Configure Newznab Now that Newznab is installed, we need to configure it. Configuration is done via a web browser. Run Installer It is now time to configure Newznab. This is done via a web-based installer. Open up http://localhost/install in a web browser (or whatever the address/IP address is of your server) and follow the guided steps. Enable Groups Head over to /admin/group-list.php in your web browser and pick some groups to index by clicking “activate” on a few groups. Set Paths and Options Make sure to set your newznab ID. We need to let Newznab know where all the extra software is that we installed earlier, so head over to /admin/site-edit.php in your browser, scroll down to the “3rd Party Application Paths” section and update the fields: Unrar Path /usr/bin/unrar Mediainfo Path /usr/bin/mediainfo Ffmpeg Path /usr/local/bin/ffmpeg Lame Path /usr/bin/lame If you’d like to enable audio previews, check Save audio preview. It is worthwhile to do rar checking, so set Check For Passworded Releases to Deep. That’s it for configuration right now, but don’t close your browser yet as we’ll be coming back to the configuration page when configuring Sphinx. 3.2.4 Indexing Back at the command line its time to fire up the binaries and releases update scripts: cd /var/www/newznab/misc/update_scripts The update_scripts folder contains a lot of scripts. The most important ones are update_binaries.php and update_releases.php. If you have any experience with screen or tmux, it is highly recommended that you use one of these to run the update scripts, as it will allow you to monitor the update process, observe and resolve issues; this is especially important for newcomers to Newznab. With that said, Newznab also ships with an init-sytle script that can be installed to make Newznab run more or less as a daemon that will start and stop with startup and shutdown, respectively. Screen or tmux If you want to go the screen or tmux route, you’ll need to pick one and install it: 22 Chapter 3. Guides Newznab Documentation, Release 0.2.3-dev # Install screen... sudo apt-get install -y screen # ...or tmux sudo apt-get install -y tmux In the nix_scripts directory there is a useful script called newznab_screen.sh that runs update_binaries.php and update_releases.php, in addition to a few other scripts, continuously and automatically. First, we need to modify it however, so lets change dir and make a copy: cd /var/www/newznab/misc/update_scripts/nix_scripts cp newznab_screen.sh newznab_screen_local.sh Now open newznab_screen_local.sh in a text editor and modify NEWZNAB_PATH near the top to point to our installation path: nano newznab_screen_local.sh Set NEWZNAB_PATH: export NEWZNAB_PATH="/var/www/newznab/misc/update_scripts" Now we can run the script via screen: screen sh newznab_screen_local.sh You should see the script download headers for the groups that you have enabled and then run various stages that will attempt to group and catalogue the headers. For now, just leave the script running and detach from screen by typing cntl a d. 3.2.5 Sphinx As mentioned previously, Sphinx is a fast full-text indexer. By default, it is disabled in Newznab, so go ahead and enable it by visiting /admin/site-edit.php and setting “Use Sphinx” to “Yes”. While there, you’ll also notice that there are a few other configuration options for Sphinx. By default, Sphinx will index all of the release information, however, there are three other optional indexes: NZB contents, NFO contents and release files. Enabling these optional indexes will add increased processing time, so you will likely want to experiment to see what combination works best for your hardware. For now, you don’t have to enable any of the optional indexes. To get Sphinx running, we need to generate a sphinx.conf file. To do this we’ll use the nnindexer.php script in misc/sphinx: cd /var/www/newznab/misc/sphinx ./nnindexer generate The script will print out the location of the sphinx.conf file, which by default will be /var/www/newznab/sphinx/sphinx.conf. This path needs to be entered into the “Sphinx Configuration Path” setting located at /admin/site-edit.php. Now we need to start the search daemon and create the indexes and restart the daemon: ./nnindexer.php ./nnindexer.php ./nnindexer.php ./nnindexer.php ./nnindexer.php daemon index full all index delta all daemon --stop daemon 3.2. Newznab on Ubuntu 11.10 23 Newznab Documentation, Release 0.2.3-dev 3.2.6 Summary of Installed Software • PHP v5.3.6 • Pear v1.9.2 • MySQL v5.1.58 or • Percona v5.5.17 • Apache v2.2.20 or • Nginx 1.0.5 • FFmpeg v0.8.7 • MediaInfo v0.7.50 • Lame v3.98.4 • unrar v4.00-beta3 • Sphinx 2.0.2-beta 3.3 Newznab on Ubuntu 14.04.2 x64 This guide will help you install everything you need to get Newznab+ running on a fresh Ubuntu server. It will run through all the requirements for intalling: PHP, Apache2, phpmyadmin, Percona, unrar, Lame, Mediainfo, subversion, screen, tmux, Sphinxsearch, ffmpeg and of course Newznab+ itself. It will then go on to help you get Newznab+ basically configured and background scripts running. Note: This assumes you know linux in general, and know how to use CLI. Note: This is a step-by-step guide. I am assuming that you are not tinkering with locations of installation et cetera. If you decide to install Newznab+ elsewhere or put unrar in your home directory, there will be other changes you will have to make. Guide written by Stifler. Find me on synIRC #newznab Version 0.1 - Initial Release Version 0.2 - fixed typos; fixed incorrect character encoding; added install nano; fixed subversion install; added key_buffer change Version 0.3 - sphinxsearch installation change; 3.3.1 Step 1: Install Ubuntu 14.04.2 Download the iso image of Ubuntu Server 14.04.2 amd64. On the start page (after you select your language) hit F4 and select “install a minimal system” (or if you are doing it in a VM, “Install a minimal virtual machine”) and hit Enter. Hit Enter again to start the install. During the install choose region, keyboard, hostname, user name, timezone, partitions, etc and go get a beverage. Note: When it comes to asking what software to install, select “OpenSSH server” only. 24 Chapter 3. Guides Newznab Documentation, Release 0.2.3-dev 3.3.2 Step 2: Update Ubuntu Login into your new server and run: sudo apt-get -y update sudo apt-get -y upgrade sudo apt-get -y dist-upgrade The Next step is optional, it will update the kernel to version 4.0. cd /tmp/ wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.0-vivid/linux-headers-4.0.0-040000_4.0.0-040000 wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.0-vivid/linux-headers-4.0.0-040000-generic_4.0. wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.0-vivid/linux-image-4.0.0-040000-generic_4.0.0sudo dpkg -i linux-headers-4.0.0-*.deb linux-image-4.0.0-*.deb sudo reboot At this point you have a basic Ubuntu x64 Linux kernel 4.0.0 with SSH. Which if you haven’t already, can start using for the rest of the process if you need to. 3.3.3 Step 3: Install the necessities for NN+ Install php5 and some additional modules for it. At time of writing version 5.5.9 sudo apt-get install -y php5 php5-dev php-pear php5-gd php5-mysql php5-curl Install Percona and TokuDb. At time of writing version 5.6 sudo apt-key adv --keyserver keys.gnupg.net --recv-keys 1C4CBDCDCD2EFD2A sudo gpg -a --export CD2EFD2A | sudo apt-key add sudo sh -c "echo \"deb http://repo.percona.com/apt trusty main \ndeb-src http://repo.percona.com/apt sudo apt-get -y update sudo apt-get install percona-server-server-5.6 percona-server-client-5.6 Note: You will be asked to create a password for the DB server root user. sudo apt-get install -y percona-server-tokudb-5.6 sudo service mysql restart sudo ps_tokudb_admin --enable -p Note: You will be asked for the database password. Install apache2 sudo apt-get install -y apache2 Install unrar sudo apt-get install -y unrar 3.3. Newznab on Ubuntu 14.04.2 x64 25 Newznab Documentation, Release 0.2.3-dev Install Lame sudo apt-get install -y lame Install MediaInfo sudo apt-get install -y mediainfo Install Subversion (SVN) sudo apt-get install -y subversion Install Screen and tmux sudo apt-get install -y screen tmux Install Sphinx search Note: OMG! sphinxsearch is so far behind in Ubuntu!! Notice I even had to goto Precise to get one :-P Lets get a daily build instead.: sudo sudo sudo sudo sudo gpg --keyserver hkp://keys.gnupg.net --recv-keys B9D8946B16932B16 gpg -a --export 16932B16 | sudo apt-key add sh -c "echo \"deb http://ppa.launchpad.net/builds/sphinxsearch-daily/ubuntu precise main \ndeb-s apt-get -y update apt-get install -y sphinxsearch Install nano sudo apt-get install -y nano Install ffmpeg You have two options, either follow this https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu or better yet, do this: Copy the script from here: https://gist.github.com/xdamman/e4f713c8cd1a389a5917 Create a new script file: sudo nano ~/install_ffmpeg_ubuntu.sh Paste the script in and save the file. Then make it executable: sudo chmod 777 ~/install_ffmpeg_ubuntu.sh And run it: sudo ~/install_ffmpeg_ubuntu.sh 26 Chapter 3. Guides Newznab Documentation, Release 0.2.3-dev Whichever way you choose, you will be spending a lot of time drinking the beverage of your choice waiting for ffmpeg... Install phpmyadmin sudo apt-get install -y phpmyadmin Now let’s improve phpmyadmin security a bit: sudo a2disconf phpmyadmin sudo nano /etc/apache2/ports.conf Add Listen 12322 directly under Listen 80. This is where we will make phpmyadmin available. Save the file. Now we will create the new site phpmyadmin: sudo nano /etc/apache2/sites-available/phpmyadmin.conf Add this to the new file: <VirtualHost *:12322> ServerName phpmyadmin DocumentRoot /var/www/phpmyadmin </VirtualHost> Save the file. Create a symlink to phpmyadmin: sudo ln -s /usr/share/phpmyadmin /var/www/phpmyadmin Enable the site: sudo a2ensite phpmyadmin sudo service apache2 restart You will now be able to access phpmyadmin at http://yourserver:12322/ 3.3.4 Step 4: Modifying various settings to how we want. Editing php configuration (php.ini) Note: There are two php.ini files, edit both of them and make the same changes to both files. sudo nano /etc/php5/cli/php.ini and: sudo nano /etc/php5/apache2/php.ini Find these settings (under [PHP] section) and check/add/modify as necessary: ADD: register_globals = Off MODIFY: max_execution_time = 120 CONFIRM: memory_limit = -1 Next set date.timezone (under [Date] section) Remove the ‘;’ from the start of the line. For example: 3.3. Newznab on Ubuntu 14.04.2 x64 27 Newznab Documentation, Release 0.2.3-dev date.timezone = Europe/London Note: The timezone can be whatever, but it will need to be set the same as the database later. Creating the NN+ Website sudo nano /etc/apache2/sites-available/newznab.conf Add this to the new file: <VirtualHost *:80> <Directory /var/www/newznab/www/> Options FollowSymLinks AllowOverride All Order allow,deny allow from all </Directory> ServerAdmin [email protected] ServerName example.com ServerAlias www.example.com DocumentRoot /var/www/newznab/www LogLevel warn ServerSignature Off </VirtualHost> Save the file. Now to enable the new site, disable the default site and enable modrewrite. sudo sudo sudo sudo sudo service apache2 stop a2dissite 000-default.conf a2ensite newznab a2enmod rewrite service apache2 start Editing Percona configuration (mysql.cnf) sudo nano /etc/mysql/my.cnf Find these settings (under [mysqld] section) and check/add/modify as necessary: CONFIRM: max_allowed_packet = 16M ADD: group_concat_max_len = 8192 ADD: default_time_zone=’Europe/London’ MODIFY: key_buffer = 16M to key_buffer_size = 16M Save the file. Note: key_buffer is deprecated, and now becomes key_buffer_size Note: BEFORE you restart mysql import the timezones from Ubuntu into Percona database. Run the following: 28 Chapter 3. Guides Newznab Documentation, Release 0.2.3-dev mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -p mysql Note: This will ask for your database password. Now restart the database service: sudo service mysql restart Note: The timezone can be whatever, but it will need to be set the same as PHP. See the PHP section prior. 3.3.5 Step 5: The one you have been waiting for! Installing Newznab. cd /var/www sudo mkdir newznab sudo chmod 777 newznab sudo svn co svn://svn.newznab.com/nn/branches/nnplus /var/www/newznab Note: You will need your username and password from newznab to access the svn. When you run this command first time, it will ask you for the password of the user you are logged in with. Ignore that and just hit Enter, it will then ask for your svn username. sudo sudo sudo sudo sudo sudo sudo chmod chmod chmod chmod chmod chmod chmod 777 777 777 777 777 777 777 /var/www/newznab/www/lib/smarty/templates_c /var/www/newznab/www/covers/movies /var/www/newznab/www/covers/anime /var/www/newznab/www/covers/music /var/www/newznab/www /var/www/newznab/www/install /var/www/newznab/nzbfiles/ Once you have completed all that you should now be able to login at http://yourserver/ Note: Whilst probably not necessary, I would personally reboot at this point. 3.3.6 Step 6: Make Newznab+ do what you want it to do. Here we are going to setup some basics to get Newznab+ running. There are many more things can can and will need to be done. This is not going to cover everything, but you will be running after this. Configuration from the home page. Login to your server http://yourserver/ Click on "Go to step one: Pre flight check" Confirm that the preflight checklist is all **OK**. If not, you will need to fix those problems first Click on "Go to step two: Set up the database" Enter your database username ‘‘root‘‘ and your password. Leave the other settings as is. Click on "Setup Database" Click on "Step three: Setup news server connection" Enter your details for your news server. Click on "Test Connection" Click on "Step four: Cache Settings" 3.3. Newznab on Ubuntu 14.04.2 x64 29 Newznab Documentation, Release 0.2.3-dev Leave Click Click Enter Click Click Leave Click Caching Type on "None" on "Save configuration file" on "Step five: Setup admin user" the details you want for the administrator of Newznab+ on "Create Admin User" on "Step Seven: Set NZB File Path" the location as ‘‘/var/www/newznab/nzbfiles/‘‘ on "Set NZB File Path" Done! Click on the link to the admin page. Leave the browser open. Configure Sphinx Log into your Newznab server shell. First generate a config for sphinxsearch.: cd /var/www/newznab/misc/sphinx sudo ./nnindexer.php generate Next we need create the indexes.: sudo sudo sudo sudo sudo ./nnindexer.php ./nnindexer.php ./nnindexer.php ./nnindexer.php ./nnindexer.php daemon index full all index delta all daemon --stop daemon Configure Site Settings Back in your browser at the Admin Home. Click on the “hide this welcome message” so you can see the Status Alerts. There will probably be a couple of them. Note: Most obvious and important is the one that is telling you that your Newznab ID is missing. Now click on Edit Site and we will set a couple of basic items up. Scroll to the bottom of Main Site Settings, HTML Layout, Tags and you will see newznab ID:. Paste your ID in there. Scroll down to 3rd Party Application Paths and change the following: Unrar Path to : /usr/bin/unrar Mediainfo Path to: /usr/bin/mediainfo ffmpeg Path to : /usr/local/bin/ffmpeg Lame Path to : /usr/bin/lame Now scroll down further to Password Settings and change Check For Passworded Releases: to Deep (requires unrar) Now scroll further to Sphinx Settings and change Use Sphinx to Yes. ReleaseFiles to Yes. Then change Index Now scroll all the way to the bottom and hit Save Site Settings. 30 Chapter 3. Guides Newznab Documentation, Release 0.2.3-dev Configure Groups Under the Admin Functions click on View in View Add BulkAdd Groups. Click on Activate for a couple of the groups you want to index. You will probably want to add more groups later and you can do that by clicking on Add or BulkAdd under Admin Functions, View Add BulkAdd Groups. 3.3.7 Step 7: Running the scripts. To run the scripts we need to do it in either screen or tmux. The choice is yours, if you dont know either then I suggest screen first for its simplicity. I’ll use screen for this guide. Go back to your shell login and change to ‘’nix_scripts” directory. We will create our own script based on the default and modify it: cd /var/www/newznab/misc/update_scripts/nix_scripts sudo cp newznab_screen.sh mynewznab.sh sudo chmod 744 mynewznab.sh sudo nano mynewznab.sh Now modify the export NEWZNAB_PATH to: export NEWZNAB_PATH="/var/www/newznab/misc/update_scripts" Save the file and start screen.: screen -S newznab Run the script.: sudo ./mynewznab.sh You should now see the script start to run. To exit the screen and leave the script running press [CTRL]-[a] and then [d]. At anytime you wish to go back into the screen to see what is happening run: screen -r newznab 3.3.8 Step 8: Changing your database engine to TokuDb or InnoDb for Newznab the tables. Once you have your Newznab site configured, before you get a large database you may wish to convert to TokuDB for the table engine. Note: Stop your screen script first. Start mysql in a shell: mysql -u root -p Note: You will need your database password. Once logged in: 3.3. Newznab on Ubuntu 14.04.2 x64 31 Newznab Documentation, Release 0.2.3-dev use newznab; Paste this: SET @DATABASE_NAME = ’newznab’; SELECT CONCAT(’ALTER TABLE ‘’, table_name, ’‘ ENGINE=TokuDB;’) AS sql_statements FROM information_schema.tables AS tb WHERE table_schema = @DATABASE_NAME AND ‘ENGINE‘ = ’MyISAM’ AND ‘TABLE_TYPE‘ = ’BASE TABLE’ ORDER BY table_name DESC; Copy all the lines printed on the screen. Now paste it back into the same window and hit Enter (twice probably). Note: If you are using putty to ssh into your server you can hold Down the ALT key then select with the mouse, and then right click which will paste what you highlighted. don’t select the pretty ‘ASCII table’ suround. See example below. Note: I have left the above like it is so you can modify it to suit your needs. Line 1, modify ‘newznab’ to whatever you have called your database. Line 2, change ‘TokuDB’ to whatever database you wish to use. Line 5, change ‘MyISAM’ to whatever the current database engine is. Type ‘quit’ to exit mysql. Done! An Example Paste: ALTER ALTER ALTER ALTER ALTER ALTER ALTER ALTER ALTER ALTER ALTER ALTER ALTER ALTER ALTER ALTER ALTER ALTER ALTER ALTER ALTER ALTER ALTER ALTER ALTER ALTER ALTER ALTER 32 TABLE TABLE TABLE TABLE TABLE TABLE TABLE TABLE TABLE TABLE TABLE TABLE TABLE TABLE TABLE TABLE TABLE TABLE TABLE TABLE TABLE TABLE TABLE TABLE TABLE TABLE TABLE TABLE ‘userseries‘ ENGINE=TokuDB; ‘users‘ ENGINE=TokuDB; ‘userroles‘ ENGINE=TokuDB; ‘userrequests‘ ENGINE=TokuDB; ‘usermovies‘ ENGINE=TokuDB; ‘userinvite‘ ENGINE=TokuDB; ‘userexcat‘ ENGINE=TokuDB; ‘userdownloads‘ ENGINE=TokuDB; ‘usercart‘ ENGINE=TokuDB; ‘upcoming‘ ENGINE=TokuDB; ‘tvrage‘ ENGINE=TokuDB; ‘thetvdb‘ ENGINE=TokuDB; ‘spotnabsources‘ ENGINE=TokuDB; ‘sphinx‘ ENGINE=TokuDB; ‘site‘ ENGINE=TokuDB; ‘roleexcat‘ ENGINE=TokuDB; ‘releasevideo‘ ENGINE=TokuDB; ‘releasesubs‘ ENGINE=TokuDB; ‘releases‘ ENGINE=TokuDB; ‘releaseregextesting‘ ENGINE=TokuDB; ‘releaseregex‘ ENGINE=TokuDB; ‘releasenfo‘ ENGINE=TokuDB; ‘releasefiles‘ ENGINE=TokuDB; ‘releaseextrafull‘ ENGINE=TokuDB; ‘releasecomment‘ ENGINE=TokuDB; ‘releaseaudio‘ ENGINE=TokuDB; ‘predb‘ ENGINE=TokuDB; ‘parts‘ ENGINE=TokuDB; Chapter 3. Guides Newznab Documentation, Release 0.2.3-dev ALTER ALTER ALTER ALTER ALTER ALTER ALTER ALTER ALTER ALTER ALTER ALTER ALTER ALTER ALTER ALTER TABLE TABLE TABLE TABLE TABLE TABLE TABLE TABLE TABLE TABLE TABLE TABLE TABLE TABLE TABLE TABLE ‘partrepair‘ ENGINE=TokuDB; ‘musicinfo‘ ENGINE=TokuDB; ‘movieinfo‘ ENGINE=TokuDB; ‘menu‘ ENGINE=TokuDB; ‘groups‘ ENGINE=TokuDB; ‘genres‘ ENGINE=TokuDB; ‘forumpost‘ ENGINE=TokuDB; ‘episodeinfo‘ ENGINE=TokuDB; ‘content‘ ENGINE=TokuDB; ‘consoleinfo‘ ENGINE=TokuDB; ‘category‘ ENGINE=TokuDB; ‘bookinfo‘ ENGINE=TokuDB; ‘binaryblacklist‘ ENGINE=TokuDB; ‘binaries‘ ENGINE=TokuDB; ‘animetitles‘ ENGINE=TokuDB; ‘anidb‘ ENGINE=TokuDB; 3.3. Newznab on Ubuntu 14.04.2 x64 33 Newznab Documentation, Release 0.2.3-dev 34 Chapter 3. Guides CHAPTER 4 FAQ Below is a collection of common questions and errors and their answers and solutions. Please read through this carefully before asking for help. 4.1 Authorization rejected from nntp server Check you have enough available connections not currently in use 4.2 White screen instead of web page This is probably a php error not being displayed to browser or session timed out and 403 being throw. 4.3 Lots of binary headers processed but few releases created The binary headers downloaded do not match the regexs used to create a release. The message headers must follow popular formats in order for releases to be created. 4.4 Search and raws earch requests lose page CSS styling Use the provided Apache VirtualHost. 4.5 Error: Server did not return article numbers 1234567 This isn’t necessarily a bad thing, see section on missing parts. 4.6 Error: Connection timed out If you’re seeing errors like: 35 Newznab Documentation, Release 0.2.3-dev Connection timed out. Reconnecting... Cannot connect to server ******* Already connected, disconnect first! Disabling compressed headers should solve the issue. 4.7 Error: Session error during install step1 Set register_globals to off in php.ini. 4.8 Error in TMDb.php with strstr If you’re seeing an error like: Warning: Wrong parameter count for ‘‘strstr()‘‘ in ‘‘newznab\www\lib\TMDb.php‘‘ on line 354 You’re most likely using the wrong php version; upgrade to version 5.3+. 4.9 Error: PEAR::isError() Error like: Strict Standards: Non-static method PEAR::isError() should not be called statically Set error_reporting = E_ALL ^ E_STRICT in php.ini. 4.10 Error: 502 Bad Gateway Error at $cfg->pearCheck = @include(’System.php’); solved by adding in open_basedir path to pear. 4.11 Error: curl_init() Call to undefined function curl_init(). Make sure you are using the right php.ini file. If you are using WAMP, then the php.ini file that Apache uses is in the Apache /bin folder (not the php.ini in wamp/php). The php cli will use the first php.ini it can find in the Windows path environmental variable. In my case, this was an old version in another php directory I set up. Once I deleted that, it used the version in the /wamp/php directory. 4.12 Error: “MySQL server has gone away...” MySQL is dropping your connection. Adjust max_allowed_packet in my.cnf, which you should have already set according to the install docs, and if that doesn’t fix it, you can try adjusting mysql.connect_timeout in php.ini. 36 Chapter 4. FAQ Newznab Documentation, Release 0.2.3-dev 4.13 Movies with a large number of releases are not listing the releases properly Read the install docs (see group_concat_max_len under MySQL). 4.14 No previews or media info Check that you version of unrar > 3.8. 4.15 Php cli not seeing that curl is installed on a wamp server When you use the php cli windows uses php.exe inside the php wamp directory, that php is for web only really. Point Newznab to the php-win.exe in the same directory. The only script having problem was updatereleases.bat so in that script now looks like C:\wamp\bin\php\php5.3.5\php-win.exe update_releases.php 4.16 Updating releases is taking forever If updating releases appears to have frozen at Stage 8 . You have the header retention set too high, or during a large import have allowed too many parts/binaries to be inserted, and mysql takes a long time to prune the table. It will finish eventually, just be patient. 4.17 Error: Parts failed to insert If you’re getting the WARNING: xxx Parts failed to insert error it is likely that something went a little crazy with your parts table. In order to fix this you need to truncate (empty) your parts, partrepair and binaries tables and “reset” your groups. First, truncate your tables (SQL): TRUNCATE ‘parts‘; TRUNCATE ‘partrepair‘; TRUNCATE ‘binaries‘; Now, if the error occurred during normal update_binaries operation, then you don’t actually need to completely reset your groups table and instead you can just reset its knowledge of how to go “forward” (i.e. what to consider as new posts). You can do this like so: UPDATE groups SET last_record = 0; UPDATE groups SET last_record_postdate = NULL; If the error occurred while backfilling, you’ll most likely want to update first_record and first_record_postdate in the same manner. Additionally, you’ll probably want to set the “Where to start new groups” setting to the appropriate value (like 1 day, for example). 4.13. Movies with a large number of releases are not listing the releases properly 37 Newznab Documentation, Release 0.2.3-dev 4.18 Error: stream_socket_client or “Failed to write to socket” If you see errors like stream_socket_client or “Failed to write to socket” while trying to connect to your news server, it is possible that the standard NNTP ports (119 and 563) are being blocked (either by your ISP or a firewall). Try setting your NNTP port to 80 (for non-ssl) or 443 (for ssl), if you’re news server supports it (many do). 4.19 Error: PHP Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given Corrupted mysql tables. Run misc\update_scripts\optimise_db.php true to force an optimise and repair of all mysql tables. 4.20 Error: You must have POSIX and PCNTL functions to use PowerSpawn The threaded update scripts can only be run on Linux systems with posix installed. Recompile php with –enable-pcntl 4.21 No releases appear in audio or console view Check you are not using cover view and using the shared Amazon api key. Get your own key or switch to list view. 4.22 Error: “Notice: Trying to get property of non-object in C:xampphtdocsnnpluswwwinstallindex.php on line 50” Reinstall xampp. 4.23 Sphinx not updating Delta index. New releases not visible There is known issues with Windows. Solution is to change “preopen_indexes” from 1 to 0 in sphinx.conf 4.24 Sphinx error - PHP Notice: Undefined index: total-documents in /var/www/newznab/htdocs/www/lib/sphinx.php on line 331 Indexes have failed to be rotated from <indexname>.new.sph to <indexname>.sph. Sphinx expects the old files to be there. Solution is to goto the sphinxdata dir and: rm releases* touch releases.{spa,spd,sph,spi,spk,spm,spp,sps} touch releases_delta.{spa,spd,sph,spi,spk,spm,spp,sps} Then run a full + delta index for releases. See also http://sphinxsearch.com/forum/view.html?id=9859 38 Chapter 4. FAQ Newznab Documentation, Release 0.2.3-dev 4.25 Script terminating early when using freebsd Ensure all the php libraries are included: extension=gd.so extension=session.so extension=mysql.so extension=curl.so extension=xml.so extension=ctype.so extension=openssl.so extension=iconv.so extension=mysqli.so extension=hash.so extension=zlib.so extension=pcntl.so extension=posix.so extension=simplexml.so 4.26 If you are seeing this in your error log: Fatal error: Class ‘COM’ not found You require this in php.ini: [PHP_COM_DOTNET] extension=php_com_dotnet.dll Previously it was compiled as built-in on the Windows build. 4.25. Script terminating early when using freebsd 39 Newznab Documentation, Release 0.2.3-dev 40 Chapter 4. FAQ CHAPTER 5 Settings Newznab has a large number of variable settings which can be defined via the Admin interface. When you click on Admin you will be taken to the Admin Hangout. On the left hand side you will see a list of option under the title Admin Functions. This page is a work-in-progress and incomplete 5.1 Admin Hangout The Admin Hangout by default will show you a welcome page. The actual intention of the Admin Hangout is to show you any Status Alerts. You can enable this by clicking on hide this welcome message. The status messages can identify several issues: * * * * * * If there are any database patches that need to be run. Bad database version. Shared keys being used. High binary header retention Newznab ID missing. Mysql configuration issues. 5.2 Admin Functions 5.2.1 Home Will take you home, as defined by the Default Home Page in the Edit Site page. 5.2.2 Admin Home Will bring you back to the Admin Hangout. 41 Newznab Documentation, Release 0.2.3-dev 5.2.3 Edit Site 5.2.4 Add Edit Content Page 5.2.5 View Add Menu Items 5.2.6 Edit Categories 5.2.7 View Add BulkAdd Groups 5.2.8 View Add Test Send Regex 5.2.9 View Add Blacklist 5.2.10 View Releases 5.2.11 View Previews 5.2.12 View Add TVRage List 5.2.13 View TheTVDB List 5.2.14 View Add Movie List 5.2.15 View AniDB List 5.2.16 View Music List 5.2.17 View Console List 5.2.18 View Book List 5.2.19 Import Export Nzb’s 5.2.20 Optimise Tables 5.2.21 View Comments 5.2.22 View Add Spotnab Sources 5.2.23 View Add Users 5.2.24 View Add Roles 5.2.25 Site Stats Debug 42 Chapter 5. Settings CHAPTER 6 Config Config variables are stored in the config.php file at the root of the www directory. Unlike Settings, config options cannot be updated via the admin page and instead must be edited directly by modifying the contents of config.php.Below you will find detailed information on each option. 6.1 Config.php The file config.php file is located in newznab/www looks like this: <?php //========================= // Config you must change - updated by installer. //========================= define(’DB_TYPE’, ’mysql’); define(’DB_HOST’, ’localhost’); define(’DB_PORT’, 3306); define(’DB_USER’, ’username’); define(’DB_PASSWORD’, ’password’); define(’DB_NAME’, ’newznab’); define(’DB_INNODB’, false); define(’DB_PCONNECT’, true); define(’DB_ERRORMODE’, PDO::ERRMODE_SILENT); define(’NNTP_USERNAME’, ’username’); define(’NNTP_PASSWORD’, ’password’); define(’NNTP_SERVER’, ’my.newsserver.com’); define(’NNTP_PORT’, ’563’); define(’NNTP_SSLENABLED’, true); define(’CACHEOPT_METHOD’, ’none’); define(’CACHEOPT_TTLFAST’, ’120’); define(’CACHEOPT_TTLMEDIUM’, ’600’); define(’CACHEOPT_TTLSLOW’, ’1800’); define(’CACHEOPT_MEMCACHE_SERVER’, ’127.0.0.1’); define(’CACHEOPT_MEMCACHE_PORT’, ’11211’); // define(’EXTERNAL_PROXY_IP’, ’’); //Internal address of public facing server // define(’EXTERNAL_HOST_NAME’, ’’); //The external hostname that should be used require("automated.config.php"); 6.1.1 DB_TYPE Currently the only option for this is mysql and is not used. 43 Newznab Documentation, Release 0.2.3-dev The default setting for this option is mysql. 6.1.2 DB_HOST The database server which has the Newznab database on it. localhost if the database is on the same webserver as Newznab. This can be fully qualified name, IP address, ‘localhost’ or ‘127.0.0.1’. The default setting for this option is localhost. 6.1.3 DB_PORT The port used to access the database. The default setting for this option is 3306. 6.1.4 DB_USER The username to access the database. 6.1.5 DB_PASSWORD The password for DB_USER. 6.1.6 DB_NAME The name of the newznab database. The default setting for this option is newznab. 6.1.7 DB_INNODB This changes the behaviour of how deletes are done on the database. If you are using InnoDB tables, set this to True. The default for this option is false. 6.1.8 DB_PCONNECT Forces a persistent connection to the database server. The default setting for this option is True. 6.1.9 DB_ERRORMODE This attribute controls how the PHP Data Object (PDO) error reporting mode operates. The options for this are: PDO::ERRMODE_SILENT PDO::ERRMODE_WARNING PDO::ERRMODE_EXCEPTION 44 Chapter 6. Config Newznab Documentation, Release 0.2.3-dev The default setting for this option is PDO::ERRMODE_SILENT. 6.1.10 NNTP_USERNAME Your username for your news server. 6.1.11 NNTP_PASSWORD Your password for NNTP_USERNAME 6.1.12 NNTP_SERVER The fully qualified domain name of your news server. 6.1.13 NNTP_PORT The port to connect to your news server. Typically this is port 119 or port 563 if using SSL. If you are going to use SSL, you will need to set NNTP_SSLENABLED. The default setting for this option is 119. 6.1.14 NNTP_SSLENABLED Enable SSL for communications to your news server. Set it to true to enable SSL. The default setting for this option is false. 6.1.15 CACHEOPT_METHOD This setting enables the use of memcached. To use it, set it to memcache. The other option is to have query results saved to files. They will be located in “newznab/db/cache”. The options for this are: none memcache file The default setting for this option is none. 6.1.16 CACHEOPT_TTLFAST The default is 120 seconds. 6.1.17 CACHEOPT_TTLMEDIUM The default is 600 seconds. 6.1. Config.php 45 Newznab Documentation, Release 0.2.3-dev 6.1.18 CACHEOPT_TTLSLOW The default is 1800 seconds. 6.1.19 CACHEOPT_MEMCACHE_SERVER The address of the memcached server. The default assumes memcached is installed on the same server as Newznab. This can be fully qualified name, IP address, ‘localhost’ or ‘127.0.0.1’. The default setting for this option is 127.0.0.1. 6.1.20 CACHEOPT_MEMCACHE_PORT The port used to connect to the memcache server. The default setting for this option is 11211. 6.1.21 EXTERNAL_PROXY_IP If you are behind a proxy, enable this setting and set it to the Internal Address of your proxy server. This can be fully qualified name or IP address. The default setting for this option is not enabled. 6.1.22 EXTERNAL_HOST_NAME If you are behind a proxy, enable this setting and set it to the fully qualified external hostname. The default setting for this option is not enabled. 46 Chapter 6. Config CHAPTER 7 Miscellaneous 7.1 Web API 7.1.1 Introduction This document describes the NEWZNAB Usenet Searching Web API. The API is designed to be implemented by Usenet indexing sites, i.e. sites that index Usenet newsgroups through some means, typically by downloading and inspecting the NTTP headers. The API is aimed for NZB aware client applications to allow them to perform Usenet searches against Newznab servers and receive NZB information in order to facilitate direct downloading from Usenet without having to download any NTTP headers. This document does not describe the actual implementation of either the client or the server but just describes the HTTP(S) interface and request/response sequences. Intended readers are server and client implementers. Notation This document uses the following notations: Parameters: • t=c denotes a required HTTP query parameter. • [o=json | o=xml] denotes optional parameters with possible values. 7.1.2 Functions All functions are executed as HTTP(S) requests over TCP. All parameters are to be passed as query parameters unless otherwise indicated. All returned XML/JSON data is UTF-8 encoded unless otherwise specified. All query parameters should be UTF-8 and URL encoded, i.e.: query-param = URL-ENCODE(UTF8-ENCODE(param=value)). The functions are divided into two categories. Functions specific to searching and retrieving of items and the their information such as SEARCH and TV-SEARCH and functions that are for site/user account management such as CAPS and REGISTER. Any conforming implementation should support the CAPS and SEARCH functions. Other functions are optional and if not supported will return the “203 Function Not Available” when invoked. 47 Newznab Documentation, Release 0.2.3-dev CAPS The CAPS function is used to query the server for supported features and the protocol version and other meta data relevant to the implementation. This function doesn’t require the client to provide any login information but can be executed out of “login session”. Returned Fields server/version limits retention category category/id category/name category/description category/subcat category/subcat/id category/subcat/name category/subcat/description groups group/name group/description group/lastupdate genres genre/id genre/name genre/categoryid The version of the protocol implemented by the server. All implementations should be backwards compatible. The limit and defaults to the number of search results returned. Server retention (how many days NZB information is stored before being purged). Defines a searchable category which might have any number of subcategories. Unique category ID, can be either one of the standard category IDs or a site specific ID. Any descriptive name for the category. Can be site/language specific. A description of the contents of the category. A subcategory. Unique category ID, can be either one of the standard category IDs or a site specific ID. Any descriptive name for the category. Can be site/language specific. A description of the contents of the category. Defines a list of active, indexed usenet groups. Name of usenet group. Description of usenet group. Date and time usenet group was last updated. Defines a list of active genres. Id of genre. Name of genre. The category the genre is associate with. HTTP Method GET HTTP Response 200 OK Parameters t=caps Caps function, must always be “caps”. Optional parameters o=xxx Output format, either “JSON” or “XML. Default is “XML”. Examples 1. Normal behavior Request: GET http://servername.com/api?t=caps Response: 200 OK Content: <?xml version="1.0" encoding="UTF-8"?> <caps> <!-- server information --> 48 Chapter 7. Miscellaneous Newznab Documentation, Release 0.2.3-dev <server version="1.0" title="Newznab" strapline="A great usenet indexer" email="[email protected]" url="http://servername.com/" image="http://servername.com/theme/black/images/banner.jpg"/> <!-- limit parameter range --> <limits max="100" default="50"/> <!-- the server NZB retention --> <retention days="400"/> <!-- registration available or not --> <registration available="yes" open="yes" /> <!-The search functions available at the server The only currently defined search functions are SEARCH and TV -SEARCH. Any conforming implementation should at least support the basic search. Other search functions are optional. --> <searching> <search available="yes"/> <tv-search available="yes"/> <movie-search available="no"/> </searching> <!-- supported categories --> <categories> <category id="1000" name="Console"> <subcat id="1010" name="NDS"/> <subcat id="1020" name="PSP"/> </category> <category id="2000" name="Movies"> <subcat id="2010" name="Foreign"/> </category> <!-- site specific categories --> <category id="1000001" name="Debian" <category id="1000002" name="Mandrake 2010" <subcat id="1000003" name="Mandrake 2010 HD" <subcat id="1000004" name="Mandrake 2010 SD" </category> <!-- etc.. --> </categories> </caps> </xml> description="Latest Debian stuff"/> description="Mandrake 2010"> description="Mandrake HD stuff"/> description="Mandrake SD stuff"/> REGISTER The REGISTER function is used for automatically creating and registering user account. This is an optional function and may or may not be available at a site. It is also possible that function is available but currently registrations at the site are closed. The only prerequisite for registering an account is a valid email address and any server policies. It is at the server administration discretion to allow or deny registrations based on for example the validity of the email address or the the current client host address. On successful registration a valid username, password and api key are returned to the caller. On error an appropriate 7.1. Web API 49 Newznab Documentation, Release 0.2.3-dev error code is returned. HTTP Method GET HTTP Response 200 OK Parameters t=register email=xxx Register function, must always be “register” A valid email address to be used for registration. (URL/UTF-8 encoded). Examples 1. Normal behavior Request: GET HTTP://servername.com/api?t=register&email=john.joe%40acme.com Response: 200 OK Content: <?xml version="1.0" encoding="UTF-8"?> <register username="user123" password="pass123" apikey="abcabcd11234abc" /> 2. Denial Request: GET HTTP://servername.com/api?t=register&email=john.joe%40acme.com Response: 200 OK Content: <?xml version="1.0" encoding="UTF-8"?> <error code="103" description="Registration denied"/> 3. Registration limit imposed Request: GET HTTP://servername.com/api?t=register&email=john.joe%40acme.com Response: 200 OK Content: <?xml version="1.0" encoding="UTF-8"?> <error code="104" description="No more registrations allowed"/> 4. Registration disabled Request: GET HTTP://servername.com/api?t=register&email=john.joe%40acme.com Response: 50 Chapter 7. Miscellaneous Newznab Documentation, Release 0.2.3-dev 200 OK Content: <?xml version="1.0" encoding="UTF-8"?> <error code="203" description="Function not available"/> SEARCH The SEARCH function searches the index for items matching the search criteria. On successful search the response contains a list of found items. Even if search matched nothing an empty response set is created and returned. This function requires passing the user credentials. Searches that include categories that are not supported by the server are still executed but the non-supported categories are simply skipped. This basically treats such a search simply as a “no match” but allows the same query to be ran simultaneously against several servers. The list of search categories specifies a logical OR condition. I.e. an item matching the search input in any of the specified categories is considered a match and is returned. E.g. a search searching for “linux” in “computer” and “ebook” categories searches for matching items in “computer” and “ebook” but does not search for example the “movies” category. Items found in either group are then combined into a single result set. If the input string for search is empty all items (within the server/query limits) are returned for the matching categories. When performing the query the categories to be searched are concatenated into a single query parameter by , (comma). For example cat=200,300,400, which is then URL encoded. The returned XML data stream is RSS 2.0 compliant and also contains additional information in the extra namespace. Response-offset field identifies the current subset of all the matches that are being transmitted in the response. In other words, if a search for “disco” finds more matches than the server is capable of transmitting in a single response, the response needs to be split into several responses. Then it is’s the clients responsibility to repeat the same query with same parameters but specify an increased offset in order to return the next set of results. If offset query parameter is not used response data contains items between 0 offset - limit. If offset query parameter is out of bounds an empty result set is returned. Attrs parameter provides a comma ”,” separated list of additional (extended) attributes that the search should return if they are applicable to the current item. If attrs is not specified a set of default parameters is returned. Todo What is this set? Important fields of the returned data (RSS) title guid pubdate category enclosure Title of the found item. A globally unique (GUID) item identifier. The publishing date in RSS date object as specified by RFC822/2822. (not the Usenet date) The category the NZB belongs to. (This is human readable for RSS. More precise category is found in additional data) The NZB url HTTP Method GET HTTP Response 200 OK 7.1. Web API 51 Newznab Documentation, Release 0.2.3-dev Parameters Search function, must always be “search” User’s key as provided by the service provider. t=search apikey=xxxx Optional parameters q=xxxx group=xxxx limit=123 cat=xxx o=xxx attrs=xxx extended=1 del=1 maxage=123 offset=50 Search input (URL/UTF-8 encoded). Case insensitive. List of usenet groups to search delimited by ”,” Upper limit for the number of items to be returned. List of categories to search delimited by ”,” Output format, either “JSON” or “XML”. Default is “XML”. List of requested extended attributes delimeted by ”,” List all extended attributes (attrs ignored) Delete the item from a users cart on download. Only return results which were posted to usenet in the last x days. The 0 based query offset defining which part of the response we want. Examples 1. Normal behavior Request: GET http://servername.com/api?t=search&apikey=xxxxx&q=a%20tv%20show Response: 200 OK Content: <?xml version="1.0" encoding="UTF-8"?> <rss version="2.0"> <channel> <title>example.com</tile> <description>example.com API results</description> <!-More RSS content --> <!-- offset is the current offset of the response total is the total number of items found by the query --> <newznab:response offset="0" total="2344"/> <item> <!-- Standard RSS 2.0 Data --> <title>A.Public.Domain.Tv.Show.S06E05</title> <guid isPermaLink="true">http://servername.com/rss/viewnzb/e9c515e02346086e3a477a5436d7bc8 <link>http://servername.com/rss/nzb/e9c515e02346086e3a477a5436d7bc8c&i=1&r=18cf9f0 <comments>http://servername.com/rss/viewnzb/e9c515e02346086e3a477a5436d7bc8c#comments</com <pubDate>Sun, 06 Jun 2010 17:29:23 +0100</pubDate> <category>TV > XviD</category> <description>Some TV show</description> <enclosure url="http://servername.com/rss/nzb/e9c515e02346086e3a477a5436d7bc8c&i=1& <!-- Additional attributes --> <newznab:attr name="category" value="2000"/> <newznab:attr name="category" value="2030"/> <newznab:attr name="size" value="4294967295"/> 52 Chapter 7. Miscellaneous Newznab Documentation, Release 0.2.3-dev </item> </channel> </rss> 2. No items matched the search criteria. Request: GET http://servername.com/api?t=search&apikey=xxxxx&q=linux%20image Response: 200 OK Content: <?xml version="1.0" encoding="UTF-8"?> <rss> <channel> <newznab:response offset="0" total="0"/> </channel> </rss> 3. Query could not be completed because user credentials are broken Request: GET http://servername.com/api?t=search&apikey=xxxxx&q=linux%20image Response: 200 OK Content: <?xml version="1.0" encoding="UTF-8"?> <error code="100" description="Incorrect user credentials"/> 4. Query could not be completed because it was malformed Request: GET http://servername.com/api?t=search&apikey=xxxxx&q=linux%20image Response: 200 OK Content: <?xml version="1.0" encoding="UTF-8"/> <error code="200" description="Missing parameter: key"/> TV-SEARCH The TV-SEARCH function searches the index in the TV category for items matching the search criteria. The criteria includes query string and in addition information about season and episode. On successful search the response contains a list of items that matched the query. Even if the search matched nothing an empty but valid response is created and returned. This function requires passing the user credentials. The returned XML data stream is RSS 2.0 compliant and also contains additional information in the extra namespace and optionally TV specific information. HTTP Method 7.1. Web API 53 Newznab Documentation, Release 0.2.3-dev GET HTTP Response 200 OK Parameters t=tvsearch apikey=xxx TV-Search function, must always be “tvsearch”. User’s key as provided by the service provider. Optional parameters limit=123 rid=xxxx cat=xxx season=xxxx q=xxxx ep=xxx o=xml attrs=xxx extended=1 del=1 maxage=123 offset=50 Upper limit for the number of items to be returned, e.g. 123. TVRage id of the item being queried. List of categories to search delimited by ”,” Season string, e.g S13 or 13 for the item being queried. Search input (URL/UTF-8 encoded). Case insensitive. Episode string, e.g E13 or 13 for the item being queried. Output format, either “JSON” or “XML”. Default is “XML”. List of requested extended attributes delimeted by ”,” List all extended attributes (attrs ignored) Delete the item from a users cart on download. Only return results which were posted to usenet in the last x days. The 0 based query offset defining which part of the response we want. Examples 1. Normal behavior Request: GET http://servername.com/api?t=tvsearch&apikey=xxx&q=title&season=S03 Response: 200 OK Content: <?xml version="1.0" encoding="UTF-8"?> <rss version="2.0"> <channel> <title>example.com</title> <description>example.com API results</description> <!-More RSS content --> <!-- offset is the current offset of the response total is the total number of items found by the query --> <newznab:response offset="0" total="1234"/> <item> <!-- Standard RSS 2.0 data --> <title>A.Public.Domain.Tv.Show.S06E05</title> <guid isPermaLink="true">http://servername.com/rss/viewnzb/e9c515e02346086e3a477a5436d7bc8 <link>http://servername.com/rss/nzb/e9c515e02346086e3a477a5436d7bc8c&i=1&r=18cf9f0 <comments>http://servername.com/rss/viewnzb/e9c515e02346086e3a477a5436d7bc8c#comments</com <pubDate>Sun, 06 Jun 2010 17:29:23 +0100</pubDate> <category>TV > XviD</category> <description>Some TV show</description> <enclosure url="http://servername.com/rss/nzb/e9c515e02346086e3a477a5436d7bc8c&i=1& 54 Chapter 7. Miscellaneous Newznab Documentation, Release 0.2.3-dev <!-- Additional attributes --> <newznab:attr name="category" value="5030"/> <newznab:attr name="size" value="154653309"/> <newznab:attr name="season" value="3"/> <newznab:attr name="episode" value="2"/> </item> <item> <!-- Standard RSS 2.0 data --> <title>A.Public.Domain.Tv.Show.S06E05</title> <guid isPermaLink="true">http://servername.com/rss/viewnzb/e9c515e02346086e3a477a5436d7bc8 <link>http://servername.com/rss/nzb/e9c515e02346086e3a477a5436d7bc8c&i=1&r=18cf9f0 <comments>http://servername.com/rss/viewnzb/e9c515e02346086e3a477a5436d7bc8c#comments</com <pubDate>Sun, 06 Jun 2010 17:29:23 +0100</pubDate> <category>TV > XviD</category> <description>Some TV show</description> <enclosure url="http://servername.com/rss/nzb/e9c515e02346086e3a477a5436d7bc8c&i=1& <!-- Additional attributes --> <newznab:attr name="category" value="5000" /> <newznab:attr name="category" value="5030" /> <newznab:attr name="size" value="4294967295" /> <newznab:attr name="season" value="3"/> <newznab:attr name="episode" value="1"/> </item> <!-- more items to follow --> </channel> </rss> MOVIE-SEARCH The MOVIE-SEARCH function searches the index for items matching an IMDb ID or search query. On successful search the response contains a list of items that matched the query. Even if the search matched nothing an empty but valid response is created and returned. This function requires passing the user credentials. The returned XML data stream is RSS 2.0 compliant and also contains additional information in the extra namespace and optionally movie specific information. HTTP Method GET HTTP Response 200 OK Parameters t=movie apikey=xxx Movie-Search function, must always be “movie”. User’s key as provided by the service provider. Optional parameters 7.1. Web API 55 Newznab Documentation, Release 0.2.3-dev limit=123 imdbid=xxxx cat=xxx genre=xxx q=xxxx o=xml attrs=xxx extended=1 del=1 maxage=123 offset=50 Upper limit for the number of items to be returned, e.g. 123. IMDB id of the item being queried e.g. 0058935. List of categories to search delimited by ”,” A genre string i.e. ‘Romance’ would match ‘(Comedy, Drama, Indie, Romance)’ Search input (URL/UTF-8 encoded). Case insensitive. Output format, either “JSON” or “XML”. Default is “XML”. List of requested extended attributes delimeted by ”,” List all extended attributes (attrs ignored) Delete the item from a users cart on download. Only return results which were posted to usenet in the last x days. The 0 based query offset defining which part of the response we want. Examples 1. Normal behavior Request: GET http://servername.com/api?t=movie&apikey=xxx&imdbid=0058935 Response: 200 OK Content: <?xml version="1.0" encoding="UTF-8"?> <rss version="2.0"> <channel> <title>example.com</title> <description>example.com API results</description> <!-More RSS content --> <!-- offset is the current offset of the response total is the total number of items found by the query --> <newznab:response offset="0" total="1234"/> <item> <!-- Standard RSS 2.0 data --> <title>A.Public.Domain.Movie.720p.DTS.x264</title> <guid isPermaLink="true">http://servername.com/rss/viewnzb/e9c515e02346086e3a477a5436d <link>http://servername.com/rss/nzb/e9c515e02346086e3a477a5436d7bc8c&i=1&r=18c <comments>http://servername.com/rss/viewnzb/e9c515e02346086e3a477a5436d7bc8c#comments< <pubDate>Sun, 06 Jun 2010 17:29:23 +0100</pubDate> <category>Movie > XviD</category> <description>Some movie</description> <enclosure url="http://servername.com/rss/nzb/e9c515e02346086e3a477a5436d7bc8c&i=1 <!-- Additional attributes --> <newznab:attr name="category" value="2000" /> <newznab:attr name="category" value="2030" /> <newznab:attr name="size" value="4294967295" /> </item> </channel> </rss> 56 Chapter 7. Miscellaneous Newznab Documentation, Release 0.2.3-dev MUSIC-SEARCH The MUSIC-SEARCH function searches the index for items matching music properties. On successful search the response contains a list of items that matched the query. Even if the search matched nothing an empty but valid response is created and returned. This function requires passing the user credentials. The returned XML data stream is RSS 2.0 compliant and also contains additional information in the extra namespace and optionally music specific information. HTTP Method GET HTTP Response 200 OK Parameters Music-Search function, must always be “music”. User’s key as provided by the service provider. t=music apikey=xxx Optional Parameters limit=123 album=xxxx artist=xxxx label=xxxx track=xxxx year=xxxx genre=123 cat=xxx o=xml attrs=xxx extended=1 del=1 maxage=123 offset=50 Upper limit for the number of items to be returned, e.g. 123. Album title (URL/UTF-8 encoded). Case insensitive. Artist name (URL/UTF-8 encoded). Case insensitive. Publisher/Label name (URL/UTF-8 encoded). Case insensitive. Track name (URL/UTF-8 encoded). Case insensitive. Four digit year of release. List of music genre id’s to search delimited by ”,”. See CAPS for available genres. List of categories to search delimited by ”,” Output format, either “JSON” or “XML”. Default is “XML”. List of requested extended attributes delimited by ”,” List all extended attributes (attrs ignored) Delete the item from a users cart on download. Only return results which were posted to usenet in the last x days. The 0 based query offset defining which part of the response we want. Examples 1. Normal behavior Request: GET http://servername.com/api?t=music&apikey=xxx&album=Groovy&extended=1 Response: 200 OK Content: <?xml version="1.0" encoding="UTF-8"?> <rss version="2.0"> <channel> <title>example.com</title> <description>example.com API results</description> <!-More RSS content --> <!-- offset is the current offset of the response 7.1. Web API 57 Newznab Documentation, Release 0.2.3-dev total is the total number of items found by the query --> <newznab:response offset="0" total="1234"/> <item> <!-- Standard RSS 2.0 data --> <title>A.Public.Domain.Album.Name</title> <guid isPermaLink="true">http://servername.com/rss/viewnzb/e9c515e02346086e3a477a5436d <link>http://servername.com/rss/nzb/e9c515e02346086e3a477a5436d7bc8c&i=1&r=18c <comments>http://servername.com/rss/viewnzb/e9c515e02346086e3a477a5436d7bc8c#comments< <pubDate>Sun, 06 Jun 2010 17:29:23 +0100</pubDate> <category>Music > MP3</category> <description>Some music</description> <enclosure url="http://servername.com/rss/nzb/e9c515e02346086e3a477a5436d7bc8c&i=1 <!-- Additional attributes --> <newznab:attr name="category" value="3000" /> <newznab:attr name="category" value="3010" /> <newznab:attr name="size" value="144967295" /> <newznab:attr name="artist" value="Bob Smith" /> <newznab:attr name="album" value="Groovy Tunes" /> <newznab:attr name="publisher" value="Epic Music" /> <newznab:attr name="year" value="2011" /> <newznab:attr name="tracks" value="track one|track two|track three" /> <newznab:attr name="coverurl" value="http://servername.com/covers/music/12345.jpg" /> <newznab:attr name="review" value="This album is great" /> </item> </channel> </rss> BOOK-SEARCH The BOOK-SEARCH function searches the index for items matching book properties. On successful search the response contains a list of items that matched the query. Even if the search matched nothing an empty but valid response is created and returned. This function requires passing the user credentials. The returned XML data stream is RSS 2.0 compliant and also contains additional information in the extra namespace and optionally music specific information. HTTP Method GET HTTP Response 200 OK Parameters t=book apikey=xxx Book-Search function, must always be “book”. User’s key as provided by the service provider. Optional Parameters 58 Chapter 7. Miscellaneous Newznab Documentation, Release 0.2.3-dev limit=123 title=xxxx author=xxxx o=xml attrs=xxx extended=1 del=1 maxage=123 offset=50 Upper limit for the number of items to be returned, e.g. 123. Book title (URL/UTF-8 encoded). Case insensitive. Author name (URL/UTF-8 encoded). Case insensitive. Output format, either “JSON” or “XML”. Default is “XML”. List of requested extended attributes delimited by ”,” List all extended attributes (attrs ignored) Delete the item from a users cart on download. Only return results which were posted to usenet in the last x days. The 0 based query offset defining which part of the response we want. Examples 1. Normal behavior Request: GET http://servername.com/api?t=book&apikey=xxx&author=Charles%20Dack&extended=1 Response: 200 OK Content: <?xml version="1.0" encoding="UTF-8"?> <rss version="2.0"> <channel> <title>example.com</title> <description>example.com API results</description> <!-More RSS content --> <!-- offset is the current offset of the response total is the total number of items found by the query --> <newznab:response offset="0" total="1234"/> <item> <!-- Standard RSS 2.0 data --> <title>A.Public.Domain.Book.Name</title> <guid isPermaLink="true">http://servername.com/rss/viewnzb/e9c515e02346086e3a477a5436d <link>http://servername.com/rss/nzb/e9c515e02346086e3a477a5436d7bc8c&i=1&r=18c <comments>http://servername.com/rss/viewnzb/e9c515e02346086e3a477a5436d7bc8c#comments< <pubDate>Sun, 06 Jun 2010 17:29:23 +0100</pubDate> <category>Misc > Ebook</category> <description>Some book</description> <enclosure url="http://servername.com/rss/nzb/e9c515e02346086e3a477a5436d7bc8c&i=1 <!-- Additional attributes --> <newznab:attr name="category" value="7020" /> <newznab:attr name="size" value="144967295" /> <newznab:attr name="author" value="Charles Dack" /> <newznab:attr name="title" value="Weather and Folk Lore of Peterborough and Distric <newznab:attr name="review" value="This book is a classic" /> </item> </channel> </rss> 7.1. Web API 59 Newznab Documentation, Release 0.2.3-dev DETAILS The DETAILS function returns all information for a particular Usenet (NZB) item. The response contains the generic RSS part + full extra information + full type/category specific information. HTTP Method GET HTTP Response 200 OK Parameters t=details id=xxxx apikey=xxxx Details function, must always be “details”. The GUID of the item being queried. User’s key as provided by the service provider. Optional Parameters o=xxx Output format, either “JSON” or “XML”. Default is “XML”. Examples 1. Normal behavior Request: GET http://servername.com/api?t=details&apikey=xxxxx&guid=xxxxxxxxx Response: 200 OK Content: <?xml version="1.0" encoding="UTF-8"?> <rss version="2.0"> <channel> <item> <!-- Standard RSS 2.0 Data --> <title>A.Public.Domain.Tv.Show.S06E05</title> <guid isPermaLink="true">http://servername.com/rss/viewnzb/e9c515e02346086e3a477a5436d7b <link>http://servername.com/rss/nzb/e9c515e02346086e3a477a5436d7bc8c&i=1&r=18cf9 <comments>http://servername.com/rss/viewnzb/e9c515e02346086e3a477a5436d7bc8c#comments</c <pubDate>Sun, 06 Jun 2010 17:29:23 +0100</pubDate> <category>TV > XviD</category> <description>Some TV show</description> <enclosure url="http://servername.com/rss/nzb/e9c515e02346086e3a477a5436d7bc8c&i=1&a <!-- Additional attributes Details function returns all possible attributes that are 1) known and 2) applicabl for the item requested. --> <newznab:attr <newznab:attr <newznab:attr <newznab:attr <newznab:attr <newznab:attr <newznab:attr <newznab:attr 60 name="category" name="category" name="size" name="files" name="poster" name="grabs" name="comments" name="usenetdate" value="2000" /> value="2030" /> value="4294967295" /> value="107" /> value="[email protected] (example)" /> value="1" /> value="0" /> value="Tue, 22 Jun 2010 06:54:22 +0100" /> Chapter 7. Miscellaneous Newznab Documentation, Release 0.2.3-dev <newznab:attr name="group" value="alt.binaries.teevee" /> </item> </channel> </rss> 2. Query could not be completed because it was malformed Request: GET http://servername.com/api?t=details&apikey=xxxxx&guid=xxxxxxxxx Response: 200 OK Content: <?xml version="1.0" encoding="UTF-8"/> <error code="200" description="Missing parameter: key"/> 3. Query could not be completed because no such item was available Request: GET http://servername.com/api?t=details&apikey=xxxxx&guid=xxxxxxxxx Response: 200 OK Content: <?xml version="1.0" encoding="UTF-8"/> <error code="300" description="No such GUID"/> 4. Query could not be completed because user credentials are broken Request: GET http://servername.com/api?t=details&apikey=xxxxx&guid=xxxxxxxxx Response: 200 OK Content: <?xml version="1.0" encoding="UTF-8"/> <error code="100" description="Incorrect user credentials"/> GETNFO The GETNFO function returns an nfo file for a particular Usenet (NZB) item. HTTP Method GET HTTP Response 200 OK Parameters t=getnfo Details function, must always be “getnfo”. id=xxxx The GUID of the item being queried. apikey=xxxx User’s key as provided by the service provider. 7.1. Web API 61 Newznab Documentation, Release 0.2.3-dev Optional parameters raw=1 If provided returns just the nfo file without the rss container o=xxx Output format, either “JSON” or “XML”. Default is “XML”. Examples 1. Normal behavior Request: GET http://servername.com/api?t=getnfo&apikey=xxxxx&guid=xxxxxxxxx Response: 200 OK Content: <?xml version="1.0" encoding="UTF-8"?> <rss version="2.0"> <channel> <item> <!-- Standard RSS 2.0 Data --> <title>A.Public.Domain.Tv.Show.S06E05</title> <guid isPermaLink="true">http://servername.com/details/e9c515e02346086e3a477a5436d7bc8c< <link>http://servername.com/nfo/e9c515e02346086e3a477a5436d7bc8c</link> <pubDate>Sun, 06 Jun 2010 17:29:23 +0100</pubDate> <description>This is the nfo file</description> <enclosure url="http://servername.com/nfo/e9c515e02346086e3a477a5436d7bc8c&enclosure= </item> </channel> </rss> 2. Query could not be completed because it was malformed Request: GET http://servername.com/api?t=getnfo&apikey=xxxxx&id=xxxxxxxxx Response: 200 OK Content: <?xml version="1.0" encoding="UTF-8"/> <error code="200" description="Missing parameter: id"/> 3. Query could not be completed because no such item was available Request: GET http://servername.com/api?t=getnfo&apikey=xxxxx&id=xxxxxxxxx Response: 200 OK Content: <?xml version="1.0" encoding="UTF-8"/> <error code="300" description="No such GUID"/> 4. Query could not be completed because user credentials are broken Request: GET http://servername.com/api?t=getnfo&apikey=xxxxx&id=xxxxxxxxx 62 Chapter 7. Miscellaneous Newznab Documentation, Release 0.2.3-dev Response: 200 OK Content: <?xml version="1.0" encoding="UTF-8"/> <error code="100" description="Incorrect user credentials"/> GET The GET function returns an nzb for a guid. HTTP Method GET HTTP Response 200 OK Parameters t=get Details function, must always be “get”. id=xxxx The GUID of the item being queried. apikey=xxxx User’s key as provided by the service provider. Optional parameters del=1 If provided removes the nzb from the users cart (if present) Examples 1. Normal behavior Request: GET http://servername.com/api?t=get&apikey=xxxxx&guid=xxxxxxxxx Response: 200 OK Content: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE nzb PUBLIC "-//newzBin//DTD NZB 1.1//EN" "http://www.newzbin.com/DTD/nzb/nzb-1.1.d <nzb xmlns="http://www.newzbin.com/DTD/2003/nzb"> ... 2. Query could not be completed because it was malformed Request: GET http://servername.com/api?t=get&apikey=xxxxx&id=xxxxxxxxx Response: 200 OK Content: <?xml version="1.0" encoding="UTF-8"/> <error code="200" description="Missing parameter: id"/> 3. Query could not be completed because no such item was available Request: GET http://servername.com/api?t=get&apikey=xxxxx&id=xxxxxxxxx Response: 7.1. Web API 63 Newznab Documentation, Release 0.2.3-dev 200 OK Content: <?xml version="1.0" encoding="UTF-8"/> <error code="300" description="No such GUID"/> 4. Query could not be completed because user credentials are broken Request: GET http://servername.com/api?t=get&apikey=xxxxx&id=xxxxxxxxx Response: 200 OK Content: <?xml version="1.0" encoding="UTF-8"/> <error code="100" description="Incorrect user credentials"/> CART-ADD The CART-ADD function adds an item to the users cart. HTTP Method GET HTTP Response 200 OK Parameters t=cartadd id=xxxx apikey=xxxx Cart add function, must always be “cartadd”. The GUID of the item being added to the cart. User’s key as provided by the service provider. Optional Parameters o=xxx Output format, either “JSON” or “XML”. Default is “XML”. Examples 1. Default behavior Request: GET http://servername.com/api?t=cartadd&id=12344234234234&apikey=xxxxx Response: 200 OK Content: <?xml version="1.0" encoding="UTF-8"?> <cartadd id="123" /> 2. Query could not be completed because it was malformed Request: GET http://servername.com/api?t=cartadd&apikey=xxxxx&guid=xxxxxxxxx 64 Chapter 7. Miscellaneous Newznab Documentation, Release 0.2.3-dev Response: 200 OK Content: <?xml version="1.0" encoding="UTF-8"/> <error code="200" description="Missing parameter: id"/> 3. Query could not be completed because no such item was available Request: GET http://servername.com/api?t=cartadd&apikey=xxxxx&guid=xxxxxxxxx Response: 200 OK Content: <?xml version="1.0" encoding="UTF-8"/> <error code="300" description="No such GUID"/> 4. Query could not be completed because user credentials are broken Request: GET http://servername.com/api?t=cartadd&apikey=xxxxx&guid=xxxxxxxxx Response: 200 OK Content: <?xml version="1.0" encoding="UTF-8"/> <error code="100" description="Incorrect user credentials"/> 5. Query could not be completed because item already exists Request: GET http://servername.com/api?t=cartadd&apikey=xxxxx&guid=xxxxxxxxx Response: 200 OK Content: <?xml version="1.0" encoding="UTF-8"/> <error code="310" description="Item already exists"/> CART-DEL The CART-DEL function deletes an item from the users cart. HTTP Method GET HTTP Response 200 OK 7.1. Web API 65 Newznab Documentation, Release 0.2.3-dev Parameters t=cartdel id=xxxx apikey=xxxx Cart del function, must always be “cartdel”. The GUID of the item being delete from the cart. User’s key as provided by the service provider. Optional Parameters o=xxx Output format, either “JSON” or “XML”. Default is “XML”. Examples 1. Default behavior Request: GET http://servername.com/api?t=cartdel&id=12344234234234&apikey=xxxxx Response: 200 OK Content: <?xml version="1.0" encoding="UTF-8"?> <cartdel id="123" /> 2. Query could not be completed because it was malformed Request: GET http://servername.com/api?t=cartdel&apikey=xxxxx&guid=xxxxxxxxx Response: 200 OK Content: <?xml version="1.0" encoding="UTF-8"/> <error code="200" description="Missing parameter: id"/> 3. Query could not be completed because no such item was available Request: GET http://servername.com/api?t=cartdel&apikey=xxxxx&guid=xxxxxxxxx Response: 200 OK Content: <?xml version="1.0" encoding="UTF-8"/> <error code="300" description="No such GUID"/> 4. Query could not be completed because user credentials are broken Request: GET http://servername.com/api?t=cartdel&apikey=xxxxx&guid=xxxxxxxxx Response: 200 OK Content: 66 Chapter 7. Miscellaneous Newznab Documentation, Release 0.2.3-dev <?xml version="1.0" encoding="UTF-8"/> <error code="100" description="Incorrect user credentials"/> COMMENTS The COMMENTS function returns all comments known about a release. HTTP Method GET HTTP Response 200 OK Parameters t=comments guid=xxxx apikey=xxxx Comments function, must always be “comments”. The GUID of the item being queried. User’s key as provided by the service provider. Optional Parameters o=xxx Output format, either “JSON” or “XML”. Default is “XML”. Examples 1. Default behavior Request: GET http://servername.com/api?t=comments&apikey=xxxxx&guid=xxxxxxxxx Response: 200 OK Content: <?xml version="1.0" encoding="UTF-8"?> <rss version="2.0"> <channel> <item> <!-- Standard RSS 2.0 Data --> <title>username_of_poster</title> <guid isPermaLink="true">http://servername.com/rss/viewnzb/e9c515e02346086e3a477a5436d7b <link>http://servername.com/rss/viewnzb/e9c515e02346086e3a477a5436d7bc8c</link> <pubDate>Sun, 06 Jun 2010 17:29:23 +0100</pubDate> <description>Comment about the item</description> </item> </channel> </rss> 2. Query could not be completed because it was malformed Request: GET http://servername.com/api?t=comments&apikey=xxxxx&guid=xxxxxxxxx Response: 200 OK Content: 7.1. Web API 67 Newznab Documentation, Release 0.2.3-dev <?xml version="1.0" encoding="UTF-8"/> <error code="200" description="Missing parameter: key"/> 3. Query could not be completed because no such item was available Request: GET http://servername.com/api?t=comments&apikey=xxxxx&guid=xxxxxxxxx Response: 200 OK Content: <?xml version="1.0" encoding="UTF-8"/> <error code="300" description="No such GUID"/> 4. Query could not be completed because user credentials are broken Request: GET http://servername.com/api?t=comments&apikey=xxxxx&guid=xxxxxxxxx Response: 200 OK Content: <?xml version="1.0" encoding="UTF-8"/> <error code="100" description="Incorrect user credentials"/> COMMENTS-ADD The COMMENTS-ADD function adds a comment to a release. HTTP Method GET HTTP Response 200 OK Parameters t=commentadd guid=xxxx apikey=xxxx text=xxxx Comments-add function, must always be “commentadd”. The GUID of the item being queried. User’s key as provided by the service provider. The comment being added (URL/UTF-8 encoded). Optional Parameters o=xxx Output format, either “JSON” or “XML”. Default is “XML”. Examples 1. Request: GET HTTP://servername.com/api?t=commentadd&apikey=xxxxx&guid=xxxxxxxxx&text=comment Response: 200 OK 68 Chapter 7. Miscellaneous Newznab Documentation, Release 0.2.3-dev Content: <?xml version="1.0" encoding="UTF-8"?> <commentadd id="123" /> 2. Request: GET HTTP://servername.com/api?t=commentadd&apikey=xxxxx&guid=xxxxxxxxx&text=comment Response: 200 OK Content: <?xml version="1.0" encoding="UTF-8"?> <error code="300" description="No such item"/> 3. Request: GET HTTP://servername.com/api?t=commentadd&apikey=xxxxx&guid=xxxxxxxxx&text=comment Response: 200 OK Content: <?xml version="1.0" encoding="UTF-8"?> <error code="203" description="Function not available"/> USER The USER function is used for retrieving information about a user account HTTP Method GET HTTP Response 200 OK Parameters t=user username=xxx User function, must always be “user” A valid username (URL/UTF-8 encoded). Examples 1. Request: GET HTTP://servername.com/api?t=user&username=user123 Response: 200 OK Content: <?xml version="1.0" encoding="UTF-8"?> <user username="user123" grabs="123" role="User" apirequests="100" downloadrequests="100" movieview="1" musicview="1" consoleview="1" createddate="2011-08-23 12:31:47" /> 2. Request: 7.1. Web API 69 Newznab Documentation, Release 0.2.3-dev GET HTTP://servername.com/api?t=user&username=user123 Response: 200 OK Content: <?xml version="1.0" encoding="UTF-8"?> <error code="300" description="No such item"/> 3. Request: GET HTTP://servername.com/api?t=user&username=user123 Response: 200 OK Content: <?xml version="1.0" encoding="UTF-8"?> <error code="203" description="Function not available"/> 7.1.3 Predefined Categories In order to facilitate operation that does not rely on a particular natural language, e.g. english a set of predefined category IDs have been defined. It is possible to define custom categories in the custom category range. Each category is given a range for a set of subcategories. It is possible for an item to belong to several categories at the same time. Category Ranges Category Range 0000-0999 1000-1999 2000-2999 3000-3999 4000-4999 5000-5999 6000-6999 7000-7999 8000-99999 100000- Category Name Reserved Console Movies Audio PC TV XXX Other Reserved Custom Comments Reserved for future expansion Site specific category range. Defined in CAPS. Category List Categories 0000 1000 1010 1020 1030 1040 1050 1060 1070 2000 2010 70 Category Name Reserved Console Console/NDS Console/PSP Console/Wii Console/XBox Console/XBox 360 Console/Wiiware Console/XBox 360 DLC Movies Movies/Foreign Continued on next page Chapter 7. Miscellaneous Newznab Documentation, Release 0.2.3-dev Table 7.1 – continued from previous page Categories Category Name 2020 Movies/Other 2030 Movies/SD 2040 Movies/HD 2050 Movies/BluRay 2060 Movies/3D 3000 Audio 3010 Audio/MP3 3020 Audio/Video 3030 Audio/Audiobook 3040 Audio/Lossless 4000 PC 4010 PC/0day 4020 PC/ISO 4030 PC/Mac 4040 PC/Mobile-Other 4050 PC/Games 4060 PC/Mobile-iOS 4070 PC/Mobile-Android 5000 TV 5020 TV/Foreign 5030 TV/SD 5040 TV/HD 5050 TV/Other 5060 TV/Sport 6000 XXX 6010 XXX/DVD 6020 XXX/WMV 6030 XXX/XviD 6040 XXX/x264 7000 Other 7010 Misc 7020 EBook 7030 Comics 100000Custom 7.1.4 Predefined Attributes A set of known attributes for items in different categories has been defined. Its possible that not all attributes are available at all times. Therefore a client application should not rely on any particular attributes being in the returned data but should take this list as an optional extra information. However attributes marked with * are always available. Additionally, not all attributes are applicable to all items. The category information can be used to check which attributes area available for which category items. All attributes are defined using XML namespace syntax. e.g. xmlns:newznab=”http://www.newznab.com/DTD/2010/feeds/attributes/” List of Attributes Attribute size * Category ALL Description Size in bytes Example value “252322” Con 7.1. Web API 71 Newznab Documentation, Release 0.2.3-dev Attribute category * guid files poster group team grabs password comments usenetdate info year season episode rageid tvtitle tvairdate video audio resolution framerate language subs imdb imdbscore imdbtitle imdbtagline imdbplot imdbyear imdbdirector imdbactors genre artist album publisher tracks coverurl backdropcoverurl review booktitle publishdate author pages Category ALL ALL ALL ALL ALL ALL ALL ALL ALL ALL ALL ALL TV TV TV TV TV TV, Movies TV, Movies, Audio TV, Movies TV, Movies TV, Movies, Audio TV, Movies Movies Movies Movies Movies Movies Movies Movies Movies TV, Movies Music Music Music, Book Music TV, Movies, Music, Book TV, Movies, Music Movies, Music, Book Book Book Book Book Table 7.2 – continued from previous page Description Example value Item’s category “5004” Unique release guid “6c6734da3e92a7b0e494e896b58081 Number of files “4” NNTP Poster “yenc@power-post“ NNTP Group(s) “a.b.group, a.b.teevee” Team doing the release “DiAMOND” Number of times item downloaded “1” Whether the archive is passworded “0” no, “1” rar pass, “2” contains inne Number of comments “2” Date posted to usenet “Tue, 22 Jun 2010 06:54:22 +0100” Info (.nfo) file URL “http://somesite/stuff/info.php?id=123 Release year “2009” Numeric season “1” Numeric episode within the season “1” TVRage ID. (www.tvrage.com) “2322” TVRage Show Title. (www.tvrage.com) “Duck and Cover” TVRage Show Air date. (www.tvrage.com) “Tue, 22 Jun 2010 06:54:22 +0100” Video codec “x264” Audio codec “AC3 2.0 @ 384 kbs” Video resolution “1280x716 1.78:1” Video fps “23.976 fps” Natural languages “English” Subtitles “English, Spanish” IMDb ID (www.imdb.com) “0104409” IMDb score “5/10” IMDb score “Bobs Movie” IMDb tagline “Bobs new adventure” IMDb plot “All about the movie” IMDb year “1971” IMDb director “Bob Smith” IMDb actors “Bob Smith, Kate Smith” Genre “Horror, Comedy” Artist name “Bob Smith” Album name “Groovy Tunes” Publisher name “Epic Music” Track listing “track one|track two|track three” URL to cover image “http://servername.com/covers/music/ URL to backdrop image “http://servername.com/covers/movies Critics review “This media is great” Book title “Weather and Folk Lore of Peterborou Date book published “Tue, 22 Jun 2010 06:54:22 +0100” Book author “Charles Dack” Number of pages “123” Attribute Example Example attribute declarations within <item> element: <newznab:attr name="category" value="2000" /> <newznab:attr name="category" value="2030" /> <newznab:attr name="size" value="4294967295" /> 72 Chapter 7. Miscellaneous Newznab Documentation, Release 0.2.3-dev 7.1.5 Newznab Error Codes Under normal circumstances i.e. when the HTTP request/response sequence is successfully completed Newznab implementations always respond with HTTP 200 OK. However this doesn’t mean that the query was semantically correct. It simply means that the HTTP part of the sequence was successful. One then must check the actual response body/data to see if the request was completed without errors. In case of a Newznab error the response contains an error code and an a description of the error. The error codes have been defined into different ranges. 100-199 Account/user credentials specific error codes, 200299 API call specific error codes, 300-399 content specific error codes and finally 900-999 Other error codes. Error code 100 101 102 103 104 105 106 107 200 201 202 203 300 300 900 910 Description Incorrect user credentials Account suspended Insufficient privileges/not authorized Registration denied Registrations are closed Invalid registration (Email Address Taken) Invalid registration (Email Address Bad Format) Registration Failed (Data error) Missing parameter Incorrect parameter No such function. (Function not defined in this specification). Function not available. (Optional function is not implemented). No such item. Item already exists. Unknown error API Disabled Error code example 1. Query could not be completed because user credentials are broken Request: GET http://servername.com/api?t=details&apikey=xxxxx&guid=xxxxxxxxx Response: 200 OK Content: <?xml version="1.0" encoding="UTF-8"?> <error code="100" description="Incorrect user credentials"/> 7.2 Sphinx This is the documentation for the full-text search extension for Newznab. It is built on top of the very powerful Sphinx full-text indexer. To learn more about Sphinx go to: http://sphinxsearch.com/ 7.2. Sphinx 73 Newznab Documentation, Release 0.2.3-dev 7.2.1 Install To install the search indexing system for Newznab, follow the steps below. If you follow these directions carefully you shouldn’t have any issues. Read through them at least once before actually doing anything to make sure you know what’s going to happen. 1. Download and/or install Sphinx. Make sure to get version 2.0.2 or higher: http://sphinxsearch.com/ 2. Create the necessary directories. By default the directory sphinxdata in newznab’s db directory will be used. If you don’t need to specify a different location, you can skip this step and go to step 3. The first directory is where Sphinx will write the indexes to. Make sure it exists and is writeable: mkdir /path/to/index/storage/dir chmod 755 /path/to/index/storage/dir The second directory is where Sphinx will hold it’s binary log files. This directory needs to exist inside of the first directory. Again, make sure the directory exists and is writeable: mkdir /path/to/index/storage/dir/binlog chmod 755 /path/to/index/storage/dir/binlog 3. Generate a ‘sphinx.conf’ file. The nnindexer.php generate command takes a single optional argument: the path to the first directory you created in Step 2 (the indexes storage directory). If you didn’t create a custom directory in step 3, then type: ./nnindexer.php generate If you created a custom storage directory in step 2, pass the first directory you created as the first argument to the generate command: ./nnindexer.php generate /path/to/index/storage/dir The command will generate a sphinx.conf for you and will print out where it saved it to. It will also update the “Sphinx Configuration Path” setting in the database. 4. Login to the admin area of your Newznab install and set the Sphinx settings as desired. Two very important options that you must have filled in correctly before proceeding are: (a) “Sphinx Configuration Path” - The full path to the sphinx.conf file that you just generated in Step 3. Verify that this matches the value printed out by the nnindexer.php generate command that you ran in step 3. (b) “Sphinx Binaries Path” - The full path to the location where you installed the Sphinx binaries to in Step 1. If you’re not sure where this is, you want the directory returned by the command which searchd or equivalent. If you leave this blank, then it is imperative that the Sphinx binaries be installed to a location within your system’s $PATH variable (or the Windows equivalent if not on a *nix platform). It’s worth mentioning that if you want the following commands to work, you need to make sure that “Use Sphinx” is set to “Yes”. This is also a good time to decide which indexes to enable. The default releases index is enabled by default and cannot be disabled (unless you disable Sphinx entirely). For more information on the indexes and how much “effort” it takes if they are enabled, see the section “Available Indexes” below. As a general rule, if you just want to speed up searching releases, leave the extra indexes disabled. You can always enable them later if you want. 5. Start the Sphinx search daemon (searchd): ./nnindexer.php daemon Don’t worry about any errors mentioning missing indexes, preload or “No such file or directory; NOT SERVING”–this is normal because we haven’t indexed anything yet (that’s the next step). 74 Chapter 7. Miscellaneous Newznab Documentation, Release 0.2.3-dev Important: You must run the daemon this as the same user that you run update_releases.php. If you don’t do this, things will almost certainly not work correctly! 6. Generate the initial indexes: ./nnindexer.php index full all ./nnindexer.php index delta all Depending on which items you’ve enabled for indexing, this step could take a while. 7. Restart the search daemon now that we have created all of the indexes. Note that future updates will not require a restart of the search daemon. The only reason that we have to restart it this time is because the initial indexes didn’t exist. However, for future updates the indexes will be updated without any need to restart and with zero downtime because we take advantage of Sphinx’s ability to “rotate” indexes: # Stop the search daemon... ./nnindexer.php daemon --stop # ...and restart it ./nnindexer.php daemon 8. You’re done! You should be able to test it now: ./nnindexer.php search --index releases "some search term" 7.2.2 Overview Below you’ll find some useful information for understanding how Sphinx works and how it is integrated into Newznab. Full vs. Delta Sphinx is designed in such a way that every time you “index”, you have to actually “re-index”; you can’t just simply update the index with only the new data. However, we obviously don’t want to have to re-index such a large dataset every time a new record is added. So, to get around this issue, we use “delta index” update scheme. The way this works is fairly simple; for every index we actually have two indexes: a “main” or “full” index and a “delta” index. The “main” index holds most of the indexed data, while the “delta” index only hold the data that has been added/modified since we last updated the “main” index. Fortunately, Sphinx also provides a way to merge indexes, so every so often (say once a day) we merge the “delta” into the “main”. You can control this merge frequency via the “Merge Frequency” setting from the site settings page. For more information about how this works see the Sphinx website: http://sphinxsearch.com/docs/2.0.2/deltaupdates.html Fields vs. Attributes An important concept in Sphinx is the difference between “fields” and “attributes”. “fields” store data that is directly retrievable from a search string; this is the data that make the index a “full-text” search. “attributes” contain data that gets attached to each record in the full-text index. While not directly searchable, “attributes” can be used to filter, group and sort the results returned from the search. 7.2. Sphinx 75 Newznab Documentation, Release 0.2.3-dev Deleting Releases The situation is further complicated by the fact that removing items from the index is somewhat complicated. As a simple remedy to this, there is the “Rebuild Frequency” setting on the site settings page. This setting controls how often we do a full rebuild of the main index. When the main index is rebuilt, all of the deleted items will no longer be present in the index. It is also worth mentioning here that even though your index may contain items that have subsequently been deleted from MySQL this won’t have any visible effect on the search results on Newznab’s frontend. The reason that we rebuild is so that performance and integrity of the main index doesn’t degrade over time. 7.2.3 Available Indexes Currently there are 5 supported indexes. You can enable or disable any of them except for the main “releases” index. They are, listed in order of difficulty to index: • releases (main) • releasefiles • releasenfo • nzbs • predb As stated, you can choose to enable or disable any of the indexes except for “releases”. In order to decide which ones to enable/disable, below you will find some information about each index which might help you make your decision. Index: releases This is the main index. It indexes nearly all of the data contained within the “releases”, “bookinfo”, “consoleinfo”, “episodeinfo”, “musicinfo” and “movieinfo” tables in Newznab. The “delta” index contains all releases that have been added or modified since the last time the “main” index was updated. This ensures that not just new releases are indexed, but also ones that were updated as well. The searchable fields are: • name • searchname • fromname • tvtitle • season • episode • bookinfo_title • bookinfo_author • bookinfo_publisher • bookinfo_review • consoleinfo_title • consoleinfo_publisher • consoleinfo_review • episodeinfo_showtitle 76 Chapter 7. Miscellaneous Newznab Documentation, Release 0.2.3-dev • episodeinfo_eptitle • episodeinfo_director • episodeinfo_writer • episodeinfo_gueststars • episodeinfo_overview • musicinfo_title • musicinfo_review • musicinfo_artist • musicinfo_publisher • musicinfo_tracks • movieinfo_title • movieinfo_tagline • movieinfo_plot • movieinfo_director • movieinfo_actors • movieinfo_genre • predb_dirname • predb_filename The attributes are: size groupID categoryID totalpart grabs completion regexID rageID tvdbID imdbID episodeinfoID musicinfoID consoleinfoID bookinfoID preID anidbID reqID comments passwordstatus rarinnerfilecount haspreview guid seriesfull postdate 7.2. Sphinx bigint uint uint uint uint uint uint uint uint uint uint uint uint uint uint uint uint uint uint uint uint string string timestamp Continued on next page 77 Newznab Documentation, Release 0.2.3-dev Table 7.3 – continued from previous page adddate timestamp tvairdate timestamp bookinfo_genreID uint bookinfo_pages uint bookinfo_cover uint bookinfo_asin string bookinfo_url string bookinfo_dewey string bookinfo_ean string bookinfo_isbn string bookinfo_publishdate timestamp consoleinfo_asin string consoleinfo_url string consoleinfo_salesrank uint consoleinfo_platform string consoleinfo_genreID uint consoleinfo_esrb string consoleinfo_releasedate timestamp consoleinfo_cover uint episodeinfo_rageID uint episodeinfo_tvdbID uint episodeinfo_imdbID uint episodeinfo_epabsolute uint episodeinfo_rating float episodeinfo_fullep string episodeinfo_link string episodeinfo_airdate timestamp musicinfo_salesrank uint musicinfo_genreID uint musicinfo_cover uint musicinfo_asin string musicinfo_year string musicinfo_releasedate timestamp movieinfo_imdbID uint movieinfo_tmdbID uint movieinfo_year uint movieinfo_cover uint movieinfo_backdrop uint movieinfo_rating float movieinfo_language string predb_ctime uint predb_nuketime uint predb_filesize float predb_filecount uint predb_category string predb_nuketype string predb_nukereason string Index: releasefiles Optional This indexes everything in the “releasefiles” table within Newznab. An important thing to note here is that due to the 78 Chapter 7. Miscellaneous Newznab Documentation, Release 0.2.3-dev nature of the query needed for this index, all the results need to be obtained in a single query. As a result, you’re “releasefiles” table might become locked for an extended period of time as this index is built. However, depending on your database and hardware, this might be a non-issue for you, so it is best to test it and see what works. A solution for this might be implemented in future versions. The searchable fields are: • name (a concatenated list of all the file names for a given release) There are no attributes associated with this index. Index: releasenfo Optional This indexes everything in the “releasenfo” table within Newznab. Since the NFOs can be fairly large documents of text, this index take considerably longer to index than the others listed above and also requires more disk space. The searchable fields are: • nfo There are no attributes associated with this index. Index: nzbs Optional This indexes the contents of all the NZBs. You should think very carefully about whether or not your machine is capable of dealing with this index as it requires 2-3 orders of magnitude more disk space and processing time than all of the other indexes combined. With that said, this index also uses Sphinx’s “real-time” indexing functionality. What that really means for you is that once you have the data indexed, you won’t ever really have to re-index it (unlike the other indexes which do not work this way). The searchable fields are: • file_names (a space-concatenated string of the file names) The attributes are: • file_count (int) Index: predb Optional If you use the nzpre feature and you frequently search PreDB, then this might be a worthwhile index for you. Since the predb table can contain many rows (3-5x as many as releases), this might strain your system a bit. The searchable fields are: • dirname • category • nuketype The attributes are: • ctime (uint) • guid (string) 7.2. Sphinx 79 Newznab Documentation, Release 0.2.3-dev • nfoID (uint) 7.2.4 API misc/sphinx/nnindexer.php property $name property $title print_usage() index() generate() search() daemon() merge() main() 7.3 Update Scripts This directory (misc/update_scripts) contains a collection of command-line utilities for updating Newznab. Whilst you can run them stand-alone for testing things out, it is intended that you should run the calling script win_scriptsrunme.bat or nix_scriptsnewznab_screen.sh which runs each of these scripts in the right order. 7.3.1 Updating These scripts should be run on a frequent basis in order to stay current with the newest posts to usenet. update_binaries.php This script downloads new headers from the news server and puts them in the database (binaries and parts tables). update_binaries_threaded.php This script runs on linux only and calls the update_binaries script in 10 separate threads. update_predb.php If you have configured nzpre this script will retrieve pre data and store it in the newznab database. If the parameter true is added, then releases are matched and linked with pre entries update_releases.php This script creates releases from downloaded headers. It includes all the additional post processing which is performed as a release is formed. 80 Chapter 7. Miscellaneous Newznab Documentation, Release 0.2.3-dev update_theaters.php This script updates the ‘whats on in theaters’ data from rotten tomatoes if a rotten tomatoes api key is present. update_tvschedule.php This script updates the tv schedule data from thetvdb. 7.3.2 Maintenance These scripts should be run occasionally. optimise_db.php Optimises and repairs mysql tables if necessary. Pass in the true argument to force an optimise and repair regardless of whether its necessary. 7.3.3 Backfilling backfill.php The equivalent of update_binaries.php but for going forwards from the group.backfilldays to the latest post. Downloads headers from usenet and puts them in the database (binaries and parts tables). backfill_date.php The same as backfill.php but goes back to a specific date passed as an argument. backfill_threaded.php Calls backfill.php with a thread for each group requiring backfilling. 7.3. Update Scripts 81 Newznab Documentation, Release 0.2.3-dev 82 Chapter 7. Miscellaneous CHAPTER 8 Software license for Newznab+ 8.1 Summary Personal use only (cannot be resold or distributed) Commercial use allowed Can modify source-code but cannot distribute modifications (derivative works) Software trademarks are included in the license Parts of the software are provided under separate licenses, as follows: • jquery.js is under the MIT license • PEAR/NNTP is under the W3C license • rarinfo.php is under the modified BSD license • Smarty.class.php is under the LGPL license • Tmdb.php is under the BSD license • powerspawn.php is under the BSD license 8.2 Terms and Conditions 1. Preamble: This Agreement governs the relationship between licensee, a private person, (hereinafter: Licensee) and newznab.com, whose principal place of business is United Kingdom (Hereinafter: Licensor). This Agreement sets the terms, rights, restrictions and obligations on using [newznab] (hereinafter: The Software) created and owned by Licensor, as detailed herein 2. License Grant: Licensor hereby grants Licensee a Personal, Non-assignable & non-transferable, Commercial, Royalty free, Including the rights to create but not distribute derivative works, Non-exclusive license, all with accordance with the terms set forth and other legal restrictions set forth in 3rd party software used while running Software. 3. Limited: Licensee may use Software for the purpose of: (a) Running Software on Licensee‘s Website[s] and Server[s]; (b) Allowing 3rd Parties to run Software on Licensee‘s Website[s] and Server[s]; (c) Publishing Software‘s output to Licensee and 3rd Parties; (d) Distribute Verbatim Copites of Software‘s output; (e) Modify Software to suit Licensee‘s needs and specifications. 83 Newznab Documentation, Release 0.2.3-dev 4. Personal: Licensee may not sublicense, lease, rent or otherwise allow 3rd parties to use Software, or any portions thereof, apart from being executed in any form apart from being run as a server script on Licensee’s Website[s] or Server[s] 5. Non Assignable & Non-Transferable: Licensee may not assign or transfer his rights and duties under this license. 6. Commercial, Royalty Free: Licensee may use Software for any purpose, including paid-services, without any royalties 7. Including the Right to Create Derivative Works: Licensee may create derivative works based on Software, including amending Software’s source code, modifying it, integrating it into a larger work or removing portions of Software, as long as no distribution of the derivative works is made 8. [Multi-]Site: Licensee may use Software on unlimited Server[s] and unlimited Website[s], for Licensee’s Websites only 9. Licensor shall retain full title in Trademarks, and any trademarks and tradenames contained, including Software’s names, logos, and all other intellectual property. Unless specifically stated in this license, no license shall be made to use, associate or affiliate Software with Licensee in any manner. Licensee may not use Software‘s name, tradename, trademarks or logo when distributing derivative works of software to 3rd parties. 10. Additional licenses: Portions of the The Software are based on source-code licensed under different licenses, as follows: • jquery.js is under the MIT license • PEAR/NNTP is under the W3C license • rarinfo.php is under the modified BSD license • Smarty.class.php is under the LGPL license • Tmdb.php is under the BSD license 11. Term & Termination: The Term of this license shall be until terminated. Licensor may terminate this Agreement, including Licensee‘s license in the case where Licensee: (a) became insolvent or otherwise entered into any liquidation process; or (b) exported The Software to any jurisdiction where licensor may not enforce his rights under this agreements in; or (c) Licenee was in breach of any of this license’s terms and conditions and such breach was not cured, immediately upon notification; or (d) Licensee in breach of any of the terms of clause 2 to this license; or (e) Licensee otherwise entered into any arrangement which caused Licensor to be unable to enforce his rights under this License. 12. Payment: In consideration of the License granted under clause 2, Licensee shall pay Licensor a {fee}, via PayPal or any other mean which Licensor may deem adequate, and through Binpress‘ clearing system. Failure to perform payment shall construe as material breach of this Agreement. 13. Upgrades, Updates and Fixes: Licensor may provide Licensee, from time to time, with Upgrades, Updates or Fixes, as detailed herein and according to his sole discretion. Licensee hereby warrants to keep The Software up-to-date and install all relevant updates and fixes, and may, at his sole discretion, purchase upgrades, according to the rates set by Licensor. Licensor shall provide any update or Fix free of charge; however, nothing in this Agreement shall require Licensor to provide Updates or Fixes. (a) Upgrades: for the purpose of this license, an Upgrade shall be a material amendment in The Software, which contains new features and or major performance improvements and shall be marked as a new version number. For example, should Licensee purchase The Software under version 1.X.X, an upgrade shall commence under number 2.0.0. 84 Chapter 8. Software license for Newznab+ Newznab Documentation, Release 0.2.3-dev (b) Updates: for the purpose of this license, an update shall be a minor amendment in The Software, which may contain new features or minor improvements and shall be marked as a new sub-version number. For example, should Licensee purchase The Software under version 1.1.X, an upgrade shall commence under number 1.2.0. (c) Fix: for the purpose of this license, a fix shall be a minor amendment in The Software, intended to remove bugs or alter minor features which impair the The Software’s functionality. A fix shall be marked as a new sub-sub-version number. For example, should Licensee purchase Software under version 1.1.1, an upgrade shall commence under number 1.1.2. 14. Support: Software is provided under an AS-IS basis and without any support, updates or maintenance. Nothing in this Agreement shall require Licensor to provide Licensee with support or fixes to any bug, failure, misperformance or other defect in The Software. 15. Bug Notification: Licensee may provide Licensor of details regarding any bug, defect or failure in The Software promptly and with no delay from such event; Licensee shall comply with Licensor’s request for information regarding bugs, defects or failures and furnish him with information, screenshots and try to reproduce such bugs, defects or failures. 16. Feature Request: Licensee may request additional features in Software, provided, however, that (i) Licesee shall waive any claim or right in such feature should feature be developed by Licensor; (ii) Licensee shall be prohibited from developing the feature, or disclose such feature request, or feature, to any 3rd party directly competing with Licensor or any 3rd party which may be, following the development of such feature, in direct competition with Licensor; (iii) Licensee warrants that feature does not infringe any 3rd party patent, trademark, trade-secret or any other intellectual property right; and (iv) Licensee developed, envisioned or created the feature solely by himself. 17. Liability: To the extent permitted under Law, The Software is provided under an AS-IS basis. Licensor shall never, and without any limit, be liable for any damage, cost, expense or any other payment incurred by Licesee as a result of Software‘s actions, failure, bugs and/or any other interaction between The Software and Licesee‘s end-equipment, computers, other software or any 3rd party, end-equipment, computer or services. Moreover, Licensor shall never be liable for any defect in source code written by Licensee when relying on The Software or using The Software‘s source code. 18. Warranty: (a) Intellectual Property: Licensor hereby warrants that The Software does not violate or infringe any 3rd party claims in regards to intellectual property, patents and/or trademarks and that to the best of its knowledge no legal action has been taken against it for any infringement or violation of any 3rd party intellectual property rights. (b) No-Warranty: The Software is provided without any warranty; Licensor hereby disclaims any warranty that The Software shall be error free, without defects or code which may cause damage to Licensee‘s computers or to Licensee, and that Software shall be functional. Licensee shall be solely liable to any damage, defect or loss incurred as a result of operating software and undertake the risks contained in running The Software on License‘s Server[s] and Website[s]. (c) Prior Inspection: Licensee hereby states that he inspected The Software thoroughly and found it satisfactory and adequate to his needs, that it does not interfere with his regular operation and that it does meet the standards and scope of his computer systems and architecture. Licensee found that The Software interacts with his development, website and server environment and that it does not infringe any of End User License Agreement of any software Licensee may use in performing his services. Licensee hereby waives any claims regarding The Software’s incompatibility, performance, results and features, and warrants that he inspected the The Software. 19. No Refunds: Licensee warrants that he inspected The Software according to clause 7(c) and that it is adequate to his needs. Accordingly, as The Software is intangible goods, Licensee shall not be, ever, entitled to any refund, rebate, compensation or restitution for any reason whatsoever, even if The Software contains material flaws. 8.2. Terms and Conditions 85 Newznab Documentation, Release 0.2.3-dev 20. Indemnification: Licensee hereby warrants to hold Licensor harmless and indemnify Licensor for any lawsuit brought against it in regards to Licensee‘s use of The Software in means that violate, breach or otherwise circumvent this license, Licensor’s intellectual property rights or Licensor’s title in The Software. Licensor shall promptly notify Licensee in case of such legal action and request Licensee‘s consent prior to any settlement in relation to such lawsuit or claim. 21. Governing Law, Jurisdiction: Licensee hereby agrees not to initiate class-action lawsuits against Licensor in relation to this license and to compensate Licensor for any legal fees, cots or attorney fees should any claim brought by Licensee against Licensor be denied, in part or in full. 86 Chapter 8. Software license for Newznab+ CHAPTER 9 Todo This page will list of items that are yet to be included or completed. 87 Newznab Documentation, Release 0.2.3-dev 88 Chapter 9. Todo CHAPTER 10 Glossary Amazon A provider of metadata for releases. You need an API key to use this service. imdb A provider of metadata for movie releases. This information is obtained via scraping. tmdb A provider of metadata for movie releases. A shared API key is used for this service. nfo A text file containing information about a release. par A parity file for completing usenet downloads which contain missing parts. rotten tomatoes A provider of metadata for movie releases. You need an API key to use this service. NZB An NZB is an XML-based file format for retrieving posts from NNTP (Usenet) servers. For more information about NZB files, see here. regex Short for “regular expression”, which provides a concise and flexible means for matching and extracting strings of text. “Regexs” are a central concept in Newznab as they provide the foundation for matching and grouping releases. More information can be found here. TvRage A provider of metadata for releases. The website is www.tvrage.com. 89 Newznab Documentation, Release 0.2.3-dev 90 Chapter 10. Glossary CHAPTER 11 Developer Docs These are the low-level developer docs for Newznab’s source code. They are aimed at developers or other users who want to get their hands dirty and modify Newznab’s source code or just simply learn more about the Newznab’s internals. 11.1 lib/TMDb.php class TMDb TMDb PHP API class - API ‘themoviedb.org’ API Documentation: http://api.themoviedb.org/2.1/ Documentation and usage in README file - http://github.com/glamorous/TMDb-PHP-API author $Jonas De Smet - Glamorous since 09.11.2009 date 01.09.2010 copyright Jonas $e Smet - Glamorous version 0.9.8 license BSD $ttp://www.opensource.org/licenses/bsd-license.php TMDb:: TMDB = ’Themoviedb.org (TMDb)’; TMDb:: IMDB = ’The Internet Movie Database (IMDb)’; TMDb:: JSON = ’json’; TMDb:: XML = ’xml’; TMDb:: YAML = ’yaml’; TMDb:: POST = ’post’; TMDb:: GET = ’get’; TMDb:: API_URL = ’http://api.themoviedb.org/2.1/’; TMDb:: VERSION = ’0.9.8’; __construct($apikey, $defaultFormat = TMDb::JSON, $defaultLang = ‘en’) Default constructor Parameters • $apikey (string) – API-key recieved from TMDb 91 Newznab Documentation, Release 0.2.3-dev • $defaultFormat (const[optional]) – Default return format • $defaultLang (string) – Default language Returns void searchMovie($title, $format = null) Search a movie by title Parameters • $title (string) – Title to search after in the TMDb database • $format (const[optional]) – Return format for this function Returns string getMovie($id, $type = TMDb::TMDB, $format = null) Get a movie by TMDb-id or IMDb-id Parameters • $id (string) – TMDb-id or IMDb-id • $type (const[optional]) – For use with IMDb-id you have to change this parameter to TMDb::IMDB • $format (const[optional]) – Return format for this function Returns string getMovieByHash($hash, $bytesize, $format = null) Get a movie by hash Parameters • $hash (string) – Hash • $bytesize (string) – Bitesize • $format (const[optional]) – Return format for this function Returns string getImages($id, $format = null) Get images by the TMDb-id or IMDb-id Parameters • $id (string) – Movie TMDb-id or IMDb-id • $format (const[optional]) – Return format for this function Returns string searchPerson($name, $format = null) Search a person by name Parameters • $name (string) – Name to search after in the TMDb database • $format (const[optional]) – Return format for this function Returns string getPerson($id, $format = null) Get a person by his TMDb-id 92 Chapter 11. Developer Docs Newznab Documentation, Release 0.2.3-dev Parameters • $id (string) – Persons TMDb-id • $format (const[optional]) – Return format for this function Returns string getMovieVersion($id, $format = null) Get a Movie-version by its TMDb-id or IMDB-id Parameters • $id (string) – Movie TMDb-id or IMDB-id • $format (const[optional]) – Return format for this function Returns string getMovieVersions(array $ids, $format = null) Get multiple Movie-versions by their TMDb-id or IMDB-id Parameters • $ids (array) – Array with Movie TMDb-id’s or IMDB-id’s • $format (const[optional]) – Return format for this function Returns string getPersonVersion($id, $format = null) Get a Person-version by its TMDb-id Parameters • $id (string) – Person TMDb-id • $format (const[optional]) – Return format for this function Returns string getPersonVersions(array $ids, $format = null) Get multiple Person-versions by their TMDb-id Parameters • $ids (array) – Array with Person TMDb-id’s • $format (const[optional]) – Return format for this function Returns string browseMovies($order_by, $order, $params = array(), $format = null) Browse movies to get a list ordered by rating/release/title Parameters • $order_by (string) – Order by rating, release or title • $order (string) – Order asc or desc • $params (array[optional]) – Key => value pairs for optional parameters • $format (const[optional]) – Return format for this function Returns mixed getMovieTranslations($id, $format = null) Get Movie-translations by its TMDb-id or IMDB-id 11.1. lib/TMDb.php 93 Newznab Documentation, Release 0.2.3-dev Parameters • $id (string) – Movie TMDb-id or IMDB-id • $format (const[optional]) – Return format for this function Returns string getLatestMovie($format = null) Get Latest Movie Parameters • $format (const[optional]) – Return format for this function Returns string getLatestPerson($format = null) Get Latest Person Parameters • $format (const[optional]) – Return format for this function Returns string getGenres($format = null) Get Genres Parameters • $format (const[optional]) – Return format for this function Returns string getToken() Authentication: getToken Returns string getSession($token, $format = null) Authentication: getSession Returns string addMovieRating($id, $rating, $session_key, $format = null) Add a rating to a movie Parameters • $id (string) – TMDb-id or IDMB-id of the Movie • $rating (float) – A value between 0.0 to 10.0 • $session_key (string) – Session key that you received with getSession Returns string setFormat($format) Setter for the default return format Parameters • $format (const) – Returns void getFormat() Getter for the default return format 94 Chapter 11. Developer Docs Newznab Documentation, Release 0.2.3-dev Returns const setLang($lang) Setter for the default language Parameters • $lang (string) – Returns void getLang() Getter for the default language Returns string setApikey($apikey) Setter for the API-key Parameters • $apikey (string) – Returns void getApikey() Getter for the API-key Returns string 11.2 lib/adminpage.php class AdminPage All admin pages implement this class. Enforces admin role for requesting user. AdminPage() Default constructor. render() Output a page using the admin template. 11.3 lib/amazon.php class AmazonProductAPI Class to access Amazons Product Advertising API All requests are not implemented here. You can easily implement the others from the ones given below. author $Sameer Borate link http://www.codediesel.com version 1.0 AmazonProductAPI:: MUSIC = "Music"; AmazonProductAPI:: MP3 = "MP3Downloads"; AmazonProductAPI:: DVD = "DVD"; AmazonProductAPI:: GAMES = "VideoGames"; 11.2. lib/adminpage.php 95 Newznab Documentation, Release 0.2.3-dev AmazonProductAPI:: BOOKS = "Books"; __construct($pubk, $privk, $asstag = “”) searchProducts($search, $category, $searchType = “UPC”, $searchNode=”“) Return details of products searched by various types Parameters • $search (string) – search term • $category (string) – search category • $searchType (string) – type of search Returns mixed $impleXML object getItemByUpc($upc_code, $product_type) Return details of a product searched by UPC Parameters • $upc_code (int) – UPC code of the product to search • $product_type (string) – type of the product Returns mixed $impleXML object getItemByAsin($asin_code) Return details of a product searched by ASIN Parameters • $asin_code (int) – ASIN code of the product to search Returns mixed $impleXML object getItemByKeyword($keyword, $product_type) Return details of a product searched by keyword Parameters • $keyword (string) – keyword to search • $product_type (string) – type of the product Returns mixed $impleXML object aws_signed_request() 11.4 lib/anidb.php class AniDB Class to handle the querying of anidb, and storage/retrieval of anime data from the database AniDB:: CLIENT = ’newznab’; AniDB:: CLIENTVER = 2; AniDB($echooutput=false) Default constructor. animetitlesUpdate() Retrieve a list of all anime titles from anidb API. 96 Chapter 11. Developer Docs Newznab Documentation, Release 0.2.3-dev addTitle($AniDBAPIArray) Insert an anime title to the database. updateTitle($anidbID, $title, $type, $startdate, $enddate, $related, $creators, $description, $rating, $categories, $characters, $epnos, $airdates, $episodetitles) Update an anime title in the database. deleteTitle($anidbID) Delete an anime title from the database. getanidbID($title) Retrieve an anime title by name. getAnimeList($letter=’‘, $animetitle=’‘) Retrieve a list of all anime, filterable by initial letter. getAnimeRange($start, $num, $animetitle=’‘) Retrieve a list anime by limit range. getAnimeCount($animetitle=’‘) Retrieve a count of anime. getAnimeInfo($anidbID) Retrieve an anime row. cleanFilename($searchname) Strip an anime title to a cleaned version. processAnimeReleases() Process all untagged releases in the anime category. AniDBAPI($anidbID) Issue a request to the anidb API. 11.5 lib/backfill.php class Backfill Retrieves messages from usenet based on provided backfill-to date. Backfill() Default constructor. backfillAllGroups($groupName=’‘, $backfillDate=null) Update all active groups categories and descriptions. backfillGroup($nntp, $groupArr, $backfillDate=null) Update a group back to a specified date. postdate($nntp, $post, $debug=true) Returns single timestamp from a local article number. daytopost($nntp, $group, $days, $debug=true) Calculates the post number for a given number of days back in a group. 11.6 lib/binaries.php class Binaries 11.5. lib/backfill.php 97 Newznab Documentation, Release 0.2.3-dev This class manages the downloading of binaries and parts from usenet, and the managing of data in the binaries and parts tables. Binaries:: BLACKLIST_FIELD_SUBJECT = 1; Binaries:: BLACKLIST_FIELD_FROM = 2; Binaries:: BLACKLIST_FIELD_MESSAGEID = 3; Binaries() Default constructor updateAllGroups() Process headers and store in database for all active groups. updateGroup($nntp=null, $groupArr) Process headers and store in database for a group. scan($nntp, $groupArr, $first, $last, $type=’update’) Download a range of usenet messages. Store binaries with subjects matching a specific pattern in the database. retrieveBlackList() Return internally cached list of binary blacklist patterns. isBlackListed($msg, $groupName) Test if a message subject is blacklisted. search($search, $limit=1000, $excludedcats=array()) Rawsearch. Perform a simple like match on binary subjects matching a pattern. getForReleaseId($id) Get all binaries for a release. getById($id) Get a binary row. getBlacklist($activeonly=true) Get list of blacklists from database. getBlacklistByID($id) Get a blacklist row from database. deleteBlacklist($id) Delete a blacklist row from database. updateBlacklist($regex) Update a blacklist row. addBlacklist($regex) Add a new blacklist row. delete($id) Add a new binary row and its associated parts. 11.7 lib/book.php class Book This class manages the lookup of book information and storage/retrieve of book metadata. Book:: NUMTOPROCESSPERTIME = 100; 98 Chapter 11. Developer Docs Newznab Documentation, Release 0.2.3-dev Book($echooutput=false) Default constructor. getBookInfo($id) Get bookinfo row for ID. getBookInfoByName($author, $title) Get bookinfo row for title. getRange($start, $num) Get bookinfo rows by limit. getCount() Get count of all bookinfos. getBookCount($maxage=-1) Get count of all bookinfo rows for browse list. getBookRange($start, $num, $orderby, $maxage=-1) Get range of bookinfo rows for browse list. getBrowseOrder($orderby) Get orderby column for book browse list. getBookOrdering() Get all orderable columns for book browse list. getBrowseByOptions() Get filter options from browse list. getBrowseBy() Get filter options from user into SQL query. update($id, $title, $asin, $url, $author, $publisher, $publishdate, $cover) Update bookinfo row. updateBookInfo($author, $title) Determine if a bookinfo can be found locally, if not query amazon, strip out it properties and update the database. fetchAmazonProperties($title) Query amazon for a title. processBookReleases() Process all untagged book releases for additional metadata. parseAuthor($releasename) Strip out author and title name from a release name. addUpdateBookInfo($title, $asin, $url, $author, $publisher, $publishdate, $review, $cover, $dewey, $ean, $isbn, $pages) Insert or update a bookinfo row. 11.8 lib/category.php class Category This class manages the site wide categories. Category:: CAT_GAME_NDS = 1010; Category:: CAT_GAME_PSP = 1020; 11.8. lib/category.php 99 Newznab Documentation, Release 0.2.3-dev Category:: CAT_GAME_WII = 1030; Category:: CAT_GAME_XBOX = 1040; Category:: CAT_GAME_XBOX360 = 1050; Category:: CAT_GAME_WIIWARE = 1060; Category:: CAT_GAME_XBOX360DLC = 1070; Category:: CAT_GAME_PS3 = 1080; Category:: CAT_MOVIE_FOREIGN = 2010; Category:: CAT_MOVIE_OTHER = 2020; Category:: CAT_MOVIE_SD = 2030; Category:: CAT_MOVIE_HD = 2040; Category:: CAT_MOVIE_BLURAY = 2050; Category:: CAT_MOVIE_3D = 2060; Category:: CAT_MUSIC_MP3 = 3010; Category:: CAT_MUSIC_VIDEO = 3020; Category:: CAT_MUSIC_AUDIOBOOK = 3030; Category:: CAT_MUSIC_LOSSLESS = 3040; Category:: CAT_PC_0DAY = 4010; Category:: CAT_PC_ISO = 4020; Category:: CAT_PC_MAC = 4030; Category:: CAT_PC_MOBILEOTHER = 4040; Category:: CAT_PC_GAMES = 4050; Category:: CAT_PC_MOBILEIOS = 4060; Category:: CAT_PC_MOBILEANDROID = 4070; Category:: CAT_TV_FOREIGN = 5020; Category:: CAT_TV_SD = 5030; Category:: CAT_TV_HD = 5040; Category:: CAT_TV_OTHER = 5050; Category:: CAT_TV_SPORT = 5060; Category:: CAT_TV_ANIME = 5070; Category:: CAT_XXX_DVD = 6010; Category:: CAT_XXX_WMV = 6020; Category:: CAT_XXX_XVID = 6030; Category:: CAT_XXX_X264 = 6040; Category:: CAT_XXX_PACK = 6050; Category:: CAT_XXX_IMAGESET = 6060; Category:: CAT_MISC = 7010; 100 Chapter 11. Developer Docs Newznab Documentation, Release 0.2.3-dev Category:: CAT_MISC_EBOOK = 7020; Category:: CAT_MISC_COMICS = 7030; Category:: CAT_NOT_DETERMINED = 7900; Category:: CAT_PARENT_GAME = 1000; Category:: CAT_PARENT_MOVIE = 2000; Category:: CAT_PARENT_MUSIC = 3000; Category:: CAT_PARENT_PC = 4000; Category:: CAT_PARENT_TV = 5000; Category:: CAT_PARENT_XXX = 6000; Category:: CAT_PARENT_MISC = 7000; Category:: STATUS_INACTIVE = 0; Category:: STATUS_ACTIVE = 1; get($activeonly=false, $excludedcats=array()) Get a list of categories. isParent($cid) Determine if a category is a parent. getFlat($activeonly=false) Get a list of categories and their parents. getChildren($cid) Get a list of all child categories for a parent. getById($id) Get a category row by its ID. getByIds($ids) Get a list of categories by an array of IDs. update($id, $status, $desc, $disablepreview) Update a category. getForMenu($excludedcats=array()) Get the categories in a format for use by the headermenu.tpl. getForSelect($blnIncludeNoneSelected = true) Return a list of categories for use in a dropdown. determineCategory($group, $releasename = “”) Work out which category is applicable for either a group or a binary. Returns -1 if no category is appropriate from the group name. isTV($releasename) Work out if a release is TV isForeignTV($releasename) Work out if a release is Foreign TV isSportTV($releasename) Work out if a release is Sport TV isHDTV($releasename) Work out if a release is HD TV 11.8. lib/category.php 101 Newznab Documentation, Release 0.2.3-dev isSDTV($releasename) Work out if a release is SD TV isMovie($releasename) Work out if a release is a Movie isMovieForeign($releasename) Work out if a release is a Foreign Movie isMovieSD($releasename) Work out if a release is a SD Movie isMovie3D($releasename) Work out if a release is a 3D Movie isMovieHD($releasename) Work out if a release is a HD Movie isMovieBluRay($releasename) Work out if a release is a Bluray Movie isPC($releasename) Work out if a release is PC App isMobileAndroid($releasename) Work out if a release is Mobile Android App isMobileiOS($releasename) Work out if a release is Mobile iOS App isMobileOther($releasename) Work out if a release is Mobile Other App is0day($releasename) Work out if a release is 0day App isMac($releasename) Work out if a release is Mac App isISO($releasename) Work out if a release is ISO App isPCGame($releasename) Work out if a release is PC Game isXxx($releasename) Work out if a release is XXX isXxx264($releasename) Work out if a release is HD XXX isXxxXvid($releasename) Work out if a release is SD XXX isXxxWMV($releasename) Work out if a release is Other XXX isXxxDVD($releasename) Work out if a release is XXX DVDR isXxxPack($releasename) Work out if a release is XXX Pack 102 Chapter 11. Developer Docs Newznab Documentation, Release 0.2.3-dev isXxxImageset($releasename) Work out if a release is XXX ImageSet isConsole($releasename) Work out if a release is Console App isGameNDS($releasename) Work out if a release is NDS App isGamePS3($releasename) Work out if a release is PS3 App isGamePSP($releasename) Work out if a release is PSP App isGameWiiWare($releasename) Work out if a release is WiiWare App isGameWii($releasename) Work out if a release is Wii App isGameXBOX360DLC($releasename) Work out if a release is 360DLC App isGameXBOX360($releasename) Work out if a release is 360 App isGameXBOX($releasename) Work out if a release is XBOX1 App isMusic($releasename) Work out if a release is Music isMusicVideo($releasename) Work out if a release is Music Video isMusicMP3($releasename) Work out if a release is MP3 Music isMusicLossless($releasename) Work out if a release is FLAC Music isEBook($releasename) Work out if a release is an Ebook 11.9 lib/console.php class Console This class looks up metadata about console releases and handles storage/retrieval from the database. Console:: NUMTOPROCESSPERTIME = 100; Console($echooutput=false) Default constructor getConsoleInfo($id) Get consoleinfo row by ID. getConsoleInfoByName($title, $platform) Get consoleinfo row by name and platform. 11.9. lib/console.php 103 Newznab Documentation, Release 0.2.3-dev getRange($start, $num) Get range of consoleinfo row by limit. getCount() Get count of all consoleinfo rows. getConsoleCount($cat, $maxage=-1, $excludedcats=array()) Get count of all consoleinfo rows for browse list. getConsoleRange($cat, $start, $num, $orderby, $maxage=-1, $excludedcats=array()) Get range of consoleinfo rows for browse list. getConsoleOrder($orderby) Get orderby column for console browse list. getConsoleOrdering() Get available orderby columns for console browse list. getBrowseByOptions() Get available filter columns for console browse list. getBrowseBy() Get sql for selected filter columns for console browse list. update($id, $title, $asin, $url, $salesrank, $platform, $publisher, $releasedate, $esrb, $cover, $genreID) Update consoleinfo row. updateConsoleInfo($gameInfo) Check whether a title is available at Amazon and store its metadata. fetchAmazonProperties($title, $node) Retrieve properties for an item from Amazon. processConsoleReleases() Check all untagged console releases for their extended metadata. parseTitle($releasename) Strip a title from a releasename. getBrowseNode($platform) Translate Amazon browse nodes for console types. matchBrowseNode($nodeName) Match an Amazon browse node with internal genre types . 11.10 lib/content.php class Contents This class looks up site content. Contents:: TYPEUSEFUL = 1; Contents:: TYPEARTICLE = 2; Contents:: TYPEINDEX = 3; validate($content) Validate a content row before insert/update. 104 Chapter 11. Developer Docs Newznab Documentation, Release 0.2.3-dev delete($id) Delete a content row. update($content) Update a content row. add($content) Add a content row. get() Get all active content rows. getAll() Get all content rows. getByID($id, $role) Get a content row by its ID. getIndex() Get the index page. getForMenuByTypeAndRole($id, $role) Get all content rows for a role and menu type, ie useful links. 11.11 lib/episode.php class Episode This class looks up tv episode data. getEpisodeInfoByID($episodeinfoID) Get an episodeinfo row by ID. getEpisodeInfoByName($showtitle, $fullep, $epabsolute=‘0’) Get an episodeinfo row by name. 11.12 lib/forum.php class Forum This class handles data access for forum and post data. add($parentid, $userid, $subject, $message, $locked = 0, $sticky = 0, $replies = 0) Add a forum post. getParent($parent) Get the top level post in a thread. getPosts($parent) Get all child posts for a parent. getPost($id) Get a forumpost by its ID. getBrowseCount() Get a count of all forum posts. getBrowseRange($start, $num) Get a list of forum posts for browse list by limit. 11.11. lib/episode.php 105 Newznab Documentation, Release 0.2.3-dev deleteParent($parent) Delete an entire thread. deletePost($id) Delete a forumpost row. deleteUser($id) Delete all forumposts for a user. getCountForUser($uid) Count of all posts for a user. getForUserRange($uid, $start, $num) Get forum posts for a user for paged list in profile. 11.13 lib/genres.php class Genres This class handles data access for genre data. Genres:: CONSOLE_TYPE = Category::CAT_PARENT_GAME; Genres:: MUSIC_TYPE = Category::CAT_PARENT_MUSIC; Genres:: BOOK_TYPE = Category::CAT_MISC_EBOOK; getGenres($type=’‘, $activeonly=false) Get genre rows, filter by type/active. getOrAddGenreKey($genreName, &$genreassoc) Add new genre. 11.14 lib/groups.php class Groups This class handles data access for groups. getAll() Get all group rows. getGroupsForSelect() Get all group rows for use in a select list. getByID($id) Get a group row by its ID. getActive() Get all active group rows. getByName($grp) Get a group row by name. getCount($groupname=”“) Get count of all groups, filter by name. getRange($start, $num, $groupname=”“) Get groups rows for browse list by limit. 106 Chapter 11. Developer Docs Newznab Documentation, Release 0.2.3-dev add($group) Add a new group row. delete($id) Delete a group. reset($id) Reset all stats about a group, like its first_record. purge($id) Reset all stats about a group and delete all releases and binaries associated with that group. update($group) Update a group row. addBulk($groupList, $active = 1) Update the list of newsgroups from nntp provider matching a regex and return an array of messages. updateGroupStatus($id, $status = 0) Update a group to be active/inactive. 11.15 lib/install.php class Install Structure for holding data during install. property $DB_TYPE property $DB_HOST property $DB_USER property $DB_PASSWORD property $DB_NAME property $NNTP_USERNAME property $NNTP_PASSWORD property $NNTP_SERVER property $NNTP_PORT property $NNTP_SSLENABLED property $CACHE_TYPE property $WWW_DIR property $SMARTY_DIR property $DB_DIR property $MISC_DIR property $INSTALL_DIR property $ADMIN_USER property $ADMIN_PASS property $ADMIN_EMAIL property $NZB_PATH 11.15. lib/install.php 107 Newznab Documentation, Release 0.2.3-dev property $COMPILED_CONFIG property $doCheck property $sha1Check property $mysqlCheck property $gdCheck property $curlCheck property $cacheCheck property $movieCoversCheck property $animeCoversCheck property $musicCoversCheck property $configCheck property $lockCheck property $pearCheck property $schemaCheck property $phpCheck property $timelimitCheck property $memlimitCheck property $rewriteCheck property $opensslCheck property $timezoneCheck property $dbConnCheck property $dbNameCheck property $dbCreateCheck property $nntpCheck property $adminCheck property $nzbPathCheck property $saveConfigCheck property $saveLockCheck property $error Install() Default constructor. setSession() Save this structure in session. getSession() Return this structure from session. isInitialized() Determine if this structure has been populated. 108 Chapter 11. Developer Docs Newznab Documentation, Release 0.2.3-dev isLocked() Determine if this installation has already been installed, and .lock file is present. setConfig($tmpCfg) Populate default config values from provided string. saveConfig() Write the config file to disk. saveInstallLock() Create the installation lock file. 11.16 lib/installpage.php class Installpage This class represents each page during installation. property $title property $content property $head property $page_template property $smarty property $error Installpage() Default constructor. render() Writes out the page. isPostBack() Determine if a postback has occurred. isSuccess() Determine if an install page has issued a success. 11.17 lib/menu.php class Menu This class looks up site menu data. get($role, $serverurl) Get all menu rows for a role. getAll() Get all menu rows. getById($id) Get a menu row by its ID. delete($id) Delete a menu row. 11.16. lib/installpage.php 109 Newznab Documentation, Release 0.2.3-dev add($menu) Add a menu row. update($menu) Update a menu row. 11.18 lib/movie.php class Movie This class looks up movie info from external sources and stores/retrieves movieinfo data. Movie:: SRC_BOXOFFICE = 1; Movie:: SRC_INTHEATRE = 2; Movie:: SRC_OPENING = 3; Movie:: SRC_UPCOMING = 4; Movie:: SRC_DVD = 5; Movie($echooutput=false) Default constructor. getMovieInfo($imdbId) Get a movieinfo row by its imdbID. getMovieInfoMultiImdb($imdbIds) Get movieinfo rows by array of imdbIDs. delete($imdbId) Delete movieinfo row by its imdbID. getRange($start, $num, $moviename=”“) Get movieinfo rows by limit. getCount($moviename=”“) Get count of all movieinfo rows. getMovieCount($cat, $maxage=-1, $excludedcats=array()) Get count of all movieinfo rows filter by category. getMovieRange($cat, $start, $num, $orderby, $maxage=-1, $excludedcats=array()) Get movieinfo rows for browse list by limit. getMovieOrder($orderby) Get movieinfo orderby column sql. getMovieOrdering() Get movieinfo orderby columns. getBrowseByOptions() Get movieinfo filter columns. getBrowseBy() Get movieinfo sql column for users selected filter. makeFieldLinks($data, $field) Create links for data like actor/director so used can requery. 110 Chapter 11. Developer Docs Newznab Documentation, Release 0.2.3-dev update($id, $title, $tagline, $plot, $year, $rating, $genre, $director, $actors, $language, $cover, $backdrop) Update movieinfo row. updateMovieInfo($imdbId) Update movieinfo row by querying external sources and updating known properties/images. fetchTmdbProperties($imdbId) Lookup a movie on tmdb. fetchImdbProperties($imdbId) Scrape a movie from imdb. processMovieReleases() Process all untagged movies to link them to a movieinfo row. parseMovieName($releasename) Strip a movie name from a release. getUpcoming($type, $source=”rottentomato”) Get rows from upcoming table by type. updateUpcoming() Retrieve upcoming movie data from rottentomatoes API. updateInsUpcoming($source, $type, $info) Add/Update upcoming row. getGenres() Get list of standard movie genres. 11.19 lib/music.php class Music This class looks up music info from external sources and stores/retrieves musicinfo data. Music:: NUMTOPROCESSPERTIME = 100; Music($echooutput=false) Default constructor. getMusicInfo($id) Get musicinfo row by ID. getMusicInfoByName($artist, $album) Get musicinfo row by name. getRange($start, $num) Get musicinfo rows by limit. getCount() Get count of all musicinfo rows. getMusicCount($cat, $maxage=-1, $excludedcats=array()) Get count of all musicinfo rows by filter. getMusicRange($cat, $start, $num, $orderby, $maxage=-1, $excludedcats=array()) Get musicinfo rows for browse list by filters and limit. getMusicOrder($orderby) Get musicinfo orderby column sql. 11.19. lib/music.php 111 Newznab Documentation, Release 0.2.3-dev getMusicOrdering() Get musicinfo orderby columns. getBrowseByOptions() Get musicinfo filter columns. getBrowseBy() Get musicinfo filter column sql for user selection. update($id, $title, $asin, $url, $salesrank, $artist, $publisher, $releasedate, $year, $tracks, $cover, $genreID) Update musicinfo row updateMusicInfo($artist, $album, $year) Update musicinfo from external source fetchAmazonProperties($title) Retrieve info from Amazon for a title. processMusicReleases() Process all untagged releases to see if musicinfo exists for them. parseArtist($releasename) Strip out an artist name from a release. processMusicReleaseFromMediaInfo() Process all releases tagged as musicinfoID -2 to attempt to retrieve properties from mediainfo xml. addUpdateMusicInfo($title, $asin, $url, $salesrank, $artist, $publisher, $releasedate, $review, $year, $genreID, $tracks, $cover) Insert or update a musicinfo row. matchBrowseNode($nodeId) Convert Amazon browsenodes to genres. 11.20 lib/nfo.php class Nfo This class looks up nfo files and handles storage/retrieval of them from the database. Nfo($echooutput=false) Default constructor. determineReleaseNfo($relid) Find a binary looking like an nfo for a release. addReleaseNfo($relid, $binid) Add a releasenfo row. deleteReleaseNfo($relid) Delete a releasenfo row. parseImdb($str) Find an imdb URL in an nfo string. parseRageId($str) Find an tvrage URL in an nfo string. processNfoFiles($processImdb=1, $processTvrage=1) Download all nfos ready to process. 112 Chapter 11. Developer Docs Newznab Documentation, Release 0.2.3-dev 11.21 lib/nntp.php class Nntp This class extends the standard PEAR NNTP class with some extra features. doConnect() Start an NNTP connection. doQuit() End an NNTP connection. getMessage($groupname, $partMsgId) Retrieve an NNTP message and decode it. getMessages($groupname, $msgIds) Retrieve a series of NNTP messages and decode them. getBinary($binaryId, $isNfo=false) Retrieve all NNTP messages associated with a binaries.ID getXOverview($range, $_names = true, $_forceNames = true) Get XZVER for a range of NNTP messages. cmdXZver($range = NULL) Send XZVER command over NNTP connection. decodeYenc($yencodedvar) Decode a yenc encoded string. 11.22 lib/nzb.php class NZB This class manages creation, storage and retrieval of NZB files. writeNZBforReleaseId($relid, $relguid, $name, $catId, $path, $echooutput=false) Writes out the nzb when processing releases. Performed outside of smarty due to memory issues of holding all parts in an array. getNZBPath($releaseGuid, $sitenzbpath = “”, $createIfDoesntExist = false) Builds a full path to the nzb file on disk. nzbs are stored in a subdir of their first char. nzbFileList($nzb) Returns a simple file listing from the parts inside the NZB. 11.23 lib/nzbinfo.php class nzbInfo property $source property $groups property $filecount property $parcount 11.21. lib/nntp.php 113 Newznab Documentation, Release 0.2.3-dev property $rarcount property $zipcount property $videocount property $audiocount property $filesize property $poster property $postedfirst property $postedlast property $completion property $segmenttotal property $segmentactual property $nzb property $nfofiles property $samplefiles property $mediafiles property $audiofiles property $rarfiles nzbInfo() loadFromString($str) loadFromFile($loc) summarize() 11.24 lib/page.php class Page This class represents every normal user page in the site. Page() Default constructor. render() Output the page. 11.25 lib/postprocess.php class PostProcess This class handles all post processing performed during update_releases process. PostProcess($echooutput=false) Default constructor. 114 Chapter 11. Developer Docs Newznab Documentation, Release 0.2.3-dev processAll() Perform all post processing. processNfos() Process nfo files processMovies() Lookup imdb if enabled processMusic() Lookup music if enabled processBooks() Lookup book if enabled processGames() Lookup games if enabled processUnknownCategory() Work out any categories which were not assigned by regex or determinecategory Done in post process as releasevideo/audio will have been performed by now. processTv() Process all TV related releases which will assign their series/episode/rage data processOtherMiscCategory() Process releases without a proper name and try to look it up in the nfo processAdditional() Check for passworded releases, RAR contents and Sample/Media info processReleaseFiles($fetchedBinary, $relid) Work out all files contained inside a rar processReleasePasswords($fetchedBinary, $tmpPath, $unrarPath, $checkpasswordedrar) Work out if a release is passworded isRar($rarfile) Work out if a rar is passworded getMediainfo($ramdrive, $mediainfo, $releaseID) Work out all files contained inside a rar getSample($ramdrive, $ffmpeginfo, $releaseguid) Get a sample from a release using ffmpeg lameAudioSample($lameinfo, $releaseguid) Has to be performed after mediainfo, as lame strips id3 tags. getAudioSample($ramdrive, $releaseguid) Get an audio sample from a release. updateReleaseHasPreview($guid, $prevtype=1) Update release to indicate a preview has been obtained. processMusicFromMediaInfo() Process untagged music releases using information from mediainfo if config permits. 11.26 lib/powerspawn.php class PowerSpawn 11.26. lib/powerspawn.php 115 Newznab Documentation, Release 0.2.3-dev Class that wraps PHP POSIX and PCNTL functions to easily implement process forking and pseudothreading author $Don Bauer link https://github.com/lordgnu/PowerSpawn version 1.0 property $maxChildren property $timeLimit property $sleepCount property $childData property $complete __construct() __destruct() sigHandler($signo) checkChildren() myPID() myParent() spawnChild() killChild($pid = 0) parentCheck() pidDead($pid = 0) setCallback($callback = null) setKillCallback($callback = null) childCount() runParentCode() runChildCode() spawnReady() shutdown() tick() 11.27 lib/predb.php class PreDB This class handles lookup of nzpre lookups and storage/retrieval of pre data. PreDB($echooutput=true) Default constructor. getByID($preID) Get a predb row by ID. 116 Chapter 11. Developer Docs Newznab Documentation, Release 0.2.3-dev getByDirname($dirname) Get a predb row by name. getPreCount($dirname=’‘, $category=’‘) Get count of all predb rows. getPreRange($start=0, $num, $dirname=’‘, $category=’‘) Get predb rows by limit and filter. processReleases($daysback = 3) Process all untagged releases to see if they are found in predb. updatePreDB($db, $preArray) Add/Update predb row. xorDecode($subject, $nzprekey) XOR decode a string with a key. nzpreUpdate() Get nzpre data from usenet and parse. 11.28 lib/rarinfo.php class RarInfo RarInfo class. A simple class for inspecting RAR file data and listing information about the archive contents in pure PHP (no external dependencies). Data can be loaded directly from a file or from a variable passed by reference. Example usage: // Load the RAR file or data $rar = new RarInfo; $rar->open(’./foo.rar’); // or $rar->setData($data); if ($rar->error) { echo "Error: {$rar->error}\\n"; exit; } // Check encryption if ($rar->isEncrypted) { echo "Archive is password encrypted\\n"; exit; } // Process the file list $files = $rar->getFileList(); foreach ($files as $file) { if ($file[’pass’] == true) { echo "File is passworded: {$file[’name’]}\\n"; } } CHANGELOG • 1.6 Added extra error checking to read method • 1.5 Improved getSummary method output 11.28. lib/rarinfo.php 117 Newznab Documentation, Release 0.2.3-dev • 1.4 Added filename sanity checks & maxFilenameLength variable • 1.3 Fixed issues with some file headers lacking LONG_BLOCK flag • 1.2 Tweaked seeking method • 1.1 Fixed issues with PHP not handling unsigned longs properly (pfft) • 1.0 Initial release todo Plenty $f parsing still possible, most format values have been added ;) link http://www.win-rar.com/index.php?id=24&kb_article_id=162 author $Hecks copyright 3. $010 Hecks license Modified $SD version 1.6 118 RarInfo:: BLOCK_MARK = 0x72; RarInfo:: BLOCK_MAIN = 0x73; RarInfo:: BLOCK_FILE = 0x74; RarInfo:: BLOCK_OLD_COMMENT = 0x75; RarInfo:: BLOCK_OLD_EXTRA = 0x76; RarInfo:: BLOCK_OLD_SUB = 0x77; RarInfo:: BLOCK_OLD_RECOVERY = 0x78; RarInfo:: BLOCK_OLD_AUTH = 0x79; RarInfo:: BLOCK_SUB = 0x7a; RarInfo:: BLOCK_ENDARC = 0x7b; RarInfo:: MAIN_VOLUME = 0x0001; RarInfo:: MAIN_COMMENT = 0x0002; RarInfo:: MAIN_LOCK = 0x0004; RarInfo:: MAIN_SOLID = 0x0008; RarInfo:: MAIN_NEWNUMBERING = 0x0010; RarInfo:: MAIN_AUTH = 0x0020; RarInfo:: MAIN_RECOVERY = 0x0040; RarInfo:: MAIN_PASSWORD = 0x0080; RarInfo:: MAIN_FIRSTVOLUME = 0x0100; RarInfo:: MAIN_ENCRYPTVER = 0x0200; RarInfo:: FILE_SPLIT_BEFORE = 0x0001; RarInfo:: FILE_SPLIT_AFTER = 0x0002; RarInfo:: FILE_PASSWORD = 0x0004; RarInfo:: FILE_COMMENT = 0x0008; Chapter 11. Developer Docs Newznab Documentation, Release 0.2.3-dev RarInfo:: FILE_SOLID = 0x0010; RarInfo:: FILE_DICTMASK = 0x00e0; RarInfo:: FILE_DICT64 = 0x0000; RarInfo:: FILE_DICT128 = 0x0020; RarInfo:: FILE_DICT256 = 0x0040; RarInfo:: FILE_DICT512 = 0x0060; RarInfo:: FILE_DICT1024 = 0x0080; RarInfo:: FILE_DICT2048 = 0x00a0; RarInfo:: FILE_DICT4096 = 0x00c0; RarInfo:: FILE_DIRECTORY = 0x00e0; RarInfo:: FILE_LARGE = 0x0100; RarInfo:: FILE_UNICODE = 0x0200; RarInfo:: FILE_SALT = 0x0400; RarInfo:: FILE_VERSION = 0x0800; RarInfo:: FILE_EXTTIME = 0x1000; RarInfo:: FILE_EXTFLAGS = 0x2000; RarInfo:: ENDARC_NEXT_VOLUME = 0x0001; RarInfo:: ENDARC_DATACRC = 0x0002; RarInfo:: ENDARC_REVSPACE = 0x0004; RarInfo:: ENDARC_VOLNR = 0x0008; RarInfo:: SKIP_IF_UNKNOWN = 0x4000; RarInfo:: LONG_BLOCK = 0x8000; RarInfo:: OS_MSDOS = 0; RarInfo:: OS_OS2 = 1; RarInfo:: OS_WIN32 = 2; RarInfo:: OS_UNIX = 3; RarInfo:: OS_MACOS = 4; RarInfo:: OS_BEOS = 5; RarInfo:: FORMAT_BLOCK_HEADER = ’vhead_crc/Chead_type/vhead_flags/vhead_size’; Format for unpacking the main part of each block header. RarInfo:: FORMAT_FILE_HEADER = ’Vunp_size/Chost_os/Vfile_crc/Vftime/Cunp_ver/Cmethod/vn Format for unpacking the remainder of a File block header. RarInfo:: MARKER_BLOCK = ’526172211a0700’; Signature for the Marker block. property $blockNames List of block names corresponding to block types. Var array 11.28. lib/rarinfo.php 119 Newznab Documentation, Release 0.2.3-dev property $isVolume Is the volume attribute set for the archive? Var bool property $hasAuth Is authenticity information present? Var bool property $hasRecovery Is a recovery record present? Var bool property $isEncrypted Is the archive encrypted with a password? Var bool property $error The last error message. Var string open($file) Loads data from the specified file (up to maxReadBytes) and analyses the archive contents. Parameters • $ath (string) – to the file Returns bool $alse if archive analysis fails setData(&$data) Loads data passed by reference (up to maxReadBytes) and analyses the archive contents. Parameters • $rchive (string) – data stored in a variable Returns bool $alse if archive analysis fails setMaxBytes($bytes) Sets the maximum number of data bytes to be stored. Parameters • $aximum (integer) – bytes Returns void getSummary($full=false) Convenience method that outputs a summary list of the archive information, useful for pretty-printing. Parameters • $dd (bool) – file list to output? Returns array $rchive summary getBlocks($asHex=false) Returns a list of the blocks found in the archive in human-readable format (for debugging purposes only). Parameters • $hould (bool) – numeric values be displayed as hexadecimal? 120 Chapter 11. Developer Docs Newznab Documentation, Release 0.2.3-dev Returns array $ist of blocks getFileList() Parses the stored blocks and returns a list of records for each of the files in the archive. Returns mixed $alse if no file blocks available, or array of file records property $rarFile Path to the RAR file (if any). Var string property $maxReadBytes The maximum number of bytes to analyze. Var integer property $maxFilenameLength The maximum length of filenames (for sanity checking). Var integer property $isAnalyzed Have the archive contents been analyzed? Var bool property $data The stored RAR file data. Var string property $dataSize The size in bytes of the currently stored data. Var integer property $offset A pointer to the current position in the data. Var integer property $blocks List of blocks found in the archive. Var array analyze() Parses the RAR data and stores a list of found blocks. Returns bool $alse if parsing fails read($num) Reads the given number of bytes from the stored data and moves the pointer forward. Parameters • $umber (integer) – of bytes to read Returns string $yte string seek($pos) Moves the stored data pointer to the given position. Parameters • $ew (integer) – pointer position 11.28. lib/rarinfo.php 121 Newznab Documentation, Release 0.2.3-dev Returns void dos2unixtime($dostime) Converts DOS standard timestamps to UNIX timestamps. Parameters • $OS (integer) – timestamp Returns integer $NIX timestamp reset() Resets the instance variables before parsing new data. Returns void 11.29 lib/recaptchalib.php _recaptcha_qsencode() Encodes the given data into a query string format Parameters • $ ($data) – array of string elements to be encoded Returns string $ encoded request _recaptcha_http_post() Submits an HTTP POST to a reCAPTCHA server Parameters • $host (string) – • $path (string) – • $data (array) – • $ort (int) – Returns array $esponse recaptcha_get_html() Gets the challenge HTML (javascript and non-javascript version). This is called from the browser, and the resulting reCAPTCHA HTML widget is embedded within the HTML form it was called from. Parameters • $pubkey (string) – A public key for reCAPTCHA • $error (string) – The error given by reCAPTCHA (optional, default is null) • $use_ssl (boolean) – Should the request be made over ssl? (optional, default is false) Returns string $ The HTML to be embedded in the user’s form. class ReCaptchaResponse A ReCaptchaResponse is returned from recaptcha_check_answer() property $is_valid property $error recaptcha_check_answer() Calls an HTTP POST function to verify if the user’s guess was correct 122 Chapter 11. Developer Docs Newznab Documentation, Release 0.2.3-dev Parameters • $privkey (string) – • $remoteip (string) – • $challenge (string) – • $response (string) – • $extra_params (array) – an array of extra variables to post to the server Returns ReCaptchaResponse recaptcha_get_signup_url() gets a URL where the user can sign up for reCAPTCHA. If your application has a configuration page where you enter a key, you should provide a link using this function. Parameters • $domain (string) – The domain where the page is hosted • $appname (string) – The name of your application _recaptcha_aes_pad() _recaptcha_aes_encrypt() _recaptcha_mailhide_urlbase64() recaptcha_mailhide_url() _recaptcha_mailhide_email_parts() gets the parts of the email to expose to the user. eg, given johndoe@example,com return [”john”, “example.com”]. the email is then displayed as [email protected] recaptcha_mailhide_html() Gets html to display an email address given a public an private key. to get a key, go to: http://www.google.com/recaptcha/mailhide/apikey 11.30 lib/releasecomments.php class ReleaseComments This class handles storage and retrieval of release comments. getCommentById($id) Get a comment by ID. getComments($id) Get all comments for a releaseID. getCommentsByGuid($guid) Get all comments for a release.GUID. getCommentCount() Get all count of all comments. deleteComment($id) Delete a comment. deleteCommentsForRelease($id) Delete all comments for a release.ID. 11.30. lib/releasecomments.php 123 Newznab Documentation, Release 0.2.3-dev deleteCommentsForUser($id) Delete all comments for a users.ID. addComment($id, $text, $userid, $host) Add a releasecomment row. getCommentsRange($start, $num) Get releasecomment rows by limit. updateReleaseCommentCount($relid) Update the denormalised count of comments for a release. getCommentCountForUser($uid) Get a count of all comments for a user. getCommentsForUserRange($uid, $start, $num) Get comments for a user by limit. 11.31 lib/releaseextra.php class ReleaseExtra This class handles storage and retrieval of releaseextrafull/releasevideo/audio/subs data. ReleaseExtra:: VIDEO_RESOLUTION_NA = 0; ReleaseExtra:: VIDEO_RESOLUTION_SD = 1; ReleaseExtra:: VIDEO_RESOLUTION_720 = 2; ReleaseExtra:: VIDEO_RESOLUTION_1080 = 3; determineVideoResolution($width, $height) Work out the res based on height and width makeCodecPretty($codec) Convert a codec string to a user friendly format. getVideo($id) Get a releasevideo row by ID. getAudio($id) Get a releaseaudio row by ID. getSubs($id) Get a releasesubs row by ID. getBriefByGuid($guid) Get a summary of release info for a release.GUID. delete($id) Delete releasevideo/audio/subs for a release.ID. addFromXml($releaseID, $xml) Add releasevideo/audio/subs for a release based on the mediainfo xml. addVideo($releaseID, $containerformat, $overallbitrate, $videoduration, $videoformat, $videocodec, $videowidth, $videoheight, $videoaspect, $videoframerate, $videolibrary) Add a releasevideo row. addAudio($releaseID, $audioID, $audioformat, $audiomode, $audiobitratemode, $audiobitrate, $audiochannels, $audiosamplerate, $audiolibrary, $audiolanguage, $audiotitle) Add a releaseaudio row. 124 Chapter 11. Developer Docs Newznab Documentation, Release 0.2.3-dev addSubs($releaseID, $subsID, $subslanguage) Add a releasesubs row. getFull($id) Get a releaseextrafull row for a release. deleteFull($id) Delete a releaseextrafull row for a release. addFull($id, $xml) Add a releaseextrafull row for a release. 11.32 lib/releasefiles.php class ReleaseFiles This class handles storage and retrieval of releasefiles. get($id) Get releasefiles row by ID. getByGuid($guid) Get releasefiles row by release.GUID. delete($id) Delete a releasefiles row. add($id, $name, $size, $createddate, $passworded) Add a releasefiles row. 11.33 lib/releaseimage.php class ReleaseImage This class handles storage and retrieval of release preview files obtained via ffmpeg. ReleaseImage() Default constructor. fetchImage($imgLoc) Return an image from a path. saveImage($imgName, $imgLoc, $imgSavePath, $saveThumb=false) Create an image at a path and a thumbnailed version. $imgMaxWidth=’‘, $imgMaxHeight=’‘, delete($guid) Delete an image from disk. 11.34 lib/releaseregex.php class ReleaseRegex This class handles storage and retrieval of releaseregex rows. get($activeonly=true, $groupname=”-1”, $blnIncludeReleaseCount=false, $userReleaseRegex=false) Get all releaseregex rows matching filters. 11.32. lib/releasefiles.php 125 Newznab Documentation, Release 0.2.3-dev getGroupsForSelect() Get all groups used by releaseregexes for use in dropdownlist. getByID($id) Get a releaseregex row by ID. delete($id) Delete a releaseregex row. update($regex) Update a releaseregex row. add($regex) Add a releaseregex row. 11.35 lib/releases.php class Releases This class handles storage and retrieval of releases rows and the main processing functions for turning binaries into releases. Releases:: PROCSTAT_NEW = 0; Access public Var initial $inary state after being added from usenet Releases:: PROCSTAT_TITLEMATCHED = 5; Access public Var after $ binary has matched a releaseregex Releases:: PROCSTAT_READYTORELEASE = 1; Access public Var after $ binary has been confirmed as having the right number of parts Releases:: PROCSTAT_WRONGPARTS = 2; Access public Var after $ binary has has been attempted to be matched for x days and still has the wrong number of parts Releases:: PROCSTAT_RELEASED = 4; Access public Var binary $hat has finished and successfully made it into a release Releases:: PROCSTAT_DUPLICATE = 6; Access public Var binary $hat is identified as already being part of another release (with the same name posted in a similar date range) Releases:: PROCSTAT_NOREQIDNAMELOOKUPFOUND = 7; Access public Var after $ series of attempts to lookup the allfilled style reqid to get a name, its given up 126 Chapter 11. Developer Docs Newznab Documentation, Release 0.2.3-dev Releases:: PROCSTAT_MINRELEASESIZE = 8; Access public Var the $elease is below the minimum size specified in site table Releases:: PASSWD_NONE = 0; Access public Var release $s not passworded Releases:: PASSWD_RAR = 1; Access public Var release $s passworded Releases:: PASSWD_POTENTIAL = 2; Access public Var release $ay be passworded, ie contains inner rar/ace files getByNames($names) Get a list of releases by an array of names getCount() Get a count of releases for pager. used in admin manage list getRange($start, $num) Get a range of releases. used in admin manage list getBrowseCount($cat, $maxage=-1, $excludedcats=array(), $grp=array()) Get a count of releases for main browse pager. getBrowseRange($cat, $start, $num, $orderby, $maxage=-1, $excludedcats=array(), $grp=array()) Get a releases for main browse pages. getBrowseOrder($orderby) Get a column names browse list to be ordered by getBrowseOrdering() Get a list of available columns for sorting browse list getForExport($postfrom, $postto, $group, $cat) Get a range of releases. Used in nzb export getEarliestUsenetPostDate() Get the earliest release getLatestUsenetPostDate() Get the most recent release getReleasedGroupsForSelect($blnIncludeAll = true) Get all groups for which there is a release for a html select getRss($cat, $num, $uid=0, $rageid, $anidbid, $airdate=-1) Get releases for all types of rss feeds getShowsRss($num, $uid=0, $excludedcats=array(), $airdate=-1) Get releases in users ‘my tv show’ rss feed getMyMoviesRss($num, $uid=0, $excludedcats=array()) Get releases in users ‘my movies’ rss feed 11.35. lib/releases.php 127 Newznab Documentation, Release 0.2.3-dev getShowsRange($usershows, $start, $num, $orderby, $maxage=-1, $excludedcats=array()) Get range of releases in users ‘my tvshows’ getShowsCount($usershows, $maxage=-1, $excludedcats=array()) Get count of releases in users ‘my tvshows’ for pager rebuild($id) Rebuild a release, ie delete it and reset any binaries still available for reprocessing. rebuildmulti($guids) Rebuild an array of releases based on their guid. delete($id, $isGuid=false) Delete one or more releases. deletePreview($guid) Delete a preview associated with a release and update the release to indicate it doesnt have one. update($id, $name, $searchname, $fromname, $category, $parts, $grabs, $size, $posteddate, $addeddate, $rageid, $seriesfull, $season, $episode, $imdbid, $anidbid, $tvdbid) Update a release. updatemulti($guids, $category, $grabs, $rageid, $season, $imdbid) Update multiple releases. updateHasPreview($guid, $haspreview) Update whether a release has a preview. searchadv($searchname, $filename, $poster, $group, $cat=array(-1), $sizefrom, $sizeto, $offset=0, $limit=1000, $orderby=’‘, $maxage=-1, $excludedcats=array()) Not yet implemented. search($search, $cat=array(-1), $offset=0, $limit=1000, $orderby=’‘, $maxage=-1, $excludedcats=array(), $grp=array()) Search for releases. searchbyRageId($rageId, $series=”“, $episode=”“, $cat=array(-1), $maxage=-1) Search for releases by rage id. Used by API/Sickbeard. $offset=0, $limit=100, $name=”“, searchbyAnidbId($anidbID, $epno=’‘, $offset=0, $limit=100, $name=’‘, $maxage=-1) Search for releases by anidb id. Used by API/Sickbeard. searchAudio($artist, $album, $label, $track, $year, $genre=array(-1), $offset=0, $limit=100, $cat=array(-1), $maxage=-1) Search for releases by album/artist/musicinfo. Used by API. searchBook($author, $title, $offset=0, $limit=100, $maxage=-1) Search for releases by author/bookinfo. Used by API. searchbyImdbId($imdbId, $offset=0, $limit=100, $name=”“, $cat=array(-1), $maxage=-1) Search for releases by imdbid/movieinfo. Used by API/Couchpotato. $genre=”“, searchSimilar($currentid, $name, $limit=6, $excludedcats=array()) Return a list of releases with a similar name to that provided. getSimilarName($name) Return a similar release name. getByGuid($guid) Retrieve one or more releases by guid. 128 Chapter 11. Developer Docs Newznab Documentation, Release 0.2.3-dev getZipped($guids) Writes a zip file of an array of release guids directly to the stream removeRageIdFromReleases($rageid) Removes an associated tvrage id from all releases using it. removeThetvdbIdFromReleases($tvdbID) Removes an associated tvdb id from all releases using it. removeAnidbIdFromReleases($anidbID) getById($id) getReleaseNfo($id, $incnfo=true) updateGrab($guid) processReleases() cleanReleaseName($relname) getReleaseNameForReqId($url, $nnid, $groupname, $reqid) checkRegexesUptoDate($url, $rev, $nnid) getTopDownloads() getTopComments() getRecentlyAdded() 11.36 lib/rottentomato.php class RottenTomato RottenTomato:: API_URL = "http://api.rottentomatoes.com/api/public/v1.0/"; __construct($apikey) getBoxOffice() getInTheaters() getOpening() getUpcoming() getDVDReleases() searchMovie($title) getMovie($rtid) getReviews($rtid, $type=”top_critic”) getCast($rtid) setApikey($apikey) getApikey() 11.36. lib/rottentomato.php 129 Newznab Documentation, Release 0.2.3-dev 11.37 lib/sabnzbd.php class SABnzbd property $url property $apikey property $priority property $apikeytype property $integrated property $uid property $rsstoken property $serverurl SABnzbd:: INTEGRATION_TYPE_USER = 2; SABnzbd:: INTEGRATION_TYPE_SITEWIDE = 1; SABnzbd:: INTEGRATION_TYPE_NONE = 0; SABnzbd:: API_TYPE_NZB = 1; SABnzbd:: API_TYPE_FULL = 2; SABnzbd:: PRIORITY_FORCE = 2; SABnzbd:: PRIORITY_HIGH = 1; SABnzbd:: PRIORITY_NORMAL = 0; SABnzbd:: PRIORITY_LOW = -1; SABnzbd:: PRIORITY_PAUSED = -2; SABnzbd(&$page) sendToSab($guid) getQueue() delFromQueue($id) checkCookie() setCookie($host, $apikey, $priority, $apitype) unsetCookie() 11.38 lib/site.php class Sites Sites:: REGISTER_STATUS_OPEN = 0; Sites:: REGISTER_STATUS_INVITE = 1; Sites:: REGISTER_STATUS_CLOSED = 2; 130 Chapter 11. Developer Docs Newznab Documentation, Release 0.2.3-dev Sites:: ERR_BADUNRARPATH = -1; Sites:: ERR_BADFFMPEGPATH = -2; Sites:: ERR_BADMEDIAINFOPATH = -3; Sites:: ERR_BADNZBPATH = -4; Sites:: ERR_DEEPNOUNRAR = -5; Sites:: ERR_BADTMPUNRARPATH = -6; Sites:: ERR_BADLAMEPATH = -7; Sites:: ERR_SABCOMPLETEPATH = -8; version() update($form) get() rows2Object($rows) row2Object($row) updateLatestRegexRevision($rev) getLicense($html=false) 11.39 lib/sitemaps.php class Sitemap property $type property $name property $loc property $priority property $changefreq Sitemap($t, $n, $l, $p, $c) 11.40 lib/sphinx.php class Sphinx This class manages indexing and searching the full-text indexes. runCmd($cmd, $stdout=true) Runs a Sphinx command. This suppresses various lines of output from the Sphinx binaries. Parameters • $cmd (string) – The command to run. • $stdout (boolean) – If true (default), print to stdout. Returns array $n array of lines returned from the popen process. 11.39. lib/sitemaps.php 131 Newznab Documentation, Release 0.2.3-dev getNextMergeDate() Returns the next merge date as a timestamp. This value is suitable for use as the nextmergedate value in the database. getNextRebuildDate() Returns the next rebuild date as a timestamp. This value is suitable for use as the nextrebuilddate value in the database. setRebuildDates($index, $lastRebuildDate=0) Sets the values for lastrebuilddate and nextrebuilddate in the database for the given $index. Parameters • $index (string) – The index to update. • $lastRebuildDate (int) – The timestamp of the update. Returns boolean setMergeDates($index, $lastMergedDate=0) Sets the value for lastmergedate and nextmergedate in the database for the given $index. If $lastMergedDate is supplied it will be used as the value for lastmergedate, else NOW() will used. Parameters • $index (string) – The index to update. • $lastMergedDate (int) – The timestamp of the update. Returns boolean updateIndex($index, $full=false) Updates the given index $index. If $full is true, then the ‘main’ index is updated, otherwise the ‘delta’ index is updated. Parameters • $index (string) – • $full (boolean) – Returns null mergeIndex($index, $updateDates=True) Merges a ‘delta’ index with a ‘main’ index, but only if the index is enabled. Parameters • $index (string) – The index to merge. • $updateDates (boolean) – True (default) to update merge dates. Returns null indexDetails($index, $main=False) Extracts all of the information about a given $index via the indextool program provided by Sphinx. Parameters • $index (string) – The index to query. • $main (boolean) – If false (default), query delta index. Returns Array $f information about the index. 132 Chapter 11. Developer Docs Newznab Documentation, Release 0.2.3-dev update() Updates indexes. This function does quite a lot of stuff: 1.Rebuilds any indexes that are due 2.Merges any indexes that are due 3.Updates delta indexes The first two items listed occur conditionally–they must be “due” in order to be processed. The last item, updating of delta indexes, occurs unconditionally and will happen every time this function is called. getSphinxBinPath($bin) Returns the path to the Sphinx binary $bin. For example, if the path to Sphinx’s “indexer” binary is desired, this function can be used to get the full path to it. It is also desirable to use this function as it properly sets the sphinx.conf file to use. Parameters • $bin (string) – The Sphinx binary to run (indexer, searchd, etc.). Returns string $he path to the binary. isIndexEnabled($index) Returns true if $index is enabled, false otherwise. Parameters • $index (string) – The index to check. Returns boolean getAllEnabledIndexes($deltas=false, $exclude=array()) Returns an array of all the indexes that are enabled. If Sphinx support isn’t enabled, then this returns an empty array. Parameters • $hether (boolean) – or not to include the delta indexes as well. Returns array $n array of string of the enabled indexes. generateSphinxConf($sphinxDir=”“, $sphinxConf=”“) Generates and returns a string of the of sphinx.conf file. $sphinxDir should be a string representing the directory in which to store the indexes. Parameters • $sphinxDir (string) – Path to where indexes should be stored. Returns string indexNZBs($startingID=-1) Indexing function for NZB contents. Unlink the other indexes, ‘nzbs’ can’t be indexed from MySQL data directly since the data to be indexed is contained within the compress NZB files on disk. This function decompresses the NZBs in memory, parses them, extracts the useful bits which are to be store in the indexer and then updates the index in real time. If $startingID is negative, then the last successfully indexed release will be identified and this will resume indexing from that ID onwards. If this is a positive value, then only releases with an ID larger than or equal to this will be indexed. In order to re-index everything, pass 0. Returns the number of of NZBs that were successfully indexed. Parameters 11.40. lib/sphinx.php 133 Newznab Documentation, Release 0.2.3-dev • $startingID (int) – The ID of the first release to index. Returns int searchDirect($sphinxQuery, $lookupQuery=”“) Query the indexer directly. Returns an array of the results, unless there was an error in which case false is returned. However, if Sphinx returns an “invalid query” error (1064), then an empty result array is returned. Note that an empty “result array” is not the same as an empty array and will instead look like: array({"_totalrows": 0}) If $lookupQuery is an empty string, then the results returned will be the data from the index–this is not guaranteed to be the most recent data that is in the MySQL database. If you absolutely need the most recent data from MySQL, then $lookupQuery should be a valid SQL query that has contains “releases.ID IN (%s)”. Parameters • $sphinxQuery (string) – The raw SphinxQL query. • $lookupQuery (string) – The SQL to use to lookup the results. Returns array|false buildQuery($search, $cat=array(), $offset=0, $limit=100, $order=array(“postdate”, “desc”), $maxage=-1, $excludedcats=array(), $grp=array(), $indexes=array(), $lookup=true, $where=array(), &$lookupQuery=”“) Constructs a SphinxQL query. Parameters • $search (array) – • $cat (array) – • $offset (int) – • $limit (int) – • $order (array) – • $maxage (int) – • $excludedcats (array) – • $grp (array) – • $indexes (array) – • $lookup (boolean) – • $where (array) – • $lookupQuery (string) – search($search, $cat=array(), $offset=0, $limit=1000, $order=array(“postdate”, “desc”), $maxage=-1, $excludedcats=array(), $grp=array(), $indexes=array(), $lookup=true) Search $indexes for $search term(s). $search should be a string containing a valid Sphinx query, see query syntax for examples. The default behavior is to query the indexes for release IDs and then return the releases from MySQL, but if $lookup is false then the data from the indexes will be returned. This will bypass MySQL all together, but may result in stale data. Parameters • $search (string) – Search term to query for. • $cat (array) – Category IDs to filter for. 134 Chapter 11. Developer Docs Newznab Documentation, Release 0.2.3-dev • $offset (int) – Offset from first result. • $limit (int) – Number of results to return. • $orderby (string) – Field to order results by. • $maxage (int) – Don’t include results older than this (in days). • $excludedcats (array) – Category IDs to exclude. • $grp (array) – Group IDs to filter for. • $indexes (string|array) – Only search within certain indexes. • $lookup (boolean) – Retrieve latest data from database. Returns array|false searchbyRageId($rageId, $series=”“, $episode=”“, $offset=0, $limit=100, $name=”“, $cat=array(-1), $maxage=-1, $indexes=array(), $lookup=true) Returns an array of all the releases matching the given query. This presents the same interface as Releases::searchbyRageId. searchbyImdbId($imdbId, $offset=0, $limit=100, $name=”“, $cat=array(-1), $genre=”“, $maxage=-1, $indexes=array(), $lookup=true) Returns an array of all the releases matching the given query. This presents the same interface as Releases::searchbyImdbId. searchAudio($artist, $album, $label, $track, $year, $genre=array(-1), $offset=0, $limit=100, $cat=array(-1), $maxage=-1, $indexes=array(), $lookup=true) Returns an array of all the releases matching the given query. This presents the same interface as Releases::searchAudio. searchBook($author, $title, $offset=0, $limit=100, $maxage=-1, $indexes=array(), $lookup=true) Returns an array of all the releases matching the given query. This presents the same interface as Releases::searchBook. searchbyAnidbId($anidbID, $epno=’‘, $offset=0, $limit=100, $name=’‘, $maxage=-1, $indexes=array(), $lookup=true) Returns an array of all the releases matching the given query. This presents the same interface as Releases::searchbyAnidbId. getPreRange($start=0, $num, $dirname=’‘, $category=’‘) Get predb rows by limit and filter. This presents the same interface as PreDB::getPreRange. getPreCount($dirname=’‘, $category=’‘) Get count of all predb rows that match the query. This presents the same interface as PreDB::getPreCount. If there is an issue running the query (i.e. if the query fails), then this returns -1. Parameters • $dirname (string) – The query; this is passed into MATCH(). • $category (string) – The category to limit to. Returns int $he number of results, or -1 on error. 11.41 lib/thetvdb.php class TheTVDB 11.41. lib/thetvdb.php 135 Newznab Documentation, Release 0.2.3-dev TheTVDB:: PROJECT = ’newznab’; TheTVDB:: APIKEY = ’5F84ECB91B42D719’; TheTVDB($echooutput=true) addSeries($TheTVDBAPIArray) addEpisodes($TheTVDBAPIArray) updateSeries($tvdbID, $actors, $airsday, $airstime, $contentrating, $firstaired, $genre, $imdbID, $network, $overview, $rating, $ratingcount, $runtime, $seriesname, $status) deleteTitle($tvdbID) addEmptySeries($seriesname) getSeriesInfoByID($tvdbID) getSeriesInfoByName($seriesname) getSeriesRange($start, $num, $seriesname=’‘) getSeriesCount($seriesname=’‘) lookupSeriesID($seriesname) notFound($seriesName, $fullep, $releaseID, $echooutput=true) processReleases() TheTVDBAPI($seriesid, $seriesName) 11.42 lib/trakt.php slugify() class Trakt property $errUrl property $errNum property $errMsg property $trackHost Trakt($apiKey, $debug=false) __call($method, $arguments) clearAuth() setAuth($username, $password, $isHash=false) Sets authentication for all subsequent API calls. If $isHash is true, then the $password is expected to be a valid sha1 hash of the real password. 11.43 lib/tvrage.php class TvRage 136 Chapter 11. Developer Docs Newznab Documentation, Release 0.2.3-dev TvRage:: APIKEY = ’7FwjZ8loweFcOhHfnU3E’; TvRage:: MATCH_PROBABILITY = 75; TvRage($echooutput=false) getByID($id) getByRageID($id) getByTitle($title) add($rageid, $releasename, $desc, $genre, $country, $imgbytes) update($id, $rageid, $releasename, $desc, $genre, $country, $imgbytes) delete($id) getRange($start, $num, $ragename=”“) getCount($ragename=”“) getCalendar($date = “”) getSeriesList($uid, $letter=”“, $ragename=”“) updateSchedule() getEpisodeInfo($rageid, $series, $episode) getRageInfoFromPage($rageid) getRageInfoFromService($rageid) updateEpInfo($show, $relid) updateRageInfo($rageid, $show, $tvrShow, $relid) processTvReleases($lookupTvRage=true) getRageMatch($showInfo) checkMatch($ourName, $tvrName) cleanName($str) parseNameEpSeason($relname) getGenres() 11.44 lib/usermovies.php class UserMovies addMovie($uid, $imdbid, $catid=array()) getMovies($uid) delMovie($uid, $imdbid) getMovie($uid, $imdbid) delMovieForUser($uid) updateMovie($uid, $imdbid, $catid=array()) 11.44. lib/usermovies.php 137 Newznab Documentation, Release 0.2.3-dev 11.45 lib/users.php class Users Users:: ERR_SIGNUP_BADUNAME = -1; Users:: ERR_SIGNUP_BADPASS = -2; Users:: ERR_SIGNUP_BADEMAIL = -3; Users:: ERR_SIGNUP_UNAMEINUSE = -4; Users:: ERR_SIGNUP_EMAILINUSE = -5; Users:: ERR_SIGNUP_BADINVITECODE = -6; Users:: ERR_SIGNUP_BADCAPTCHA = -7; Users:: SUCCESS = 1; Users:: ROLE_GUEST = 0; Users:: ROLE_USER = 1; Users:: ROLE_ADMIN = 2; Users:: ROLE_DISABLED = 3; Users:: DEFAULT_INVITES = 1; Users:: DEFAULT_INVITE_EXPIRY_DAYS = 7; Users:: SALTLEN = 4; Users:: SHA1LEN = 40; get() delete($id) getRange($start, $num, $orderby, $username=’‘, $email=’‘, $host=’‘, $role=’‘) getBrowseOrder($orderby) getCount() add($uname, $pass, $email, $role, $notes, $host, $invites=Users::DEFAULT_INVITES, $invitedby=0) update($id, $uname, $email, $grabs, $role, $notes, $invites, $movieview, $musicview, $consoleview, $bookview, $saburl=false, $sabapikey=false, $sabpriority=false, $sabapikeytype=false) updateUserRole($uid, $role) updateUserRoleChangeDate($uid, $date) updateExpiredRoles($uprole, $downrole, $msgsubject, $msgbody) updateRssKey($uid) updatePassResetGuid($id, $guid) updatePassword($id, $password) getByEmail($email) getByPassResetGuid($guid) getByUsername($uname) 138 Chapter 11. Developer Docs Newznab Documentation, Release 0.2.3-dev incrementGrabs($id, $num=1) getById($id) getByIdAndRssToken($id, $rsstoken) getByRssToken($rsstoken) getBrowseOrdering() isValidUsername($uname) isValidPassword($pass) isDisabled($username) isValidCaptcha($site, $challenge, $response) isValidEmail($email) isValidUrl($url) generateUsername($email) generatePassword() signup($uname, $pass, $email, $host, $role = Users::ROLE_USER, $notes, vites=Users::DEFAULT_INVITES, $invitecode=”“, $forceinvitemode=false, captcha_challenge=false, $recaptcha_response=false, $skip_recaptcha=false) $in$re- randomKey($amount) hashPassword($password) getHostHash($host, $siteseed = “”) hashSHA1($string) checkPassword($password, $hash) isLoggedIn() currentUserId() logout() login($uid, $host=”“, $remember=”“) updateSiteAccessed($uid, $host=”“) updateApiAccessed($uid) setCookies($uid) addCart($uid, $releaseid) getCart($uid, $releaseid=”“) delCartByGuid($guids, $uid) delCartByUserAndRelease($guid, $uid) delCartForUser($uid) delCartForRelease($rid) addCategoryExclusions($uid, $catids) getCategoryExclusion($uid) getCategoryExclusionNames($uid) 11.45. lib/users.php 139 Newznab Documentation, Release 0.2.3-dev delCategoryExclusion($uid, $catid) delUserCategoryExclusions($uid) sendInvite($sitetitle, $siteemail, $serverurl, $uid, $emailto) getInvite($inviteToken) addInvite($uid, $inviteToken) deleteInvite($inviteToken) checkAndUseInvite($invitecode) getTopGrabbers() getUsersByMonth() getUsersByHostHash() getUsersByRole() getLoginCountsByMonth() getRoles() getRoleById($id) getDefaultRole() addRole($name, $apirequests, $downloadrequests, $defaultinvites, $canpreview, $canpre) updateRole($id, $name, $apirequests, $downloadrequests, $defaultinvites, $isdefault, $canpreview, $canpre) deleteRole($id) getApiRequests($userid) addApiRequest($userid, $request, $hosthash) delApiRequests($userid) pruneRequestHistory($days = 0) deletes old rows from the userrequest and userdownloads tables. if site->userdownloadpurgedays set to 0 then all release history is removed but the download/request rows must remain for at least one day to allow the role based limits to apply. getDownloadRequests($userid, $hosthash = “”, $site = “”) getDownloadRequestsForUserAndAllHostHashes($userid) addDownloadRequest($userid, $hosthash, $relGuid) delDownloadRequests($userid) delDownloadRequestsForRelease($releaseID) 11.46 lib/userseries.php class UserSeries addShow($uid, $rageid, $catid=array()) getShows($uid) 140 Chapter 11. Developer Docs Newznab Documentation, Release 0.2.3-dev delShow($uid, $rageid) getShow($uid, $rageid) delShowForUser($uid) delShowForSeries($sid) updateShow($uid, $rageid, $catid=array()) 11.47 lib/util.php sendEmail() isWindows() responseXmlToObject() startsWith() endsWith() objectsIntoArray() safeFilename() runCmd() checkStatus() getUrl() cp437toUTF() 11.48 lib/zipfile.php class zipfile property $datasec property $ctrl_dir property $eof_ctrl_dir property $old_offset unix2DosTime($unixtime = 0) Converts an Unix timestamp to a four byte DOS date and time format (date in high two bytes, time in low two bytes allowing magnitude comparison). Parameters • $he (integer) – current Unix timestamp Returns integer $he current date in a four byte DOS format Access private addFile($data, $name, $time = 0) Adds “file” to archive Parameters 11.47. lib/util.php 141 Newznab Documentation, Release 0.2.3-dev • $ile (string) – contents • $ame (string) – of the file in the archive (may contains the path) • $he (integer) – current timestamp Access public file() Dumps out file Returns string $he zipped file Access public 11.49 lib/framework/basepage.php class BasePage property $title property $content property $head property $body property $meta_keywords property $meta_title property $meta_description property $page property $page_template property $smarty property $userdata property $serverurl property $template_dir property $site property $secure_connection BasePage:: FLOOD_THREE_REQUESTS_WITHIN_X_SECONDS = 1.000; BasePage:: FLOOD_PUNISHMENT_SECONDS = 3.0; BasePage() floodCheck($loggedin, $role) showFloodWarning() addToHead($headcontent) addToBody($attr) render() isPostBack() 142 Chapter 11. Developer Docs Newznab Documentation, Release 0.2.3-dev show404() show403($from_admin = false) show503($retry=’‘) getCommonTemplate($tpl) 11.50 lib/framework/cache.php class Cache property $ttl property $enabled property $method property $mc Cache() store($key, $data, $ttl=’‘) pack($data) unpack($data) fetch($key) exists($key) getKey($str) fileCacheGC() 11.51 lib/framework/db.php class DB DB() escapeString($str) makeLookupTable($rows, $keycol) queryInsert($query, $returnlastid=true) queryOneRow($query, $useCache=false, $cacheTTL=’‘) query($query, $useCache=false, $cacheTTL=’‘) queryDirect($query) optimise($force = false) 11.50. lib/framework/cache.php 143 Newznab Documentation, Release 0.2.3-dev 11.52 misc/sphinx/nnindexer.php property $name property $title print_usage() index() generate() search() daemon() merge() main() 144 Chapter 11. Developer Docs CHAPTER 12 Indices and tables • genindex • modindex • Glossary • search 145 Newznab Documentation, Release 0.2.3-dev 146 Chapter 12. Indices and tables Index Symbols addReleaseNfo() (Nfo method), 112 addRole() (Users method), 140 __call() (Trakt method), 136 addSeries() (TheTVDB method), 136 __construct() (AmazonProductAPI method), 96 addShow() (UserSeries method), 140 __construct() (PowerSpawn method), 116 addSubs() (ReleaseExtra method), 124 __construct() (RottenTomato method), 129 addTitle() (AniDB method), 96 __construct() (TMDb method), 91 addToBody() (BasePage method), 142 __destruct() (PowerSpawn method), 116 addToHead() (BasePage method), 142 _recaptcha_aes_encrypt() (global function), 123 addUpdateBookInfo() (Book method), 99 _recaptcha_aes_pad() (global function), 123 addUpdateMusicInfo() (Music method), 112 _recaptcha_http_post() (global function), 122 _recaptcha_mailhide_email_parts() (global function), addVideo() (ReleaseExtra method), 124 ADMIN_EMAIL (Install property), 107 123 ADMIN_PASS (Install property), 107 _recaptcha_mailhide_urlbase64() (global function), 123 ADMIN_USER (Install property), 107 _recaptcha_qsencode() (global function), 122 adminCheck (Install property), 108 AdminPage (class), 95 A AdminPage() (AdminPage method), 95 add() (Contents method), 105 Amazon, 89 add() (Forum method), 105 AmazonProductAPI (class), 95 add() (Groups method), 106 analyze() (RarInfo method), 121 add() (Menu method), 109 AniDB (class), 96 add() (ReleaseFiles method), 125 AniDB() (AniDB method), 96 add() (ReleaseRegex method), 126 AniDBAPI() (AniDB method), 97 add() (TvRage method), 137 animeCoversCheck (Install property), 108 add() (Users method), 138 animetitlesUpdate() (AniDB method), 96 addApiRequest() (Users method), 140 apikey (SABnzbd property), 130 addAudio() (ReleaseExtra method), 124 apikeytype (SABnzbd property), 130 addBlacklist() (Binaries method), 98 audiocount (nzbInfo property), 114 addBulk() (Groups method), 107 audiofiles (nzbInfo property), 114 addCart() (Users method), 139 aws_signed_request() (global function), 96 addCategoryExclusions() (Users method), 139 addComment() (ReleaseComments method), 124 B addDownloadRequest() (Users method), 140 Backfill (class), 97 addEmptySeries() (TheTVDB method), 136 Backfill() (Backfill method), 97 addEpisodes() (TheTVDB method), 136 backfillAllGroups() (Backfill method), 97 addFile() (zipfile method), 141 backfillGroup() (Backfill method), 97 addFromXml() (ReleaseExtra method), 124 BasePage (class), 142 addFull() (ReleaseExtra method), 125 BasePage() (BasePage method), 142 addInvite() (Users method), 140 Binaries (class), 97 addMovie() (UserMovies method), 137 Binaries() (Binaries method), 98 addMovieRating() (TMDb method), 94 blockNames (RarInfo property), 119 147 Newznab Documentation, Release 0.2.3-dev blocks (RarInfo property), 121 body (BasePage property), 142 Book (class), 98 Book() (Book method), 98 browseMovies() (TMDb method), 93 buildQuery() (Sphinx method), 134 C Cache (class), 143 Cache() (Cache method), 143 CACHE_TYPE (Install property), 107 cacheCheck (Install property), 108 Category (class), 99 changefreq (Sitemap property), 131 checkAndUseInvite() (Users method), 140 checkChildren() (PowerSpawn method), 116 checkCookie() (SABnzbd method), 130 checkMatch() (TvRage method), 137 checkPassword() (Users method), 139 checkRegexesUptoDate() (Releases method), 129 checkStatus() (global function), 141 childCount() (PowerSpawn method), 116 childData (PowerSpawn property), 116 cleanFilename() (AniDB method), 97 cleanName() (TvRage method), 137 cleanReleaseName() (Releases method), 129 clearAuth() (Trakt method), 136 cmdXZver() (Nntp method), 113 COMPILED_CONFIG (Install property), 107 complete (PowerSpawn property), 116 completion (nzbInfo property), 114 configCheck (Install property), 108 Console (class), 103 Console() (Console method), 103 content (BasePage property), 142 content (Installpage property), 109 Contents (class), 104 cp437toUTF() (global function), 141 ctrl_dir (zipfile property), 141 curlCheck (Install property), 108 currentUserId() (Users method), 139 D daemon() (global function), 80, 144 data (RarInfo property), 121 datasec (zipfile property), 141 dataSize (RarInfo property), 121 daytopost() (Backfill method), 97 DB (class), 143 DB() (DB method), 143 DB_DIR (Install property), 107 DB_HOST (Install property), 107 DB_NAME (Install property), 107 DB_PASSWORD (Install property), 107 148 DB_TYPE (Install property), 107 DB_USER (Install property), 107 dbConnCheck (Install property), 108 dbCreateCheck (Install property), 108 dbNameCheck (Install property), 108 decodeYenc() (Nntp method), 113 delApiRequests() (Users method), 140 delCartByGuid() (Users method), 139 delCartByUserAndRelease() (Users method), 139 delCartForRelease() (Users method), 139 delCartForUser() (Users method), 139 delCategoryExclusion() (Users method), 139 delDownloadRequests() (Users method), 140 delDownloadRequestsForRelease() (Users method), 140 delete() (Binaries method), 98 delete() (Contents method), 104 delete() (Groups method), 107 delete() (Menu method), 109 delete() (Movie method), 110 delete() (ReleaseExtra method), 124 delete() (ReleaseFiles method), 125 delete() (ReleaseImage method), 125 delete() (ReleaseRegex method), 126 delete() (Releases method), 128 delete() (TvRage method), 137 delete() (Users method), 138 deleteBlacklist() (Binaries method), 98 deleteComment() (ReleaseComments method), 123 deleteCommentsForRelease() (ReleaseComments method), 123 deleteCommentsForUser() (ReleaseComments method), 123 deleteFull() (ReleaseExtra method), 125 deleteInvite() (Users method), 140 deleteParent() (Forum method), 105 deletePost() (Forum method), 106 deletePreview() (Releases method), 128 deleteReleaseNfo() (Nfo method), 112 deleteRole() (Users method), 140 deleteTitle() (AniDB method), 97 deleteTitle() (TheTVDB method), 136 deleteUser() (Forum method), 106 delFromQueue() (SABnzbd method), 130 delMovie() (UserMovies method), 137 delMovieForUser() (UserMovies method), 137 delShow() (UserSeries method), 140 delShowForSeries() (UserSeries method), 141 delShowForUser() (UserSeries method), 141 delUserCategoryExclusions() (Users method), 140 determineCategory() (Category method), 101 determineReleaseNfo() (Nfo method), 112 determineVideoResolution() (ReleaseExtra method), 124 doCheck (Install property), 108 doConnect() (Nntp method), 113 Index Newznab Documentation, Release 0.2.3-dev doQuit() (Nntp method), 113 dos2unixtime() (RarInfo method), 122 E enabled (Cache property), 143 endsWith() (global function), 141 eof_ctrl_dir (zipfile property), 141 Episode (class), 105 errMsg (Trakt property), 136 errNum (Trakt property), 136 error (Install property), 108 error (Installpage property), 109 error (RarInfo property), 120 error (ReCaptchaResponse property), 122 errUrl (Trakt property), 136 escapeString() (DB method), 143 exists() (Cache method), 143 F fetch() (Cache method), 143 fetchAmazonProperties() (Book method), 99 fetchAmazonProperties() (Console method), 104 fetchAmazonProperties() (Music method), 112 fetchImage() (ReleaseImage method), 125 fetchImdbProperties() (Movie method), 111 fetchTmdbProperties() (Movie method), 111 file() (zipfile method), 142 fileCacheGC() (Cache method), 143 filecount (nzbInfo property), 113 filesize (nzbInfo property), 114 floodCheck() (BasePage method), 142 Forum (class), 105 G gdCheck (Install property), 108 generate() (global function), 80, 144 generatePassword() (Users method), 139 generateSphinxConf() (Sphinx method), 133 generateUsername() (Users method), 139 Genres (class), 106 get() (Category method), 101 get() (Contents method), 105 get() (Menu method), 109 get() (ReleaseFiles method), 125 get() (ReleaseRegex method), 125 get() (Sites method), 131 get() (Users method), 138 getActive() (Groups method), 106 getAll() (Contents method), 105 getAll() (Groups method), 106 getAll() (Menu method), 109 getAllEnabledIndexes() (Sphinx method), 133 getanidbID() (AniDB method), 97 getAnimeCount() (AniDB method), 97 Index getAnimeInfo() (AniDB method), 97 getAnimeList() (AniDB method), 97 getAnimeRange() (AniDB method), 97 getApikey() (RottenTomato method), 129 getApikey() (TMDb method), 95 getApiRequests() (Users method), 140 getAudio() (ReleaseExtra method), 124 getAudioSample() (PostProcess method), 115 getBinary() (Nntp method), 113 getBlacklist() (Binaries method), 98 getBlacklistByID() (Binaries method), 98 getBlocks() (RarInfo method), 120 getBookCount() (Book method), 99 getBookInfo() (Book method), 99 getBookInfoByName() (Book method), 99 getBookOrdering() (Book method), 99 getBookRange() (Book method), 99 getBoxOffice() (RottenTomato method), 129 getBriefByGuid() (ReleaseExtra method), 124 getBrowseBy() (Book method), 99 getBrowseBy() (Console method), 104 getBrowseBy() (Movie method), 110 getBrowseBy() (Music method), 112 getBrowseByOptions() (Book method), 99 getBrowseByOptions() (Console method), 104 getBrowseByOptions() (Movie method), 110 getBrowseByOptions() (Music method), 112 getBrowseCount() (Forum method), 105 getBrowseCount() (Releases method), 127 getBrowseNode() (Console method), 104 getBrowseOrder() (Book method), 99 getBrowseOrder() (Releases method), 127 getBrowseOrder() (Users method), 138 getBrowseOrdering() (Releases method), 127 getBrowseOrdering() (Users method), 139 getBrowseRange() (Forum method), 105 getBrowseRange() (Releases method), 127 getByDirname() (PreDB method), 116 getByEmail() (Users method), 138 getByGuid() (ReleaseFiles method), 125 getByGuid() (Releases method), 128 getById() (Binaries method), 98 getById() (Category method), 101 getByID() (Contents method), 105 getByID() (Groups method), 106 getById() (Menu method), 109 getByID() (PreDB method), 116 getByID() (ReleaseRegex method), 126 getById() (Releases method), 129 getByID() (TvRage method), 137 getById() (Users method), 139 getByIdAndRssToken() (Users method), 139 getByIds() (Category method), 101 getByName() (Groups method), 106 149 Newznab Documentation, Release 0.2.3-dev getByNames() (Releases method), 127 getByPassResetGuid() (Users method), 138 getByRageID() (TvRage method), 137 getByRssToken() (Users method), 139 getByTitle() (TvRage method), 137 getByUsername() (Users method), 138 getCalendar() (TvRage method), 137 getCart() (Users method), 139 getCast() (RottenTomato method), 129 getCategoryExclusion() (Users method), 139 getCategoryExclusionNames() (Users method), 139 getChildren() (Category method), 101 getCommentById() (ReleaseComments method), 123 getCommentCount() (ReleaseComments method), 123 getCommentCountForUser() (ReleaseComments method), 124 getComments() (ReleaseComments method), 123 getCommentsByGuid() (ReleaseComments method), 123 getCommentsForUserRange() (ReleaseComments method), 124 getCommentsRange() (ReleaseComments method), 124 getCommonTemplate() (BasePage method), 143 getConsoleCount() (Console method), 104 getConsoleInfo() (Console method), 103 getConsoleInfoByName() (Console method), 103 getConsoleOrder() (Console method), 104 getConsoleOrdering() (Console method), 104 getConsoleRange() (Console method), 104 getCount() (Book method), 99 getCount() (Console method), 104 getCount() (Groups method), 106 getCount() (Movie method), 110 getCount() (Music method), 111 getCount() (Releases method), 127 getCount() (TvRage method), 137 getCount() (Users method), 138 getCountForUser() (Forum method), 106 getDefaultRole() (Users method), 140 getDownloadRequests() (Users method), 140 getDownloadRequestsForUserAndAllHostHashes() (Users method), 140 getDVDReleases() (RottenTomato method), 129 getEarliestUsenetPostDate() (Releases method), 127 getEpisodeInfo() (TvRage method), 137 getEpisodeInfoByID() (Episode method), 105 getEpisodeInfoByName() (Episode method), 105 getFileList() (RarInfo method), 121 getFlat() (Category method), 101 getForExport() (Releases method), 127 getFormat() (TMDb method), 94 getForMenu() (Category method), 101 getForMenuByTypeAndRole() (Contents method), 105 getForReleaseId() (Binaries method), 98 getForSelect() (Category method), 101 150 getForUserRange() (Forum method), 106 getFull() (ReleaseExtra method), 125 getGenres() (Genres method), 106 getGenres() (Movie method), 111 getGenres() (TMDb method), 94 getGenres() (TvRage method), 137 getGroupsForSelect() (Groups method), 106 getGroupsForSelect() (ReleaseRegex method), 126 getHostHash() (Users method), 139 getImages() (TMDb method), 92 getIndex() (Contents method), 105 getInTheaters() (RottenTomato method), 129 getInvite() (Users method), 140 getItemByAsin() (AmazonProductAPI method), 96 getItemByKeyword() (AmazonProductAPI method), 96 getItemByUpc() (AmazonProductAPI method), 96 getKey() (Cache method), 143 getLang() (TMDb method), 95 getLatestMovie() (TMDb method), 94 getLatestPerson() (TMDb method), 94 getLatestUsenetPostDate() (Releases method), 127 getLicense() (Sites method), 131 getLoginCountsByMonth() (Users method), 140 getMediainfo() (PostProcess method), 115 getMessage() (Nntp method), 113 getMessages() (Nntp method), 113 getMovie() (RottenTomato method), 129 getMovie() (TMDb method), 92 getMovie() (UserMovies method), 137 getMovieByHash() (TMDb method), 92 getMovieCount() (Movie method), 110 getMovieInfo() (Movie method), 110 getMovieInfoMultiImdb() (Movie method), 110 getMovieOrder() (Movie method), 110 getMovieOrdering() (Movie method), 110 getMovieRange() (Movie method), 110 getMovies() (UserMovies method), 137 getMovieTranslations() (TMDb method), 93 getMovieVersion() (TMDb method), 93 getMovieVersions() (TMDb method), 93 getMusicCount() (Music method), 111 getMusicInfo() (Music method), 111 getMusicInfoByName() (Music method), 111 getMusicOrder() (Music method), 111 getMusicOrdering() (Music method), 111 getMusicRange() (Music method), 111 getMyMoviesRss() (Releases method), 127 getNextMergeDate() (Sphinx method), 131 getNextRebuildDate() (Sphinx method), 132 getNZBPath() (NZB method), 113 getOpening() (RottenTomato method), 129 getOrAddGenreKey() (Genres method), 106 getParent() (Forum method), 105 getPerson() (TMDb method), 92 Index Newznab Documentation, Release 0.2.3-dev getPersonVersion() (TMDb method), 93 getPersonVersions() (TMDb method), 93 getPost() (Forum method), 105 getPosts() (Forum method), 105 getPreCount() (PreDB method), 117 getPreCount() (Sphinx method), 135 getPreRange() (PreDB method), 117 getPreRange() (Sphinx method), 135 getQueue() (SABnzbd method), 130 getRageInfoFromPage() (TvRage method), 137 getRageInfoFromService() (TvRage method), 137 getRageMatch() (TvRage method), 137 getRange() (Book method), 99 getRange() (Console method), 103 getRange() (Groups method), 106 getRange() (Movie method), 110 getRange() (Music method), 111 getRange() (Releases method), 127 getRange() (TvRage method), 137 getRange() (Users method), 138 getRecentlyAdded() (Releases method), 129 getReleasedGroupsForSelect() (Releases method), 127 getReleaseNameForReqId() (Releases method), 129 getReleaseNfo() (Releases method), 129 getReviews() (RottenTomato method), 129 getRoleById() (Users method), 140 getRoles() (Users method), 140 getRss() (Releases method), 127 getSample() (PostProcess method), 115 getSeriesCount() (TheTVDB method), 136 getSeriesInfoByID() (TheTVDB method), 136 getSeriesInfoByName() (TheTVDB method), 136 getSeriesList() (TvRage method), 137 getSeriesRange() (TheTVDB method), 136 getSession() (Install method), 108 getSession() (TMDb method), 94 getShow() (UserSeries method), 141 getShows() (UserSeries method), 140 getShowsCount() (Releases method), 128 getShowsRange() (Releases method), 127 getShowsRss() (Releases method), 127 getSimilarName() (Releases method), 128 getSphinxBinPath() (Sphinx method), 133 getSubs() (ReleaseExtra method), 124 getSummary() (RarInfo method), 120 getToken() (TMDb method), 94 getTopComments() (Releases method), 129 getTopDownloads() (Releases method), 129 getTopGrabbers() (Users method), 140 getUpcoming() (Movie method), 111 getUpcoming() (RottenTomato method), 129 getUrl() (global function), 141 getUsersByHostHash() (Users method), 140 getUsersByMonth() (Users method), 140 Index getUsersByRole() (Users method), 140 getVideo() (ReleaseExtra method), 124 getXOverview() (Nntp method), 113 getZipped() (Releases method), 128 Groups (class), 106 groups (nzbInfo property), 113 H hasAuth (RarInfo property), 120 hashPassword() (Users method), 139 hashSHA1() (Users method), 139 hasRecovery (RarInfo property), 120 head (BasePage property), 142 head (Installpage property), 109 I imdb, 89 incrementGrabs() (Users method), 138 index() (global function), 80, 144 indexDetails() (Sphinx method), 132 indexNZBs() (Sphinx method), 133 Install (class), 107 Install() (Install method), 108 INSTALL_DIR (Install property), 107 Installpage (class), 109 Installpage() (Installpage method), 109 integrated (SABnzbd property), 130 is0day() (Category method), 102 is_valid (ReCaptchaResponse property), 122 isAnalyzed (RarInfo property), 121 isBlackListed() (Binaries method), 98 isConsole() (Category method), 103 isDisabled() (Users method), 139 isEBook() (Category method), 103 isEncrypted (RarInfo property), 120 isForeignTV() (Category method), 101 isGameNDS() (Category method), 103 isGamePS3() (Category method), 103 isGamePSP() (Category method), 103 isGameWii() (Category method), 103 isGameWiiWare() (Category method), 103 isGameXBOX() (Category method), 103 isGameXBOX360() (Category method), 103 isGameXBOX360DLC() (Category method), 103 isHDTV() (Category method), 101 isIndexEnabled() (Sphinx method), 133 isInitialized() (Install method), 108 isISO() (Category method), 102 isLocked() (Install method), 108 isLoggedIn() (Users method), 139 isMac() (Category method), 102 isMobileAndroid() (Category method), 102 isMobileiOS() (Category method), 102 isMobileOther() (Category method), 102 151 Newznab Documentation, Release 0.2.3-dev isMovie() (Category method), 102 isMovie3D() (Category method), 102 isMovieBluRay() (Category method), 102 isMovieForeign() (Category method), 102 isMovieHD() (Category method), 102 isMovieSD() (Category method), 102 isMusic() (Category method), 103 isMusicLossless() (Category method), 103 isMusicMP3() (Category method), 103 isMusicVideo() (Category method), 103 isParent() (Category method), 101 isPC() (Category method), 102 isPCGame() (Category method), 102 isPostBack() (BasePage method), 142 isPostBack() (Installpage method), 109 isRar() (PostProcess method), 115 isSDTV() (Category method), 101 isSportTV() (Category method), 101 isSuccess() (Installpage method), 109 isTV() (Category method), 101 isValidCaptcha() (Users method), 139 isValidEmail() (Users method), 139 isValidPassword() (Users method), 139 isValidUrl() (Users method), 139 isValidUsername() (Users method), 139 isVolume (RarInfo property), 119 isWindows() (global function), 141 isXxx() (Category method), 102 isXxx264() (Category method), 102 isXxxDVD() (Category method), 102 isXxxImageset() (Category method), 102 isXxxPack() (Category method), 102 isXxxWMV() (Category method), 102 isXxxXvid() (Category method), 102 K killChild() (PowerSpawn method), 116 L lameAudioSample() (PostProcess method), 115 loadFromFile() (nzbInfo method), 114 loadFromString() (nzbInfo method), 114 loc (Sitemap property), 131 lockCheck (Install property), 108 login() (Users method), 139 logout() (Users method), 139 lookupSeriesID() (TheTVDB method), 136 M main() (global function), 80, 144 makeCodecPretty() (ReleaseExtra method), 124 makeFieldLinks() (Movie method), 110 makeLookupTable() (DB method), 143 matchBrowseNode() (Console method), 104 152 matchBrowseNode() (Music method), 112 maxChildren (PowerSpawn property), 116 maxFilenameLength (RarInfo property), 121 maxReadBytes (RarInfo property), 121 mc (Cache property), 143 mediafiles (nzbInfo property), 114 memlimitCheck (Install property), 108 Menu (class), 109 merge() (global function), 80, 144 mergeIndex() (Sphinx method), 132 meta_description (BasePage property), 142 meta_keywords (BasePage property), 142 meta_title (BasePage property), 142 method (Cache property), 143 MISC_DIR (Install property), 107 Movie (class), 110 Movie() (Movie method), 110 movieCoversCheck (Install property), 108 Music (class), 111 Music() (Music method), 111 musicCoversCheck (Install property), 108 myParent() (PowerSpawn method), 116 myPID() (PowerSpawn method), 116 mysqlCheck (Install property), 108 N name ( property), 80, 144 name (Sitemap property), 131 nfo, 89 Nfo (class), 112 Nfo() (Nfo method), 112 nfofiles (nzbInfo property), 114 Nntp (class), 113 NNTP_PASSWORD (Install property), 107 NNTP_PORT (Install property), 107 NNTP_SERVER (Install property), 107 NNTP_SSLENABLED (Install property), 107 NNTP_USERNAME (Install property), 107 nntpCheck (Install property), 108 notFound() (TheTVDB method), 136 NZB, 89 NZB (class), 113 nzb (nzbInfo property), 114 NZB_PATH (Install property), 107 nzbFileList() (NZB method), 113 nzbInfo (class), 113 nzbInfo() (nzbInfo method), 114 nzbPathCheck (Install property), 108 nzpreUpdate() (PreDB method), 117 O objectsIntoArray() (global function), 141 offset (RarInfo property), 121 old_offset (zipfile property), 141 Index Newznab Documentation, Release 0.2.3-dev open() (RarInfo method), 120 opensslCheck (Install property), 108 optimise() (DB method), 143 P pack() (Cache method), 143 page (BasePage property), 142 Page (class), 114 Page() (Page method), 114 page_template (BasePage property), 142 page_template (Installpage property), 109 par, 89 parcount (nzbInfo property), 113 parentCheck() (PowerSpawn method), 116 parseArtist() (Music method), 112 parseAuthor() (Book method), 99 parseImdb() (Nfo method), 112 parseMovieName() (Movie method), 111 parseNameEpSeason() (TvRage method), 137 parseRageId() (Nfo method), 112 parseTitle() (Console method), 104 pearCheck (Install property), 108 phpCheck (Install property), 108 pidDead() (PowerSpawn method), 116 postdate() (Backfill method), 97 postedfirst (nzbInfo property), 114 postedlast (nzbInfo property), 114 poster (nzbInfo property), 114 PostProcess (class), 114 PostProcess() (PostProcess method), 114 PowerSpawn (class), 115 PreDB (class), 116 PreDB() (PreDB method), 116 print_usage() (global function), 80, 144 priority (SABnzbd property), 130 priority (Sitemap property), 131 processAdditional() (PostProcess method), 115 processAll() (PostProcess method), 114 processAnimeReleases() (AniDB method), 97 processBookReleases() (Book method), 99 processBooks() (PostProcess method), 115 processConsoleReleases() (Console method), 104 processGames() (PostProcess method), 115 processMovieReleases() (Movie method), 111 processMovies() (PostProcess method), 115 processMusic() (PostProcess method), 115 processMusicFromMediaInfo() (PostProcess method), 115 processMusicReleaseFromMediaInfo() (Music method), 112 processMusicReleases() (Music method), 112 processNfoFiles() (Nfo method), 112 processNfos() (PostProcess method), 115 processOtherMiscCategory() (PostProcess method), 115 Index processReleaseFiles() (PostProcess method), 115 processReleasePasswords() (PostProcess method), 115 processReleases() (PreDB method), 117 processReleases() (Releases method), 129 processReleases() (TheTVDB method), 136 processTv() (PostProcess method), 115 processTvReleases() (TvRage method), 137 processUnknownCategory() (PostProcess method), 115 pruneRequestHistory() (Users method), 140 purge() (Groups method), 107 Q query() (DB method), 143 queryDirect() (DB method), 143 queryInsert() (DB method), 143 queryOneRow() (DB method), 143 R randomKey() (Users method), 139 rarcount (nzbInfo property), 113 rarFile (RarInfo property), 121 rarfiles (nzbInfo property), 114 RarInfo (class), 117 read() (RarInfo method), 121 rebuild() (Releases method), 128 rebuildmulti() (Releases method), 128 recaptcha_check_answer() (global function), 122 recaptcha_get_html() (global function), 122 recaptcha_get_signup_url() (global function), 123 recaptcha_mailhide_html() (global function), 123 recaptcha_mailhide_url() (global function), 123 ReCaptchaResponse (class), 122 regex, 89 ReleaseComments (class), 123 ReleaseExtra (class), 124 ReleaseFiles (class), 125 ReleaseImage (class), 125 ReleaseImage() (ReleaseImage method), 125 ReleaseRegex (class), 125 Releases (class), 126 removeAnidbIdFromReleases() (Releases method), 129 removeRageIdFromReleases() (Releases method), 129 removeThetvdbIdFromReleases() (Releases method), 129 render() (AdminPage method), 95 render() (BasePage method), 142 render() (Installpage method), 109 render() (Page method), 114 reset() (Groups method), 107 reset() (RarInfo method), 122 responseXmlToObject() (global function), 141 retrieveBlackList() (Binaries method), 98 rewriteCheck (Install property), 108 rotten tomatoes, 89 RottenTomato (class), 129 153 Newznab Documentation, Release 0.2.3-dev row2Object() (Sites method), 131 rows2Object() (Sites method), 131 rsstoken (SABnzbd property), 130 runChildCode() (PowerSpawn method), 116 runCmd() (global function), 141 runCmd() (Sphinx method), 131 runParentCode() (PowerSpawn method), 116 S SABnzbd (class), 130 SABnzbd() (SABnzbd method), 130 safeFilename() (global function), 141 samplefiles (nzbInfo property), 114 saveConfig() (Install method), 109 saveConfigCheck (Install property), 108 saveImage() (ReleaseImage method), 125 saveInstallLock() (Install method), 109 saveLockCheck (Install property), 108 scan() (Binaries method), 98 schemaCheck (Install property), 108 search() (Binaries method), 98 search() (global function), 80, 144 search() (Releases method), 128 search() (Sphinx method), 134 searchadv() (Releases method), 128 searchAudio() (Releases method), 128 searchAudio() (Sphinx method), 135 searchBook() (Releases method), 128 searchBook() (Sphinx method), 135 searchbyAnidbId() (Releases method), 128 searchbyAnidbId() (Sphinx method), 135 searchbyImdbId() (Releases method), 128 searchbyImdbId() (Sphinx method), 135 searchbyRageId() (Releases method), 128 searchbyRageId() (Sphinx method), 135 searchDirect() (Sphinx method), 134 searchMovie() (RottenTomato method), 129 searchMovie() (TMDb method), 92 searchPerson() (TMDb method), 92 searchProducts() (AmazonProductAPI method), 96 searchSimilar() (Releases method), 128 secure_connection (BasePage property), 142 seek() (RarInfo method), 121 segmentactual (nzbInfo property), 114 segmenttotal (nzbInfo property), 114 sendEmail() (global function), 141 sendInvite() (Users method), 140 sendToSab() (SABnzbd method), 130 serverurl (BasePage property), 142 serverurl (SABnzbd property), 130 setApikey() (RottenTomato method), 129 setApikey() (TMDb method), 95 setAuth() (Trakt method), 136 setCallback() (PowerSpawn method), 116 154 setConfig() (Install method), 109 setCookie() (SABnzbd method), 130 setCookies() (Users method), 139 setData() (RarInfo method), 120 setFormat() (TMDb method), 94 setKillCallback() (PowerSpawn method), 116 setLang() (TMDb method), 95 setMaxBytes() (RarInfo method), 120 setMergeDates() (Sphinx method), 132 setRebuildDates() (Sphinx method), 132 setSession() (Install method), 108 sha1Check (Install property), 108 show403() (BasePage method), 143 show404() (BasePage method), 142 show503() (BasePage method), 143 showFloodWarning() (BasePage method), 142 shutdown() (PowerSpawn method), 116 sigHandler() (PowerSpawn method), 116 signup() (Users method), 139 site (BasePage property), 142 Sitemap (class), 131 Sitemap() (Sitemap method), 131 Sites (class), 130 sleepCount (PowerSpawn property), 116 slugify() (global function), 136 smarty (BasePage property), 142 smarty (Installpage property), 109 SMARTY_DIR (Install property), 107 source (nzbInfo property), 113 spawnChild() (PowerSpawn method), 116 spawnReady() (PowerSpawn method), 116 Sphinx (class), 131 startsWith() (global function), 141 store() (Cache method), 143 summarize() (nzbInfo method), 114 T template_dir (BasePage property), 142 TheTVDB (class), 135 TheTVDB() (TheTVDB method), 136 TheTVDBAPI() (TheTVDB method), 136 tick() (PowerSpawn method), 116 timeLimit (PowerSpawn property), 116 timelimitCheck (Install property), 108 timezoneCheck (Install property), 108 title ( property), 80, 144 title (BasePage property), 142 title (Installpage property), 109 tmdb, 89 TMDb (class), 91 trackHost (Trakt property), 136 Trakt (class), 136 Trakt() (Trakt method), 136 ttl (Cache property), 143 Index Newznab Documentation, Release 0.2.3-dev TvRage, 89 TvRage (class), 136 TvRage() (TvRage method), 137 type (Sitemap property), 131 U uid (SABnzbd property), 130 unix2DosTime() (zipfile method), 141 unpack() (Cache method), 143 unsetCookie() (SABnzbd method), 130 update() (Book method), 99 update() (Category method), 101 update() (Console method), 104 update() (Contents method), 105 update() (Groups method), 107 update() (Menu method), 110 update() (Movie method), 110 update() (Music method), 112 update() (ReleaseRegex method), 126 update() (Releases method), 128 update() (Sites method), 131 update() (Sphinx method), 132 update() (TvRage method), 137 update() (Users method), 138 updateAllGroups() (Binaries method), 98 updateApiAccessed() (Users method), 139 updateBlacklist() (Binaries method), 98 updateBookInfo() (Book method), 99 updateConsoleInfo() (Console method), 104 updateEpInfo() (TvRage method), 137 updateExpiredRoles() (Users method), 138 updateGrab() (Releases method), 129 updateGroup() (Binaries method), 98 updateGroupStatus() (Groups method), 107 updateHasPreview() (Releases method), 128 updateIndex() (Sphinx method), 132 updateInsUpcoming() (Movie method), 111 updateLatestRegexRevision() (Sites method), 131 updateMovie() (UserMovies method), 137 updateMovieInfo() (Movie method), 111 updatemulti() (Releases method), 128 updateMusicInfo() (Music method), 112 updatePassResetGuid() (Users method), 138 updatePassword() (Users method), 138 updatePreDB() (PreDB method), 117 updateRageInfo() (TvRage method), 137 updateReleaseCommentCount() (ReleaseComments method), 124 updateReleaseHasPreview() (PostProcess method), 115 updateRole() (Users method), 140 updateRssKey() (Users method), 138 updateSchedule() (TvRage method), 137 updateSeries() (TheTVDB method), 136 updateShow() (UserSeries method), 141 Index updateSiteAccessed() (Users method), 139 updateTitle() (AniDB method), 97 updateUpcoming() (Movie method), 111 updateUserRole() (Users method), 138 updateUserRoleChangeDate() (Users method), 138 url (SABnzbd property), 130 userdata (BasePage property), 142 UserMovies (class), 137 Users (class), 138 UserSeries (class), 140 V validate() (Contents method), 104 version() (Sites method), 131 videocount (nzbInfo property), 114 W writeNZBforReleaseId() (NZB method), 113 WWW_DIR (Install property), 107 X xorDecode() (PreDB method), 117 Z zipcount (nzbInfo property), 114 zipfile (class), 141 155
© Copyright 2024