Commits

Josep Batalle committed 7ad1b41

Delete debugs and comments.

Comments (0)

Files changed (4)

 Google Music for Amarok
 
-This script allows you to listen your music allocated in your Google Music account using Amarok.
+This script allows you to listen your music allocated in your account in Google Music in your Amarok player.
 
 INSTRUCTIONS
 Download this script and put it into scripts directory (usually ~/.kde/share/apps/amarok/scripts/). Then, active the script in your Amarok 
 	echo $url > url
 	url=$(sed 's/\\u0026/\&/g' url)
 #  url=${url//\\\0026/&}
-#	echo $url > url
-rm url
-rm url.json
+
+	rm url
+	rm url.json
 	echo $url
 }
 getList="getList"
 getUrlSong="getUrlSong"
-#echo $1>file1.txt
-#echo $action>file12.txt
-#echo $2>file2.txt
-#echo $3>file3.txt
+
 if [ "$action" == "$getList" ]; then
 	email=$2
 	password=$3
-	#echo $1>file232.txt
 	auth $email $password
 	return_val=$?
-#	echo $return_val>return.txt
+	echo $return_val>return.txt
 	if [ "$?" == "" ]; then
 		echo "offline"
 		echo $return_val>return.txt
     var Response = p.readAllStandardOutput();
     var textStream = new QTextStream(Response, QIODevice.ReadOnly);
     var tinyURL = textStream.readAll();
-    //Amarok.alert(args[1]);
-    //Amarok.alert(tinyURL) 
 }
 
 function getUrl(id) {
-    //  id="4abbd809-0d8e-3852-9301-a61a7f2fce3b";
     var dirScript = "../.kde4/share/apps/amarok/scripts/google_music/"; //~/Documents by default
     var nameScript = "google_music.sh"; //getUrl
     var args = new Array();
     args[0] = nameScript;
     args[1] = "getUrlSong";
     args[2] = id;
-    //Amarok.alert(id);
+
     var p = new QProcess();
     p.setWorkingDirectory(dirScript);
     p.start("sh", args, QIODevice.ReadOnly);
     var Response = p.readAllStandardOutput();
     var textStream = new QTextStream(Response, QIODevice.ReadOnly);
     var tinyURL = textStream.readAll();
-//    Amarok.alert(tinyURL);
     return tinyURL;
 }
 
     }
     else{
     	return null;    	
-    	}
+    }
 }
 
 function ScriptBaseDir() {
 var delayedArgs = null;
 var update = true;
 
-var myRadioService = new RadioService("RADIO SERVICE", "aaa", "HTML DEscription", "aaaaaa", "Message");
+//var myRadioService = new RadioService("RADIO SERVICE", "aaa", "HTML DEscription", "aaaaaa", "Message");
+var myRadioService = new RadioService("Google Music SERVICE", "", "Listen your uploaded Music!", "", "You need a Google Music Account");
 var categoryName = "Google Music";
 var categoryImageFullPath = ScriptBaseDir() + "/Defaults/Category.default.image.png";
 var categoryHtmlDescr = "text";
 var serviceDataJson;
 
 function newItems() {
-    Amarok.debug("save stations");
-    Amarok.debug(ScriptBaseDir());	
-	
     serviceDataJson = ImportJsonFile(ListFiles(ScriptBaseDir(), "ListSongs.json")[0]);
     if(serviceDataJson != null){
     	var categoryObj = myRadioService.addCategory(categoryName, categoryImageFullPath, categoryHtmlDescr);
 
 function GoogleMusicforAmarok() {
     ScriptableServiceScript.call(this, "Google Music for Amarok", 2, "Songs allocated in Google music", "GoogleMusic2", false);
-    Amarok.debug("ok.");
 }
 
 function onConfigure() {
 }
 
 function onPopulating(level, callbackData, filter) {
-    Amarok.debug("ON POPULATING--------------------------------------------");
     if (update == true) {
         delayedArgs = [level, callbackData, filter];
         newItems();
     }
     update = true;
     Amarok.debug("Populating... " + level);
-    //Amarok.alert("CAllback... "+callbackData);
 
-    Amarok.debug("Number of categories: " + myRadioService.categoriesList.length);
     if (level == 1) {
         for (var cat_index = 0; cat_index < myRadioService.categoriesList.length; cat_index++) {
             var category = myRadioService.categoriesList[cat_index];
             var stationsList = category.stationsList;
             for (var sta_index = 0; sta_index < stationsList.length; sta_index++) {
                 var station = stationsList[sta_index];
-                Amarok.debug("DEBUUUUUUG             " + station.stationName);
                 item = Amarok.StreamItem;
                 item.level = 0;
                 item.callbackData = "";
     var google_for_amarok = "Google Music";
     if (Amarok.Playlist.trackAt(row).album == google_for_amarok) {
         //  Amarok.alert(Amarok.Playlist.trackAt(row).album);
-
         var uri = getUrl(Amarok.Playlist.trackAt(row).path);
         uri = uri.replace(/[\n\r]/g, ''); //delete carrier return
         Amarok.debug(uri);
 }
 Amarok.Playlist.trackInserted.connect(getNewURL);
 
-
-
 function onCustomize() {
     var currentDir = Amarok.Info.scriptPath() + "/";
     var iconPixmap = new QPixmap(currentDir + "icon.png");
 }
 
 Amarok.configured.connect(onConfigure);
-
-
 script = new GoogleMusicforAmarok();
 script.populate.connect(onPopulating);
-script.customize.connect(onCustomize);
+script.customize.connect(onCustomize);