~dobey/rhythmbox-ubuntuone/fix-preview

« back to all changes in this revision

Viewing changes to ubuntuone/MusicStoreWidget.py

  • Committer: Rodney Dawes
  • Date: 2012-03-03 03:40:27 UTC
  • Revision ID: rodney.dawes@canonical.com-20120303034027-fscnmcobytjia540
Use plain new instead of example_new to create entries for preview tracks
Use self.db instead of self.shell.props.db when looking at the db

Show diffs side-by-side

added added

removed removed

Lines of Context:
131
131
        """A file is finished downloading"""
132
132
        library_uri = self._udf_path_to_library_uri(path)
133
133
        # Import the URI
134
 
        if not self.shell.props.db.entry_lookup_by_location(library_uri):
 
134
        if not self.db.entry_lookup_by_location(library_uri):
135
135
            self.db.add_uri(library_uri)
136
136
 
137
137
    def play_library(self, source, path):
138
138
        """Switch to and start playing a song from the library"""
139
139
        uri = self._udf_path_to_library_uri(path)
140
 
        entry = self.shell.props.db.entry_lookup_by_location(uri).ref()
 
140
        entry = self.db.entry_lookup_by_location(uri)
141
141
        if not entry:
142
142
            print "couldn't find entry", uri
143
143
            return
157
157
    def play_preview_mp3(self, source, url, title):
158
158
        """Play a passed mp3; signal handler for preview-mp3 signal."""
159
159
        # create an entry, don't save it, and play it
160
 
        entry = RB.RhythmDBEntry.example_new(self.shell.props.db,
161
 
                                             self.entry_type, url)
 
160
        entry = RB.RhythmDBEntry.new(self.db, self.entry_type, url)
162
161
        self.db.entry_set(entry, RB.RhythmDBPropType.TITLE, title)
163
162
        player = self.shell.get_property('shell-player')
164
163
        player.stop()