summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortmzullinger <tmzullinger@f01d2545-417e-4e96-918e-98f8d0dbbcb6>2008-08-23 18:04:30 +0000
committertmzullinger <tmzullinger@f01d2545-417e-4e96-918e-98f8d0dbbcb6>2008-08-23 18:04:30 +0000
commita002a6baceaaed976d4e9790fbf20d0d96bb1abd (patch)
tree892b4aba4eafd5402347bf807aa9ee6a5fcd3d46
parent3f1e901ee5fe81afdb0301eea4daa15e639b9c5a (diff)
downloadlibgpod-python-podcast-mediatype.tar.gz
libgpod-python-podcast-mediatype.tar.xz
libgpod-python-podcast-mediatype.zip
Python: Set the mediatype field for Track objectspython-podcast-mediatypepython-container-methods
git-svn-id: https://gtkpod.svn.sf.net/svnroot/gtkpod/libgpod/trunk@2112 f01d2545-417e-4e96-918e-98f8d0dbbcb6
-rw-r--r--ChangeLog3
-rw-r--r--bindings/python/ipod.py10
2 files changed, 12 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 11b9c87..37ab1b2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -18,6 +18,9 @@
* bindings/python/tests/tests.py:
Whitespace cleanup
+ * bindings/python/ipod.py:
+ Set the mediatype field for Track objects
+
2008-08-20 Todd Zullinger <tmzullinger at users.sourceforge.net>
* bindings/python/examples/save_photos.py
diff --git a/bindings/python/ipod.py b/bindings/python/ipod.py
index 85f5456..4c82ebe 100644
--- a/bindings/python/ipod.py
+++ b/bindings/python/ipod.py
@@ -297,13 +297,18 @@ class Track:
k.startswith("reserved") or
k == "chapterdata")]
- def __init__(self, filename=None,
+ def __init__(self, filename=None, mediatype=gpod.ITDB_MEDIATYPE_AUDIO,
proxied_track=None, podcast=False, ownerdb=None):
"""Create a Track object.
If from_file or filename is set, the file specified will be
used to create the track.
+ The mediatype parameter sets the mediatype for the track. It
+ defaults to audio, unless 'podcast' is True, in which case it
+ is set to podcast. See gpod.ITDB_MEDIATYPE_* for other valid
+ mediatypes.
+
If proxied_track is set, it is expected to be an Itdb_Track
object.
@@ -357,6 +362,8 @@ class Track:
else:
self._track = gpod.itdb_track_new()
self.set_podcast(podcast)
+ if not 'mediatype' in self:
+ self['mediatype'] = mediatype
def _set_userdata_utf8(self, key, value):
self['userdata']['%s_locale' % key] = value
@@ -440,6 +447,7 @@ class Track:
self['skip_when_shuffling'] = 0x01
self['remember_playback_position'] = 0x01
self['flag4'] = 0x01 # Show Title/Album on the 'Now Playing' page
+ self['mediatype'] = gpod.ITDB_MEDIATYPE_PODCAST
else:
self['skip_when_shuffling'] = 0x00
self['remember_playback_position'] = 0x00