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

Proposed by Charles Profitt
Status: Merged
Merged at revision: 77
Proposed branch: lp:~cprofitt/ubuntu-desktop-accomplishments/multimedia-added-photos
Merge into: lp:ubuntu-desktop-accomplishments
Diff against target: 67 lines (+49/-0)
3 files modified
CATEGORIES (+1/-0)
accomplishments/ubuntu-desktop/en/multimedia/multimedia-added-photos.accomplishment (+9/-0)
scripts/ubuntu-desktop/multimedia/multimedia-added-photos.py (+39/-0)
To merge this branch: bzr merge lp:~cprofitt/ubuntu-desktop-accomplishments/multimedia-added-photos
Reviewer Review Type Date Requested Status
Rafał Cieślak Approve
Review via email: mp+109443@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Rafał Cieślak (rafalcieslak256) wrote :

Thanks for this MP, Charles.
Although the script looks perfect, the documentation is far too brief. Would you mind expanding it a bit, explaining that images are usually kept in their directory, and maybe a note on how to do this? Note that this accomplishment documentation if for newbies, so although it seems obvious, it may be good to explain it at least a bit.
Also, your .accomplishment files does not contain 'collection = ubuntu-community' line, which is necessary.

I have also a tip for you: there is no need to copy your accomplishment to pl and bn directories - if you use the 0.2 daemon (available and almost stable in daily builds PPA), it will use the file from en directory, if there is no equivalent in a localized dir - so it saves some efforts (especially in UCA, where we have already ~30 localized directories) :)
Thanks again for your awesome work!

review: Needs Fixing
17. By Charles Profitt <email address hidden>

changed accomplishment file

18. By Charles Profitt <email address hidden>

added more description to photos description

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

Added a bit more, but not sure if it is enough.

Charles

On Sun, 2012-06-10 at 11:56 +0000, Rafal Cieślak wrote:
> Review: Needs Fixing
>
> Thanks for this MP, Charles.
> Although the script looks perfect, the documentation is far too brief. Would you mind expanding it a bit, explaining that images are usually kept in their directory, and maybe a note on how to do this? Note that this accomplishment documentation if for newbies, so although it seems obvious, it may be good to explain it at least a bit.
> Also, your .accomplishment files does not contain 'collection = ubuntu-community' line, which is necessary.
>
> I have also a tip for you: there is no need to copy your accomplishment to pl and bn directories - if you use the 0.2 daemon (available and almost stable in daily builds PPA), it will use the file from en directory, if there is no equivalent in a localized dir - so it saves some efforts (especially in UCA, where we have already ~30 localized directories) :)
> Thanks again for your awesome work!

Revision history for this message
Rafał Cieślak (rafalcieslak256) wrote :

This is not satisfying, but let's consider this a bug, so that others may expand it.
Thanks again Charles for this accom, I have just merged it in! And sorry for the delay.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CATEGORIES'
2--- CATEGORIES 2012-05-19 18:08:54 +0000
3+++ CATEGORIES 2012-06-10 19:57:18 +0000
4@@ -4,3 +4,4 @@
5
6 Audio and Video
7 Games
8+Multimedia
9
10=== added file 'accomplishments/ubuntu-desktop/en/multimedia/multimedia-added-photos.accomplishment'
11--- accomplishments/ubuntu-desktop/en/multimedia/multimedia-added-photos.accomplishment 1970-01-01 00:00:00 +0000
12+++ accomplishments/ubuntu-desktop/en/multimedia/multimedia-added-photos.accomplishment 2012-06-10 19:57:18 +0000
13@@ -0,0 +1,9 @@
14+[accomplishment]
15+title = Added Photos
16+description = You have added photos to your computer
17+category = Multimedia
18+icon = default.png
19+author = Charles Profitt <cprofitt@ubuntu.com>
20+collection = ubuntu-desktop
21+summary = Ubuntu has many great applications to help you edit and manage your photos, but the first step is adding photos to your computer. When you add images to your <i>pictures folder</i> you will earn this accomplishment.
22+
23
24=== added file 'scripts/ubuntu-desktop/multimedia/multimedia-added-photos.py'
25--- scripts/ubuntu-desktop/multimedia/multimedia-added-photos.py 1970-01-01 00:00:00 +0000
26+++ scripts/ubuntu-desktop/multimedia/multimedia-added-photos.py 2012-06-10 19:57:18 +0000
27@@ -0,0 +1,39 @@
28+#!/usr/bin/python
29+import commands, sys, os
30+homeDir = os.getenv("HOME")
31+path = os.path.join(homeDir,'.config/user-dirs.dirs')
32+result = open(path, "r")
33+content = result.readline()
34+while (content != "" ):
35+ content.replace( "\n", "" )
36+ content = result.readline()
37+ startStr = content[0:16]
38+ if startStr == 'XDG_PICTURES_DIR':
39+ photosDir = content
40+ print photosDir
41+
42+# recursive function to go through sub-directories
43+def test_for_images(directory):
44+ dirList = os.listdir(directory)
45+ for fname in dirList:
46+ filepath = os.path.join(directory, fname)
47+ if os.path.isdir(filepath):
48+ test_for_images(filepath)
49+ else:
50+ filetype = commands.getstatusoutput('file -b "' +filepath + '"')
51+ if "image" in filetype[1]:
52+ # image file present
53+ sys.exit(0)
54+
55+
56+# removes extra characters around directory
57+photosDir = photosDir[24:]
58+photosDir = photosDir[:-2]
59+
60+photos = os.path.join(homeDir, photosDir)
61+test_for_images(photos)
62+
63+
64+
65+#user has no images
66+sys.exit(1)
67\ No newline at end of file

Subscribers

People subscribed via source and target branches