
G15 Show Tune
Source (link to git-repo or to original if based on someone elses unmodified work):
G15 daemon has to be running before you attempt to use this script.
This script has been now merged with Robert Riemann's G15 Amarok Plugin Plus (http://www.kde-apps.org/content/show.php/G15+Amarok+Plugin+Plus?content=76743) and officially replaces it.
The 2.3 release was put together completely by Robert Riemann, with the patches from Alex Richardson and Lambert Belkiss. Thank you guys and sorry for the slow turnaround time from my side - my own G15 is broken atm.
2010-12-30: Version 2.3
* Fixed the text encoding for Latin-1 encoded tags (patch by Alex Richardson)
* Fixed wrong song duration due amarok api change (patch by Lambert Belkiss)
* Show alert message in the case of g15composer not found in $PATH
2009-03-10: Version 2.2
* Fixed the text encoding for Latin-1 encoded tags
* Code cleanups, fixed up the spec file, fixed changelog
* This script is now official successor of the G15 Amarok Plugin Plus
2009-03-09: Version 2.1
* Changed encoding for the displayed text from ISO-8859-1 to IBM 850.
2009-03-07: Version 2.0
* Fixes from Robert Riemann, now it starts the composer automatically, more fancy display, merged with his
G15 Amarok Plugin Plus (http://www.kde-apps.org/content/show.php/G15+Amarok+Plugin+Plus?content=76743)
2008-11-02: Version 1.0
* Initial release
Ratings & Comments
3 Comments
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();
If g15composer is not present it hangs whole amarok. There should be some check for g15composer and warning if it's not found. Nice script anyway :)
Hello, here is a small patch for your script (it seems the total time is returned in ms now) http://www.paste.to/v/kjb3ul1b Thank you for the app ! belkiss Here is a link on paste.to