Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

README

  • Loading branch information...
commit 086d0cf51b2305d6cb2df2644170aee87feb8926 1 parent bcf7c17
@macbury authored
Showing with 3,886 additions and 0 deletions.
  1. +32 −0 Gemfile
  2. +674 −0 README
  3. +10 −0 Rakefile
  4. +73 −0 app/controllers/animes_controller.rb
  5. +22 −0 app/controllers/application_controller.rb
  6. +15 −0 app/controllers/links_controller.rb
  7. +15 −0 app/controllers/search_controller.rb
  8. +85 −0 app/controllers/sources_controller.rb
  9. +19 −0 app/controllers/stylesheets_controller.rb
  10. +12 −0 app/controllers/tags_controller.rb
  11. +18 −0 app/helpers/animes_helper.rb
  12. +5 −0 app/helpers/application_helper.rb
  13. +18 −0 app/helpers/tags_helper.rb
  14. +199 −0 app/models/anime.rb
  15. +26 −0 app/models/episode.rb
  16. +73 −0 app/models/link.rb
  17. +26 −0 app/models/source.rb
  18. +14 −0 app/models/tag.rb
  19. +4 −0 app/models/taggable.rb
  20. +104 −0 app/models/title.rb
  21. +79 −0 app/parsers/rss.rb
  22. +88 −0 app/parsers/sitemap.rb
  23. +6 −0 app/regexp/skip_urls.txt
  24. +70 −0 app/regexp/title_gsubs.txt
  25. +12 −0 app/regexp/title_name_episode.txt
  26. +9 −0 app/regexp/title_season_gsubs.txt
  27. +21 −0 app/stylesheets/frame.less
  28. +447 −0 app/stylesheets/main.less
  29. +11 −0 app/views/animes/_anime.html.erb
  30. +23 −0 app/views/animes/index.html.erb
  31. +40 −0 app/views/animes/invalid.html.erb
  32. +104 −0 app/views/animes/show.html.erb
  33. +17 −0 app/views/animes/show.rss.builder
  34. +49 −0 app/views/layouts/application.html.erb
  35. +24 −0 app/views/links/show.html.erb
  36. +23 −0 app/views/search/index.html.erb
  37. +26 −0 app/views/search/show.html.erb
  38. +25 −0 app/views/sources/_form.html.erb
  39. +6 −0 app/views/sources/edit.html.erb
  40. +27 −0 app/views/sources/index.html.erb
  41. +5 −0 app/views/sources/new.html.erb
  42. +20 −0 app/views/sources/show.html.erb
  43. +11 −0 app/views/tags/index.html.erb
  44. +13 −0 app/views/tags/show.html.erb
  45. +5 −0 app/workers/source_refresh_job.rb
  46. +4 −0 config.ru
  47. +46 −0 config/application.rb
  48. +6 −0 config/boot.rb
  49. +51 −0 config/database.yml
  50. +5 −0 config/environment.rb
  51. +19 −0 config/environments/development.rb
  52. +42 −0 config/environments/production.rb
  53. +32 −0 config/environments/test.rb
  54. +7 −0 config/initializers/backtrace_silencers.rb
  55. +5 −0 config/initializers/delayed_job_worker.rb
  56. +31 −0 config/initializers/gsubs.rb
  57. +10 −0 config/initializers/inflections.rb
  58. +5 −0 config/initializers/mime_types.rb
  59. +7 −0 config/initializers/secret_token.rb
  60. +8 −0 config/initializers/session_store.rb
  61. +1 −0  config/initializers/wallpaper.rb
  62. +41 −0 config/locales/en.yml
  63. +179 −0 config/locales/pl.yml
  64. +76 −0 config/routes.rb
  65. +15 −0 config/schedule.rb
  66. +22 −0 config/sources.yml
  67. +7 −0 config/wallpaper.yml
  68. +15 −0 db/migrate/20100507100254_create_sources.rb
  69. +17 −0 db/migrate/20100507194821_create_animes.rb
  70. +15 −0 db/migrate/20100507195655_create_episodes.rb
  71. +14 −0 db/migrate/20100507195656_create_links.rb
  72. +14 −0 db/migrate/20100508201325_create_titles.rb
  73. +9 −0 db/migrate/20100508202314_add_animdb_id_to_animes.rb
  74. +8 −0 db/migrate/20100508211201_rename_column_animdb_id_to_anidb_id_in_anime.rb
  75. +8 −0 db/migrate/20100508212341_rename_anime_show_id_to_anime_id.rb
  76. +9 −0 db/migrate/20100509094455_add_main_to_titles.rb
  77. +9 −0 db/migrate/20100509104518_add_season_to_episodes.rb
  78. +9 −0 db/migrate/20100509125139_add_description_to_episodes.rb
  79. +15 −0 db/migrate/20100510203253_add_poster_to_anime.rb
  80. +9 −0 db/migrate/20100510215327_add_airdate_to_episode.rb
  81. +9 −0 db/migrate/20100517193705_add_hash_to_titles.rb
  82. +13 −0 db/migrate/20100518163937_create_tags.rb
  83. +14 −0 db/migrate/20100518164117_create_taggables.rb
  84. +9 −0 db/migrate/20100518165038_add_hentai_to_animes.rb
  85. +9 −0 db/migrate/20100518200151_add_taggables_count_to_tags.rb
  86. +14 −0 db/migrate/20100518202010_add_permalink_to_tags.rb
  87. +9 −0 db/migrate/20100519104324_add_trailer_url_to_animes.rb
  88. +18 −0 db/migrate/20100723080526_delayed_jobs.rb
  89. +95 −0 db/schema.rb
  90. +7 −0 db/seeds.rb
  91. +2 −0  doc/README_FOR_APP
  92. +72 −0 lib/background_rotator.rb
  93. +48 −0 lib/color_from_image.rb
  94. 0  lib/tasks/.gitkeep
  95. +114 −0 lib/tasks/ase.rake
  96. +26 −0 public/404.html
  97. +26 −0 public/422.html
  98. +26 −0 public/500.html
  99. 0  public/favicon.ico
  100. BIN  public/images/anime/medium/1265.jpg
  101. BIN  public/images/anime/medium/1266.jpg
  102. BIN  public/images/anime/medium/1267.jpg
  103. BIN  public/images/anime/medium/1268.jpg
  104. BIN  public/images/anime/medium/1269.jpg
  105. BIN  public/images/anime/medium/1270.jpg
  106. BIN  public/images/anime/medium/1271.jpg
  107. BIN  public/images/anime/medium/1272.jpg
  108. BIN  public/images/anime/medium/1273.jpg
  109. BIN  public/images/anime/medium/1274.jpg
  110. BIN  public/images/anime/medium/1276.jpg
  111. BIN  public/images/anime/medium/1277.jpg
  112. BIN  public/images/anime/medium/1278.jpg
  113. BIN  public/images/anime/medium/1279.jpg
  114. BIN  public/images/anime/medium/1281.jpg
  115. BIN  public/images/anime/medium/1282.jpg
  116. BIN  public/images/anime/medium/1283.jpg
  117. BIN  public/images/anime/medium/1285.jpg
  118. BIN  public/images/anime/medium/1286.jpg
  119. BIN  public/images/anime/medium/1287.jpg
  120. BIN  public/images/anime/medium/1289.jpg
  121. BIN  public/images/anime/medium/1290.jpg
  122. BIN  public/images/anime/medium/1291.jpg
  123. BIN  public/images/anime/medium/1292.jpg
  124. BIN  public/images/anime/medium/1293.jpg
  125. BIN  public/images/anime/medium/1294.jpg
  126. BIN  public/images/anime/medium/1295.jpg
  127. BIN  public/images/anime/medium/1296.jpg
  128. BIN  public/images/anime/medium/1297.jpg
  129. BIN  public/images/anime/medium/1298.jpg
  130. BIN  public/images/anime/medium/1299.jpg
  131. BIN  public/images/anime/medium/1300.jpg
  132. BIN  public/images/anime/medium/1301.jpg
  133. BIN  public/images/anime/medium/1302.jpg
  134. BIN  public/images/anime/medium/1303.gif
  135. BIN  public/images/anime/medium/1304.jpg
  136. BIN  public/images/anime/medium/1305.jpg
  137. BIN  public/images/anime/medium/1306.jpg
  138. BIN  public/images/anime/medium/1307.jpg
  139. BIN  public/images/anime/medium/1308.jpg
  140. BIN  public/images/anime/medium/1309.jpg
  141. BIN  public/images/anime/medium/1310.jpg
  142. BIN  public/images/anime/medium/1311.jpg
  143. BIN  public/images/anime/medium/1312.jpg
  144. BIN  public/images/anime/medium/1313.jpg
  145. BIN  public/images/anime/medium/1315.jpg
  146. BIN  public/images/anime/medium/1316.jpg
  147. BIN  public/images/anime/medium/1317.jpg
  148. BIN  public/images/anime/medium/1318.jpg
  149. BIN  public/images/anime/medium/1319.jpg
  150. BIN  public/images/anime/medium/1321.jpg
  151. BIN  public/images/anime/medium/1322.jpg
  152. BIN  public/images/anime/medium/1323.jpg
  153. BIN  public/images/anime/medium/1324.jpg
  154. BIN  public/images/anime/medium/1325.jpg
  155. BIN  public/images/anime/medium/1326.jpg
  156. BIN  public/images/anime/medium/1327.jpg
  157. BIN  public/images/anime/medium/1328.jpg
  158. BIN  public/images/anime/medium/1329.jpg
  159. BIN  public/images/anime/medium/1330.jpg
  160. BIN  public/images/anime/medium/1331.jpg
  161. BIN  public/images/anime/medium/1332.jpg
  162. BIN  public/images/anime/medium/1333.jpg
  163. BIN  public/images/anime/medium/1334.jpg
  164. BIN  public/images/anime/medium/1335.jpg
  165. BIN  public/images/anime/medium/1336.jpg
  166. BIN  public/images/anime/medium/1337.jpg
  167. BIN  public/images/anime/medium/1338.jpg
  168. BIN  public/images/anime/medium/1339.jpg
  169. BIN  public/images/anime/medium/1340.jpg
  170. BIN  public/images/anime/medium/1341.jpg
  171. BIN  public/images/anime/medium/1342.jpg
  172. BIN  public/images/anime/medium/1343.jpg
  173. BIN  public/images/anime/medium/1344.jpg
  174. BIN  public/images/anime/medium/1345.jpg
  175. BIN  public/images/anime/medium/1347.jpg
  176. BIN  public/images/anime/medium/1348.jpg
  177. BIN  public/images/anime/medium/1349.jpg
  178. BIN  public/images/anime/medium/1350.jpg
  179. BIN  public/images/anime/medium/1351.jpg
  180. BIN  public/images/anime/medium/1352.jpg
  181. BIN  public/images/anime/medium/1353.jpg
  182. BIN  public/images/anime/medium/1354.jpg
  183. BIN  public/images/anime/medium/1355.jpg
  184. BIN  public/images/anime/medium/1356.jpg
  185. BIN  public/images/anime/medium/1357.jpg
  186. BIN  public/images/anime/medium/1359.jpg
  187. BIN  public/images/anime/medium/1360.jpg
  188. BIN  public/images/anime/medium/1361.jpg
  189. BIN  public/images/anime/medium/1362.jpg
  190. BIN  public/images/anime/medium/1363.jpg
  191. BIN  public/images/anime/medium/1364.jpg
  192. BIN  public/images/anime/medium/1365.jpg
  193. BIN  public/images/anime/medium/1366.jpg
  194. BIN  public/images/anime/medium/1367.jpg
  195. BIN  public/images/anime/medium/1369.jpg
  196. BIN  public/images/anime/medium/1370.jpg
  197. BIN  public/images/anime/medium/1371.jpg
  198. BIN  public/images/anime/medium/1372.jpg
  199. BIN  public/images/anime/medium/1373.jpg
  200. BIN  public/images/anime/medium/1374.jpg
  201. BIN  public/images/anime/medium/1375.jpg
  202. BIN  public/images/anime/medium/1377.jpg
  203. BIN  public/images/anime/medium/1378.jpg
  204. BIN  public/images/anime/medium/1379.jpg
  205. BIN  public/images/anime/medium/1380.jpg
  206. BIN  public/images/anime/medium/1381.jpg
  207. BIN  public/images/anime/medium/1382.jpg
  208. BIN  public/images/anime/medium/1383.jpg
  209. BIN  public/images/anime/medium/1384.jpg
  210. BIN  public/images/anime/medium/1385.jpg
  211. BIN  public/images/anime/medium/1386.jpg
  212. BIN  public/images/anime/medium/1387.jpg
  213. BIN  public/images/anime/medium/1388.jpg
  214. BIN  public/images/anime/medium/1389.jpg
  215. BIN  public/images/anime/medium/1390.jpg
  216. BIN  public/images/anime/medium/1391.jpg
  217. BIN  public/images/anime/medium/1392.jpg
  218. BIN  public/images/anime/medium/1393.jpg
  219. BIN  public/images/anime/medium/1394.jpg
  220. BIN  public/images/anime/medium/1395.jpg
  221. BIN  public/images/anime/medium/1396.jpg
  222. BIN  public/images/anime/medium/1397.jpg
  223. BIN  public/images/anime/medium/1398.jpg
  224. BIN  public/images/anime/medium/1399.jpg
  225. BIN  public/images/anime/medium/1400.jpg
  226. BIN  public/images/anime/medium/1402.jpg
  227. BIN  public/images/anime/medium/1403.jpg
  228. BIN  public/images/anime/medium/1405.jpg
  229. BIN  public/images/anime/medium/1408.jpg
  230. BIN  public/images/anime/medium/1409.jpg
  231. BIN  public/images/anime/medium/1411.jpg
  232. BIN  public/images/anime/medium/1412.jpg
  233. BIN  public/images/anime/medium/1413.jpg
  234. BIN  public/images/anime/medium/1414.jpg
  235. BIN  public/images/anime/medium/1415.jpg
  236. BIN  public/images/anime/medium/1417.jpg
  237. BIN  public/images/anime/medium/1418.jpg
  238. BIN  public/images/anime/medium/1419.jpg
  239. BIN  public/images/anime/medium/1420.jpg
  240. BIN  public/images/anime/medium/1421.jpg
  241. BIN  public/images/anime/medium/1422.jpg
  242. BIN  public/images/anime/medium/1423.jpg
  243. BIN  public/images/anime/medium/1425.jpg
  244. BIN  public/images/anime/medium/1426.jpg
  245. BIN  public/images/anime/medium/1427.jpg
  246. BIN  public/images/anime/medium/1428.jpg
  247. BIN  public/images/anime/medium/1429.jpg
  248. BIN  public/images/anime/medium/1430.jpeg
  249. BIN  public/images/anime/medium/1431.jpg
  250. BIN  public/images/anime/medium/1432.jpg
  251. BIN  public/images/anime/medium/1434.jpg
  252. BIN  public/images/anime/medium/1435.jpg
  253. BIN  public/images/anime/medium/1437.jpg
  254. BIN  public/images/anime/medium/1438.jpg
  255. BIN  public/images/anime/medium/1441.jpg
  256. BIN  public/images/anime/medium/1443.jpg
  257. BIN  public/images/anime/medium/1446.jpg
  258. BIN  public/images/anime/medium/1447.jpg
  259. BIN  public/images/anime/medium/1448.jpg
  260. BIN  public/images/anime/medium/1481.jpg
  261. BIN  public/images/anime/medium/1482.jpg
  262. BIN  public/images/anime/medium/1484.jpg
  263. BIN  public/images/anime/medium/1485.jpg
  264. BIN  public/images/anime/medium/1486.jpg
  265. BIN  public/images/anime/medium/1487.jpg
  266. BIN  public/images/anime/medium/1489.jpg
  267. BIN  public/images/anime/medium/1490.jpg
  268. BIN  public/images/anime/medium/1491.jpg
  269. BIN  public/images/anime/medium/1492.jpg
  270. BIN  public/images/anime/medium/1493.jpg
  271. BIN  public/images/anime/medium/1496.jpg
  272. BIN  public/images/anime/medium/1497.jpg
  273. BIN  public/images/anime/medium/1498.jpg
  274. BIN  public/images/anime/medium/1499.jpg
  275. BIN  public/images/anime/medium/1500.jpg
  276. BIN  public/images/anime/medium/1501.jpg
  277. BIN  public/images/anime/medium/1502.jpg
  278. BIN  public/images/anime/medium/1503.jpg
  279. BIN  public/images/anime/medium/1504.jpg
  280. BIN  public/images/anime/medium/1505.jpg
  281. BIN  public/images/anime/medium/1506.jpg
  282. BIN  public/images/anime/medium/1507.gif
  283. BIN  public/images/anime/medium/1508.jpg
  284. BIN  public/images/anime/medium/1511.jpg
  285. BIN  public/images/anime/medium/1512.jpg
  286. BIN  public/images/anime/medium/1513.jpg
  287. BIN  public/images/anime/medium/1514.jpg
  288. BIN  public/images/anime/medium/1515.jpg
  289. BIN  public/images/anime/medium/1516.jpg
  290. BIN  public/images/anime/medium/1517.jpg
  291. BIN  public/images/anime/medium/1518.jpg
  292. BIN  public/images/anime/medium/1519.jpg
  293. BIN  public/images/anime/medium/1520.jpg
  294. BIN  public/images/anime/medium/1521.jpg
  295. BIN  public/images/anime/medium/1522.jpg
  296. BIN  public/images/anime/medium/1523.jpg
  297. BIN  public/images/anime/medium/1524.jpg
  298. BIN  public/images/anime/medium/1525.jpg
  299. BIN  public/images/anime/medium/1526.jpg
  300. BIN  public/images/anime/medium/1531.jpg
Sorry, we could not display the entire diff because too many files (901) changed.
View
32 Gemfile
@@ -0,0 +1,32 @@
+source 'http://rubygems.org'
+
+gem 'rails', '3.0.0.beta3'
+
+# Bundle edge Rails instead:
+#gem 'rails', :git => 'git://github.com/rails/rails.git'
+
+gem 'pg'
+gem 'color-tools'
+gem 'youtube-g'
+gem 'less'
+gem 'paperclip', :git => 'git://github.com/JasonKing/paperclip.git', :branch => 'rails3'
+gem 'libxml-ruby', :require => false
+gem 'nokogiri', :require => false
+gem "will_paginate", :git => "http://github.com/mislav/will_paginate.git", :branch => "rails3"
+# Use unicorn as the web server
+# gem 'unicorn'
+
+# Deploy with Capistrano
+# gem 'capistrano'
+
+# Bundle the extra gems:
+# gem 'bj'
+# gem 'nokogiri', '1.4.1'
+# gem 'sqlite3-ruby', :require => 'sqlite3'
+# gem 'aws-s3', :require => 'aws/s3'
+
+# Bundle gems for certain environments:
+# gem 'rspec', :group => :test
+# group :test do
+# gem 'webrat'
+# end
View
674 README
@@ -0,0 +1,674 @@
+GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) 2009 Buras Arkadiusz
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ ASE Copyright (C) 2009 Buras Arkadiusz
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<http://www.gnu.org/licenses/>.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
View
10 Rakefile
@@ -0,0 +1,10 @@
+# Add your own tasks in files placed in lib/tasks ending in .rake,
+# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
+
+require File.expand_path('../config/application', __FILE__)
+
+require 'rake'
+require 'rake/testtask'
+require 'rake/rdoctask'
+
+Rails::Application.load_tasks
View
73 app/controllers/animes_controller.rb
@@ -0,0 +1,73 @@
+class AnimesController < ApplicationController
+
+ before_filter :authenticate, :only => [:merge, :invalid, :destroy]
+ before_filter :prepare_query, :only => [:index, :latest]
+
+ def latest
+ @animes = @query.latest.paginate :per_page => 15, :page => params[:page]
+ render(:index)
+ end
+
+ def index
+ @animes = @query.paginate :per_page => 15, :page => params[:page]
+ end
+
+ def invalid
+ @animes = Anime.where("anidb_id IS NULL").order("created_at DESC").all
+
+ end
+
+ def show
+ @anime = Anime.find_by_permalink!(params[:id])
+ @episodes = @anime.episodes.order('number DESC').all(:include => :links)
+ @titles = @anime.titles.order('main DESC, name ASC').all
+ end
+
+ def merge
+ @anime = Anime.find_by_permalink!(params[:id])
+ if params[:anidb_id]
+ Title.find_by_anidb_id!(params[:anidb_id])
+
+ @destination_anime = Anime.find_or_initialize_by_anidb_id(params[:anidb_id])
+
+ if @destination_anime.new_record?
+ @destination_anime.proposeName
+ @destination_anime.save
+ end
+ else
+ @destination_anime = Anime.find_by_permalink!(params[:anime_id])
+ end
+
+ @destination_anime = @anime.merge_with_anime(@destination_anime)
+
+ if @destination_anime
+ @anime.destroy
+ redirect_to @destination_anime
+ else
+ logger.debug @destination_anime.errors.full_messages.join(", ")
+ redirect_to invalid_animes_path
+ end
+
+ end
+
+ def destroy
+ @anime = Anime.find_by_permalink!(params[:id])
+ @anime.destroy
+
+ redirect_to invalid_animes_path
+ end
+
+ protected
+
+ def prepare_query
+ @query = Anime.visible
+ if params[:letter]
+ if params[:letter] == "0"
+ @query = @query.where("name !~* '^[a-z]'") # thank god for postgresql regexp
+ else
+ @query = @query.where("name ILIKE ?", "#{params[:letter]}%")
+ end
+ end
+ @query = @query.order("name ASC")
+ end
+end
View
22 app/controllers/application_controller.rb
@@ -0,0 +1,22 @@
+class ApplicationController < ActionController::Base
+ protect_from_forgery
+ layout 'application'
+
+ before_filter :set_locale
+
+ def set_locale
+ I18n.locale = params[:locale] || :en
+ end
+
+ def default_url_options(options={})
+ {:locale => I18n.locale.to_s}
+ end
+
+ USER_NAME, PASSWORD = "macbury", "password"
+
+ def authenticate
+ authenticate_or_request_with_http_basic do |user_name, password|
+ user_name == USER_NAME && password == PASSWORD
+ end
+ end
+end
View
15 app/controllers/links_controller.rb
@@ -0,0 +1,15 @@
+class LinksController < ApplicationController
+ layout false
+ before_filter :load_anime
+
+ def show
+ @link = Link.find(params[:id])
+ end
+
+ protected
+
+ def load_anime
+ @anime = Anime.find_by_permalink!(params[:anime_id])
+ end
+
+end
View
15 app/controllers/search_controller.rb
@@ -0,0 +1,15 @@
+class SearchController < ApplicationController
+
+ def show
+ @title = Title.find_by_title(params[:query]).anidb_id rescue 0
+ @animes = Anime.visible.where("animes.anidb_id = ? OR animes.name ILIKE ? OR titles.name ILIKE ?", @title, "%#{params[:query]}%", "%#{params[:query]}%").order("updated_at DESC").paginate(
+ :joins => [:titles],
+ :per_page => 15,
+ :page => params[:page],
+ :select => "DISTINCT (animes.*)")
+
+
+ redirect_to @animes.first if @animes.size == 1
+ end
+
+end
View
85 app/controllers/sources_controller.rb
@@ -0,0 +1,85 @@
+class SourcesController < ApplicationController
+ before_filter :authenticate
+ # GET /sources
+ # GET /sources.xml
+ def index
+ @sources = Source.all
+
+ respond_to do |format|
+ format.html # index.html.erb
+ format.xml { render :xml => @sources }
+ end
+ end
+
+ # GET /sources/1
+ # GET /sources/1.xml
+ def show
+ @source = Source.find(params[:id])
+
+ respond_to do |format|
+ format.html # show.html.erb
+ format.xml { render :xml => @source }
+ end
+ end
+
+ # GET /sources/new
+ # GET /sources/new.xml
+ def new
+ @source = Source.new
+
+ respond_to do |format|
+ format.html # new.html.erb
+ format.xml { render :xml => @source }
+ end
+ end
+
+ # GET /sources/1/edit
+ def edit
+ @source = Source.find(params[:id])
+ end
+
+ # POST /sources
+ # POST /sources.xml
+ def create
+ @source = Source.new(params[:source])
+
+ respond_to do |format|
+ if @source.save
+ format.html { redirect_to(@source, :notice => 'Source was successfully created.') }
+ format.xml { render :xml => @source, :status => :created, :location => @source }
+ else
+ format.html { render :action => "new" }
+ format.xml { render :xml => @source.errors, :status => :unprocessable_entity }
+ end
+ end
+ end
+
+ # PUT /sources/1
+ # PUT /sources/1.xml
+ def update
+ @source = Source.find(params[:id])
+
+ respond_to do |format|
+ if @source.update_attributes(params[:source])
+ format.html { redirect_to(@source, :notice => 'Source was successfully updated.') }
+ format.xml { head :ok }
+ else
+ format.html { render :action => "edit" }
+ format.xml { render :xml => @source.errors, :status => :unprocessable_entity }
+ end
+ end
+ end
+
+ # DELETE /sources/1
+ # DELETE /sources/1.xml
+ def destroy
+ @source = Source.find(params[:id])
+ @source.destroy
+
+ respond_to do |format|
+ format.html { redirect_to(sources_url) }
+ format.xml { head :ok }
+ end
+ end
+
+end
View
19 app/controllers/stylesheets_controller.rb
@@ -0,0 +1,19 @@
+class StylesheetsController < ApplicationController
+ #caches_action :show, :for => 24.hours
+ respond_to :css
+
+ def show
+ @wallpaper = YAML.load_file(File.join([Rails.root, "config/wallpaper.yml"]))
+
+ stylesheet_filename = File.join([Rails.root, 'app', 'stylesheets', "#{params[:name]}.less"])
+
+ if File.exists?(stylesheet_filename)
+ stylesheet = render_to_string(stylesheet_filename, :layout => false)
+
+ render :text => Less.parse(stylesheet), :content_type => "text/css"
+ else
+ render :text => ".no_file {} ", :content_type => "text/css"
+ end
+ end
+
+end
View
12 app/controllers/tags_controller.rb
@@ -0,0 +1,12 @@
+class TagsController < ApplicationController
+
+ def index
+ @tags = Tag.order('name ASC').all
+ end
+
+ def show
+ @tag = Tag.find_by_permalink!(params[:id])
+ @animes = @tag.animes.order("name ASC").paginate :per_page => 15, :page => params[:page]
+ end
+
+end
View
18 app/helpers/animes_helper.rb
@@ -0,0 +1,18 @@
+module AnimesHelper
+
+ def description(text)
+ return if text.nil?
+ text.gsub!(/\A^\*.+$/i, '')
+ text.gsub!(/(http:\/\/anidb\.net\/[a-zA-Z0-9]+)\s\[([a-zA-Z0-9\s\/`\-"]+)\]/i, link_to('\2','\1', :target => "_blank"))
+ text.html_safe
+ end
+
+ def aired_ago(date)
+ if date.to_datetime >= 7.days.ago.at_beginning_of_day
+ content_tag :span, distance_of_time_in_words_to_now(date) + " " + t('datetime.distance_in_words.ago'), :title => l(date, :format => :long)
+ else
+ content_tag :span, l(date, :format => "%d %b %Y"), :title => distance_of_time_in_words_to_now(date) + " " + t('datetime.distance_in_words.ago')
+ end
+ end
+
+end
View
5 app/helpers/application_helper.rb
@@ -0,0 +1,5 @@
+module ApplicationHelper
+ def rss_link(title, path)
+ tag :link, :type => 'application/rss+xml', :title => title, :href => path, :rel => "alternate"
+ end
+end
View
18 app/helpers/tags_helper.rb
@@ -0,0 +1,18 @@
+module TagsHelper
+
+ def tag_cloud_for_tags(tags,classes=%w( tag1 tag2 tag3 tag4, tag5, tag6, tag7, tag8, tag9, tag10, tag11, tag12 ))
+ max, min = 0, 0
+
+ tags.each do |tag|
+ max = [tag.taggables_count, max].max
+ min = [tag.taggables_count, min].min
+ end
+
+ div = ((max - min) / classes.size) + 1
+
+ tags.each do |tag|
+ yield tag, classes[(tag.taggables_count - min) / div]
+ end
+ end
+
+end
View
199 app/models/anime.rb
@@ -0,0 +1,199 @@
+require 'net/http'
+require 'xml'
+require 'zlib'
+require 'youtube_g'
+
+class Anime < ActiveRecord::Base
+ include Paperclip
+
+ validates :name, :presence => true
+
+ has_many :episodes, :dependent => :destroy
+ has_many :titles, :foreign_key => "anidb_id", :primary_key => "anidb_id"
+
+ has_many :taggables, :dependent => :delete_all
+ has_many :tags, :through => :taggables
+
+ has_attached_file :poster,
+ :styles => { :thumb => "90x90#", :medium => "200x260#" },
+ :url => "/images/anime/:style/:id.:extension",
+ :path => "#{Rails.root}/public/images/anime/:style/:id.:extension"
+
+ scope :visible, where("episodes_count > 0")
+ scope :duplicates, where("anidb_id IS NOT NULL").group("animes.anidb_id").having("count(animes.id) > 1")
+ scope :latest, :order => "updated_at DESC"
+
+ attr_accessor :subtitle
+ before_create :create_permalink
+
+ def self.create_by_title(title)
+ tmp_title = Title.find_main_title(title)
+
+ if tmp_title.nil?
+ anime = Anime.find_or_create_by_name(title.capitalize.strip)
+ else
+ anime = Anime.find_or_initialize_by_anidb_id(tmp_title.anidb_id)
+
+ if anime.new_record?
+ anime.name = tmp_title.name
+ anime.save
+ end
+ end
+
+ return anime
+ end
+
+ def merge_with_anime(destination_anime)
+ title = Title.find_or_initialize_by_name(self.name)
+ title.anidb_id = destination_anime.anidb_id
+ title.main = false
+ title.save
+
+ self.episodes.each do |wrong_episode|
+ good_episode = Episode.find_or_initialize_by_anime_id_and_number(destination_anime.id, wrong_episode.number)
+ good_episode.anime = destination_anime
+ good_episode.save
+
+ wrong_episode.links.all.each do |link|
+ good_episode.links.find_or_create_by_url(link.url)
+ end
+ end
+
+ destination_anime.episodes_count = destination_anime.episodes.size
+
+ if destination_anime.save
+ destroy
+ destination_anime
+ else
+ false
+ end
+ end
+
+ def permalink
+ read_attribute(:permalink) || create_permalink
+ end
+
+ def create_permalink
+ uid = self.anidb_id || self.id
+ self.permalink = "#{uid}-#{PermalinkFu.escape(name)}"
+ end
+
+ def proposeName
+ return if self.anidb_id.nil?
+ tmp = Title.where("anidb_id = ?", self.anidb_id).where("main = ?", true).first
+ tmp = Title.where("anidb_id = ?", self.anidb_id).first if tmp.nil?
+
+ write_attribute :name, tmp.name
+ end
+
+ def name
+ read_attribute(:subtitle) || read_attribute(:name)
+ end
+
+ def to_param
+ permalink
+ end
+
+ def download_poster
+ return if poster.file? || poster_url.nil?
+
+ url = URI.parse("http://img7.anidb.net/pics/anime/#{poster_url}")
+ store_path = File.join([Rails.root, "tmp/cache/#{poster_url}"])
+ File.delete(store_path) if File.exist?(store_path)
+
+ puts "Downloading poster for #{name} from #{url.to_s}"
+
+ File.open(store_path, "a") do |f|
+ f.write Net::HTTP.get_response(url).body
+ end
+
+ if File.zero?(store_path)
+
+ poster_url = nil
+ else
+ self.poster = File.open(store_path, "r")
+
+ File.delete(store_path) if save
+ end
+ end
+
+ def getTrailer!
+ return if anidb_id.nil?
+
+ client = YouTubeG::Client.new
+ trailers = client.videos_by(:query => "#{self.name} trailer")
+
+ puts "YOUTUBE: #{self.name}"
+
+ return if trailers.videos.size == 0
+
+ tmp_trailer = client.video_by(trailers.videos.first.video_id)
+
+ self.trailer_url = tmp_trailer.media_content.first.url
+
+ puts "+ #{self.trailer_url}"
+ self.save
+ end
+
+ def getInfoFromAniDb!
+ unless anidb_id.nil?
+ url = URI.parse("http://api.anidb.net:9001/httpapi?request=anime&client=animesearch&clientver=1&protover=1&aid=#{anidb_id}")
+
+ empty_episodes = episodes.empty.all
+
+ unless (self.description.nil? || empty_episodes.size == 0)
+ puts "Skip #{name}"
+ return
+ end
+
+ puts "Info for #{self.name} ID: #{self.anidb_id}"
+
+ raw_xml = Net::HTTP.get_response(url).body
+ gz = Zlib::GzipReader.new(StringIO.new(raw_xml))
+ xml = XML::Document.string(gz.read)
+ gz = nil
+ raw_xml = nil
+
+ self.description = xml.find_first("description").content rescue nil
+
+ tmp_poster = xml.find_first("picture")
+ if self.poster_url.nil? && !tmp_poster.nil?
+ self.poster_url = tmp_poster.content
+ self.download_poster
+ end
+ save
+
+ xml.find("categories/category").each do |raw_xml_category|
+ self.hentai ||= raw_xml_category["hentai"]
+ name = raw_xml_category.find_first("name").content
+
+ self.tags << Tag.find_or_create_by_name(name)
+ end
+ puts "TAGS: " + self.tags.map(&:name).join(", ")
+ xml.find("episodes/episode").each do |raw_xml_episode|
+ ep_id = raw_xml_episode.find_first("epno").content.to_i
+ empty_episodes.each do |episode|
+ next if episode.number != ep_id
+
+ puts "+ episode #{ep_id}"
+
+ raw_xml_episode.find("title").each do |raw_titles|
+ episode.title = raw_titles.content if raw_titles["lang"] == "en"
+ end
+
+ tmp_description = raw_xml_episode.find_first("description")
+ episode.description ||= tmp_description.content unless tmp_description.nil?
+
+ tmp_airdate = raw_xml_episode.find_first("airdate")
+
+ unless tmp_airdate.nil?
+ episode.airdate = tmp_airdate.content.to_date rescue nil
+ end
+
+ episode.save
+ end
+ end
+ end
+ end
+
+end
View
26 app/models/episode.rb
@@ -0,0 +1,26 @@
+class Episode < ActiveRecord::Base
+ belongs_to :anime, :counter_cache => true
+ has_many :links, :dependent => :delete_all
+
+ scope :empty, where("title IS NULL")
+
+ def title=(new_title)
+ new_title = nil if new_title =~ /episode/i
+
+ if new_title && new_title.size > 255
+ self.description = new_title
+
+ if new_title.size > 256
+ new_title = new_title[0..252] + "..."
+ else
+ new_title = new_title[0..255]
+ end
+ end
+
+ write_attribute :title, new_title
+ end
+
+ def aired_at
+ airdate || created_at
+ end
+end
View
73 app/models/link.rb
@@ -0,0 +1,73 @@
+class Link < ActiveRecord::Base
+ validates :url, :presence => true
+ belongs_to :episode
+
+ def source
+ URI.parse(self.url).host.gsub('www.', '')
+ end
+
+ def parse
+ if self.new_record? && !self.url.nil?
+ doc = Nokogiri::HTML(Net::HTTP.get_response(URI.parse(self.url)).body)
+ if doc.at_css("title").nil?
+ logger.info "Error parsing HTML: NO <TITLE> TAG - #{url}"
+ return
+ end
+ title = doc.at_css("title").text
+
+ TITLE_GSUBS.each do |regexp|
+ title.gsub!(regexp, '')
+ end
+
+ title.gsub!(/\s{2,100}/, ' ')
+ title.strip!
+ doc = nil
+
+ TITLE_REGEXP.each do |regexp|
+ if title =~ regexp
+ title = $1.strip
+
+ regexp_episode = $2
+ season = 1
+
+ TITLE_SEASON_GSUBS.each do |season_regexp|
+ if title =~ season_regexp
+ season = $1.to_i || 1
+ title.gsub!(season_regexp, '')
+ break
+ end
+ end
+
+ anime = Anime.create_by_title(title)
+
+ refresh_informations = anime.new_record?
+
+ self.episode_id = Episode.find_or_create_by_anime_id_and_number(anime.id,regexp_episode).id
+ if self.save
+ logger.info "+ #{anime.name} ep. #{episode.number}: #{url}"
+ refresh_informations = true
+ indexed += 1
+ else
+ logger.info "Invalid: #{url}"
+ logger.info "Title: #{title}"
+ invalid += 1
+ end
+
+ if refresh_informations
+ anime.send_later(:getInfoFromAniDb!)
+ anime.send_later(:download_poster)
+ end
+
+ anime.send_later(:getTrailer!) if anime.trailer_url.nil?
+
+ return
+ end
+ end
+
+ else
+ logger.info 'Skip ' + url
+ skipped += 1
+ end
+
+ end
+end
View
26 app/models/source.rb
@@ -0,0 +1,26 @@
+require "sitemap"
+require "rss"
+class Source < ActiveRecord::Base
+ validates :url, :presence => true
+ validates :parser, :presence => true
+
+ def parse
+ if sitemap?
+ Sitemap.new(self.url)
+ elsif rss?
+ Rss.new(self.url)
+ end
+ end
+
+ def youtube?
+ parser == "youtube"
+ end
+
+ def sitemap?
+ parser == "sitemap"
+ end
+
+ def rss?
+ parser == "rss"
+ end
+end
View
14 app/models/tag.rb
@@ -0,0 +1,14 @@
+class Tag < ActiveRecord::Base
+ has_many :taggables, :dependent => :delete_all
+ has_many :animes, :through => :taggables
+
+ before_create :create_permalink
+
+ def create_permalink
+ self.permalink = PermalinkFu.escape(name)
+ end
+
+ def to_param
+ self.permalink
+ end
+end
View
4 app/models/taggable.rb
@@ -0,0 +1,4 @@
+class Taggable < ActiveRecord::Base
+ belongs_to :anime
+ belongs_to :tag, :counter_cache => true
+end
View
104 app/models/title.rb
@@ -0,0 +1,104 @@
+require 'net/http'
+require 'zlib'
+require 'xml'
+
+class Title < ActiveRecord::Base
+ belongs_to :anime, :foreign_key => "anidb_id"
+
+ before_save :hash!
+
+ def self.hash_name(new_name)
+ tmp_name = new_name.gsub(/[^0-9a-z]/i, "").strip.downcase
+ tmp_name = new_name.gsub(/[\d\W_]/i, "").strip.downcase if tmp_name == ""
+
+ Digest::SHA1.hexdigest(tmp_name)
+ end
+
+ def hash!
+ self.hashed_name = Title.hash_name(self.name)
+ end
+
+ def self.find_by_title(title)
+ Title.find_by_hashed_name(Title.hash_name(title)) || Title.where("name ILIKE ?", "%#{title}%").first
+ end
+
+ def self.find_main_title(title)
+ tmp_title = Title.find_by_title(title)
+ unless tmp_title.nil?
+ tmp = nil
+ tmp = Title.where("anidb_id = ?", tmp_title.anidb_id).order("main DESC").first unless tmp_title.main?
+ tmp_title = tmp unless tmp.nil?
+ end
+
+ tmp_title
+ end
+
+ def self.download
+ source_url = "http://anidb.net/api/animetitles.xml.gz"
+ puts "Downloading: #{source_url}"
+ tmp_file = File.join([Rails.root, "tmp/animetitles.xml.gz"])
+
+ File.delete(tmp_file) if File.exist?(tmp_file)
+ puts "Saving file in: #{tmp_file}"
+ File.open(tmp_file, "a") do |file|
+ file.write(Net::HTTP.get_response(URI.parse(source_url)).body)
+ end
+
+ tmp_extracted_file = File.join([Rails.root, "tmp/animetitles.xml"])
+ puts "Extracting file to: #{tmp_extracted_file}"
+ File.delete(tmp_extracted_file) if File.exist?(tmp_extracted_file)
+
+ File.open(tmp_extracted_file, "a") do |file|
+ Zlib::GzipReader.open(tmp_file) do |gz|
+ file.write(gz.read)
+ end
+ end
+
+ if File.zero?(tmp_extracted_file)
+ puts "FILE IS EMPTY!!!! WHAT THE FUCK???"
+ return
+ else
+ Title.parse(tmp_extracted_file)
+ end
+ end
+
+ def self.parse(file_name)
+ reader = XML::Reader.file(file_name)
+ animdb_id = nil
+ puts "Parsing file #{file_name}"
+ while reader.read
+ if reader.name == "anime" && reader.node_type == XML::Reader::TYPE_ELEMENT
+ while(reader.read_attribute_value == 0)
+ reader.move_to_next_attribute
+ end
+
+ animdb_id = reader.value
+
+ while (!(reader.name == "anime" && reader.node_type == XML::Reader::TYPE_END_ELEMENT))
+ reader.read
+
+ isMainTitle = false
+
+ if reader.name == "title" && reader.node_type == XML::Reader::TYPE_ELEMENT
+ isMainTitle = (reader["type"] == "main")
+ reader.read
+
+ if reader.node_type == XML::Reader::TYPE_TEXT
+ title = Title.find_or_initialize_by_name_and_anidb_id(reader.value, animdb_id)
+ title.main = isMainTitle unless title.main?
+ title.save
+ puts "#{title.main ? "M" : "+"} #{animdb_id}: #{reader.value}"
+ end
+ end
+ end
+
+ animdb_id = nil
+ end
+ end
+ end
+
+ def main?
+ main
+ end
+
+end
View
79 app/parsers/rss.rb
@@ -0,0 +1,79 @@
+require 'xml'
+require 'net/http'
+require 'open-uri'
+
+class Rss
+
+ def initialize(source_url)
+ puts "====================================="
+ puts "Downloading: #{source_url}"
+
+ raw_rss = Net::HTTP.get_response(URI.parse(source_url)).body
+
+ if raw_rss == nil || raw_rss == ""
+ puts "ERROR: EMPTY RESPONSE"
+ return
+ end
+
+ xml = XML::Document.string(raw_rss)
+ indexed = 0
+ skipped = 0
+ invalid = 0
+
+ xml.find("channel/item").each do |item|
+ link = Link.find_or_initialize_by_url(item.find_first("link").content)
+ title = item.find_first("title").content
+ if link.new_record? && !link.url.nil? && !title.nil? && title != ""
+ TITLE_GSUBS.each do |regexp|
+ title.gsub!(regexp, '')
+ end
+
+ title.gsub!(/\s{2,100}/, ' ')
+ title.strip!
+
+ TITLE_REGEXP.each do |regexp|
+ if title =~ regexp
+ title = $1.strip
+
+ regexp_episode = $2
+ season = 1
+
+ TITLE_SEASON_GSUBS.each do |season_regexp|
+ if title =~ season_regexp
+ season = $1.to_i || 1
+ title.gsub!(season_regexp, '')
+ break
+ end
+ end
+
+ anime = Anime.create_by_title(title)
+
+ link.episode_id = Episode.find_or_create_by_anime_id_and_number(anime.id,regexp_episode).id
+
+ if link.save
+ puts "+ #{anime.name} ep. #{link.episode.number}: #{link.url}"
+ indexed += 1
+ else
+ puts "Invalid: #{link.url}"
+ puts "Title: #{title}"
+ invalid += 1
+ end
+ break
+ end
+ end
+
+ else
+ puts "Skip: [#{title}] #{link.url}"
+ skipped += 1
+ end
+ end
+
+ puts "\n\n\n\n\n\n"
+ puts "==========================================================="
+ puts "INDEXED = #{indexed}"
+ puts "SKIPPED = #{skipped}"
+ puts "INVALID = #{invalid}"
+ puts "==========================================================="
+ end
+
+end
View
88 app/parsers/sitemap.rb
@@ -0,0 +1,88 @@
+require 'xml'
+require 'net/http'
+require 'nokogiri'
+require 'open-uri'
+
+class Sitemap
+ def initialize(source_url)
+ logfile = File.open(File.join([Rails.root, "log", "sitemap_parser.log"]), 'a')
+ logfile.sync = true
+ logger = Logger.new(logfile)
+ logger.info "====================================================="
+ logger.info "Downloading: #{source_url}"
+ logger.info "====================================================="
+
+ tmp_file = File.join([Rails.root, "tmp/cache_sitemap.xml"])
+
+ if source_url =~ /\.gz$/i
+ gz_tmp_file = File.join([Rails.root, "tmp/cache_sitemap.xml.gz"])
+
+ File.delete(gz_tmp_file) if File.exist?(gz_tmp_file)
+ File.open(gz_tmp_file, "a") do |file|
+ file.write(Net::HTTP.get_response(URI.parse(source_url)).body)
+ end
+
+ logger.info "Decompresing file: #{tmp_file}"
+ logger.info "====================================================="
+ File.delete(tmp_file) if File.exist?(tmp_file)
+ File.open(tmp_file, "a") do |file|
+ Zlib::GzipReader.open(gz_tmp_file) do |gz|
+ file.write(gz.read)
+ end
+ end
+ else
+ File.delete(tmp_file) if File.exist?(tmp_file)
+ File.open(tmp_file, "w") do |file|
+ file.write(Net::HTTP.get_response(URI.parse(source_url)).body)
+ end
+ logger.info "Caching file in: #{tmp_file}"
+ logger.info "====================================================="
+ end
+
+ return if File.zero?(tmp_file)
+ logger.info "Parsing file..."
+ logger.info "====================================================="
+
+ reader = XML::Reader.file(tmp_file)
+ indexed = 0
+ skipped = 0
+ invalid = 0
+
+ begin
+ while reader.read
+ if reader.name == "loc" && reader.node_type == XML::Reader::TYPE_ELEMENT
+ reader.read
+
+ skip_this_url = false
+
+ SKIP_URL_REGEXP.each do |skip_regexp|
+ if reader.value =~ skip_regexp
+ skip_this_url = true
+ break
+ end
+ end
+
+ unless skip_this_url
+ link = Link.find_or_initialize_by_url(reader.value)
+ logger.info "Adding to quee #{reader.value}"
+ link.send_later(:parse) if link.new_record? && !link.url.nil?
+ else
+ logger.info "Skipping #{reader.value}"
+ end
+
+ end
+ end
+ rescue Exception => e
+ logger.info "Error: #{e.to_s}"
+ end
+
+ logger.info "\n\n\n\n\n\n"
+ logger.info "==========================================================="
+ logger.info "INDEXED = #{indexed}"
+ logger.info "SKIPPED = #{skipped}"
+ logger.info "INVALID = #{invalid}"
+ logger.info "==========================================================="
+ end
+
+
+end
View
6 app/regexp/skip_urls.txt
@@ -0,0 +1,6 @@
+http:\/\/www\.voober\.com\/forums\/.*
+http:\/\/www\.voober\.com\/?genre=.*
+http:\/\/www\.voober\.com\/anime-series-list\/
+http:\/\/www\.voober.com\/recent-anime-additions\/
+http:\/\/www\.voober\.com\/anime-movies\/
+http:\/\/www\.animestealth\.com\/chat\/
View
70 app/regexp/title_gsubs.txt
@@ -0,0 +1,70 @@
+\s\|\sWatch\s.+\sOnline
+\s\|\sUrHentai.com\sDaily\sFree\sHentai\sStream
+\s\|\s.+\sStream\sOnline
+\s\|\s.+
+\s\|\sWatch.+
+Daily
+Free
+Hentai
+Stream
+- watch.+
+Watch
+Anime\sThat!
+Stream\sAnime
+Movies
+Anime\sEpisodes
+\|.+Stream Online
+\d:
+:
+fuel\.com
+\.com
+watch
+\sII\s
+online
+crunchyroll
+leet
+-\and
+anime stealth
+by AnimeClipse
+animeclipse
+official
+home
+~.+~
+videos
+zomg
+episodes
+anilikz
+dvd
+download A
+\sEN\s
+\sPL\s
+\sTV\s
+animekuro
+movies
+Free
+animeviewer
+Nothing found for\s.+
+OVA
+\.net
+stream
+\si{1,3}\s
+\sl{1,3}\s
+streaming
+english
+subbed
+dubbed
+download
+anime
+\[.+\]
+\(.+\)
+\(Uncensored\)
+&raquo;
+part
+special
+finale
+final
+doujinshi
+read
+ova
+\s-\sThat!\s.*
+[^0-9A-Za-z\s\-!?`']
View
12 app/regexp/title_name_episode.txt
@@ -0,0 +1,12 @@
+(.+)v(\d{1,5})\s-
+(.+)\s-\sEpisode\s(\d{1,5})\s-\sand
+(.+)\s?-\s?Episode\s?(\d{1,5})
+(.+)\sEpisode\s(\d{1,5})\s-
+(.+)\s-\sEpisode\s(\d{1,5})
+(.+)\sEpisode\s(\d{1,5})
+(.+)\sEp\s(\d{1,5})
+(.+)\sEpisode (\d{1,5})
+(.+)\s-\s(\d{1,5})
+(.+)\s(\d{1,5})
+(.+)\s-\sOdcinek\s(\d{1,5})
+(.+) - Episode (\d{1,5})
View
9 app/regexp/title_season_gsubs.txt
@@ -0,0 +1,9 @@
+Season (\d{1,4})
+s\. (\d{1,4})
+S(\d{1,4})
+Season \((\d{1,4})\)
+episode
+(\d{1,4})th Season
+(\d{1,4})nd season
+(\d{1,4})nd season
+season
View
21 app/stylesheets/frame.less
@@ -0,0 +1,21 @@
+body {
+ background: #000;
+ overflow: hidden;
+}
+
+/*
+ Link
+*/
+
+iframe.link {
+ overflow: auto;
+ position: absolute;
+ display: block;
+ width: 100%;
+ height: 100%;
+ top: 24px;
+ bottom: 0px;
+ left: 0px;
+ right: 0px;
+ border: 0;
+}
View
447 app/stylesheets/main.less
@@ -0,0 +1,447 @@
+/*
+ Dynamic Variables
+*/
+
+@background_color: <%= @wallpaper[:base_color] %>;
+@box_color: <%= @wallpaper[:background_color] %>;
+@link_color: <%= @wallpaper[:link_color] %>;
+@link_active_color: <%= @wallpaper[:link_active_color] %>;
+@link_hover_color: <%= @wallpaper[:link_hover_color] %>;
+
+/*
+ Content
+*/
+
+body {
+ margin: 0;
+ padding: 0;
+ height: auto;
+ font: 12px Arial;
+ color: #fff;
+ background: @background_color url(/images/wallpaper.jpg) no-repeat top center fixed;
+}
+
+p { margin-top: 0; }
+h1, h2, h3, h4 { margin: 0 0 5px 0; color: @link_color + #444; }
+
+a { color: @link_color; cursor: pointer; outline: none !important; text-decoration: none; }
+a:visited { color: @link_active_color; }
+a:hover, a:focus, a:active { color: @link_hover_color; }
+a img { border: 0; }
+
+/* Helpers */
+
+.reset { clear: both; margin: 0; padding: 0; list-style: none; }
+.text_center { text-align: center; }
+.text_right { text-align: right; }
+.clear { clear: both; }
+
+.loader { background: transparent url('/images/ajax.gif') no-repeat center center; height: 20px; display: none; }
+.right { float: right; }
+.left { float: left; }
+
+.rounded_corners (@radius: 5px) {
+ -moz-border-radius: @radius;
+ -webkit-border-radius: @radius;
+ border-radius: @radius;
+}
+
+/* Flash */
+
+.flash_notice {
+ background: #A4E1A2 url('../images/icon-success.png') 20px center no-repeat;
+ color: #094808;
+ text-shadow: #C0FDE3 0px 1px 0px;
+ border: 1px solid #DDE3D7;
+}
+
+.flash_error, .flash_notice {
+ margin: 0 0 10px 0;
+ font-size: 18px;
+ padding: 10px 60px;
+ -webkit-border-radius: 5px;
+ -moz-border-radius: 5px;
+ border-radius: 5px;
+ opacity: 0.9;
+}
+
+.flash_error {
+ background: #AF2B2B url('../images/icon-error.png') 20px center no-repeat;
+ color: #fff;
+ border: 1px solid #DA3536;
+ text-shadow: #000 0px 1px 0px;
+}
+
+/*
+ Wrapper
+*/
+
+.wrapper {
+ margin: 0 auto;
+ width: 800px;
+}
+
+/*
+ Top navigation
+*/
+
+.top {
+ margin: 0;
+ background-color: #151515;
+ height: 24px;
+}
+
+.top > ul { width: .wrapper['width']; margin: 0 auto; }
+.top > ul > li { float: left; border-right: 1px solid #444; overflow: hidden; }
+.top > ul > li:first-child { border-left: 1px solid #444; }
+.top > ul > .right { float: right; }
+.top > ul > li:last-child { float: right; border-left: 1px solid #444; }
+
+.top > ul > li:hover { overflow: visible; }
+.top > ul > li > ul { visibility: hidden; z-index: 10; position: absolute; }
+.top > ul > li:hover > ul { visibility: visible; }
+
+.top > ul > li > ul > li > a { background-color: rgba(21,21,21,0.9); width: 100px; }
+
+.top > ul > li a {
+ color: #888;
+ background-color: #151515;
+ display: block;
+ height: 20px;
+ line-height: 20px;
+ padding: 2px 6px;
+}
+
+.top > ul > li a:hover {
+ color: #C2C2C2;
+ border-bottom: 2px solid @link_color;
+ padding-bottom: 0;
+}
+
+/*
+ Box
+*/
+
+@box_padding: 5px;
+
+.box {
+ background-color: @box_color;
+ .rounded_corners(4px);
+ padding: @box_padding;
+ margin-top: 0;
+ margin-bottom: 15px;
+}
+
+@box_section_border_color: #272727;
+@box_section_padding: 2px;
+@box_section_border_size: 2px;
+
+.box:first-child {
+ margin-top: 50px;
+}
+
+.box > section:first-child {
+ margin-top: 0px;
+}
+
+.box > section {
+ margin-top: 10px;
+ border: @box_section_border_size solid @box_section_border_color;
+ background-color: #444;
+ padding: @box_section_padding;
+ .rounded_corners(3px);
+}
+
+.box > .black {
+ background-color: rgba(0,0,0, 0.7) !important;
+ .rounded_corners(3px);
+ border: 0;
+ padding: @box_section_padding;
+}
+
+.box article {
+ margin: 4px;
+ color: #CCC;
+}
+
+/*
+ Search Box
+*/
+
+@search_box_width: 460px;
+@search_box_full_width: 90px;
+
+.searchbox {
+ width: @search_box_width;
+ margin: 0 auto;
+ margin-top: 180px !important;
+}
+
+.searchbox.full {
+ width: auto;
+ margin-top: 20px !important;
+}
+
+.searchbox input[type="submit"] {
+ background-color: @box_section_border_color;
+ border: 0;
+ color: #fff;
+ font-weight: bold;
+ height: 25px;
+ float: right;
+ margin-top: 1px;
+ margin-right: 1px;
+ width: 70px;
+ .rounded_corners(2px);
+}
+
+.searchbox input[type="submit"]:active {
+ background-color: @box_section_border_color - #111;
+}
+
+.searchbox input[type="text"] {
+ border: 0;
+ padding: 3px;
+ .rounded_corners(2px);
+ width: 368px;
+ margin-left: 2px;
+ font-size: 14px;
+ color: #666;
+}
+
+.searchbox.full input[type="text"] {
+ width: 698px;
+}
+
+/*
+ Popular searches
+*/
+
+.popularSearches {
+ width: .searchbox['width']+80px;
+ margin: 0 auto;
+ margin-top: 40px;
+ text-align: center;
+}
+
+.popularSearches p {
+ margin: 4px 6px;
+}
+
+.popularSearches a { padding: 0 4px; }
+
+/*
+ List
+*/
+
+.list:first-child {
+ margin-top: 0px;
+ padding-top: 0px;
+ border-top: 0;
+}
+
+@list_preview_width: 90px;
+@list_preview_margin: 4px;
+
+.list {
+ border-top: 1px dashed #444;
+ padding-top: 5px;
+ margin-top: 5px;
+ min-height: @list_preview_width;
+}
+
+.list h2 { margin-bottom: 0px; }
+.list .info {
+ margin-bottom: 4px;
+ font-weight: normal;
+ text-align: left;
+ color: #fff;
+ font-size: 11px;
+}
+
+.list > .preview {
+ width: @list_preview_width;
+ height: @list_preview_width;
+ .rounded_corners(4px);
+ background: #000;
+ position: absolute;
+ margin-left: @list_preview_margin;
+}
+
+.list > article {
+ margin-left: @list_preview_width + 5px + 2 * @list_preview_margin;
+}
+
+/*
+ Anime details
+*/
+
+article .details {
+ margin-top: 10px;
+ min-height: 270px;
+}
+
+article header h1 {
+ margin-bottom: 5px;
+ padding-bottom: 5px;
+ border-bottom: 1px dashed #444;
+}
+
+@details_preview_width: 200px;
+
+.details > .preview {
+ overflow: hidden;
+ width: @details_preview_width;
+ height: 260px;
+ position: absolute;
+ margin-left: 0;
+ text-align: center;
+ background: transparent url() no-repeat center center;
+ .rounded_corners(4px);
+ border: 2px solid #000;
+}
+
+.details > .description {
+ margin-left: @details_preview_width + 20px;
+ min-height: 140px;
+}
+
+/*
+ Episodes
+*/
+
+.episodes {
+ list-style: none inside;
+ margin: 5px 10px;
+ padding: 0;
+}
+
+.episodes p {
+ margin-left: 25px;
+ margin-bottom: 3px;
+}
+
+.episodes > li {
+ padding: 4px 6px;
+ margin-bottom: 4px;
+}
+
+.episodes .link { cursor: pointer; }
+
+.episodes .link .aired {
+ float: right;
+ width: 130px;
+ font-size: 11px;
+ margin-left: 5px;
+ text-align: left;
+}
+
+.episodes .link h4 {
+ margin: 0;
+ display: block;
+}
+
+@episode_link_number_width: 80px;
+@episode_link_number_margin_right: 5px;
+
+.episodes .link .number {
+ margin-right: @episode_link_number_margin_right;
+ font-weight: bold;
+ float: left;
+ width: @episode_link_number_width;
+}
+
+.episodes .details {
+ margin-top: 5px;
+ margin-left: @episode_link_number_width + @episode_link_number_margin_right;
+}
+
+.episodes > li.alt {
+ background-color: rgba(255, 255, 255, 0.1);
+}
+
+.episodes ol {
+ margin: 0;
+ list-style: decimal inside;
+ padding-left: 30px;
+}
+
+.episodes ol > li {
+ display: block;
+ padding: 2px 4px;
+}
+
+.episodes ol > li.alt {
+ background-color: rgba(255, 255, 255, 0.05);
+}
+
+
+/*
+ Letters
+*/
+
+.letters {
+ list-style: none inside;
+ margin-bottom: 10px;
+ padding: 0;
+ text-align: center;
+}
+
+.letters > li {
+ display: inline;
+ margin-left: 3px;
+ margin-bottom: 2px;
+}
+
+.letters > li > a {
+ background: rgba(0,0,0, 0.8);
+ color: #fff;
+ font-weight: bold;
+ padding: 4px 6px;
+ .rounded_corners(2px);
+}
+
+.letters > li > a:hover, .letters > li > .selected {
+ background: rgba(255, 255, 255, 0.3);
+ color: #000;
+}
+
+/*
+ Pagination
+*/
+
+.pagination {
+ text-align: center;
+ margin: 5px 10px;
+}
+
+.pagination .previous_page, .pagination .next_page {
+ font-weight: bold;