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
=== added file 'accomplishments/ubuntu-desktop/bn/multimedia/musicinrhythmbox.accomplishment'
--- accomplishments/ubuntu-desktop/bn/multimedia/musicinrhythmbox.accomplishment 1970-01-01 00:00:00 +0000
+++ accomplishments/ubuntu-desktop/bn/multimedia/musicinrhythmbox.accomplishment 2012-06-08 21:27:19 +0000
@@ -0,0 +1,19 @@
1[accomplishment]
2title = Used Rhythmbox
3description = You have used Rhythmbox.
4category = Accessories:Accomplishments
5icon = default.png
6author = Charles Profitt <cprofitt@ubuntu.com>
7depends=ubuntu-desktop/musicinrhythmbox
8summary = 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.
9 This accomplishment is awarded when you have used added music to your Rhythmbox library
10steps = Click the <i>Dash Home</i>
11 Enter <i>Rhythmbox</i>
12 You will be presented with the Rhythmbox application
13 Click the <i>Rhythmbox</i> icon
14 Right click the 'music' entry under library and choose 'import file...' for a single song or 'import folder...' for a folder of music
15 Navigate to the folder or song desired
16tips = You can even buy music through Rhythmbox
17pitfalls = Using a network share could resultin Rhythmbox reporting that you have missing files if you have not mounted the share prior to launching Rhythmbox.
18help = Click the <i>Help</i> menu.
19
020
=== added file 'accomplishments/ubuntu-desktop/en/multimedia/musicinrhythmbox.accomplishment'
--- accomplishments/ubuntu-desktop/en/multimedia/musicinrhythmbox.accomplishment 1970-01-01 00:00:00 +0000
+++ accomplishments/ubuntu-desktop/en/multimedia/musicinrhythmbox.accomplishment 2012-06-08 21:27:19 +0000
@@ -0,0 +1,19 @@
1[accomplishment]
2title = Used Rhythmbox
3description = You have used Rhythmbox.
4category = Accessories:Accomplishments
5icon = default.png
6author = Charles Profitt <cprofitt@ubuntu.com>
7depends=ubuntu-desktop/musicinrhythmbox
8summary = 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.
9 This accomplishment is awarded when you have used added music to your Rhythmbox library
10steps = Click the <i>Dash Home</i>
11 Enter <i>Rhythmbox</i>
12 You will be presented with the Rhythmbox application
13 Click the <i>Rhythmbox</i> icon
14 Right click the 'music' entry under library and choose 'import file...' for a single song or 'import folder...' for a folder of music
15 Navigate to the folder or song desired
16tips = You can even buy music through Rhythmbox
17pitfalls = Using a network share could resultin Rhythmbox reporting that you have missing files if you have not mounted the share prior to launching Rhythmbox.
18help = Click the <i>Help</i> menu.
19
020
=== added file 'accomplishments/ubuntu-desktop/pl/multimedia/musicinrhythmbox.accomplishment'
--- accomplishments/ubuntu-desktop/pl/multimedia/musicinrhythmbox.accomplishment 1970-01-01 00:00:00 +0000
+++ accomplishments/ubuntu-desktop/pl/multimedia/musicinrhythmbox.accomplishment 2012-06-08 21:27:19 +0000
@@ -0,0 +1,19 @@
1[accomplishment]
2title = Used Rhythmbox
3description = You have used Rhythmbox.
4category = Accessories:Accomplishments
5icon = default.png
6author = Charles Profitt <cprofitt@ubuntu.com>
7depends=ubuntu-desktop/musicinrhythmbox
8summary = 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.
9 This accomplishment is awarded when you have used added music to your Rhythmbox library
10steps = Click the <i>Dash Home</i>
11 Enter <i>Rhythmbox</i>
12 You will be presented with the Rhythmbox application
13 Click the <i>Rhythmbox</i> icon
14 Right click the 'music' entry under library and choose 'import file...' for a single song or 'import folder...' for a folder of music
15 Navigate to the folder or song desired
16tips = You can even buy music through Rhythmbox
17pitfalls = Using a network share could resultin Rhythmbox reporting that you have missing files if you have not mounted the share prior to launching Rhythmbox.
18help = Click the <i>Help</i> menu.
19
020
=== modified file 'scripts/ubuntu-desktop/multimedia/multimedia-added-music.py'
--- scripts/ubuntu-desktop/multimedia/multimedia-added-music.py 2012-06-06 18:17:23 +0000
+++ scripts/ubuntu-desktop/multimedia/multimedia-added-music.py 2012-06-08 21:27:19 +0000
@@ -10,13 +10,30 @@
10 startStr = content[0:13]10 startStr = content[0:13]
11 if startStr == 'XDG_MUSIC_DIR':11 if startStr == 'XDG_MUSIC_DIR':
12 musicDir = content12 musicDir = content
13
14# recursive function to go through sub-directories
15def test_for_music(directory):
16 dirList = os.listdir(directory)
17 for fname in dirList:
18 filepath = os.path.join(directory, fname)
19 if os.path.isdir(filepath):
20 test_for_music(filepath)
21 else:
22 filetype = commands.getstatusoutput('file -b "' +filepath + '"')
23 if "audio" in filetype[1]:
24 # audio file present
25 sys.exit(0)
26
27
28# removes extra characters around directory
13musicDir = musicDir[21:]29musicDir = musicDir[21:]
14musicDir = musicDir[:-2]30musicDir = musicDir[:-2]
15fileCount = commands.getstatusoutput('ls ~/'+musicDir+'/ -1 | wc -l')31
16fileCount = fileCount[1:]32music = os.path.join(homeDir, musicDir)
17if fileCount[0] == 0:33test_for_music(music)
18 #user has no music34
19 sys.exit(1)35
20else:36
21 #user has music37#user has no music
22 sys.exit(0)38sys.exit(1)
39
2340
=== added file 'scripts/ubuntu-desktop/multimedia/musicinrhythmbox.py'
--- scripts/ubuntu-desktop/multimedia/musicinrhythmbox.py 1970-01-01 00:00:00 +0000
+++ scripts/ubuntu-desktop/multimedia/musicinrhythmbox.py 2012-06-08 21:27:19 +0000
@@ -0,0 +1,31 @@
1#!/usr/bin/python
2import commands, sys, os
3homeDir = os.getenv("HOME")
4path = os.path.join(homeDir,'.local/share/rhythmbox/rhythmdb.xml')
5
6
7if os.path.exists(path):
8 #user has used Rhythmbox now we need to test for the existence of music
9 # test for the existence of <entry type="song"> in the rhythmdb.xml
10 file = open(path)
11
12 # convert file to string
13 data = file.read()
14
15 # we do not need to keep the file open
16 file.close()
17
18 # test for the existence of a song in the file
19 if "song" in data:
20 #user has music in Rhythmbox
21 sys.exit(0)
22 # print "user has music"
23 else:
24 #user does not have music in Rhythmbox
25 sys.exit(0)
26 # print "user does not have music"
27
28else:
29 # user has not used Rhythmbox
30 sys.exit(1)
31

Subscribers

People subscribed via source and target branches