Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Initial commit

  • Loading branch information...
commit 3716a9c369c56b3a976738c9edaecb3fb5c4891d 0 parents
@mattprice mattprice authored
Showing with 14,753 additions and 0 deletions.
  1. BIN  Bookmark.png
  2. +340 −0 COPYING
  3. BIN  Clock.png
  4. +108 −0 Controller.h
  5. +671 −0 Controller.m
  6. +24 −0 Credits.rtf
  7. +96 −0 DownloadShowList.rb
  8. BIN  English.lproj/InfoPlist.strings
  9. +55 −0 English.lproj/MainMenu.nib/classes.nib
  10. +88 −0 English.lproj/MainMenu.nib/info.nib
  11. BIN  English.lproj/MainMenu.nib/keyedobjects.nib
  12. +41 −0 GetLatestSeasonEpisodeForShow.rb
  13. +135 −0 GetShowDetails.rb
  14. BIN  Green.tif
  15. +49 −0 Helper.h
  16. +286 −0 Helper.m
  17. +61 −0 Info.plist
  18. +51 −0 NEWS
  19. BIN  Play.tif
  20. BIN  Preferences.png
  21. BIN  Red.tif
  22. BIN  Reload.png
  23. +1 −0  Sparkle.framework/Headers
  24. +1 −0  Sparkle.framework/Resources
  25. +1 −0  Sparkle.framework/Sparkle
  26. +33 −0 Sparkle.framework/Versions/A/Headers/SUAppcast.h
  27. +47 −0 Sparkle.framework/Versions/A/Headers/SUAppcastItem.h
  28. +118 −0 Sparkle.framework/Versions/A/Headers/SUUpdater.h
  29. +27 −0 Sparkle.framework/Versions/A/Headers/SUVersionComparisonProtocol.h
  30. +21 −0 Sparkle.framework/Versions/A/Headers/Sparkle.h
  31. +24 −0 Sparkle.framework/Versions/A/Resources/Info.plist
  32. +7 −0 Sparkle.framework/Versions/A/Resources/License.txt
  33. +174 −0 Sparkle.framework/Versions/A/Resources/SUModelTranslation.plist
  34. +56 −0 Sparkle.framework/Versions/A/Resources/SUStatus.nib/classes.nib
  35. +20 −0 Sparkle.framework/Versions/A/Resources/SUStatus.nib/info.nib
  36. BIN  Sparkle.framework/Versions/A/Resources/SUStatus.nib/keyedobjects.nib
  37. +50 −0 Sparkle.framework/Versions/A/Resources/de.lproj/SUAutomaticUpdateAlert.nib/classes.nib
  38. +20 −0 Sparkle.framework/Versions/A/Resources/de.lproj/SUAutomaticUpdateAlert.nib/info.nib
  39. BIN  Sparkle.framework/Versions/A/Resources/de.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib
  40. +67 −0 Sparkle.framework/Versions/A/Resources/de.lproj/SUUpdateAlert.nib/classes.nib
  41. +20 −0 Sparkle.framework/Versions/A/Resources/de.lproj/SUUpdateAlert.nib/info.nib
  42. BIN  Sparkle.framework/Versions/A/Resources/de.lproj/SUUpdateAlert.nib/keyedobjects.nib
  43. +59 −0 Sparkle.framework/Versions/A/Resources/de.lproj/SUUpdatePermissionPrompt.nib/classes.nib
  44. +20 −0 Sparkle.framework/Versions/A/Resources/de.lproj/SUUpdatePermissionPrompt.nib/info.nib
  45. BIN  Sparkle.framework/Versions/A/Resources/de.lproj/SUUpdatePermissionPrompt.nib/keyedobjects.nib
  46. BIN  Sparkle.framework/Versions/A/Resources/de.lproj/Sparkle.strings
  47. +50 −0 Sparkle.framework/Versions/A/Resources/en.lproj/SUAutomaticUpdateAlert.nib/classes.nib
  48. +20 −0 Sparkle.framework/Versions/A/Resources/en.lproj/SUAutomaticUpdateAlert.nib/info.nib
  49. BIN  Sparkle.framework/Versions/A/Resources/en.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib
  50. +67 −0 Sparkle.framework/Versions/A/Resources/en.lproj/SUUpdateAlert.nib/classes.nib
  51. +20 −0 Sparkle.framework/Versions/A/Resources/en.lproj/SUUpdateAlert.nib/info.nib
  52. BIN  Sparkle.framework/Versions/A/Resources/en.lproj/SUUpdateAlert.nib/keyedobjects.nib
  53. +59 −0 Sparkle.framework/Versions/A/Resources/en.lproj/SUUpdatePermissionPrompt.nib/classes.nib
  54. +21 −0 Sparkle.framework/Versions/A/Resources/en.lproj/SUUpdatePermissionPrompt.nib/info.nib
  55. BIN  Sparkle.framework/Versions/A/Resources/en.lproj/SUUpdatePermissionPrompt.nib/keyedobjects.nib
  56. BIN  Sparkle.framework/Versions/A/Resources/en.lproj/Sparkle.strings
  57. +50 −0 Sparkle.framework/Versions/A/Resources/es.lproj/SUAutomaticUpdateAlert.nib/classes.nib
  58. +20 −0 Sparkle.framework/Versions/A/Resources/es.lproj/SUAutomaticUpdateAlert.nib/info.nib
  59. BIN  Sparkle.framework/Versions/A/Resources/es.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib
  60. +67 −0 Sparkle.framework/Versions/A/Resources/es.lproj/SUUpdateAlert.nib/classes.nib
  61. +20 −0 Sparkle.framework/Versions/A/Resources/es.lproj/SUUpdateAlert.nib/info.nib
  62. BIN  Sparkle.framework/Versions/A/Resources/es.lproj/SUUpdateAlert.nib/keyedobjects.nib
  63. +59 −0 Sparkle.framework/Versions/A/Resources/es.lproj/SUUpdatePermissionPrompt.nib/classes.nib
  64. +20 −0 Sparkle.framework/Versions/A/Resources/es.lproj/SUUpdatePermissionPrompt.nib/info.nib
  65. BIN  Sparkle.framework/Versions/A/Resources/es.lproj/SUUpdatePermissionPrompt.nib/keyedobjects.nib
  66. BIN  Sparkle.framework/Versions/A/Resources/es.lproj/Sparkle.strings
  67. +50 −0 Sparkle.framework/Versions/A/Resources/fr.lproj/SUAutomaticUpdateAlert.nib/classes.nib
  68. +16 −0 Sparkle.framework/Versions/A/Resources/fr.lproj/SUAutomaticUpdateAlert.nib/info.nib
  69. BIN  Sparkle.framework/Versions/A/Resources/fr.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib
  70. +67 −0 Sparkle.framework/Versions/A/Resources/fr.lproj/SUUpdateAlert.nib/classes.nib
  71. +16 −0 Sparkle.framework/Versions/A/Resources/fr.lproj/SUUpdateAlert.nib/info.nib
  72. BIN  Sparkle.framework/Versions/A/Resources/fr.lproj/SUUpdateAlert.nib/keyedobjects.nib
  73. +59 −0 Sparkle.framework/Versions/A/Resources/fr.lproj/SUUpdatePermissionPrompt.nib/classes.nib
  74. +16 −0 Sparkle.framework/Versions/A/Resources/fr.lproj/SUUpdatePermissionPrompt.nib/info.nib
  75. BIN  Sparkle.framework/Versions/A/Resources/fr.lproj/SUUpdatePermissionPrompt.nib/keyedobjects.nib
  76. BIN  Sparkle.framework/Versions/A/Resources/fr.lproj/Sparkle.strings
  77. +1 −0  Sparkle.framework/Versions/A/Resources/fr.lproj/fr.lproj
  78. +1 −0  Sparkle.framework/Versions/A/Resources/fr_CA.lproj
  79. +50 −0 Sparkle.framework/Versions/A/Resources/it.lproj/SUAutomaticUpdateAlert.nib/classes.nib
  80. +20 −0 Sparkle.framework/Versions/A/Resources/it.lproj/SUAutomaticUpdateAlert.nib/info.nib
  81. BIN  Sparkle.framework/Versions/A/Resources/it.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib
  82. +67 −0 Sparkle.framework/Versions/A/Resources/it.lproj/SUUpdateAlert.nib/classes.nib
  83. +20 −0 Sparkle.framework/Versions/A/Resources/it.lproj/SUUpdateAlert.nib/info.nib
  84. BIN  Sparkle.framework/Versions/A/Resources/it.lproj/SUUpdateAlert.nib/keyedobjects.nib
  85. +59 −0 Sparkle.framework/Versions/A/Resources/it.lproj/SUUpdatePermissionPrompt.nib/classes.nib
  86. +20 −0 Sparkle.framework/Versions/A/Resources/it.lproj/SUUpdatePermissionPrompt.nib/info.nib
  87. BIN  Sparkle.framework/Versions/A/Resources/it.lproj/SUUpdatePermissionPrompt.nib/keyedobjects.nib
  88. BIN  Sparkle.framework/Versions/A/Resources/it.lproj/Sparkle.strings
  89. +50 −0 Sparkle.framework/Versions/A/Resources/nl.lproj/SUAutomaticUpdateAlert.nib/classes.nib
  90. +18 −0 Sparkle.framework/Versions/A/Resources/nl.lproj/SUAutomaticUpdateAlert.nib/info.nib
  91. BIN  Sparkle.framework/Versions/A/Resources/nl.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib
  92. +67 −0 Sparkle.framework/Versions/A/Resources/nl.lproj/SUUpdateAlert.nib/classes.nib
  93. +16 −0 Sparkle.framework/Versions/A/Resources/nl.lproj/SUUpdateAlert.nib/info.nib
  94. BIN  Sparkle.framework/Versions/A/Resources/nl.lproj/SUUpdateAlert.nib/keyedobjects.nib
  95. +59 −0 Sparkle.framework/Versions/A/Resources/nl.lproj/SUUpdatePermissionPrompt.nib/classes.nib
  96. +16 −0 Sparkle.framework/Versions/A/Resources/nl.lproj/SUUpdatePermissionPrompt.nib/info.nib
  97. BIN  Sparkle.framework/Versions/A/Resources/nl.lproj/SUUpdatePermissionPrompt.nib/keyedobjects.nib
  98. BIN  Sparkle.framework/Versions/A/Resources/nl.lproj/Sparkle.strings
  99. BIN  Sparkle.framework/Versions/A/Resources/relaunch
  100. +50 −0 Sparkle.framework/Versions/A/Resources/ru.lproj/SUAutomaticUpdateAlert.nib/classes.nib
  101. +20 −0 Sparkle.framework/Versions/A/Resources/ru.lproj/SUAutomaticUpdateAlert.nib/info.nib
  102. BIN  Sparkle.framework/Versions/A/Resources/ru.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib
  103. +67 −0 Sparkle.framework/Versions/A/Resources/ru.lproj/SUUpdateAlert.nib/classes.nib
  104. +20 −0 Sparkle.framework/Versions/A/Resources/ru.lproj/SUUpdateAlert.nib/info.nib
  105. BIN  Sparkle.framework/Versions/A/Resources/ru.lproj/SUUpdateAlert.nib/keyedobjects.nib
  106. +59 −0 Sparkle.framework/Versions/A/Resources/ru.lproj/SUUpdatePermissionPrompt.nib/classes.nib
  107. +18 −0 Sparkle.framework/Versions/A/Resources/ru.lproj/SUUpdatePermissionPrompt.nib/info.nib
  108. BIN  Sparkle.framework/Versions/A/Resources/ru.lproj/SUUpdatePermissionPrompt.nib/keyedobjects.nib
  109. BIN  Sparkle.framework/Versions/A/Resources/ru.lproj/Sparkle.strings
  110. +50 −0 Sparkle.framework/Versions/A/Resources/sv.lproj/SUAutomaticUpdateAlert.nib/classes.nib
  111. +20 −0 Sparkle.framework/Versions/A/Resources/sv.lproj/SUAutomaticUpdateAlert.nib/info.nib
  112. BIN  Sparkle.framework/Versions/A/Resources/sv.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib
  113. +39 −0 Sparkle.framework/Versions/A/Resources/sv.lproj/SUUpdateAlert.nib/classes.nib
  114. +18 −0 Sparkle.framework/Versions/A/Resources/sv.lproj/SUUpdateAlert.nib/info.nib
  115. BIN  Sparkle.framework/Versions/A/Resources/sv.lproj/SUUpdateAlert.nib/keyedobjects.nib
  116. +59 −0 Sparkle.framework/Versions/A/Resources/sv.lproj/SUUpdatePermissionPrompt.nib/classes.nib
  117. +20 −0 Sparkle.framework/Versions/A/Resources/sv.lproj/SUUpdatePermissionPrompt.nib/info.nib
  118. BIN  Sparkle.framework/Versions/A/Resources/sv.lproj/SUUpdatePermissionPrompt.nib/keyedobjects.nib
  119. BIN  Sparkle.framework/Versions/A/Resources/sv.lproj/Sparkle.strings
  120. BIN  Sparkle.framework/Versions/A/Sparkle
  121. +1 −0  Sparkle.framework/Versions/Current
  122. BIN  Start.tiff
  123. BIN  Stop.png
  124. BIN  Stop.tiff
  125. +29 −0 TODO
  126. BIN  TVShows.icns
  127. +1,324 −0 TVShows.xcodeproj/administrateur.mode1
  128. +82 −0 TVShows.xcodeproj/administrateur.pbxuser
  129. +1,865 −0 TVShows.xcodeproj/martin.pbxuser
  130. +1,645 −0 TVShows.xcodeproj/martin.perspective
  131. +411 −0 TVShows.xcodeproj/project.pbxproj
  132. +441 −0 TVShowsScript/TVShows.rb
  133. +38 −0 TVShowsScript/TVShowsConstants.rb
  134. +22 −0 TVShowsScript/lib/plist.rb
  135. +224 −0 TVShowsScript/lib/plist/generator.rb
  136. +225 −0 TVShowsScript/lib/plist/parser.rb
  137. +149 −0 TVShowsScript/lib/simple-rss.rb
  138. +16 −0 TVTableView.h
  139. +52 −0 TVTableView.m
  140. +18 −0 UserDefaults.plist
  141. +56 −0 ValueTransformers.h
  142. +144 −0 ValueTransformers.m
  143. BIN  Web.png
  144. +1 −0  build/Debug/TVShows.app/Contents/Frameworks/Sparkle.framework/Headers
  145. +1 −0  build/Debug/TVShows.app/Contents/Frameworks/Sparkle.framework/Resources
  146. +1 −0  build/Debug/TVShows.app/Contents/Frameworks/Sparkle.framework/Sparkle
  147. +13 −0 build/Debug/TVShows.app/Contents/Frameworks/Sparkle.framework/Versions/A/Headers/NSApplication+AppCopies.h
  148. +11 −0 ...d/Debug/TVShows.app/Contents/Frameworks/Sparkle.framework/Versions/A/Headers/NSFileManager+Authentication.h
  149. +15 −0 build/Debug/TVShows.app/Contents/Frameworks/Sparkle.framework/Versions/A/Headers/NSFileManager+Verification.h
  150. +61 −0 build/Debug/TVShows.app/Contents/Frameworks/Sparkle.framework/Versions/A/Headers/NSString+extras.h
  151. +98 −0 build/Debug/TVShows.app/Contents/Frameworks/Sparkle.framework/Versions/A/Headers/RSS.h
  152. +27 −0 build/Debug/TVShows.app/Contents/Frameworks/Sparkle.framework/Versions/A/Headers/SUAppcast.h
  153. +57 −0 build/Debug/TVShows.app/Contents/Frameworks/Sparkle.framework/Versions/A/Headers/SUAppcastItem.h
  154. +21 −0 build/Debug/TVShows.app/Contents/Frameworks/Sparkle.framework/Versions/A/Headers/SUAutomaticUpdateAlert.h
  155. +20 −0 build/Debug/TVShows.app/Contents/Frameworks/Sparkle.framework/Versions/A/Headers/SUConstants.h
  156. +26 −0 build/Debug/TVShows.app/Contents/Frameworks/Sparkle.framework/Versions/A/Headers/SUStatusChecker.h
  157. +33 −0 build/Debug/TVShows.app/Contents/Frameworks/Sparkle.framework/Versions/A/Headers/SUStatusController.h
  158. +25 −0 build/Debug/TVShows.app/Contents/Frameworks/Sparkle.framework/Versions/A/Headers/SUUnarchiver.h
  159. +40 −0 build/Debug/TVShows.app/Contents/Frameworks/Sparkle.framework/Versions/A/Headers/SUUpdateAlert.h
  160. +55 −0 build/Debug/TVShows.app/Contents/Frameworks/Sparkle.framework/Versions/A/Headers/SUUpdater.h
  161. +20 −0 build/Debug/TVShows.app/Contents/Frameworks/Sparkle.framework/Versions/A/Headers/SUUtilities.h
  162. +22 −0 build/Debug/TVShows.app/Contents/Frameworks/Sparkle.framework/Versions/A/Headers/Sparkle.h
  163. +22 −0 build/Debug/TVShows.app/Contents/Frameworks/Sparkle.framework/Versions/A/Resources/Info.plist
  164. +12 −0 build/Debug/TVShows.app/Contents/Frameworks/Sparkle.framework/Versions/A/Resources/SUStatus.nib/classes.nib
  165. +16 −0 build/Debug/TVShows.app/Contents/Frameworks/Sparkle.framework/Versions/A/Resources/SUStatus.nib/info.nib
  166. BIN  .../Debug/TVShows.app/Contents/Frameworks/Sparkle.framework/Versions/A/Resources/SUStatus.nib/keyedobjects.nib
  167. +12 −0 .../Contents/Frameworks/Sparkle.framework/Versions/A/Resources/en.lproj/SUAutomaticUpdateAlert.nib/classes.nib
  168. +16 −0 ...app/Contents/Frameworks/Sparkle.framework/Versions/A/Resources/en.lproj/SUAutomaticUpdateAlert.nib/info.nib
  169. BIN  ...ents/Frameworks/Sparkle.framework/Versions/A/Resources/en.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib
  170. +21 −0 ...Shows.app/Contents/Frameworks/Sparkle.framework/Versions/A/Resources/en.lproj/SUUpdateAlert.nib/classes.nib
  171. +16 −0 .../TVShows.app/Contents/Frameworks/Sparkle.framework/Versions/A/Resources/en.lproj/SUUpdateAlert.nib/info.nib
  172. BIN  ....app/Contents/Frameworks/Sparkle.framework/Versions/A/Resources/en.lproj/SUUpdateAlert.nib/keyedobjects.nib
  173. BIN  build/Debug/TVShows.app/Contents/Frameworks/Sparkle.framework/Versions/A/Resources/en.lproj/Sparkle.strings
  174. BIN  build/Debug/TVShows.app/Contents/Frameworks/Sparkle.framework/Versions/A/Sparkle
  175. +1 −0  build/Debug/TVShows.app/Contents/Frameworks/Sparkle.framework/Versions/Current
  176. +59 −0 build/Debug/TVShows.app/Contents/Info.plist
  177. BIN  build/Debug/TVShows.app/Contents/MacOS/TVShows
  178. +1 −0  build/Debug/TVShows.app/Contents/PkgInfo
  179. BIN  build/Debug/TVShows.app/Contents/Resources/Bookmark.png
  180. BIN  build/Debug/TVShows.app/Contents/Resources/Clock.png
  181. +24 −0 build/Debug/TVShows.app/Contents/Resources/Credits.rtf
  182. +96 −0 build/Debug/TVShows.app/Contents/Resources/DownloadShowList.rb
  183. BIN  build/Debug/TVShows.app/Contents/Resources/English.lproj/InfoPlist.strings
  184. +55 −0 build/Debug/TVShows.app/Contents/Resources/English.lproj/MainMenu.nib/classes.nib
  185. +88 −0 build/Debug/TVShows.app/Contents/Resources/English.lproj/MainMenu.nib/info.nib
  186. BIN  build/Debug/TVShows.app/Contents/Resources/English.lproj/MainMenu.nib/keyedobjects.nib
  187. +41 −0 build/Debug/TVShows.app/Contents/Resources/GetLatestSeasonEpisodeForShow.rb
  188. +135 −0 build/Debug/TVShows.app/Contents/Resources/GetShowDetails.rb
  189. BIN  build/Debug/TVShows.app/Contents/Resources/Green.tif
  190. BIN  build/Debug/TVShows.app/Contents/Resources/Play.tif
  191. BIN  build/Debug/TVShows.app/Contents/Resources/Preferences.png
  192. BIN  build/Debug/TVShows.app/Contents/Resources/Red.tif
  193. BIN  build/Debug/TVShows.app/Contents/Resources/Reload.png
  194. BIN  build/Debug/TVShows.app/Contents/Resources/Stop.png
  195. BIN  build/Debug/TVShows.app/Contents/Resources/TVShows.icns
  196. +441 −0 build/Debug/TVShows.app/Contents/Resources/TVShowsScript/TVShows.rb
  197. +38 −0 build/Debug/TVShows.app/Contents/Resources/TVShowsScript/TVShowsConstants.rb
  198. +22 −0 build/Debug/TVShows.app/Contents/Resources/TVShowsScript/lib/plist.rb
  199. +224 −0 build/Debug/TVShows.app/Contents/Resources/TVShowsScript/lib/plist/generator.rb
  200. +225 −0 build/Debug/TVShows.app/Contents/Resources/TVShowsScript/lib/plist/parser.rb
  201. +149 −0 build/Debug/TVShows.app/Contents/Resources/TVShowsScript/lib/simple-rss.rb
  202. +18 −0 build/Debug/TVShows.app/Contents/Resources/UserDefaults.plist
  203. BIN  build/Debug/TVShows.app/Contents/Resources/Web.png
  204. BIN  build/TVShows.build/Debug/TVShows.build/Objects-normal/i386/Controller.o
  205. BIN  build/TVShows.build/Debug/TVShows.build/Objects-normal/i386/Helper.o
  206. +5 −0 build/TVShows.build/Debug/TVShows.build/Objects-normal/i386/TVShows.LinkFileList
  207. BIN  build/TVShows.build/Debug/TVShows.build/Objects-normal/i386/TVTableView.o
  208. BIN  build/TVShows.build/Debug/TVShows.build/Objects-normal/i386/ValueTransformers.o
  209. BIN  build/TVShows.build/Debug/TVShows.build/Objects-normal/i386/main.o
  210. +30 −0 build/TVShows.build/Debug/TVShows.build/Script-5B240B3E0BC40F140081A28E.sh
  211. +28 −0 build/TVShows.build/Debug/TVShows.build/TVShows.dep
  212. BIN  build/TVShows.build/Debug/TVShows.build/TVShows.hmap
  213. +28 −0 build/TVShows.build/Debug/TVShows.build/TVShows~.dep
  214. +624 −0 build/TVShows.build/Debug/TVShows.build/build-state.dat
  215. +624 −0 build/TVShows.build/Debug/TVShows.build/build-state~.dat
  216. BIN  build/TVShows.build/TVShows.pbxindex/categories.pbxbtree
  217. BIN  build/TVShows.build/TVShows.pbxindex/cdecls.pbxbtree
  218. BIN  build/TVShows.build/TVShows.pbxindex/decls.pbxbtree
  219. BIN  build/TVShows.build/TVShows.pbxindex/files.pbxbtree
  220. BIN  build/TVShows.build/TVShows.pbxindex/imports.pbxbtree
  221. BIN  build/TVShows.build/TVShows.pbxindex/pbxindex.header
  222. BIN  build/TVShows.build/TVShows.pbxindex/protocols.pbxbtree
  223. BIN  build/TVShows.build/TVShows.pbxindex/refs.pbxbtree
  224. BIN  build/TVShows.build/TVShows.pbxindex/strings.pbxstrings/control
  225. BIN  build/TVShows.build/TVShows.pbxindex/strings.pbxstrings/strings
  226. BIN  build/TVShows.build/TVShows.pbxindex/subclasses.pbxbtree
  227. BIN  build/TVShows.build/TVShows.pbxindex/symbols0.pbxsymbols
  228. +12 −0 main.m
  229. +9 −0 tvshows_Prefix.pch
  230. BIN  yellow.tiff
BIN  Bookmark.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
340 COPYING
@@ -0,0 +1,340 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) 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
+this service 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 make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. 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.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute 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 and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+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
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the 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 a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, 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.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE 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.
+
+ 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
+convey 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) <year> <name of author>
+
+ 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 2 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, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision 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, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This 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 Library General
+Public License instead of this License.
BIN  Clock.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
108 Controller.h
@@ -0,0 +1,108 @@
+/*
+ This file is part of the TVShows source code.
+ http://tvshows.sourceforge.net
+ It may be used under the terms of the GNU General Public License.
+*/
+
+#import <Cocoa/Cocoa.h>
+#import "Helper.h"
+
+@interface Controller : NSObject {
+
+ // Experimental
+ NSArray *tableItems;
+ IBOutlet NSView *mainView;
+ IBOutlet NSView *preferencesView;
+ IBOutlet NSTableColumn *mainColumn;
+
+ NSArray *qualities;
+ NSDictionary *shows;
+ Helper *h;
+ NSArray *details;
+
+ // Main window
+ IBOutlet NSWindow *mainWindow;
+ NSToolbar *mainToolbar;
+ IBOutlet NSView *searchToolbarItemView;
+ IBOutlet NSSearchField *searchToolbarItemTextField;
+ IBOutlet NSArrayController *showsController;
+ IBOutlet NSUserDefaultsController *defaultsController;
+ IBOutlet NSTableView *showsTable;
+
+ // Preferences window
+ IBOutlet NSWindow *preferencesWindow;
+ IBOutlet NSButton *enableDisableButton;
+ IBOutlet NSTextField *enableDisableLabel;
+
+ // Progress panel
+ IBOutlet NSWindow *progressPanel;
+ IBOutlet NSProgressIndicator *progressPanelIndicator;
+
+ // Details sheet
+ IBOutlet NSWindow *detailsSheet;
+ IBOutlet NSProgressIndicator *detailsProgressIndicator;
+ IBOutlet NSScrollView *detailsTable;
+ IBOutlet NSButton *detailsOKButton;
+ IBOutlet NSArrayController *detailsController;
+ IBOutlet NSTextField *detailsErrorText;
+ int retries;
+
+ // Download show
+ NSPipe *downloadShowListPipe;
+ NSTask *downloadShowListTask;
+ NSTask *getShowDetailsTask;
+ NSPipe *getShowDetailsPipe;
+ int currentShowIndex;
+ NSDictionary *currentShow;
+
+}
+
+// Toolbar
+- (NSToolbarItem *)toolbar: (NSToolbar *)toolbar itemForItemIdentifier:(NSString *)itemIdentifier willBeInsertedIntoToolbar:(BOOL)flag;
+- (NSArray *)toolbarDefaultItemIdentifiers:(NSToolbar*)toolbar;
+- (NSArray *)toolbarAllowedItemIdentifiers:(NSToolbar *)toolbar;
+
+// Download Show List
+- (IBAction)downloadShowList;
+- (void)downloadShowListDidFinish: (NSNotification *)notification;
+
+// Setters/getters
+- (NSArray *)qualities;
+- (void)setQualities: (NSArray *)someQualities;
+- (NSDictionary *)shows;
+- (void)setShows: (NSDictionary *)someShows;
+- (NSArray *)details;
+- (void)setDetails: (NSArray *)someDetails;
+
+// Preferences
+- (IBAction)openPreferences: (id)sender;
+- (IBAction)closePreferences: (id)sender;
+- (IBAction)enableDisable: (id)sender;
+- (IBAction)changeSaveFolder: (id)sender;
+
+// Show list
+- (IBAction)subscribe: (id)sender;
+- (IBAction)cancelSubscription: (id)sender;
+- (IBAction)okSubscription: (id)sender;
+- (IBAction)okSubscriptionToNextAiredEpisode: (id)sender;
+- (void)getShowDetailsDidFinish: (NSNotification *)notification;
+- (void) tableView:(NSTableView*)tableView willDisplayCell:(id)cell forTableColumn:(NSTableColumn*)tableColumn row:(int)row;
+- (IBAction)filterShows: (id)sender;
+
+// Launchd
+- (void)saveLaunchdPlist;
+- (void)unloadFromLaunchd;
+- (void)loadIntoLaunchd;
+
+// Menu handlers
+- (IBAction)find: (id)sender;
+- (IBAction)help: (id)sender;
+- (IBAction)sendFeedback: (id)sender;
+
+// Misc
+- (void)applicationWillTerminate: (NSNotification *)aNotification;
+- (IBAction)test: (id)sender;
+- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)theApplication;
+- (void)checkForBittorrentClient;
+- (void)checkForBittorrentClientAlertDidEnd:(NSAlert *)alert returnCode:(int)returnCode contextInfo:(void *)contextInfo;
+@end
671 Controller.m
@@ -0,0 +1,671 @@
+/*
+ This file is part of the TVShows source code.
+ http://tvshows.sourceforge.net
+ It may be used under the terms of the GNU General Public License.
+*/
+
+#import "Controller.h"
+#import "ValueTransformers.h"
+
+// Toolbar
+#define ToolbarFilter @"Filter"
+#define ToolbarPreferences @"Preferences"
+#define ToolbarUpdateShowList @"UpdateShowList"
+
+// Shows properties
+#define ShowsVersion @"Version"
+#define ShowsLatestVersion @"1"
+#define ShowsShows @"Shows"
+
+// Show properties
+#define ShowHumanName @"HumanName"
+#define ShowExactName @"ExactName"
+#define ShowEpisode @"Episode"
+#define ShowSeason @"Season"
+#define ShowSubscribed @"Subscribed"
+#define ShowDate @"Date"
+#define ShowTitle @"Title"
+#define ShowType @"Type"
+#define ShowTime @"Time"
+
+// Types of shows
+#define TypeSeasonEpisode @"SeasonEpisodeType"
+#define TypeDate @"DateType"
+#define TypeTime @"TimeType"
+
+// Details keys
+#define DetailsEpisodes @"Episodes"
+
+// Preferences keys
+#define TVShowsIsEnabled @"IsEnabled"
+#define TVShowsAutomaticallyOpen @"AutomaticallyOpen"
+#define TVShowsCheckDelay @"CheckDelay"
+#define TVShowsQuality @"Quality"
+#define TVShowsTorrentFolder @"TorrentFolder"
+#define TVShowsScriptInstalledVersion @"ScriptVersion"
+
+// Ruby scripts
+#define RubyDownloadShowList @"DownloadShowList"
+#define RubyGetShowDetails @"GetShowDetails"
+
+// Misc
+#define TVShowsURL @"http://tvshows.sourceforge.net"
+#define TVShowsFeedbackURL @"http://sourceforge.net/tracker/?group_id=190705"
+#define TransmissionURL @"http://transmission.m0k.org"
+
+@implementation Controller
+
+#pragma mark -
+#pragma mark Init / AwakeFromNib
+
+- (id)init
+{
+ self = [super init];
+ if (self != nil) {
+
+ // Experimental
+ /*
+ tableItems = [NSArray arrayWithObjects:
+ [NSDictionary dictionaryWithObjectsAndKeys:@"GENERAL",@"Label",[NSNumber numberWithBool:YES],@"IsHeading",nil],
+ [NSDictionary dictionaryWithObjectsAndKeys:@"Preferences",@"Label",[NSNumber numberWithBool:NO],@"IsHeading",nil],
+ [NSDictionary dictionaryWithObjectsAndKeys:@"AVAILABLE SHOWS",@"Label",[NSNumber numberWithBool:YES],@"IsHeading",nil],
+ [NSDictionary dictionaryWithObjectsAndKeys:@"The Shield",@"Label",[NSNumber numberWithBool:NO],@"IsHeading",nil],
+ nil];
+ */
+
+ h = [[Helper alloc] init];
+ [self unloadFromLaunchd];
+
+ [NSApp setDelegate:self];
+ [self setDetails:[NSArray array]];
+
+ [NSDateFormatter setDefaultFormatterBehavior:NSDateFormatterBehavior10_4];
+
+ retries = 0;
+ qualities = [NSArray arrayWithObjects:
+ [NSDictionary dictionaryWithObjectsAndKeys:@"Normal",@"quality",@"350Mb per episode",@"label",nil],
+ [NSDictionary dictionaryWithObjectsAndKeys:@"High",@"quality",@"700Mb per episode",@"label",nil],
+ [NSDictionary dictionaryWithObjectsAndKeys:@"Very High (720p)",@"quality",@"1.2Gb per episode",@"label",nil],
+ nil];
+
+ // Merge the defaults defaults with the defaults
+ NSDictionary *userDefaultsDefaults = [NSDictionary dictionaryWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"UserDefaults" ofType:@"plist"]];
+ NSEnumerator *enumerator = [userDefaultsDefaults keyEnumerator];
+ NSString *key;
+ while ( key = [enumerator nextObject] ) {
+ if ( ![[NSUserDefaults standardUserDefaults] objectForKey:key] ) {
+ [[NSUserDefaults standardUserDefaults] setObject:[userDefaultsDefaults objectForKey:key] forKey:key];
+ }
+ }
+ [[NSUserDefaults standardUserDefaults] synchronize];
+
+ if ( [[NSFileManager defaultManager] fileExistsAtPath:[h showsPath]] ) {
+ [self setShows:[NSDictionary dictionaryWithContentsOfFile:[h showsPath]]];
+ } else {
+ [self setShows:nil];
+ }
+
+ NonZeroValueTransformer *tr1 = [[[NonZeroValueTransformer alloc] init] autorelease];
+ [NSValueTransformer setValueTransformer:tr1
+ forName:@"NonZeroValueTransformer"];
+
+ DownloadBooleanToTitleTransformer *tr2 = [[[DownloadBooleanToTitleTransformer alloc] init] autorelease];
+ [NSValueTransformer setValueTransformer:tr2
+ forName:@"DownloadBooleanToTitleTransformer"];
+
+ EnabledToImagePathTransformer *tr3 = [[[EnabledToImagePathTransformer alloc] init] autorelease];
+ [NSValueTransformer setValueTransformer:tr3
+ forName:@"EnabledToImagePathTransformer"];
+
+ EnabledToStringTransformer *tr4 = [[[EnabledToStringTransformer alloc] init] autorelease];
+ [NSValueTransformer setValueTransformer:tr4
+ forName:@"EnabledToStringTransformer"];
+
+ PathToNameTransformer *tr5 = [[[PathToNameTransformer alloc] init] autorelease];
+ [NSValueTransformer setValueTransformer:tr5
+ forName:@"PathToNameTransformer"];
+
+ IndexesToIndexTransformer *tr6 = [[[IndexesToIndexTransformer alloc] init] autorelease];
+ [NSValueTransformer setValueTransformer:tr6
+ forName:@"IndexesToIndexTransformer"];
+
+ DetailToStringTransformer *tr7 = [[[DetailToStringTransformer alloc] init] autorelease];
+ [NSValueTransformer setValueTransformer:tr7
+ forName:@"DetailToStringTransformer"];
+
+ DateToShortDateTransformer *tr8 = [[[DateToShortDateTransformer alloc] init] autorelease];
+ [NSValueTransformer setValueTransformer:tr8
+ forName:@"DateToShortDateTransformer"];
+
+
+
+ }
+ return self;
+}
+
+- (void)awakeFromNib
+{
+
+ // Experimental
+ /*
+ [mainColumn setDataCell:[[TVTextFieldCell alloc] init]];
+ */
+
+ [mainView addSubview:preferencesView];
+ [mainView setNeedsDisplay:YES];
+ [preferencesView setNeedsDisplay:YES];
+
+
+ [showsTable setIntercellSpacing:NSMakeSize(3.0,10.0)];
+
+ [defaultsController setAppliesImmediately:YES];
+
+ // Register to some notifications
+ // Dowload shows
+ [[NSNotificationCenter defaultCenter] addObserver:self
+ selector:@selector(mainWindowDidBecomeMain:)
+ name:NSWindowDidBecomeMainNotification
+ object:nil];
+
+ // Toolbar
+ mainToolbar = [[NSToolbar alloc] initWithIdentifier:@"mainToolbar"];
+ [mainToolbar setDelegate:self];
+ [mainToolbar setAllowsUserCustomization:YES];
+ [mainWindow setToolbar:mainToolbar];
+
+ [showsController setSortDescriptors:[NSArray arrayWithObject:[[[NSSortDescriptor alloc] initWithKey:ShowSubscribed ascending:NO] autorelease]]];
+
+}
+
+#pragma mark -
+#pragma mark Toolbar
+
+- (NSToolbarItem *)toolbar: (NSToolbar *)toolbar itemForItemIdentifier:(NSString *)itemIdentifier willBeInsertedIntoToolbar:(BOOL)flag
+{
+ NSToolbarItem *toolbarItem = [[[NSToolbarItem alloc] initWithItemIdentifier:itemIdentifier] autorelease];
+
+ if ( [itemIdentifier isEqualToString:ToolbarFilter] ) {
+ [toolbarItem setLabel:@"Filter"];
+ [toolbarItem setPaletteLabel:@"Filter"];
+ [toolbarItem setToolTip:@"Filter shows name"];
+ [toolbarItem setView:searchToolbarItemView];
+ [toolbarItem setMinSize:NSMakeSize(NSWidth([searchToolbarItemView frame]),NSHeight([searchToolbarItemView frame]))];
+ [toolbarItem setMaxSize:NSMakeSize(150,NSHeight([searchToolbarItemView frame]))];
+ } else if ( [itemIdentifier isEqualToString:ToolbarPreferences] ) {
+ [toolbarItem setLabel:@"Preferences"];
+ [toolbarItem setPaletteLabel:@"Preferences"];
+ [toolbarItem setToolTip:@"Open preferences window"];
+ [toolbarItem setImage:[NSImage imageNamed:@"Preferences.png"]];
+ [toolbarItem setTarget:self];
+ [toolbarItem setAction:@selector(openPreferences:)];
+ } else if ( [itemIdentifier isEqualToString:ToolbarUpdateShowList] ) {
+ [toolbarItem setLabel:@"Update list"];
+ [toolbarItem setPaletteLabel:@"Update list"];
+ [toolbarItem setToolTip:@"Updates the show list"];
+ [toolbarItem setImage:[NSImage imageNamed:@"Reload.png"]];
+ [toolbarItem setTarget:self];
+ [toolbarItem setAction:@selector(downloadShowList)];
+ } else {
+ [toolbarItem release];
+ toolbarItem = nil;
+ }
+ return toolbarItem;
+}
+
+- (NSArray *)toolbarDefaultItemIdentifiers: (NSToolbar*)toolbar
+{
+ return [NSArray arrayWithObjects:ToolbarFilter,NSToolbarFlexibleSpaceItemIdentifier,ToolbarUpdateShowList,ToolbarPreferences,nil];
+}
+
+- (NSArray *)toolbarAllowedItemIdentifiers: (NSToolbar *)toolbar
+{
+ return [NSArray arrayWithObjects:ToolbarFilter,NSToolbarFlexibleSpaceItemIdentifier,ToolbarUpdateShowList,ToolbarPreferences,nil];
+}
+
+#pragma mark -
+#pragma mark Download Show List
+
+- (void)mainWindowDidBecomeMain: (NSNotification *)notification
+{
+ [[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowDidBecomeMainNotification object:nil];
+ [self checkForBittorrentClient];
+ if ( ![shows valueForKey:ShowsShows] || ([shows valueForKey:ShowsShows] && NSOrderedAscending == [[shows valueForKey:ShowsVersion] compare:ShowsLatestVersion options:NSNumericSearch]))
+ [self downloadShowList];
+}
+
+- (IBAction)downloadShowList
+{
+
+ [NSApp beginSheet:progressPanel
+ modalForWindow:mainWindow
+ modalDelegate:self
+ didEndSelector:nil
+ contextInfo:nil];
+ [progressPanelIndicator startAnimation:nil];
+
+ NSTask *aTask = [[NSTask alloc] init];
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(downloadShowListDidFinish:) name:NSTaskDidTerminateNotification object:aTask];
+ [aTask setArguments:[NSArray arrayWithObjects:[h showsPath],ShowsLatestVersion,nil]];
+ [aTask setLaunchPath:[[NSBundle mainBundle] pathForResource:RubyDownloadShowList ofType:@"rb"]];
+ [aTask launch];
+
+}
+
+- (void)downloadShowListDidFinish: (NSNotification *)notification
+{
+ if ( [(NSTask *)[notification object] terminationStatus] != 0 ) {
+ [NSApp endSheet:progressPanel];
+ [progressPanel close];
+ [Helper dieWithErrorMessage:@"Could not download the show list. Are you connected to the internet ?"];
+ } else {
+ [self setShows:[NSDictionary dictionaryWithContentsOfFile:[h showsPath]]];
+ [NSApp endSheet:progressPanel];
+ [progressPanel close];
+ }
+}
+
+
+#pragma mark -
+#pragma mark Setters/Getters
+
+- (NSArray *)qualities
+{
+ return qualities;
+}
+
+- (void)setQualities: (NSArray *)someQualities
+{
+ if ( someQualities != qualities ) {
+ [qualities release];
+ qualities = [someQualities retain];
+ }
+}
+
+- (NSDictionary *)shows
+{
+ return shows;
+}
+
+- (void)setShows: (NSDictionary *)someShows
+{
+ if ( someShows != shows ) {
+ [shows release];
+ shows = [someShows retain];
+ }
+}
+
+- (NSArray *)details;
+{
+ return details;
+}
+
+- (void)setDetails: (NSArray *)someDetails
+{
+ if ( someDetails != details ) {
+ [details release];
+ details = [someDetails retain];
+ }
+}
+
+
+#pragma mark -
+#pragma mark Preferences
+
+- (IBAction)openPreferences: (id)sender
+{
+ [NSApp beginSheet:preferencesWindow
+ modalForWindow:mainWindow
+ modalDelegate:self
+ didEndSelector:nil
+ contextInfo:nil];
+ if ( ( [[[NSUserDefaults standardUserDefaults] valueForKey:TVShowsIsEnabled] boolValue] && [[enableDisableButton title] isEqualToString:@"Enabled"] ) ||
+ ( ![[[NSUserDefaults standardUserDefaults] valueForKey:TVShowsIsEnabled] boolValue] && [[enableDisableButton title] isEqualToString:@"Disable"] ) ) {
+ [self enableDisable:enableDisableButton];
+ }
+ [preferencesWindow makeKeyAndOrderFront:sender];
+}
+
+- (IBAction)closePreferences: (id)sender
+{
+ [[NSUserDefaults standardUserDefaults] synchronize];
+ [NSApp endSheet:preferencesWindow];
+ [preferencesWindow close];
+}
+
+- (IBAction)enableDisable: (id)sender
+{
+ if ( [[sender title] isEqualToString:@"Enable"] ) {
+ [[NSUserDefaults standardUserDefaults] setValue:[NSNumber numberWithBool:YES] forKey:TVShowsIsEnabled];
+ [[NSUserDefaults standardUserDefaults] synchronize];
+ [sender setTitle:@"Disable"];
+ [enableDisableLabel setStringValue:@"TVShows is enabled"];
+ } else if ( [[sender title] isEqualToString:@"Disable"] ) {
+ [[NSUserDefaults standardUserDefaults] setValue:[NSNumber numberWithBool:NO] forKey:TVShowsIsEnabled];
+ [[NSUserDefaults standardUserDefaults] synchronize];
+ [sender setTitle:@"Enable"];
+ [enableDisableLabel setStringValue:@"TVShows is disabled"];
+ }
+}
+
+- (IBAction)changeSaveFolder: (id)sender
+{
+ if ( 0 == [sender indexOfSelectedItem] ) {
+ return;
+ } else if ( 2 == [sender indexOfSelectedItem] ) {
+ int result;
+ NSOpenPanel *oPanel = [NSOpenPanel openPanel];
+ [oPanel setAllowsMultipleSelection:YES];
+ [oPanel setTitle:@"Torrents will be saved in..."];
+ [oPanel setMessage:@"Choose the folder in which torrents will be downloaded."];
+ [oPanel setDelegate:self];
+ [oPanel setCanChooseFiles:NO];
+ [oPanel setCanChooseDirectories:YES];
+ result = [oPanel runModalForDirectory:NSHomeDirectory() file:nil types:nil];
+ [sender selectItemAtIndex:0];
+ if (result == NSOKButton) {
+ [[NSUserDefaults standardUserDefaults] setObject:[oPanel filename] forKey:TVShowsTorrentFolder];
+ }
+ }
+}
+
+#pragma mark -
+#pragma mark Show list
+
+- (IBAction)subscribe: (id)sender
+{
+ if ( retries == 0 ) currentShow = [[showsController arrangedObjects] objectAtIndex:[sender clickedRow]];
+ if ( ![[currentShow valueForKey:ShowSubscribed] boolValue] ) {
+ if ( retries > 0 ) {
+ [detailsErrorText setStringValue:[NSString stringWithFormat:@"Could not reach ezrss.it, retrying (%d)...",retries]];
+ [detailsErrorText setHidden:NO];
+ [detailsErrorText display];
+ sleep(2); // That's bad, I know
+ } else {
+ [self setDetails:[NSArray array]];
+ [detailsErrorText setHidden:YES];
+ [detailsProgressIndicator setHidden:NO];
+ [detailsTable setHidden:YES];
+ [detailsOKButton setEnabled:NO];
+ [NSApp beginSheet:detailsSheet
+ modalForWindow:mainWindow
+ modalDelegate:self
+ didEndSelector:nil
+ contextInfo:nil];
+ [detailsProgressIndicator startAnimation:nil];
+ }
+ getShowDetailsTask = [[NSTask alloc] init];
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(getShowDetailsDidFinish:) name:NSTaskDidTerminateNotification object:getShowDetailsTask];
+ [getShowDetailsTask setArguments:[NSArray arrayWithObject:
+ [[[showsController arrangedObjects] objectAtIndex:[sender clickedRow]] valueForKey:ShowExactName]
+ ]];
+ [getShowDetailsTask setLaunchPath:[[NSBundle mainBundle] pathForResource:RubyGetShowDetails ofType:@"rb"]];
+ getShowDetailsPipe = [NSPipe pipe];
+ [getShowDetailsTask setStandardOutput:getShowDetailsPipe];
+ [getShowDetailsTask launch];
+ } else {
+ [currentShow setValue:[NSNumber numberWithBool:NO] forKeyPath:ShowSubscribed];
+ /*
+ [currentShow setValue:[NSNumber numberWithInt:0] forKeyPath:ShowSeason];
+ [currentShow setValue:[NSNumber numberWithInt:0] forKeyPath:ShowEpisode];
+ [currentShow setValue:[NSNumber numberWithBool:NO] forKeyPath:ShowSubscribed];
+ */
+ [showsController rearrangeObjects];
+ }
+}
+
+- (void)getShowDetailsDidFinish: (NSNotification *)notification
+{
+ // Already retried
+ if ( retries >= 2 ) {
+
+ retries = 0;
+ [detailsProgressIndicator setHidden:YES];
+ [detailsErrorText setStringValue:@"Could not reach ezrss.it, please retry later."];
+ return;
+
+ // Should retry
+ } else if ( 0 != [getShowDetailsTask terminationStatus] ) {
+
+ retries++;
+ [self subscribe:nil];
+
+ // Ok
+ } else {
+
+ retries = 0;
+ NSString *errorString;
+ id someDetails = [NSPropertyListSerialization
+ propertyListFromData:[[getShowDetailsPipe fileHandleForReading] readDataToEndOfFile]
+ mutabilityOption:NSPropertyListImmutable
+ format:NULL
+ errorDescription:&errorString];
+
+ if ( errorString ) {
+ NSLog(@"TVShows: error getting show details (%@).",errorString);
+ [errorString release];
+ return;
+ }
+
+ [self setDetails:(NSArray *)someDetails];
+ [detailsProgressIndicator setHidden:YES];
+ [detailsErrorText setHidden:YES];
+ [detailsTable setHidden:NO];
+ [detailsOKButton setEnabled:YES];
+ [detailsController setSelectedObjects:nil];
+ if ( [[[details lastObject] objectForKey:ShowType] isEqualToString:TypeSeasonEpisode] ) {
+ [detailsController setSortDescriptors:[NSArray arrayWithObjects:
+ [[[NSSortDescriptor alloc] initWithKey:ShowSeason ascending:NO] autorelease],
+ [[[NSSortDescriptor alloc] initWithKey:ShowEpisode ascending:NO] autorelease],
+ nil]];
+ } else if ( [[[details lastObject] objectForKey:ShowType] isEqualToString:TypeDate] ) {
+ [detailsController setSortDescriptors:[NSArray arrayWithObject:
+ [[[NSSortDescriptor alloc] initWithKey:ShowDate ascending:NO] autorelease]]];
+ } else {
+ [detailsController setSortDescriptors:[NSArray arrayWithObject:
+ [[[NSSortDescriptor alloc] initWithKey:ShowTime ascending:NO] autorelease]]];
+ }
+
+ }
+}
+
+- (IBAction)cancelSubscription: (id)sender
+{
+ [[NSNotificationCenter defaultCenter] removeObserver:self name:NSTaskDidTerminateNotification object:getShowDetailsTask];
+ [getShowDetailsTask terminate];
+ [currentShow setValue:[NSNumber numberWithBool:NO] forKeyPath:ShowSubscribed];
+ [NSApp endSheet:detailsSheet];
+ [detailsSheet close];
+}
+
+- (IBAction)okSubscription: (id)sender
+{
+ NSDictionary *selectedShow = [[detailsController selectedObjects] objectAtIndex:0];
+
+ if ( [[selectedShow objectForKey:ShowType] isEqualToString:TypeSeasonEpisode] ) {
+ [currentShow setValue:[selectedShow objectForKey:ShowSeason] forKeyPath:ShowSeason];
+ [currentShow setValue:[NSNumber numberWithInt:([[selectedShow objectForKey:ShowEpisode] intValue]-1)] forKeyPath:ShowEpisode];
+ [currentShow setValue:[selectedShow objectForKey:ShowType] forKeyPath:ShowType];
+
+ } else if ( [[selectedShow objectForKey:ShowType] isEqualToString:TypeDate] ) {
+ [currentShow setValue:[[selectedShow objectForKey:ShowDate] addTimeInterval:-3600.0*24.0] forKeyPath:ShowDate];
+ [currentShow setValue:[selectedShow objectForKey:ShowType] forKeyPath:ShowType];
+
+ } else {
+ [currentShow setValue:[[selectedShow objectForKey:ShowTime] addTimeInterval:-3600.0] forKeyPath:ShowTime];
+ [currentShow setValue:[selectedShow objectForKey:ShowType] forKeyPath:ShowType];
+
+ }
+ [currentShow setValue:[NSNumber numberWithBool:YES] forKeyPath:ShowSubscribed];
+
+ [showsController rearrangeObjects];
+ [NSApp endSheet:detailsSheet];
+ [detailsSheet close];
+}
+
+- (IBAction)okSubscriptionToNextAiredEpisode: (id)sender
+{
+ NSDictionary *firstShow = [[detailsController arrangedObjects] objectAtIndex:0];
+
+ if ( [[firstShow objectForKey:ShowType] isEqualToString:TypeSeasonEpisode] ) {
+ [currentShow setValue:[firstShow objectForKey:ShowSeason] forKeyPath:ShowSeason];
+ [currentShow setValue:[firstShow objectForKey:ShowEpisode] forKeyPath:ShowEpisode];
+ [currentShow setValue:[firstShow objectForKey:ShowType] forKeyPath:ShowType];
+
+ } else if ( [[firstShow objectForKey:ShowType] isEqualToString:TypeDate] ) {
+ [currentShow setValue:[firstShow objectForKey:ShowDate] forKeyPath:ShowDate];
+ [currentShow setValue:[firstShow objectForKey:ShowType] forKeyPath:ShowType];
+
+ } else {
+ [currentShow setValue:[firstShow objectForKey:ShowTime] forKeyPath:ShowTime];
+ [currentShow setValue:[firstShow objectForKey:ShowType] forKeyPath:ShowType];
+
+ }
+ [currentShow setValue:[NSNumber numberWithBool:YES] forKeyPath:ShowSubscribed];
+
+ [showsController rearrangeObjects];
+ [NSApp endSheet:detailsSheet];
+ [detailsSheet close];
+}
+
+- (void) tableView:(NSTableView*)tableView willDisplayCell:(id)cell forTableColumn:(NSTableColumn*)tableColumn row:(int)row
+{
+ if ( [[tableView tableColumns] lastObject] == tableColumn ) {
+ [cell bind:@"title" toObject:[[showsController arrangedObjects] objectAtIndex:row] withKeyPath:ShowSubscribed options:[NSDictionary dictionaryWithObject:@"DownloadBooleanToTitleTransformer" forKey:NSValueTransformerNameBindingOption]];
+ }
+}
+
+- (IBAction)filterShows: (id)sender
+{
+ if ( [[sender stringValue] length] > 0 ) {
+ [showsController setFilterPredicate:[NSPredicate predicateWithFormat:@"HumanName CONTAINS[cd] %@",[sender stringValue]]];
+ } else {
+ [showsController setFilterPredicate:nil];
+ }
+}
+
+#pragma mark -
+#pragma mark launchd
+
+- (void)unloadFromLaunchd
+{
+ NSTask *aTask = [[NSTask alloc] init];
+ [aTask setLaunchPath:@"/bin/launchctl"];
+ [aTask setArguments:[NSArray arrayWithObjects:@"unload",[h launchdPlistPath],nil]];
+ [aTask launch];
+ [aTask waitUntilExit];
+ [aTask release];
+}
+
+- (void)loadIntoLaunchd
+{
+ NSTask *aTask = [[NSTask alloc] init];
+ [aTask setLaunchPath:@"/bin/launchctl"];
+ [aTask setArguments:[NSArray arrayWithObjects:@"load",[h launchdPlistPath],nil]];
+ [aTask launch];
+ [aTask waitUntilExit];
+ [aTask release];
+}
+
+- (void)saveLaunchdPlist
+{
+ NSMutableDictionary *launchdProperties = [NSMutableDictionary dictionary];
+ [[NSFileManager defaultManager] removeFileAtPath:[h launchdPlistPath] handler:nil];
+ int checkDelay = [[[NSUserDefaults standardUserDefaults] objectForKey:TVShowsCheckDelay] intValue];
+ if ( checkDelay <= 2 ) {
+ switch (checkDelay) {
+ case 0:
+ [launchdProperties setObject:[NSNumber numberWithInt:15*60] forKey:@"StartInterval"];
+ break;
+ case 1:
+ [launchdProperties setObject:[NSNumber numberWithInt:30*60] forKey:@"StartInterval"];
+ break;
+ }
+ [launchdProperties setObject:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithInt:[[NSCalendarDate calendarDate] minuteOfHour]],@"Minute",nil]
+ forKey:@"StartCalendarInterval"];
+ } else {
+ [launchdProperties setObject:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithInt:[[NSCalendarDate calendarDate] hourOfDay]],@"Hour",nil]
+ forKey:@"StartCalendarInterval"];
+ }
+ [launchdProperties setObject:[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleIdentifier"]
+ forKey:@"Label"];
+ [launchdProperties setObject:[NSArray arrayWithObjects:[h scriptPath],[h preferencesFile],[h showsPath],nil]
+ forKey:@"ProgramArguments"];
+ [launchdProperties setObject:[Helper negate:[[NSUserDefaults standardUserDefaults] objectForKey:TVShowsIsEnabled]]
+ forKey:@"Disabled"];
+ [launchdProperties setObject:[h logPath]
+ forKey:@"StandardErrorPath"];
+ [launchdProperties setObject:[NSDictionary dictionaryWithObject:[h scriptFolder] forKey:@"TVSHOWSPATH"]
+ forKey:@"EnvironmentVariables"];
+ [launchdProperties setObject:[NSNumber numberWithBool:YES]
+ forKey:@"RunAtLoad"];
+
+ if ( ![launchdProperties writeToFile:[h launchdPlistPath] atomically:YES] )
+ [Helper dieWithErrorMessage:@"Could not write the ~/Library/LaunchAgents/net.sourceforge.tvshows.plist"];
+}
+
+
+#pragma mark -
+#pragma mark Menu handlers
+
+- (IBAction)find: (id)sender
+{
+ [mainWindow makeFirstResponder:searchToolbarItemTextField];
+}
+
+- (IBAction)help: (id)sender
+{
+ [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:TVShowsURL]];
+}
+
+- (IBAction)sendFeedback: (id)sender
+{
+ [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:TVShowsFeedbackURL]];
+}
+
+#pragma mark -
+#pragma mark Misc
+
+- (void)applicationWillTerminate: (NSNotification *)aNotification
+{
+ [shows writeToFile:[h showsPath] atomically:YES];
+ [self saveLaunchdPlist];
+ [self loadIntoLaunchd];
+}
+
+- (IBAction)test: (id)sender
+{
+ [defaultsController save:self];
+}
+
+- (BOOL)shouldGreenRowAtIndex: (int)index
+{
+ if ( index < [[showsController arrangedObjects] count] )
+ return [[[[showsController arrangedObjects] objectAtIndex:index] objectForKey:ShowSubscribed] boolValue];
+ return NO;
+}
+
+- (void)checkForBittorrentClient
+{
+ if ( kLSApplicationNotFoundErr == LSGetApplicationForInfo(kLSUnknownType,kLSUnknownCreator,CFSTR("torrent"),kLSRolesAll,NULL,NULL) ) {
+ NSAlert *alert = [[[NSAlert alloc] init] autorelease];
+ [alert addButtonWithTitle:@"Download Transmission"];
+ [alert addButtonWithTitle:@"No"];
+ [alert setMessageText:@"You need a Bittorrent client to use TVShows, would you like to download one?"];
+ [alert setInformativeText:@"We recommend Transmission, a great client."];
+ [alert setAlertStyle:NSWarningAlertStyle];
+ [alert beginSheetModalForWindow:mainWindow modalDelegate:self didEndSelector:@selector(checkForBittorrentClientAlertDidEnd:returnCode:contextInfo:) contextInfo:nil];
+ }
+}
+
+- (void)checkForBittorrentClientAlertDidEnd:(NSAlert *)alert returnCode:(int)returnCode contextInfo:(void *)contextInfo {
+ if (returnCode == NSAlertFirstButtonReturn) {
+ [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:TransmissionURL]];
+ }
+}
+
+- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)theApplication
+{
+ return YES;
+}
+
+@end
24 Credits.rtf
@@ -0,0 +1,24 @@
+{\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf110
+{\fonttbl\f0\fnil\fcharset0 LucidaGrande;}
+{\colortbl;\red255\green255\blue255;}
+{\*\listtable{\list\listtemplateid1\listhybrid{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{disc\}}{\leveltext\leveltemplateid1\'01\uc0\u8226 ;}{\levelnumbers;}\fi-360\li720\lin720 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{hyphen\}}{\leveltext\leveltemplateid2\'01\uc0\u8259 ;}{\levelnumbers;}\fi-360\li1440\lin1440 }{\listname ;}\listid1}}
+{\*\listoverridetable{\listoverride\listid1\listoverridecount0\ls1}}
+\vieww9000\viewh8400\viewkind0
+\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\ql\qnatural\pardirnatural
+{\field{\*\fldinst{HYPERLINK "http://tvshows.sourceforge.net"}}{\fldrslt
+\f0\fs22 \cf0 tvshows.sourceforge.net}}
+\f0\fs22 \
+\
+\pard\tx220\tx720\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\li720\fi-720\ql\qnatural\pardirnatural
+\ls1\ilvl0\cf0 {\listtext \'95 }Data and RSS feeds by {\field{\*\fldinst{HYPERLINK "http://www.ezrss.it/"}}{\fldrslt ezrss.it}}\
+{\listtext \'95 }Automatic updates with {\field{\*\fldinst{HYPERLINK "http://sparkle.andymatuschak.org/"}}{\fldrslt Sparkle}}\
+{\listtext \'95 }Application icon by {\field{\*\fldinst{HYPERLINK "http://jonas.seph.ws/"}}{\fldrslt Jonas Rask}}\
+{\listtext \'95 }Toobar icons by {\field{\*\fldinst{HYPERLINK "http://www.kombine.net/icons.php"}}{\fldrslt Kombine}}\
+{\listtext \'95 }Daemon written in {\field{\*\fldinst{HYPERLINK "http://www.ruby-lang.org/"}}{\fldrslt Ruby}}\
+{\listtext \'95 }Modules from {\field{\*\fldinst{HYPERLINK "http://www.rubyforge.org/"}}{\fldrslt RubyForge}} :\
+\pard\tx940\tx1440\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\li1440\fi-1440\ql\qnatural\pardirnatural
+\ls1\ilvl1\cf0 {\listtext \uc0\u8259 }{\field{\*\fldinst{HYPERLINK "http://rubyforge.org/projects/plist"}}{\fldrslt plist}}\
+{\listtext \uc0\u8259 }{\field{\*\fldinst{HYPERLINK "http://rubyforge.org/projects/simple-rss"}}{\fldrslt simple-rss}}\
+\
+TVShows is under a GPL license.\
+}
96 DownloadShowList.rb
@@ -0,0 +1,96 @@
+#!/usr/bin/env ruby
+
+# This file is part of the TVShows source code.
+# http://tvshows.sourceforge.net
+# It may be used under the terms of the GNU General Public License.
+
+requires = [
+ 'open-uri',
+ File.join(File.dirname(__FILE__), 'TVShowsScript/TVShowsConstants.rb'),
+ File.join(File.dirname(__FILE__), 'TVShowsScript/lib/plist.rb')
+]
+
+def die(message,exitstatus = 1)
+ $stderr.puts "TVShows Error: #{message}"
+ exit(exitstatus)
+end
+def printError(message)
+ $stderr.puts "TVShows Error: #{message}"
+end
+def printException(exception)
+ $stderr.puts "TVShows Error: #{exception.inspect}\n\t#{exception.backtrace.join("\n\t")}"
+end
+
+requires.each { |r|
+ begin
+ die("Could not load #{r}") unless require r
+ rescue => e
+ printException(e)
+ end
+}
+
+exit(2) if ( ARGV.length != 2 )
+
+begin
+
+ path = ARGV[0]
+ version = ARGV[1]
+
+ shows = {
+ "Shows" => [],
+ "Version" => version
+ }
+
+ data = nil
+ 3.times { |n|
+ begin
+ data = open("http://ezrss.it/shows")
+ break
+ rescue Exception, Timeout::Error => e
+ printError("Failed to download the list, retrying...")
+ end
+ }
+
+ raise "Data is nil." if data.nil?
+
+ data.read.scan(/show_name=(.*?)&amp;show_name_exact=true\">(.*?)</i).each { |show|
+ shows["Shows"] << {
+ "ExactName" => show[0],
+ "HumanName" => show[1],
+ "Subscribed" => false,
+ "Type" => ""
+ }
+ }
+
+ # Merge
+ if ( File.exists?(path) ) then
+ begin
+ knownShows = Plist::parse_xml(path)
+ rescue => e
+ printException(e)
+ exit(1)
+ end
+
+ if !knownShows.nil? then
+ showsToAdd = []
+ shows["Shows"].each { |show|
+ if ( !knownShows["Shows"].find{|ks| ks["ExactName"] == show["ExactName"]} ) then
+ showsToAdd << show
+ end
+ }
+
+ knownShows["Shows"] += showsToAdd
+ knownShows["Version"] = version
+ shows = knownShows
+ end
+ end
+
+ shows["Shows"] = shows["Shows"].sort_by{ |s| s["HumanName"] }
+ shows.save_plist(path)
+
+rescue Exception, Timeout::Error => e
+ printException(e)
+ exit(1)
+end
+
+exit(0)
BIN  English.lproj/InfoPlist.strings
Binary file not shown
55 English.lproj/MainMenu.nib/classes.nib
@@ -0,0 +1,55 @@
+{
+ IBClasses = (
+ {
+ ACTIONS = {
+ cancelSubscription = id;
+ changeSaveFolder = id;
+ closePreferences = id;
+ enableDisable = id;
+ filterShows = id;
+ find = id;
+ help = id;
+ okSubscription = id;
+ okSubscriptionToNextAiredEpisode = id;
+ openPreferences = id;
+ sendFeedback = id;
+ subscribe = id;
+ test = id;
+ };
+ CLASS = Controller;
+ LANGUAGE = ObjC;
+ OUTLETS = {
+ defaultsController = NSUserDefaultsController;
+ detailsController = NSArrayController;
+ detailsErrorText = NSTextField;
+ detailsOKButton = NSButton;
+ detailsProgressIndicator = NSProgressIndicator;
+ detailsSheet = NSWindow;
+ detailsTable = NSScrollView;
+ enableDisableButton = NSButton;
+ enableDisableLabel = NSTextField;
+ mainColumn = NSTableColumn;
+ mainView = NSView;
+ mainWindow = NSWindow;
+ preferencesView = NSView;
+ preferencesWindow = NSWindow;
+ progressPanel = NSWindow;
+ progressPanelIndicator = NSProgressIndicator;
+ searchToolbarItemTextField = NSSearchField;
+ searchToolbarItemView = NSView;
+ showsController = NSArrayController;
+ showsTable = NSTableView;
+ };
+ SUPERCLASS = NSObject;
+ },
+ {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; },
+ {
+ ACTIONS = {checkForUpdates = id; };
+ CLASS = SUUpdater;
+ LANGUAGE = ObjC;
+ SUPERCLASS = NSObject;
+ },
+ {CLASS = TVTableView; LANGUAGE = ObjC; SUPERCLASS = NSTableView; }
+ );
+ IBVersion = 1;
+}
88 English.lproj/MainMenu.nib/info.nib
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>IBDocumentLocation</key>
+ <string>110 124 655 370 0 0 1440 878 </string>
+ <key>IBEditorPositions</key>
+ <dict>
+ <key>29</key>
+ <string>132 599 291 44 0 0 1440 878 </string>
+ <key>406</key>
+ <string>659 573 121 64 0 0 1440 878 </string>
+ <key>667</key>
+ <string>971 47 345 592 0 0 1440 878 </string>
+ <key>674</key>
+ <string>522 276 395 592 0 0 1440 878 </string>
+ <key>676</key>
+ <string>522 276 395 592 0 0 1440 878 </string>
+ </dict>
+ <key>IBFramework Version</key>
+ <string>446.1</string>
+ <key>IBGroupedObjects</key>
+ <dict>
+ <key>0</key>
+ <array>
+ <string>206</string>
+ <string>207</string>
+ </array>
+ <key>10</key>
+ <array>
+ <string>684</string>
+ <string>687</string>
+ </array>
+ <key>2</key>
+ <array>
+ <string>221</string>
+ <string>239</string>
+ </array>
+ <key>3</key>
+ <array>
+ <string>206</string>
+ <string>207</string>
+ </array>
+ <key>4</key>
+ <array>
+ <string>221</string>
+ <string>239</string>
+ </array>
+ <key>5</key>
+ <array>
+ <string>264</string>
+ <string>240</string>
+ <string>220</string>
+ <string>226</string>
+ <string>227</string>
+ </array>
+ <key>7</key>
+ <array>
+ <string>697</string>
+ <string>685</string>
+ <string>708</string>
+ </array>
+ <key>8</key>
+ <array>
+ <string>677</string>
+ <string>706</string>
+ </array>
+ <key>9</key>
+ <array>
+ <string>700</string>
+ <string>690</string>
+ </array>
+ </dict>
+ <key>IBLastGroupID</key>
+ <string>11</string>
+ <key>IBOldestOS</key>
+ <integer>4</integer>
+ <key>IBOpenObjects</key>
+ <array>
+ <integer>661</integer>
+ <integer>674</integer>
+ <integer>667</integer>
+ <integer>676</integer>
+ </array>
+ <key>IBSystem Version</key>
+ <string>8P2137</string>
+</dict>
+</plist>
BIN  English.lproj/MainMenu.nib/keyedobjects.nib
Binary file not shown
41 GetLatestSeasonEpisodeForShow.rb
@@ -0,0 +1,41 @@
+#!/usr/bin/env ruby
+
+# This file is part of the TVShows source code.
+# http://tvshows.sourceforge.net
+# It may be used under the terms of the GNU General Public License.
+
+require File.join(File.dirname(__FILE__), 'TVShowsScript/lib/simple-rss.rb')
+require 'open-uri'
+
+begin
+ feed = "http://ezrss.it/search/index.php?show_name=%s&show_name_exact=true&mode=rss"
+ url = feed % ARGV[0]
+ begin
+ episodes = SimpleRSS.parse(open(url))
+ rescue => exception
+ exit(-1)
+ end
+
+ maxSeason = 0
+ maxEpisode = 0
+ episodes.items.each do |episode|
+ seasonNoMatch = /Season\s*:\ ([0-9]*?);/.match(episode.description)
+ if ( !seasonNoMatch.nil? ) then
+ seasonNo = seasonNoMatch[1].to_i
+ episodeNoMatch = /Episode\s*:\ ([0-9]*?)$/.match(episode.description)
+ if ( !episodeNoMatch.nil? ) then
+ episodeNo = episodeNoMatch[1].to_i
+ if ( (maxSeason == seasonNo and maxEpisode < episodeNo) or (maxSeason < seasonNo) ) then
+ maxSeason = seasonNo
+ maxEpisode = episodeNo
+ end
+ end
+ end
+ end
+
+ print "#{maxSeason}-#{maxEpisode}"
+
+ exit(0)
+rescue
+ exit(-1)
+end
135 GetShowDetails.rb
@@ -0,0 +1,135 @@
+#!/usr/bin/env ruby
+
+# This file is part of the TVShows source code.
+# http://tvshows.sourceforge.net
+# It may be used under the terms of the GNU General Public License.
+
+requires = [
+ 'open-uri',
+ File.join(File.dirname(__FILE__), 'TVShowsScript/TVShowsConstants.rb'),
+ File.join(File.dirname(__FILE__), 'TVShowsScript/lib/simple-rss.rb'),
+ File.join(File.dirname(__FILE__), 'TVShowsScript/lib/plist.rb')
+]
+
+def die(message)
+ $stderr.puts "TVShows Error: #{message}"
+ exit(-1)
+end
+def printError(message)
+ $stderr.puts "TVShows Error: #{message}"
+end
+def printException(exception)
+ $stderr.puts "TVShows Error: #{exception.inspect}\n\t#{exception.backtrace.join("\n\t")}"
+end
+
+if ( ARGV.length != 1 ) then
+ die("Usage: TVShowDetails.rb ShowName")
+ exit(-1)
+end
+requires.each { |r|
+ begin
+ die("Could not load #{r}") unless require r
+ rescue => e
+ printException(e)
+ end
+}
+
+class Show
+
+ def initialize(name)
+ @feed = "http://ezrss.it/search/index.php?show_name=%s&show_name_exact=true&mode=rss"
+ @name = name
+ end
+
+ def getDetails
+
+ url = @feed % @name
+ begin
+ rawEpisodes = SimpleRSS.parse(open(url))
+ rescue => exception
+ printError("Could not connect to ezrss.it (#{exception.message})")
+ raise "GetShowDetailsError"
+ end
+
+ episodesBySeasonAndEpisodeNumber = []
+ episodesByDate = []
+ episodesByTitle = []
+
+ rawEpisodes.items.each do |episode|
+
+ #nameMatch = /Show\ Name\s*:\ (.*?);/.match(episode.description)[1].sub(/\/|:/,'-')
+ titleMatch = /Show\s*Title\s*:\s*(.*?);/.match(episode.description)
+ seasonNoMatch = /Season\s*:\s*([0-9]*?);/.match(episode.description)
+ episodeNoMatch = /Episode\s*:\s*([0-9]*?)$/.match(episode.description)
+ dateMatch = /Episode\s*Date:\s*([0-9\-]+)$/.match(episode.description)
+
+ if ( !seasonNoMatch.nil? and !episodeNoMatch.nil? ) then
+ # Season/episode style of show (eg: Lost)
+
+ s = seasonNoMatch[1].to_i
+ e = episodeNoMatch[1].to_i
+ t = episode.pubDate
+
+ if ( episodesBySeasonAndEpisodeNumber.find_all { |ep| ep[SHOW_SEASON] == s and ep[SHOW_EPISODE] == e and (ep[SHOW_TIME] <=> t) > 0 }.length == 0 ) then
+ episodesBySeasonAndEpisodeNumber << {
+ SHOW_SEASON => s,
+ SHOW_EPISODE => e,
+ SHOW_TIME => t,
+ SHOW_TYPE => TYPE_SEASONEPISODE
+ }
+ end
+
+ elsif ( !dateMatch.nil? )
+ # Date style of show (eg: The Daily Show)
+
+ begin
+ d = Time.parse(dateMatch[1])
+ t = episode.pubDate
+
+ if ( episodesByDate.find_all { |ep| ep[SHOW_DATE] == d and (ep[SHOW_TIME] <=> t) > 0 }.length == 0 ) then
+ episodesByDate << {
+ SHOW_DATE => d,
+ SHOW_TIME => episode.pubDate,
+ SHOW_TYPE => TYPE_DATE
+ }
+ end
+ rescue Exception => e
+ end
+
+ elsif ( !titleMatch.nil? and titleMatch[1] != "n/a")
+ # Get-all-episodes style of show (eg: Discovery Channel)
+
+ ti = titleMatch[1]
+ t = episode.pubDate
+
+ if ( episodesByTitle.find_all { |ep| ep[SHOW_TIME] == ti and (ep[SHOW_TIME] <=> t) > 0 }.length == 0 ) then
+ episodesByTitle << {
+ SHOW_TITLE => titleMatch[1],
+ SHOW_TIME => episode.pubDate,
+ SHOW_TYPE => TYPE_TIME
+ }
+ end
+
+ else
+ # Should not happen
+
+ printError("Could not categorize episode.")
+
+ end
+
+ end
+
+ return [episodesBySeasonAndEpisodeNumber,episodesByDate,episodesByTitle].max{|a,b| a.length<=>b.length}.to_plist
+
+ end
+
+end
+
+begin
+ $stdout.puts Show.new(ARGV[0]).getDetails
+rescue Timeout::Error, Exception => e
+ printError("GetShowDetails error (#{e.inspect})")
+ exit(1)
+end
+
+exit(0)
BIN  Green.tif
Binary file not shown
49 Helper.h
@@ -0,0 +1,49 @@
+/*
+ This file is part of the TVShows source code.
+ http://tvshows.sourceforge.net
+ It may be used under the terms of the GNU General Public License.
+*/
+
+#import <Cocoa/Cocoa.h>
+
+
+@interface Helper : NSObject {
+
+ NSString *libraryFolder;
+ NSString *applicationSupportFolder;
+ NSString *applicationApplicationSupportFolder;
+ NSString *preferencesFolder;
+ NSString *preferencesFile;
+ NSString *showsPath;
+ NSString *launchdPlistPath;
+ NSString *scriptPath;
+ NSString *logPath;
+ NSString *scriptFolder;
+ NSString *bundleIdentifier;
+
+}
+
+- (void)createFolderAtPath: (NSString *)path;
+- (void)chmodFolderAtPath: (NSString *)path;
+- (NSString *)libraryFolder;
+- (NSString *)applicationSupportFolder;
+- (NSString *)applicationApplicationSupportFolder;
+- (NSString *)preferencesFolder;
+- (NSString *)preferencesFile;
+- (NSString *)showsPath;
+- (NSString *)launchdPlistPath;
+- (NSString *)scriptPath;
+- (NSString *)logPath;
+- (NSString *)scriptFolder;
+- (NSString *)bundleIdentifier;
+
+/*
++ (NSString *)pathForDirectoryInUserDomain: (NSSearchPathDirectory)directory;
++ (NSString *)applicationSupportFolder;
++ (NSString *)applicationApplicationSupportFolder;
++ (void)initializeFoldersAndFiles;
++ (NSString *)showListPath;
+*/
++ (void)dieWithErrorMessage: (NSString *)message;
++ (NSNumber *)negate: (NSNumber *)n;
+@end
286 Helper.m
@@ -0,0 +1,286 @@
+/*
+ This file is part of the TVShows source code.
+ http://tvshows.sourceforge.net
+ It may be used under the terms of the GNU General Public License.
+*/
+
+#import "Helper.h"
+#import <Security/Security.h>
+
+/* Thanks to http://boinc.berkeley.edu/source_code.php */
+
+static AuthorizationRef gOurAuthRef = NULL;
+static char chownPath[] = "/usr/sbin/chown";
+
+static OSStatus getAuthorization(void) {
+ static Boolean sIsAuthorized = false;
+ AuthorizationRights ourAuthRights;
+ AuthorizationFlags ourAuthFlags;
+ AuthorizationItem ourAuthRightsItem[1];
+ AuthorizationEnvironment ourAuthEnvironment;
+ AuthorizationItem ourAuthEnvItem[1];
+ char prompt[] = "TVShows needs to access to the ~/Library/LaunchAgents folder.\n\n";
+ OSStatus err = noErr;
+
+ if (sIsAuthorized)
+ return noErr;
+
+ ourAuthRights.count = 0;
+ ourAuthRights.items = NULL;
+
+ err = AuthorizationCreate (&ourAuthRights, kAuthorizationEmptyEnvironment, kAuthorizationFlagDefaults, &gOurAuthRef);
+ if (err != noErr) {
+ return err;
+ }
+
+ ourAuthRightsItem[0].name = kAuthorizationRightExecute;
+ ourAuthRightsItem[0].value = chownPath;
+ ourAuthRightsItem[0].valueLength = strlen (chownPath);
+ ourAuthRightsItem[0].flags = 0;
+
+ ourAuthRights.count = 1;
+ ourAuthRights.items = ourAuthRightsItem;
+
+ ourAuthEnvItem[0].name = kAuthorizationEnvironmentPrompt;
+ ourAuthEnvItem[0].value = prompt;
+ ourAuthEnvItem[0].valueLength = strlen(prompt);
+ ourAuthEnvItem[0].flags = 0;
+
+ ourAuthEnvironment.count = 1;
+ ourAuthEnvironment.items = ourAuthEnvItem;
+
+ ourAuthFlags = kAuthorizationFlagInteractionAllowed | kAuthorizationFlagExtendRights;
+
+ err = AuthorizationCopyRights (gOurAuthRef, &ourAuthRights, &ourAuthEnvironment, ourAuthFlags, NULL);
+
+ if (err == noErr)
+ sIsAuthorized = true;
+
+ return err;
+}
+
+OSStatus chownToUidAndGidAtPath(uid_t uid, gid_t gid, char *path) {
+
+ short i;
+ char *args[3];
+ OSStatus err;
+ FILE *ioPipe;
+ char *p, junk[256];
+
+ err = getAuthorization();
+ if (err != noErr) {
+ //if (err == errAuthorizationCanceled)
+ return err;
+ } else {
+ for (i=0; i<5; i++) { // Retry 5 times if error
+
+ char *arg0;
+ asprintf(&arg0,"%d:%d",uid,gid);
+
+ args[0] = arg0;
+ args[1] = path;
+ args[2] = NULL;
+
+
+ err = AuthorizationExecuteWithPrivileges(gOurAuthRef, chownPath, 0, args, &ioPipe);
+ // We use the pipe to signal us when the command has completed
+ do {
+ p = fgets(junk, sizeof(junk), ioPipe);
+ } while (p);
+
+ fclose (ioPipe);
+ if (err == noErr)
+ break;
+ }
+ }
+
+ return err;
+}
+
+@implementation Helper
+
+- (id) init {
+ self = [super init];
+ if (self != nil) {
+
+ NSFileManager *fm = [NSFileManager defaultManager];
+ NSString *bundleName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleName"];
+ NSString *bundleNamePlist = [bundleName stringByAppendingPathExtension:@"plist"];
+ bundleIdentifier = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleIdentifier"]; // Don't move this line, it is needed for the next one
+ NSString *bundleIdentifierPlist = [bundleIdentifier stringByAppendingPathExtension:@"plist"];
+ NSString *resourcesScriptFolder = [[NSBundle mainBundle] pathForResource:@"TVShowsScript" ofType:nil];
+ NSString *launchAgentsFolder;
+ //NSString *script = [[NSBundle mainBundle] pathForResource:@"TVShows" ofType:@"rb"];
+
+ libraryFolder = [NSSearchPathForDirectoriesInDomains(NSLibraryDirectory,NSUserDomainMask,YES) objectAtIndex:0];
+ applicationSupportFolder = [NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory,NSUserDomainMask,YES) objectAtIndex:0];
+ applicationApplicationSupportFolder = [applicationSupportFolder stringByAppendingPathComponent:bundleName];
+ preferencesFolder = [libraryFolder stringByAppendingPathComponent:@"Preferences"];
+ preferencesFile = [preferencesFolder stringByAppendingPathComponent:bundleIdentifierPlist];
+ showsPath = [applicationApplicationSupportFolder stringByAppendingPathComponent:bundleNamePlist];
+ launchAgentsFolder = [libraryFolder stringByAppendingPathComponent:@"LaunchAgents"];
+ launchdPlistPath = [launchAgentsFolder stringByAppendingPathComponent:bundleIdentifierPlist];
+ scriptFolder = [applicationApplicationSupportFolder stringByAppendingPathComponent:[resourcesScriptFolder lastPathComponent]];
+ scriptPath = [[applicationApplicationSupportFolder stringByAppendingPathComponent:[resourcesScriptFolder lastPathComponent]] stringByAppendingPathComponent:@"TVShows.rb"];
+ logPath = [applicationApplicationSupportFolder stringByAppendingPathComponent:[bundleName stringByAppendingPathExtension:@"log"]];
+
+ [libraryFolder retain];
+ [applicationSupportFolder retain];
+ [applicationApplicationSupportFolder retain];
+ [preferencesFolder retain];
+ [preferencesFile retain];
+ [showsPath retain];
+ [launchdPlistPath retain];
+ [scriptPath retain];
+ [logPath retain];
+ [scriptFolder retain];
+ [bundleIdentifier retain];
+
+ [self createFolderAtPath:applicationSupportFolder];
+ [self createFolderAtPath:applicationApplicationSupportFolder];
+ [self createFolderAtPath:launchAgentsFolder];
+ [self chmodFolderAtPath:launchAgentsFolder];
+
+ // Remove scriptFolder if we have a newer version to install
+ if ( [fm fileExistsAtPath:scriptPath] ) {
+ NSString *scriptVersion = [[NSUserDefaults standardUserDefaults] objectForKey:@"ScriptVersion"];
+ if ( !scriptVersion || NSOrderedAscending == [scriptVersion compare:[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"] options:NSNumericSearch] )
+ if ( ![fm removeFileAtPath:scriptFolder handler:nil] )
+ [Helper dieWithErrorMessage:@"Could not remove the TVShows script folder in the Application Support folder in order to install the new one."];
+ }
+
+ // Install the script in the Application Support folder
+ if ( ![fm fileExistsAtPath:scriptFolder] ) {
+ if ( ![fm copyPath:resourcesScriptFolder toPath:scriptFolder handler:nil] ) {
+ [Helper dieWithErrorMessage:@"Could not copy the TVShows script in the Application Support folder."];
+ } else {
+ // Chmod the scripts to make sure they're executable
+ [fm changeFileAttributes:[NSDictionary dictionaryWithObject:[NSNumber numberWithUnsignedLong:0744] forKey:NSFilePosixPermissions] atPath:scriptPath];
+
+ // Set the new version
+ [[NSUserDefaults standardUserDefaults] setObject:[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"] forKey:@"ScriptVersion"];
+ [[NSUserDefaults standardUserDefaults] synchronize];
+ }
+ }
+
+ // Chmod the ruby scripts in the resource folder
+ NSEnumerator *scripts = [[[NSBundle mainBundle] pathsForResourcesOfType:@"rb" inDirectory:@""] objectEnumerator];
+ NSString *script;
+ while ( script = [scripts nextObject] ) {
+ [fm changeFileAttributes:[NSDictionary dictionaryWithObject:[NSNumber numberWithUnsignedLong:0744] forKey:NSFilePosixPermissions] atPath:script];
+ }
+
+ }
+ return self;
+}
+
+- (void) dealloc {
+
+ [libraryFolder release];
+ [applicationSupportFolder release];
+ [applicationApplicationSupportFolder release];
+ [preferencesFolder release];
+ [preferencesFile release];
+ [showsPath release];
+ [launchdPlistPath release];
+ [scriptPath release];
+ [logPath release];
+ [scriptFolder release];
+ [bundleIdentifier release];
+
+ [super dealloc];
+}
+
+
+- (void)createFolderAtPath: (NSString *)path
+{
+ NSFileManager *fm = [NSFileManager defaultManager];
+ if ( ![fm fileExistsAtPath:path] )
+ if ( ![fm createDirectoryAtPath:path attributes:nil] )
+ [Helper dieWithErrorMessage:[NSString stringWithFormat:@"the folder %@ doesn't exist and I can't create it.",path]];
+}
+
+- (void)chmodFolderAtPath: (NSString *)path
+{
+ NSFileManager *fm = [NSFileManager defaultManager];
+
+ if ( ![fm changeFileAttributes:[NSDictionary dictionaryWithObject:[NSNumber numberWithUnsignedLong:0755] forKey:@"NSFilePosixPermissions"] atPath:path] ) {
+ if ( noErr == chownToUidAndGidAtPath(getuid(),getgid(),(char *)[path cStringUsingEncoding:NSUTF8StringEncoding]) ) {
+ if ( ![fm changeFileAttributes:[NSDictionary dictionaryWithObject:[NSNumber numberWithUnsignedLong:0755] forKey:@"NSFilePosixPermissions"] atPath:path] ) {
+ [Helper dieWithErrorMessage:[NSString stringWithFormat:@"Could not change permissions for %@",path]];
+ }
+ } else {
+ [Helper dieWithErrorMessage:[NSString stringWithFormat:@"I'm not authorized to change permissions for %@.",path]];
+ }
+ }
+}
+
+- (NSString *)libraryFolder
+{
+ return libraryFolder;
+}
+
+- (NSString *)applicationSupportFolder
+{
+ return applicationSupportFolder;
+}
+
+- (NSString *)applicationApplicationSupportFolder
+{
+ return applicationApplicationSupportFolder;
+}
+
+- (NSString *)preferencesFolder
+{
+ return preferencesFolder;
+}
+
+- (NSString *)preferencesFile
+{
+ return preferencesFile;
+}
+
+- (NSString *)showsPath
+{
+ return showsPath;
+}
+
+- (NSString *)launchdPlistPath
+{
+ return launchdPlistPath;
+}
+
+- (NSString *)scriptPath
+{
+ return scriptPath;
+}
+
+- (NSString *)logPath
+{
+ return logPath;
+}
+
+- (NSString *)scriptFolder
+{
+ return scriptFolder;
+}
+
+- (NSString *)bundleIdentifier
+{
+ return bundleIdentifier;
+}
+
++ (void)dieWithErrorMessage: (NSString *)message
+{
+ NSRunAlertPanel(@"Alert", message, @"Quit", nil, nil);
+ [[NSApplication sharedApplication] terminate:self];
+}
+
++ (NSNumber *)negate: (NSNumber *)n
+{
+ if ( [n boolValue] ) {
+ return [NSNumber numberWithBool:NO];
+ }
+ return [NSNumber numberWithBool:YES];
+}
+@end
61 Info.plist
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>English</string>
+ <key>CFBundleExecutable</key>
+ <string>${EXECUTABLE_NAME}</string>
+ <key>CFBundleIconFile</key>
+ <string></string>
+ <key>CFBundleIdentifier</key>
+ <string>net.sourceforge.tvshows</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>${PRODUCT_NAME}</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleShortVersionString</key>
+ <string>${CURRENT_PROJECT_VERSION}</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>${CURRENT_PROJECT_VERSION}</string>
+ <key>LSMinimumSystemVersion</key>
+ <string>10.4</string>
+ <key>NSMainNibFile</key>
+ <string>MainMenu</string>
+ <key>NSPrincipalClass</key>
+ <string>NSApplication</string>
+ <key>CFBundleIconFile</key>
+ <string>TVShows.icns</string>
+ <key>SUFeedURL</key>
+ <string>http://tvshows.sourceforge.net/appcast.xml</string>
+ <key>SUPublicDSAKey</key>
+ <string>-----BEGIN PUBLIC KEY-----
+MIIDOzCCAi4GByqGSM44BAEwggIhAoIBAQDCnjRNY7GZtp8w8lSmZO0c147STM7j
+ljl4W97qrRFHv3ORXINEReOZqnkCuDQJSkdsv9JDIsSrKXrMFxBTOI7Y2C2th9KV
+pCGWIhrZiSX7pT75a4gINM1wWo9mFjpLVFNbj9HhnmlWeb2ahLUCUsYMaNqlZ3/E
+s64PLE+/FKkOgjyLTDt41ep5GXBrYIuM+soj8pwaZiLU8MUcbJEm6ON6EkCXX7Ul
+h9xXdsCf9yIoB1/3GIdvcLsOhJrZDAeYGAZGhoYUGcERK2vNAj7F3JUgLh6gzRcZ
+21EHVPTL94QMc4nm56xsSoctLPPcRZmbD6DD/UO5o1/uH/8uBNnU8ODjAhUA48/z
+Cd43FiYc7xp2zPYbRUAjcScCggEBALinCFgHWj6bl/IMRMumAq20k1komVvXvhxc
+xGB/mB0QhDEu+u33ZGtsJVNq5DxdCJojjS83rt7jkBSon9RU5vUPAbNStLRvRA8T
+xPUxMcyROAdAvr+h1QXKCXve+cc++xos8zLzjubIofZkCOiF4CGxhNMuOBYup0lB
+eUGxK4EYuCC2dlyg3L/mrL0rduioxyl6OFIzv9n+59SweQGQ+R0Px+XqPtxQrbk/
+zXkDK3vPJg/oxKHaRGeszBeLvlAX/AoBgvvP+WEF4NIdTmX/ybqpYYUcSJUqqGzv
+ygval/NNrBdnHyv3aT2Deexxb4CEtqqOgj5TgPmad6MSTXN6F4sDggEFAAKCAQBZ
+D96tObfKTstn2d+4zePq3RbdGGnKB+T5h08uCD24mkAuuQkEIAqwuVAns8Lagk9d
+XmMV1ZHVsGtYeUwCwClU0qiQb/MaiUpJCTV9gIFIHf6u13gzCH2LKTr2UDV+iq7o
+Fz3PYy95uhd/W9eTYstJSxD6luxVM6KZUp0jcJhfvVtrhaVn5HDUM875yPaXKyCN
+/IhNRJBAqsCAUKFJL5CWYfg0H6Gi9oV0Ou/WyQnWZ3prVZw+Tk8T/80PH29OCz7w
+3vTMpmRaBLyXqi/o5Lbc9dO+VbmoCvxyWw5y5bf+MfKjsn6jD+7TVU2Qiv2uO8um
+rAoi+cFDem37Lk0CT1L0
+-----END PUBLIC KEY-----</string>
+ <key>SUExpectsDSASignature</key>
+ <true/>
+ <key>SUCheckAtStartup</key>
+ <true/>
+</dict>
+</plist>
51 NEWS
@@ -0,0 +1,51 @@
+News
+
+0.4.1 (9-14-2009)
+- Updated to use build 1.5b6 of the Sparkle auto-updater.
+- The misnamed CSI: New York S7E3 will no longer appear in the list.
+ * You should now be able to download new episodes normally.
+ * This change should not affect viewing once S7E3 is truly published.
+
+0.4 (09-11-2009)
+- MAC OS 10.5+ ONLY
+ * This is due to compiling issues. I hope to fix this in a later build.
+- Since TVShows has unofficially changed hands, all new builds will fall under the 0.4 branch and will be the only builds supported.
+- Replaced all instances of tvrss.net with the new torrent source, ezrss.it.
+- Fixed a critical bug where 0 byte torrents would be created.
+- Updated a few libraries that TVShows uses.
+
+0.3.4 (04-30-2007)
+- Possibly fixed the "Could not download the show list. Are you connected to the internet?" bug
+
+0.3.3 (04-30-2007)
+- Fixes a bug that caused the application not to work!
+
+0.3.2 (04-29-2007)
+- Fixes an issue that caused everybody to check for new episodes at :00 and :30, which resulted in a bandwidth peak for tvrss.net.
+
+0.3.1 (04-26-2007)
+- Bugfixes:
+ * Fixed a bug that happened when ruby was not installed in /usr/bin/ruby
+ * Possibly fixed the "Could not download the show list. Are you connected to the internet ?"
+
+0.3 (04-17-2007)
+- Nice icon by Jonas Rask
+- Buxfixes:
+ * TVShows now asks for credentials to chmod the ~/Library/LaunchAgents folder (fixes the "could not write the ~/Library/LaunchAgents/net.sourceforge.tvshows.plist" bug)
+ * Fixed the "spinning ball" issue when loading show details
+ * Fixed a bug that caused the daemon to crash on case-sensitive formatted drives
+- Automatic updating with Sparkle
+- Looks for a Bittorrent client at startup
+- Update show list toolbar button
+
+0.2 (04-04-2007)
+- Bugfixes
+- Now handles all types of shows :
+ * Shows organized by season/episode
+ * Shows organized by date
+ * Shows not organized at all
+- Nicer dialog to choose episode
+
+
+0.1 (03-08-2007)
+- First release
BIN  Play.tif
Binary file not shown
BIN  Preferences.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  Red.tif
Binary file not shown
BIN  Reload.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1  Sparkle.framework/Headers
1  Sparkle.framework/Resources
1  Sparkle.framework/Sparkle
33 Sparkle.framework/Versions/A/Headers/SUAppcast.h
@@ -0,0 +1,33 @@
+//
+// SUAppcast.h
+// Sparkle
+//
+// Created by Andy Matuschak on 3/12/06.
+// Copyright 2006 Andy Matuschak. All rights reserved.
+//
+
+#ifndef SUAPPCAST_H
+#define SUAPPCAST_H
+
+@class SUAppcastItem;
+@interface SUAppcast : NSObject {
+ NSArray *items;
+ NSString *userAgentString;
+ id delegate;
+ NSMutableData *incrementalData;
+}
+
+- (void)fetchAppcastFromURL:(NSURL *)url;
+- (void)setDelegate:delegate;
+- (void)setUserAgentString:(NSString *)userAgentString;
+
+- (NSArray *)items;
+
+@end
+
+@interface NSObject (SUAppcastDelegate)
+- (void)appcastDidFinishLoading:(SUAppcast *)appcast;
+- (void)appcast:(SUAppcast *)appcast failedToLoadWithError:(NSError *)error;
+@end
+
+#endif
47 Sparkle.framework/Versions/A/Headers/SUAppcastItem.h
@@ -0,0 +1,47 @@
+//
+// SUAppcastItem.h
+// Sparkle
+//
+// Created by Andy Matuschak on 3/12/06.
+// Copyright 2006 Andy Matuschak. All rights reserved.
+//
+
+#ifndef SUAPPCASTITEM_H
+#define SUAPPCASTITEM_H
+
+@interface SUAppcastItem : NSObject {
+ NSString *title;
+ NSDate *date;
+ NSString *itemDescription;
+
+ NSURL *releaseNotesURL;
+
+ NSString *DSASignature;
+ NSString *minimumSystemVersion;
+
+ NSURL *fileURL;
+ NSString *versionString;
+ NSString *displayVersionString;
+
+ NSDictionary *propertiesDictionary;
+}
+
+// Initializes with data from a dictionary provided by the RSS class.
+- initWithDictionary:(NSDictionary *)dict;
+
+- (NSString *)title;
+- (NSString *)versionString;
+- (NSString *)displayVersionString;
+- (NSDate *)date;
+- (NSString *)itemDescription;
+- (NSURL *)releaseNotesURL;
+- (NSURL *)fileURL;
+- (NSString *)DSASignature;
+- (NSString *)minimumSystemVersion;
+
+// Returns the dictionary provided in initWithDictionary; this might be useful later for extensions.
+- (NSDictionary *)propertiesDictionary;
+
+@end
+
+#endif
118 Sparkle.framework/Versions/A/Headers/SUUpdater.h
@@ -0,0 +1,118 @@
+//
+// SUUpdater.h
+// Sparkle
+//
+// Created by Andy Matuschak on 1/4/06.
+// Copyright 2006 Andy Matuschak. All rights reserved.
+//
+
+#ifndef SUUPDATER_H
+#define SUUPDATER_H
+
+#import <Sparkle/SUVersionComparisonProtocol.h>
+
+@class SUUpdateDriver, SUAppcastItem, SUHost, SUAppcast;
+@interface SUUpdater : NSObject {
+ NSTimer *checkTimer;
+ SUUpdateDriver *driver;
+
+ SUHost *host;
+ IBOutlet id delegate;
+}
+
++ (SUUpdater *)sharedUpdater;
++ (SUUpdater *)updaterForBundle:(NSBundle *)bundle;
+- (NSBundle *)hostBundle;
+
+- (void)setDelegate:(id)delegate;
+- delegate;
+
+- (void)setAutomaticallyChecksForUpdates:(BOOL)automaticallyChecks;
+- (BOOL)automaticallyChecksForUpdates;
+
+- (void)setUpdateCheckInterval:(NSTimeInterval)interval;
+- (NSTimeInterval)updateCheckInterval;
+
+- (void)setFeedURL:(NSURL *)feedURL;
+- (NSURL *)feedURL;
+
+- (void)setSendsSystemProfile:(BOOL)sendsSystemProfile;
+- (BOOL)sendsSystemProfile;
+
+- (void)setAutomaticallyDownloadsUpdates:(BOOL)automaticallyDownloadsUpdates;
+- (BOOL)automaticallyDownloadsUpdates;
+
+// This IBAction is meant for a main menu item. Hook up any menu item to this action,
+// and Sparkle will check for updates and report back its findings verbosely.
+- (IBAction)checkForUpdates:sender;
+
+// This kicks off an update meant to be programmatically initiated. That is, it will display no UI unless it actually finds an update,
+// in which case it proceeds as usual. If the fully automated updating is turned on, however, this will invoke that behavior, and if an
+// update is found, it will be downloaded and prepped for installation.
+- (void)checkForUpdatesInBackground;
+
+// Date of last update check. Returns null if no check has been performed.
+- (NSDate*)lastUpdateCheckDate;
+
+// This begins a "probing" check for updates which will not actually offer to update to that version. The delegate methods, though,
+// (up to updater:didFindValidUpdate: and updaterDidNotFindUpdate:), are called, so you can use that information in your UI.
+- (void)checkForUpdateInformation;
+
+// Call this to appropriately schedule or cancel the update checking timer according to the preferences for time interval and automatic checks. This call does not change the date of the next check, but only the internal NSTimer.
+- (void)resetUpdateCycle;
+
+- (BOOL)updateInProgress;
+@end
+
+@interface NSObject (SUUpdaterDelegateInformalProtocol)
+// This method allows you to add extra parameters to the appcast URL, potentially based on whether or not Sparkle will also be sending along the system profile. This method should return an array of dictionaries with keys: "key", "value", "displayKey", "displayValue", the latter two being specifically for display to the user.
+- (NSArray *)feedParametersForUpdater:(SUUpdater *)updater sendingSystemProfile:(BOOL)sendingProfile;
+
+// Use this to override the default behavior for Sparkle prompting the user about automatic update checks.
+- (BOOL)updaterShouldPromptForPermissionToCheckForUpdates:(SUUpdater *)bundle;
+
+// Implement this if you want to do some special handling with the appcast once it finishes loading.
+- (void)updater:(SUUpdater *)updater didFinishLoadingAppcast:(SUAppcast *)appcast;
+
+// If you're using special logic or extensions in your appcast, implement this to use your own logic for finding
+// a valid update, if any, in the given appcast.
+- (SUAppcastItem *)bestValidUpdateInAppcast:(SUAppcast *)appcast forUpdater:(SUUpdater *)bundle;
+
+// Sent when a valid update is found by the update driver.
+- (void)updater:(SUUpdater *)updater didFindValidUpdate:(SUAppcastItem *)update;
+
+// Sent when a valid update is not found.
+- (void)updaterDidNotFindUpdate:(SUUpdater *)update;
+
+// Sent immediately before installing the specified update.
+- (void)updater:(SUUpdater *)updater willInstallUpdate:(SUAppcastItem *)update;