Merge lp:~cprofitt/ubuntu-desktop-accomplishments/multimedia-added-music into lp:ubuntu-desktop-accomplishments

Proposed by Charles Profitt
Status: Merged
Merged at revision: 18
Proposed branch: lp:~cprofitt/ubuntu-desktop-accomplishments/multimedia-added-music
Merge into: lp:ubuntu-desktop-accomplishments
Diff against target: 150 lines (+113/-8)
5 files modified
accomplishments/ubuntu-desktop/bn/multimedia/musicinrhythmbox.accomplishment (+19/-0)
accomplishments/ubuntu-desktop/en/multimedia/musicinrhythmbox.accomplishment (+19/-0)
accomplishments/ubuntu-desktop/pl/multimedia/musicinrhythmbox.accomplishment (+19/-0)
scripts/ubuntu-desktop/multimedia/multimedia-added-music.py (+25/-8)
scripts/ubuntu-desktop/multimedia/musicinrhythmbox.py (+31/-0)
To merge this branch: bzr merge lp:~cprofitt/ubuntu-desktop-accomplishments/multimedia-added-music
Reviewer Review Type Date Requested Status
Rafał Cieślak Approve
Review via email: mp+109439@code.launchpad.net

Description of the change

Added improvements to music added script with fixed recursion for sub-folders
Added Music in Rhythmbox award and script

To post a comment you must log in.
Revision history for this message
Rafał Cieślak (rafalcieslak256) wrote :

Thanks for your awesome work, Charles!
I have spotted some problems with your accomplishments, which caused them not to display in the viewer (have you actually tested them?). However, they were very simple, so I fixed them for you.
First thing was that your new accomplishment depended on itself - which made it always locked. Second - there was missing 'collection = ubuntu-desktop', and the category was incorrect, I changed it to 'category = Multimedia'. Also - the script file was not marked as executable.
Anyway, I am merging, that's a nice accomplishment, and thanks for fixing the added-music script! ;-)

review: Approve
Revision history for this message
Charles Profitt (cprofitt) wrote :

Rafal:

Thanks... I will make sure to check those better. I think I added the depends when I had two steps and removed it w/o testing again.

---- "Rafal Cieślak" <email address hidden> wrote:
> Review: Approve
>
> Thanks for your awesome work, Charles!
> I have spotted some problems with your accomplishments, which caused them not to display in the viewer (have you actually tested them?). However, they were very simple, so I fixed them for you.
> First thing was that your new accomplishment depended on itself - which made it always locked. Second - there was missing 'collection = ubuntu-desktop', and the category was incorrect, I changed it to 'category = Multimedia'. Also - the script file was not marked as executable.
> Anyway, I am merging, that's a nice accomplishment, and thanks for fixing the added-music script! ;-)
> --
> https://code.launchpad.net/~cprofitt/ubuntu-desktop-accomplishments/multimedia-added-music/+merge/109439
> You are the owner of lp:~cprofitt/ubuntu-desktop-accomplishments/multimedia-added-music.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'accomplishments/ubuntu-desktop/bn/multimedia/musicinrhythmbox.accomplishment'
2--- accomplishments/ubuntu-desktop/bn/multimedia/musicinrhythmbox.accomplishment 1970-01-01 00:00:00 +0000
3+++ accomplishments/ubuntu-desktop/bn/multimedia/musicinrhythmbox.accomplishment 2012-06-08 21:27:19 +0000
4@@ -0,0 +1,19 @@
5+[accomplishment]
6+title = Used Rhythmbox
7+description = You have used Rhythmbox.
8+category = Accessories:Accomplishments
9+icon = default.png
10+author = Charles Profitt <cprofitt@ubuntu.com>
11+depends=ubuntu-desktop/musicinrhythmbox
12+summary = Rhythmbox is a music player in Ubuntu. You can use it to play music from local or shared music stores, or on-line stream radios.
13+ This accomplishment is awarded when you have used added music to your Rhythmbox library
14+steps = Click the <i>Dash Home</i>
15+ Enter <i>Rhythmbox</i>
16+ You will be presented with the Rhythmbox application
17+ Click the <i>Rhythmbox</i> icon
18+ Right click the 'music' entry under library and choose 'import file...' for a single song or 'import folder...' for a folder of music
19+ Navigate to the folder or song desired
20+tips = You can even buy music through Rhythmbox
21+pitfalls = Using a network share could resultin Rhythmbox reporting that you have missing files if you have not mounted the share prior to launching Rhythmbox.
22+help = Click the <i>Help</i> menu.
23+
24
25=== added file 'accomplishments/ubuntu-desktop/en/multimedia/musicinrhythmbox.accomplishment'
26--- accomplishments/ubuntu-desktop/en/multimedia/musicinrhythmbox.accomplishment 1970-01-01 00:00:00 +0000
27+++ accomplishments/ubuntu-desktop/en/multimedia/musicinrhythmbox.accomplishment 2012-06-08 21:27:19 +0000
28@@ -0,0 +1,19 @@
29+[accomplishment]
30+title = Used Rhythmbox
31+description = You have used Rhythmbox.
32+category = Accessories:Accomplishments
33+icon = default.png
34+author = Charles Profitt <cprofitt@ubuntu.com>
35+depends=ubuntu-desktop/musicinrhythmbox
36+summary = Rhythmbox is a music player in Ubuntu. You can use it to play music from local or shared music stores, or on-line stream radios.
37+ This accomplishment is awarded when you have used added music to your Rhythmbox library
38+steps = Click the <i>Dash Home</i>
39+ Enter <i>Rhythmbox</i>
40+ You will be presented with the Rhythmbox application
41+ Click the <i>Rhythmbox</i> icon
42+ Right click the 'music' entry under library and choose 'import file...' for a single song or 'import folder...' for a folder of music
43+ Navigate to the folder or song desired
44+tips = You can even buy music through Rhythmbox
45+pitfalls = Using a network share could resultin Rhythmbox reporting that you have missing files if you have not mounted the share prior to launching Rhythmbox.
46+help = Click the <i>Help</i> menu.
47+
48
49=== added file 'accomplishments/ubuntu-desktop/pl/multimedia/musicinrhythmbox.accomplishment'
50--- accomplishments/ubuntu-desktop/pl/multimedia/musicinrhythmbox.accomplishment 1970-01-01 00:00:00 +0000
51+++ accomplishments/ubuntu-desktop/pl/multimedia/musicinrhythmbox.accomplishment 2012-06-08 21:27:19 +0000
52@@ -0,0 +1,19 @@
53+[accomplishment]
54+title = Used Rhythmbox
55+description = You have used Rhythmbox.
56+category = Accessories:Accomplishments
57+icon = default.png
58+author = Charles Profitt <cprofitt@ubuntu.com>
59+depends=ubuntu-desktop/musicinrhythmbox
60+summary = Rhythmbox is a music player in Ubuntu. You can use it to play music from local or shared music stores, or on-line stream radios.
61+ This accomplishment is awarded when you have used added music to your Rhythmbox library
62+steps = Click the <i>Dash Home</i>
63+ Enter <i>Rhythmbox</i>
64+ You will be presented with the Rhythmbox application
65+ Click the <i>Rhythmbox</i> icon
66+ Right click the 'music' entry under library and choose 'import file...' for a single song or 'import folder...' for a folder of music
67+ Navigate to the folder or song desired
68+tips = You can even buy music through Rhythmbox
69+pitfalls = Using a network share could resultin Rhythmbox reporting that you have missing files if you have not mounted the share prior to launching Rhythmbox.
70+help = Click the <i>Help</i> menu.
71+
72
73=== modified file 'scripts/ubuntu-desktop/multimedia/multimedia-added-music.py'
74--- scripts/ubuntu-desktop/multimedia/multimedia-added-music.py 2012-06-06 18:17:23 +0000
75+++ scripts/ubuntu-desktop/multimedia/multimedia-added-music.py 2012-06-08 21:27:19 +0000
76@@ -10,13 +10,30 @@
77 startStr = content[0:13]
78 if startStr == 'XDG_MUSIC_DIR':
79 musicDir = content
80+
81+# recursive function to go through sub-directories
82+def test_for_music(directory):
83+ dirList = os.listdir(directory)
84+ for fname in dirList:
85+ filepath = os.path.join(directory, fname)
86+ if os.path.isdir(filepath):
87+ test_for_music(filepath)
88+ else:
89+ filetype = commands.getstatusoutput('file -b "' +filepath + '"')
90+ if "audio" in filetype[1]:
91+ # audio file present
92+ sys.exit(0)
93+
94+
95+# removes extra characters around directory
96 musicDir = musicDir[21:]
97 musicDir = musicDir[:-2]
98-fileCount = commands.getstatusoutput('ls ~/'+musicDir+'/ -1 | wc -l')
99-fileCount = fileCount[1:]
100-if fileCount[0] == 0:
101- #user has no music
102- sys.exit(1)
103-else:
104- #user has music
105- sys.exit(0)
106+
107+music = os.path.join(homeDir, musicDir)
108+test_for_music(music)
109+
110+
111+
112+#user has no music
113+sys.exit(1)
114+
115
116=== added file 'scripts/ubuntu-desktop/multimedia/musicinrhythmbox.py'
117--- scripts/ubuntu-desktop/multimedia/musicinrhythmbox.py 1970-01-01 00:00:00 +0000
118+++ scripts/ubuntu-desktop/multimedia/musicinrhythmbox.py 2012-06-08 21:27:19 +0000
119@@ -0,0 +1,31 @@
120+#!/usr/bin/python
121+import commands, sys, os
122+homeDir = os.getenv("HOME")
123+path = os.path.join(homeDir,'.local/share/rhythmbox/rhythmdb.xml')
124+
125+
126+if os.path.exists(path):
127+ #user has used Rhythmbox now we need to test for the existence of music
128+ # test for the existence of <entry type="song"> in the rhythmdb.xml
129+ file = open(path)
130+
131+ # convert file to string
132+ data = file.read()
133+
134+ # we do not need to keep the file open
135+ file.close()
136+
137+ # test for the existence of a song in the file
138+ if "song" in data:
139+ #user has music in Rhythmbox
140+ sys.exit(0)
141+ # print "user has music"
142+ else:
143+ #user does not have music in Rhythmbox
144+ sys.exit(0)
145+ # print "user does not have music"
146+
147+else:
148+ # user has not used Rhythmbox
149+ sys.exit(1)
150+

Subscribers

People subscribed via source and target branches