summaryrefslogtreecommitdiffstats
path: root/bindings/python/gtkpod.py
diff options
context:
space:
mode:
authorNicholas Piper <nicholas@users.sourceforge.net>2007-01-14 20:29:38 +0000
committerNicholas Piper <nicholas@users.sourceforge.net>2007-01-14 20:29:38 +0000
commitce9e6169a993e38fb7b8edaed05c105fa4450e27 (patch)
treeeea0ee523668ffa655784c5044391aa5ac69672a /bindings/python/gtkpod.py
parenta2379f519b851a68db57ac4d7c0615564cabaa9c (diff)
downloadlibgpod-ce9e6169a993e38fb7b8edaed05c105fa4450e27.tar.gz
libgpod-ce9e6169a993e38fb7b8edaed05c105fa4450e27.tar.xz
libgpod-ce9e6169a993e38fb7b8edaed05c105fa4450e27.zip
Use gtkdoc documentation for python docstrings, topped up with docstrings by Todd Zullinger.
git-svn-id: https://gtkpod.svn.sf.net/svnroot/gtkpod/libgpod/trunk@1366 f01d2545-417e-4e96-918e-98f8d0dbbcb6
Diffstat (limited to 'bindings/python/gtkpod.py')
-rw-r--r--bindings/python/gtkpod.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/bindings/python/gtkpod.py b/bindings/python/gtkpod.py
index 9eebf36..54a68dc 100644
--- a/bindings/python/gtkpod.py
+++ b/bindings/python/gtkpod.py
@@ -1,3 +1,5 @@
+"""Read and write Gtkpod extended info files."""
+
import sha
import os
import socket
@@ -9,12 +11,15 @@ import socket
hostname = socket.gethostname()
class ParseError(Exception):
+ """Exception for parse errors."""
pass
class SyncError(Exception):
+ """Exception for sync errors."""
pass
def sha1_hash(filename):
+ """Return an SHA1 hash on the first 16k of a file."""
import struct
# only hash the first 16k
hash_len = 4*4096
@@ -25,6 +30,15 @@ def sha1_hash(filename):
return hash.hexdigest()
def write(filename, db, itunesdb_file):
+ """Save extended info to a file.
+
+ db is a gpod.Database instance
+
+ Extended info is written for the iTunesDB specified in
+ itunesdb_file
+
+ """
+
file = open(filename, "w")
def write_pair(name, value):
@@ -53,6 +67,15 @@ def write(filename, db, itunesdb_file):
write_pair("id", "xxx")
def parse(filename, db, itunesdb_file=None):
+ """Load extended info from a file.
+
+ db is a gpod.Database instance
+
+ If itunesdb_file is set and it's hash is valid some expensive
+ checks are skipped.
+
+ """
+
tracks_by_id = {}
tracks_by_sha = {}
id = 0