Commits

Josep Batalle committed 4ced495

Finals ...

Comments (0)

Files changed (7)

+Google Music for Amarok
+
+This script allows you to listen your music allocated in your account in Google Music in your Amarok player.
+
+AVAILABLE NETWORKS
+
+INSTRUCTIONS
+Download this script and put it into scripts directory (usually ~/.kde/share/apps/amarok/scripts/). Then, active the script in your Amarok 
+configuration.
+
+Once the plugin is installed, you can see a new option in Tools Menu. Here you have to put your google account. Then, you can see a new 
+collection with your songs.
+
+At this moment is only a basic system, works fine but needs more little changes in order to improve the reliability.
 
 Amarok.Window.addToolsMenu("Googlemusic", "Configure Google Music...", Amarok.Info.scriptPath() + "/images/logo.png");
 Amarok.Window.ToolsMenu.Googlemusic['triggered()'].connect(configureDialog);
+Amarok.Window.addToolsSeparator();
+Amarok.Window.addToolsMenu("updateList", "Update Google Music List", Amarok.Info.scriptPath() + "/icon.png");
+Amarok.Window.ToolsMenu.updateList['triggered()'].connect(updateListJson);
+
+function updateListJson() {
+    executeScript();
+    update = false;
+    newItems();
+    Amarok.alert("Your music list is updated... Restart Amarok please.");
+}
 
 function configurationEditor() {
     this.window = new QMainWindow(this);
         helpWindow.events();
     };
 
+this.repo = function (){
+	browser = new QProcess();
+	browser.start("xdg-open", ["https://bitbucket.org/jbatalle/google-music-for-amarok"]);
+	};
     this.web = function () {
         browser = new QProcess();
         browser.start("xdg-open", ["http://kde-apps.org/content/show.php?content=155090"]);
     this.dialog.sizeHint = new QSize(350, 400);
     this.dialog.size = new QSize(350, 400);
     this.window.move(W, H);
-    this.window.setWindowTitle("Configure - SocialRok");
+    this.window.setWindowTitle("Configure - Google Music");
     this.window.windowIcon = new QIcon(Amarok.Info.scriptPath() + "/images/logo.png");
     this.window.setCentralWidget(this.dialog);
 
     this.helpMenu = this.window.menuBar().addMenu("Help");
     this.helpHlp = this.helpMenu.addAction(new QIcon(Amarok.Info.scriptPath() + "/images/help.png"), "Help");
     this.helpHlp.triggered.connect(this, this.help);
+    this.helpRepo = this.helpMenu.addAction(new QIcon(Amarok.Info.scriptPath() + "/images/logo.png"), "Repository");
+    this.helpRepo.triggered.connect(this, this.repo);
     this.helpWeb = this.helpMenu.addAction(new QIcon(Amarok.Info.scriptPath() + "/images/logo.png"), "WebSite");
     this.helpWeb.triggered.connect(this, this.web);
 
     helpText = "<h3>How to configure Google Music for Amarok</h3>";
     helpText += "This app allows you to listen the music that you have uploaded in Google Music!<br /><br />";
     helpText += "In order to listen your music you need an account on Google Music.<br>";
-    helpText += "To grant access to the Google Music click on <b>Tools</b> menu put your username and password of Google. ";
+    helpText += "To grant access to the Google Music click on <b>Tools</b> menu and put your username and password of Google. ";
     helpText += "<i>This actions require a restart of Amarok, or alternatively reload the Script.</i><br /><br />";
     helpText += "<b>Username:</b> Your username/email used in Google.<br />";
     helpText += "<b>Password:</b> Your password.<br />";
-    helpText += "<b>Skype Tab</b><br />";
-    helpText += "If you have a Skype account, you can authorize SocialRok to change the mood text on every track change. To do this, you must have Skype installed and running. When Skype will ask you to allow SocialRok to change mood text check \"Remember this selection\" and then click YES! To work, curl and python-dbus must be installed in your system.<br /><br />";
-    helpText += "<b>Flickr Tab</b><br />";
-    helpText += "If you have a Flickr account, you can authorize SocialRok to upload the Cover Arts on your space so you can post the Covers on Facebook as a link instead of as a normal picture, if you're interested to this option, go to Grant Access page for Facebook and after Login you can Grant Access for Flickr. This option can also be activated after you have already Granted Access to Facebook.<br /><br />";
+    helpText += "<br/><b>Google Music</b><br />";
+    helpText += "The extracted url only can player one time. After listen a song, if you want to listen again the same song, you need to load another time the song.<br /><br />";
+    helpText += "<b>Next versions</b><br />";
+    helpText += "In the following versions I try to improve these. If you want to collaborate with this script, you are free to do it. And also you can contact with me if you have a question.<br /><br />";
 
 
     var QRect = new QDesktopWidget;

docs/CHANGELOG.txt

-v1.6:
-- Added button to manually chat playing track in all Skype open chats. 
-- Added option to chat playing track in all Skype open chats on every track change.
-- Fixed some bugs on changing mood text on Skype.
-- Created a workaround for Amarok bug that on track Change gives multiple notify. (I hope)
-
-v1.5:
-- Retrieves more descriptive informations on errors when sends post fails, especially on facebook that has the API quite selective, so you can get an idea of what's wrong!
-
-v1.4:
-- Many bugs correct on server side. (The correction of these errors is continuous and is not necessarily linked to release of new versions.)
-- Force resizing to 100x100 for cover art when uploading on Flickr, 
-  because Facebook uses 75x75 image as link and as result the operation is more fast and there are minor possibility of errors.
-- Added skype as Social Networks (curl and python-dbus must be installed.)
-- Changed the method for open the web pages.
-- Fixed minor graphics bugs.
-
-v1.3:
-- Added Flickr option, for upload Cover Arts in a space that allows to create a link instead of as normal picture when you post on Facebook. Read the Help for the Configuration.
-- Implemented Google+ in the code but disabled it because the API actually is read only.
-
-v1.2:
-- Added option for attach Cover Art (if exist) in the Post message.
-- WARNING: for existing facebook users, the app must be deleted from App Center and then must be granted again (sorry).
-
-v1.1:
-- Fixed message options for Twitter and changed default text.
-- Others minor bugs fixed.
-
 v1.0:
 - First script release.
-SocialRok allows you to post what you're listening in Amarok on the Social Networks, 
-allows to send a Cover Arts along with the post and also creates a link to YouTube to do a search!
+Google Music for Amarok
+
+This script allows you to listen your music allocated in your account in Google Music in your Amarok player.
 
 AVAILABLE NETWORKS
-Facebook + Flickr (optional, if you want to send Cover Art along with the post as link format.)
-Twitter
-GooglePlus (Coming Soon. We have to wait until Google release the API with the write access.)
-Skype (curl and python-dbus must be installed.)
 
 INSTRUCTIONS
-Take a look at the help in the Script Configuration.
+Download this script and put it into scripts directory (usually ~/.kde/share/apps/amarok/scripts/). Then, active the script in your Amarok
+configuration.
+
+Once the plugin is installed, you can see a new option in Tools Menu. Here you have to put your google account. Then, you can see a new
+collection with your songs.
 
-PLEASE READ
-I have noticed many failed attempts of sends on facebook, so I decided to add a try/catch on the method to prevent these errors and,
-at the same time, I added a return of more descriptive information on errors, so that the user can get an idea of ​​what did not work.
-In addition, Facebook has a sending limit for the apps (to prevent spam), so it may happen that after a long series of sends,
-facebook blocks the application for the rest of the day. I don't know what is the limit, because it seems to vary based on the received comments/like.
+At this moment is only a basic system, works fine but needs more little changes in order to improve the reliability.

images/.directory

 [Dolphin]
-Timestamp=2013,1,27,0,46,49
+Timestamp=2013,1,27,12,16,1
 Version=3
     var textStream = new QTextStream(Response, QIODevice.ReadOnly);
     var tinyURL = textStream.readAll();
     //Amarok.alert(args[1]);
-    //Amarok.alert(tinyURL)
-    //Amarok.alert(Response)
-    //Amarok.alert(textStream) 
+    //Amarok.alert(tinyURL) 
 }
 
 function getUrl(id) {
     var Response = p.readAllStandardOutput();
     var textStream = new QTextStream(Response, QIODevice.ReadOnly);
     var tinyURL = textStream.readAll();
-    Amarok.alert(tinyURL);
+//    Amarok.alert(tinyURL);
     return tinyURL;
 }
 
 
 function ImportJsonFile(json_file) {
-    eval("var JSON_obj = " + ReadTextFile(json_file));
-    return JSON_obj;
+    if(json_file != null){
+    	eval("var JSON_obj = " + ReadTextFile(json_file));
+    	return JSON_obj;
+    }
+    else{
+    	return null;    	
+    	}
 }
 
 function ScriptBaseDir() {
 
 function newItems() {
     Amarok.debug("save stations");
-
+    Amarok.debug(ScriptBaseDir());	
+	
     serviceDataJson = ImportJsonFile(ListFiles(ScriptBaseDir(), "ListSongs.json")[0]);
-    var categoryObj = myRadioService.addCategory(categoryName, categoryImageFullPath, categoryHtmlDescr);
-    //  Amarok.alert("New items "+serviceDataJson.kind);
-    var items = serviceDataJson.data.items;
-
-    for (var i in items) {
-        categoryObj.addStream(items[i].title, items[i].id, items[i].artist);
+    if(serviceDataJson != null){
+    	var categoryObj = myRadioService.addCategory(categoryName, categoryImageFullPath, categoryHtmlDescr);
+    	//  Amarok.alert("New items "+serviceDataJson.kind);
+    	var items = serviceDataJson.data.items;
+	
+   	 for (var i in items) {
+        	categoryObj.addStream(items[i].title, items[i].id, items[i].artist);
+    	}
     }
     update = false;
     onPopulating(delayedArgs[0], delayedArgs[1], delayedArgs[2]);
-    Amarok.debug("end");
 }
 
 
 }
 
 Amarok.configured.connect(onConfigure);
-
 Amarok.Window.addToolsSeparator();
-Amarok.Window.addToolsMenu("updateList", "Update Google Music List", "amarok");
 
-function actionClicked() {
-    Amarok.debug("Updating music list...");
-    executeScript();
-    update = false;
-    newItems();
-}
 script = new GoogleMusic();
 script.populate.connect(onPopulating);
 script.customize.connect(onCustomize);
-Amarok.Window.ToolsMenu.updateList['triggered()'].connect(actionClicked);
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.