From a002a6baceaaed976d4e9790fbf20d0d96bb1abd Mon Sep 17 00:00:00 2001 From: tmzullinger Date: Sat, 23 Aug 2008 18:04:30 +0000 Subject: Python: Set the mediatype field for Track objects git-svn-id: https://gtkpod.svn.sf.net/svnroot/gtkpod/libgpod/trunk@2112 f01d2545-417e-4e96-918e-98f8d0dbbcb6 --- ChangeLog | 3 +++ bindings/python/ipod.py | 10 +++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) 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 * 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 -- cgit