Merge lp:~openshift/picard/script_adds_and_misc into lp:~musicbrainz-developers/picard/trunk

Proposed by Carlin Mangar
Status: Merged
Merge reported by: Lukáš Lalinský
Merged at revision: not available
Proposed branch: lp:~openshift/picard/script_adds_and_misc
Merge into: lp:~musicbrainz-developers/picard/trunk
Diff against target: 79 lines
2 files modified
picard/script.py (+28/-0)
resources/img-src/Copyright.htm (+8/-8)
To merge this branch: bzr merge lp:~openshift/picard/script_adds_and_misc
Reviewer Review Type Date Requested Status
Lukáš Lalinský Approve
Review via email: mp+13889@code.launchpad.net

This proposal supersedes a proposal from 2009-10-22.

To post a comment you must log in.
Revision history for this message
Lukáš Lalinský (luks) wrote :

Looks good now.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'picard/script.py'
2--- picard/script.py 2009-03-14 23:07:40 +0000
3+++ picard/script.py 2009-10-24 13:40:23 +0000
4@@ -2,6 +2,9 @@
5 #
6 # Picard, the next-generation MusicBrainz tagger
7 # Copyright (C) 2006-2007 Lukáš Lalinský
8+# Copyright (C) 2007 Javier Kohen
9+# Copyright (C) 2008 Philipp Wolfer
10+#
11 #
12 # This program is free software; you can redistribute it and/or
13 # modify it under the terms of the GNU General Public License
14@@ -18,6 +21,7 @@
15 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16
17 import re
18+import unicodedata
19 from picard.plugin import ExtensionPoint
20
21 class ScriptError(Exception): pass
22@@ -460,6 +464,26 @@
23 return str(parser.file.parent.album.get_num_matched_tracks())
24 return "0"
25
26+def func_firstalphachar(parser, text, nonalpha="#"):
27+ if len(text) == 0:
28+ return nonalpha
29+ firstchar = text[0]
30+ if firstchar.isalpha():
31+ return firstchar.upper()
32+ else:
33+ return nonalpha
34+
35+def func_initials(parser, text):
36+ return "".join(a[:1] for a in text.split(" ") if a[:1].isalpha())
37+
38+def func_firstwords(parser, text, length):
39+ if len(text) <= length:
40+ return text
41+ else:
42+ return text[:length].rsplit(' ', 1)[0]
43+
44+def func_truncate(parser, text, length):
45+ return text[:length].rtrim()
46
47 register_script_function(func_if, "if", eval_args=False)
48 register_script_function(func_if2, "if2", eval_args=False)
49@@ -497,3 +521,7 @@
50 register_script_function(func_len, "len")
51 register_script_function(func_performer, "performer")
52 register_script_function(func_matchedtracks, "matchedtracks")
53+register_script_function(func_firstalphachar, "firstalphachar")
54+register_script_function(func_initials, "initials")
55+register_script_function(func_firstwords, "firstwords")
56+register_script_function(func_truncate, "truncate")
57
58=== modified file 'resources/img-src/Copyright.htm'
59--- resources/img-src/Copyright.htm 2009-09-22 00:34:36 +0000
60+++ resources/img-src/Copyright.htm 2009-10-24 13:40:23 +0000
61@@ -1,9 +1,9 @@
62-<html>
63-</header>
64-<body>
65-<div style="font-family:sans-serif;font-size:11px;width:400px;" align="center">
66-<a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/2.0/uk/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-nc-sa/2.0/uk/88x31.png" /></a><br /><span xmlns:dc="http://purl.org/dc/elements/1.1/" href="http://purl.org/dc/dcmitype/StillImage" property="dc:title" rel="dc:type">Picard Icon Set</span> by <span xmlns:cc="http://creativecommons.org/ns#" property="cc:attributionName">Carlin Mangar</span> is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/2.0/uk/">Creative Commons Attribution-Non-Commercial-Share Alike 2.0 UK: England &amp; Wales License</a>.
67-</div>
68-</p>
69-</body>
70+<html>
71+</header>
72+<body>
73+<div style="font-family:sans-serif;font-size:11px;width:400px;" align="center">
74+<a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/2.0/uk/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-nc-sa/2.0/uk/88x31.png" /></a><br /><span xmlns:dc="http://purl.org/dc/elements/1.1/" href="http://purl.org/dc/dcmitype/StillImage" property="dc:title" rel="dc:type">Picard Icon Set</span> by <span xmlns:cc="http://creativecommons.org/ns#" property="cc:attributionName">Carlin Mangar</span> is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/2.0/uk/">Creative Commons Attribution-Non-Commercial-Share Alike 2.0 UK: England &amp; Wales License</a>.
75+</div>
76+</p>
77+</body>
78 </html>
79\ No newline at end of file

Subscribers

People subscribed via source and target branches

to status/vote changes: