Permalink
Browse files

First commit.

  • Loading branch information...
0 parents commit ad6ae8257c447dea2eb462ac3ada05ed99760088 Frank committed Aug 26, 2009
Showing with 1,492 additions and 0 deletions.
  1. +674 −0 COPYING
  2. +13 −0 README
  3. +17 −0 TODO
  4. +91 −0 animelist.py
  5. +57 −0 config.py
  6. +352 −0 lists.py
  7. 0 modules/__init__.py
  8. +34 −0 modules/utils.py
  9. +184 −0 myanimelist.py
  10. +70 −0 toolbar.py
674 COPYING

Large diffs are not rendered by default.

Oops, something went wrong.
13 README
@@ -0,0 +1,13 @@
+AnimeList is still under development and not everything works yet and stuff can be bugged.
+Only tested on Linux (Arch linux), does not work on Windows (XP) (yet) and Mac (OSX) has
+not bee tested yet.
+
+To startup AnimeList you need to make a ".animelist" directory in your home directory and
+put a file called "preferences.cfg" in it. In that file you put the following text:
+
+[user]
+name=yourusername
+password=yourpassword
+
+After that you can 'cd' to the AnimeList directory and make "animelist.py" executable
+(if needed) and do "./animelist.py".
17 TODO
@@ -0,0 +1,17 @@
+TODO for AnimeList
+
+ - Preferences (dialog).
+ - Should be saved in a secure file/format, because the username
+ and password are saved in the preferences file.
+ - About dialog.
+ - Search system (dialog, search result parsing, etc.).
+ - Add anime via search dialog.
+ - Save tasks when they could not be executed at shutdown.
+ - Execute tasks at shutdown or startup.
+ - lists.py
+ - Actions for "Details" and "Delete" items in the popup menu.
+ - Media player detection (for Mplayer etc.) (+GUI).
+ - Proper error handling.
+ - Make it work on Windows. The usage of threads is probably preventing
+ it to work correctly on Windows.
+ - Clean up code.
@@ -0,0 +1,91 @@
+#!/usr/bin/python
+
+# =============================================================================
+# animelist.py
+#
+# Copyright (c) 2009 Frank Smit (FSX)
+# License: GPL v3, see the COPYING file for details
+# =============================================================================
+
+import os
+
+import gtk, gobject
+
+import config, toolbar, myanimelist, lists
+
+gtk.gdk.threads_init()
+
+class AnimeList():
+ HOME = os.path.expanduser('~/.animelist')
+ app_name = 'AnimeList'
+ app_version = '0.1-dev'
+ tasks = []
+
+ def __init__(self):
+
+ self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
+ self.window.set_default_size(800, 600)
+ self.window.set_position(gtk.WIN_POS_CENTER)
+ self.window.set_title('AnimeList')
+
+ self.statusbar = gtk.Statusbar()
+ self.statusbar_message_id = None
+
+ # Classes
+ self.config = config.Config(self)
+ self.toolbar = toolbar.Toolbar(self)
+ self.mal = myanimelist.Mal(self)
+ self.lists = lists.Lists(self)
+
+ # Put everything together
+ vbox = gtk.VBox(False, 0)
+ vbox.pack_start(self.toolbar.bar, False, False, 0)
+ vbox.pack_start(self.lists.tabs, True, True, 0)
+ vbox.pack_end(self.statusbar, False, False, 0)
+
+ # Events
+ self.window.connect('destroy', self.quit)
+
+ # Create settings folder in home directory
+ if not os.access(self.HOME, os.F_OK | os.W_OK):
+ os.mkdir(self.HOME)
+
+ # Show
+ self.window.add(vbox)
+ self.window.show_all()
+
+ gtk.main()
+
+ #
+ # Set/Update/Change statusbar text
+ #
+ def update_statusbar(self, text):
+
+ if not self.statusbar_message_id is None:
+ self.statusbar.remove(0, self.statusbar_message_id)
+
+ self.statusbar_message_id = self.statusbar.push(0, text)
+
+ #
+ # Clear statusbar
+ #
+ def clear_statusbar(self, remove_timeout=None):
+
+ if not self.statusbar_message_id is None:
+ if not remove_timeout is None:
+ gobject.timeout_add(remove_timeout, self.statusbar.remove, 0, self.statusbar_message_id)
+ else:
+ self.statusbar.remove(0, self.statusbar_message_id)
+
+ #
+ # Terminates the application cleanly.
+ #
+ def quit(self, widget, data=None):
+
+ from modules.utils import cache_data
+
+ cache_data(self.HOME + '/' + self.config.user['name'] + '_animelist.cpickle', self.lists.anime_data)
+ gtk.main_quit()
+
+if __name__ == '__main__':
+ AnimeList()
@@ -0,0 +1,57 @@
+#!/usr/bin/python
+
+# =============================================================================
+# config.py
+#
+# Copyright (c) 2009 Frank Smit (FSX)
+# License: GPL v3, see the COPYING file for details
+# =============================================================================
+
+import ConfigParser
+
+class Config():
+ def __init__(self, al):
+
+ self.al = al
+
+ # Load preferences file
+ config = ConfigParser.SafeConfigParser()
+ config.read([self.al.HOME + '/preferences.cfg',])
+
+ self.lists = {
+ 1: 'Watching',
+ 2: 'Completed',
+ 3: 'On-hold',
+ 4: 'Dropped',
+ 6: 'Plan to watch'
+ }
+
+ self.tab_numbers = {
+ 0: 1,
+ 1: 2,
+ 2: 3,
+ 3: 4,
+ 4: 6
+ }
+
+ self.types = {
+ 1: 'TV',
+ 2: 'OVA',
+ 3: 'Movie',
+ 4: 'Special',
+ 5: 'ONA',
+ 6: 'Music'
+ }
+
+ self.user = {
+ 'name': config.get('user', 'name'),
+ 'password': config.get('user', 'password')
+ }
+
+ self.prefs = {
+ 'startup_refresh': False
+ }
+
+ self.mal = {
+ 'host': 'myanimelist.net'
+ }
Oops, something went wrong.

0 comments on commit ad6ae82

Please sign in to comment.