Script.py additions, and some EOL conversions.

Also include a slightly improved build string for betas.
This commit is contained in:
Carlin Mangar
2009-10-22 15:38:38 +11:00
parent 2c94e18047
commit 6fee2ff1a0
3 changed files with 33 additions and 9 deletions

View File

@@ -25,7 +25,7 @@ if version_info[3] == 'final':
else:
version_string = '%d.%d.%d' % version_info[:3]
else:
version_string = '%d.%d.%d%s%d' % version_info
version_string = '%d.%d.%d_%s%d' % version_info
__version__ = version_string
api_versions = ["0.10.0", "0.11.0", "0.12.0"]

View File

@@ -2,6 +2,9 @@
#
# Picard, the next-generation MusicBrainz tagger
# Copyright (C) 2006-2007 Lukáš Lalinský
# Copyright (C) 2007 Javier Kohen
# Copyright (C) 2008 Philipp Wolfer
#
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@@ -18,6 +21,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
import re
import unicodedata
from picard.plugin import ExtensionPoint
class ScriptError(Exception): pass
@@ -460,6 +464,23 @@ def func_matchedtracks(parser, arg):
return str(parser.file.parent.album.get_num_matched_tracks())
return "0"
def func_firstalphachar(parser, text, nonalpha="#"):
if len(text) == 0:
return nonalpha
firstchar = text[0]
if firstchar.isalpha():
return firstchar.upper()
else:
return nonalpha
def func_initials(parser, text):
return "".join(a[:1] for a in text.split(" ") if a[:1].isalpha())
def func_trunc(parser, text, length):
if len(text) <= length:
return text
else:
return text[:length].rsplit(' ', 1)[0]
register_script_function(func_if, "if", eval_args=False)
register_script_function(func_if2, "if2", eval_args=False)
@@ -497,3 +518,6 @@ register_script_function(func_copy, "copy")
register_script_function(func_len, "len")
register_script_function(func_performer, "performer")
register_script_function(func_matchedtracks, "matchedtracks")
register_script_function(func_firstalphachar, "firstalphachar")
register_script_function(func_initials, "initials")
register_script_function(func_trunc, "trunc")

View File

@@ -1,9 +1,9 @@
<html>
</header>
<body>
<div style="font-family:sans-serif;font-size:11px;width:400px;" align="center">
<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>.
</div>
</p>
</body>
<html>
</header>
<body>
<div style="font-family:sans-serif;font-size:11px;width:400px;" align="center">
<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>.
</div>
</p>
</body>
</html>