Image 01
profile-image

arichardson

Alex Richardson , Germany
Okteta Structure Definitions
test
G15 Show Tune

Amarok 2.x Scripts 3 comments

by janoc
Score 58.0%
Jan 01 2011
This should fix some chars not being displayed properly (i.e. German Umlauts)



diff -U 3 -H -d -r -N -- G15_Show_Tune/main.js G15_Show_Tune_upd/main.js
--- G15_Show_Tune/main.js 2010-08-18 15:58:40.053998954 +0200
+++ G15_Show_Tune_upd/main.js 2010-08-18 15:56:14.000000000 +0200
@@ -50,24 +50,6 @@
return result;
}

-function convertCP437( string )
-{
- //string = "�rzte";
-
- // convert original Latin1 text to Unicode
- codecLatin1 = new QTextCodec.codecForName(new QByteArray("ISO 8859-1"));
- unicode_str = codecLatin1.toUnicode(new QByteArray(string));
-
- // now transcode Unicode to IBM 850/CP437
- codec850 = new QTextCodec.codecForName(new QByteArray("IBM 850"));
- output = codec850.fromUnicode(unicode_str).toString();
-
- // Amarok.alert(t.readAll());
- return output;
-}
-// Amarok.alert( convertCP437( "�rzte" ) ); // Just an convertion check
-
-
function startComposer()
{
if(!composerProcess)
@@ -145,14 +127,14 @@
var rating = trackinfo.rating;
var filetype = trackinfo.type;
var bitrate = trackinfo.bitrate;
- var result = "MC 1\n" +
+ var result = "MC 1\n" +
"TO 2 2 1 0 \"Track \"\n" +
- "TO 31 2 2 0 \"" + convertCP437( title.substring(pos_t, pos_t + 16)) + "\"\n" +
+ "TO 31 2 2 0 \"" + title.substring(pos_t, pos_t + 16) + "\"\n" +
"DB 0 11 159 11 1 " + currentTime + " " + totalTime + " 1\n" +
"TO 2 15 1 0 \"Band \"\n" +
- "TO 31 15 2 0 \"" + convertCP437( artist.substring(pos_b, pos_b + 16)) + "\"\n" +
+ "TO 31 15 2 0 \"" + artist.substring(pos_b, pos_b + 16) + "\"\n" +
"TO 2 24 1 0 \"Album \"\n" +
- "TO 31 24 2 0 \"" + convertCP437( album.substring(pos_a, pos_a + 16))+ "\"\n" +
+ "TO 31 24 2 0 \"" + album.substring(pos_a, pos_a + 16) + "\"\n" +
"DL 1 32 158 32 1\n" +
"TO 2 34 1 0 \"" + time + "\"\n" +
"TO 2 34 1 1 \"rating: " + rating + "\"\n" +
@@ -160,7 +142,8 @@
"PB 0 0 159 42\n" +
"MC 0";
amarok_stream.writeString("PC 0\n");
- amarok_stream.writeString(result + "\n");
+ amarok_stream.writeString(result);
+ amarok_stream.writeString("\n");
amarok_stream.flush();
// Amarok.alert(trackinfo);
} else {
@@ -195,6 +178,7 @@
amarok_pipe = new QFile(amarok_pipe_name);
amarok_pipe.open(new QIODevice.OpenMode(QIODevice.WriteOnly));
amarok_stream = new QTextStream(amarok_pipe);
+amarok_stream.setCodec(QTextCodec.codecForName(new QByteArray("IBM 850")));

// set up timer
timer = new QTimer();
- Aug 18 2010