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
=== modified file 'picard/script.py'
--- picard/script.py 2009-03-14 23:07:40 +0000
+++ picard/script.py 2009-10-24 13:40:23 +0000
@@ -2,6 +2,9 @@
2#2#
3# Picard, the next-generation MusicBrainz tagger3# Picard, the next-generation MusicBrainz tagger
4# Copyright (C) 2006-2007 Lukáš Lalinský4# Copyright (C) 2006-2007 Lukáš Lalinský
5# Copyright (C) 2007 Javier Kohen
6# Copyright (C) 2008 Philipp Wolfer
7#
5#8#
6# This program is free software; you can redistribute it and/or9# This program is free software; you can redistribute it and/or
7# modify it under the terms of the GNU General Public License10# modify it under the terms of the GNU General Public License
@@ -18,6 +21,7 @@
18# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.21# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
1922
20import re23import re
24import unicodedata
21from picard.plugin import ExtensionPoint25from picard.plugin import ExtensionPoint
2226
23class ScriptError(Exception): pass27class ScriptError(Exception): pass
@@ -460,6 +464,26 @@
460 return str(parser.file.parent.album.get_num_matched_tracks())464 return str(parser.file.parent.album.get_num_matched_tracks())
461 return "0"465 return "0"
462466
467def func_firstalphachar(parser, text, nonalpha="#"):
468 if len(text) == 0:
469 return nonalpha
470 firstchar = text[0]
471 if firstchar.isalpha():
472 return firstchar.upper()
473 else:
474 return nonalpha
475
476def func_initials(parser, text):
477 return "".join(a[:1] for a in text.split(" ") if a[:1].isalpha())
478
479def func_firstwords(parser, text, length):
480 if len(text) <= length:
481 return text
482 else:
483 return text[:length].rsplit(' ', 1)[0]
484
485def func_truncate(parser, text, length):
486 return text[:length].rtrim()
463487
464register_script_function(func_if, "if", eval_args=False)488register_script_function(func_if, "if", eval_args=False)
465register_script_function(func_if2, "if2", eval_args=False)489register_script_function(func_if2, "if2", eval_args=False)
@@ -497,3 +521,7 @@
497register_script_function(func_len, "len")521register_script_function(func_len, "len")
498register_script_function(func_performer, "performer")522register_script_function(func_performer, "performer")
499register_script_function(func_matchedtracks, "matchedtracks")523register_script_function(func_matchedtracks, "matchedtracks")
524register_script_function(func_firstalphachar, "firstalphachar")
525register_script_function(func_initials, "initials")
526register_script_function(func_firstwords, "firstwords")
527register_script_function(func_truncate, "truncate")
500528
=== modified file 'resources/img-src/Copyright.htm'
--- resources/img-src/Copyright.htm 2009-09-22 00:34:36 +0000
+++ resources/img-src/Copyright.htm 2009-10-24 13:40:23 +0000
@@ -1,9 +1,9 @@
1<html>1<html>
2</header>2</header>
3<body>3<body>
4<div style="font-family:sans-serif;font-size:11px;width:400px;" align="center">4<div style="font-family:sans-serif;font-size:11px;width:400px;" align="center">
5<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>.5<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>.
6</div>6</div>
7</p>7</p>
8</body>8</body>
9</html>9</html>
10\ No newline at end of file10\ No newline at end of file

Subscribers

People subscribed via source and target branches

to status/vote changes: