Merge lp:~dobey/rhythmbox-ubuntuone/fix-preview into lp:rhythmbox-ubuntuone

Proposed by dobey on 2012-03-05
Status: Merged
Approved by: dobey on 2012-03-06
Approved revision: 113
Merged at revision: 110
Proposed branch: lp:~dobey/rhythmbox-ubuntuone/fix-preview
Merge into: lp:rhythmbox-ubuntuone
Diff against target: 64 lines (+11/-13)
1 file modified
ubuntuone/MusicStoreWidget.py (+11/-13)
To merge this branch: bzr merge lp:~dobey/rhythmbox-ubuntuone/fix-preview
Reviewer Review Type Date Requested Status
Natalia Bidart Approve on 2012-03-06
Roberto Alsina (community) 2012-03-05 Approve on 2012-03-06
Review via email: mp+95982@code.launchpad.net

Commit message

Fix the handling of preview playback in the store
Fix the handling of purchased music playback from the My Downloads page

Description of the change

To test this properly, rhythmbox from ppa:ubuntuone/nightlies is currently needed, as there is a fix for a crash when the preview playback ends, which is not yet fixed in the Ubuntu proper packaging.

To post a comment you must log in.
Roberto Alsina (ralsina) wrote :

+1

review: Approve
Natalia Bidart (nataliabidart) wrote :

Looks good!

review: Approve
Natalia Bidart (nataliabidart) wrote :

Seems like the GLib adding is not needed:

    23: [W0611] Unused import GLib

review: Needs Fixing
113. By dobey on 2012-03-06

Remove unused import from debugging

Natalia Bidart (nataliabidart) wrote :

Looks good.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ubuntuone/MusicStoreWidget.py'
2--- ubuntuone/MusicStoreWidget.py 2012-01-31 15:04:32 +0000
3+++ ubuntuone/MusicStoreWidget.py 2012-03-06 17:18:19 +0000
4@@ -83,6 +83,9 @@
5 self.source.connect("download-finished", self.download_finished)
6 self.source.connect("url-loaded", self.url_loaded)
7
8+ self.source.props.query_model = RB.RhythmDBQueryModel.new_empty(
9+ self.db)
10+
11 # Do these every time
12 self.add_u1_library()
13
14@@ -127,42 +130,37 @@
15 """A file is finished downloading"""
16 library_uri = self._udf_path_to_library_uri(path)
17 # Import the URI
18- if not self.shell.props.db.entry_lookup_by_location(library_uri):
19+ if not self.db.entry_lookup_by_location(library_uri):
20 self.db.add_uri(library_uri)
21
22 def play_library(self, source, path):
23 """Switch to and start playing a song from the library"""
24 uri = self._udf_path_to_library_uri(path)
25- entry = self.shell.props.db.entry_lookup_by_location(uri)
26+ entry = self.db.entry_lookup_by_location(uri)
27 if not entry:
28 print "couldn't find entry", uri
29 return
30 libsrc = self.shell.props.library_source
31 artist_view, album_view = libsrc.get_property_views()[0:2]
32 song_view = libsrc.get_entry_view()
33- artist = self.shell.props.db.entry_get(entry,
34- RB.RhythmDBPropType.ARTIST)
35- album = self.shell.props.db.entry_get(entry,
36- RB.RhythmDBPropType.ALBUM)
37+ artist = entry.get_string(RB.RhythmDBPropType.ARTIST)
38+ album = entry.get_string(RB.RhythmDBPropType.ALBUM)
39 self.shell.props.display_page_tree.select(libsrc)
40 artist_view.set_selection([artist])
41 album_view.set_selection([album])
42 song_view.scroll_to_entry(entry)
43- player = self.shell.get_player()
44+ player = self.shell.get_property('shell-player')
45 player.stop()
46 player.play_entry(entry, libsrc)
47
48 def play_preview_mp3(self, source, url, title):
49 """Play a passed mp3; signal handler for preview-mp3 signal."""
50 # create an entry, don't save it, and play it
51- entry = self.shell.props.db.entry_lookup_by_location(url)
52- if entry is None:
53- entry = self.shell.props.db.entry_new(self.entry_type, url)
54- self.shell.props.db.set(entry, RB.RhythmDBPropType.TITLE, title)
55- player = self.shell.get_player()
56+ entry = RB.RhythmDBEntry.new(self.db, self.entry_type, url)
57+ self.db.entry_set(entry, RB.RhythmDBPropType.TITLE, title)
58+ player = self.shell.get_property('shell-player')
59 player.stop()
60 player.play_entry(entry, self.source)
61- # delete this entry when it finishes playing. Don't know how yet.
62
63 def add_u1_library(self):
64 """Add the U1 library if not listed in RB and re-add if changed."""

Subscribers

People subscribed via source and target branches