Permalink
Browse files

Merged branches.

  • Loading branch information...
2 parents 873cad9 + 9efc2f7 commit ac1bf388c5c754c6bafc836aede1f19003fbc57c @rgarg8 rgarg8 committed Aug 12, 2011
@@ -5,11 +5,14 @@ var orgArgeeCodeGrooveShredder = {};
orgArgeeCodeGrooveShredder.$ = jQuery.noConflict();
/* Global Variables contained in the namespace */
-// orgArgeeCodeGrooveShredder.console = Components.classes["@mozilla.org/consoleservice;1"].getService(Components.interfaces.nsIConsoleService);
+orgArgeeCodeGrooveShredder.console = Components.classes["@mozilla.org/consoleservice;1"].getService(Components.interfaces.nsIConsoleService);
orgArgeeCodeGrooveShredder.download_manager = Components.classes["@mozilla.org/download-manager;1"].getService(Components.interfaces.nsIDownloadManager);
orgArgeeCodeGrooveShredder.pref_service = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService);
orgArgeeCodeGrooveShredder.gpreferences = orgArgeeCodeGrooveShredder.pref_service.getBranch("extensions.grooveshredder");
+/* Debug flag in case of emergency */
+orgArgeeCodeGrooveShredder.debug = true;
+
/**
* grooveshredder
*
@@ -553,21 +556,33 @@ orgArgeeCodeGrooveShredder.utility =
var theApp = orgArgeeCodeGrooveShredder;
// Store the POST data for re-use
theApp.streamKeyData = postdata;
+ // Extract this song's ID
+ var songId = postdata.match(/"songID":([0-9]+)/)[1];
// Add a button to grooveshark
var element = theApp.browser.contentDocument.getElementById("playerDetails_nowPlaying");
theApp.$(element).children('b').remove();
theApp.$(element).append('<b id="playerDetails_grooveShredder"> \
Download Song</b>');
+ // Obtain the file name
+ var songFile = theApp.fileUtilities.getFileName();
+ // Attach a click handler
theApp.$(element).children('b').click(function(){
- theApp.grooveDownloader.getStreamKeyAndSave(0, "", 5);
+ theApp.grooveDownloader.addDownload(songId, songFile, 5);
});
- // Autodownload if preferred
- if(theApp.gpreferences.getBoolPref(".autoget")){
+ // Autodownload if preferred (make sure it's not the same song)
+ if(theApp.gpreferences.getBoolPref(".autoget")
+ && this.songId != songId){
+ // This is now our song
+ this.songId = songId;
// Download the song automagically
- theApp.grooveDownloader.getStreamKeyAndSave(0, "", 5);
+ theApp.grooveDownloader.addDownload(songId, songFile, 5);
// Skip to next song if preferred
if(theApp.gpreferences.getBoolPref(".autonext")){
- theApp.browser.contentDocument.getElementById("player_next").click();
+ setTimeout(function(){
+ theApp.browser.contentDocument
+ .getElementById("player_next")
+ .click();
+ }, 1000);
}
}
},
@@ -690,4 +705,11 @@ orgArgeeCodeGrooveShredder.utility =
theApp : orgArgeeCodeGrooveShredder
}
+orgArgeeCodeGrooveShredder.debugMessage =
+function(logMessage){
+ var theApp = orgArgeeCodeGrooveShredder;
+ if(theApp.debug)
+ theApp.console.logStringMessage(logMessage);
+}
+
window.addEventListener("load", function () { orgArgeeCodeGrooveShredder.grooveshredder.onLoad(); }, false);
@@ -48,7 +48,7 @@ $grooveShredderQuery(function(){
$grooveShredderQuery.get('https://addons.mozilla.org/en-US/firefox/addon/grooveshredder/', function(data){
var re = /<span class="version-number">([0-9.]+)<\/span>/i
var version = re.exec(data)[1];
- var my_version = '1.14.3';
+ var my_version = '1.14.5';
if(version > my_version){
$grooveShredderQuery('#abovecontainer .orange').css('display', 'block');
} else if(version < my_version) {
@@ -8,4 +8,4 @@ multiWarn=It is HIGHLY recommended to turn off duplicate file prompts,\r\nas wel
prefsTitle=Groove Shredder preferences
onlyNewTab=Groove Shredder has acquired a new token, it won't work with older tabs.
willDownload=songs will be downloaded.
-scanningSongs=Scanning songs. Please wait...
+scanningSongs=Scanning songs. Please wait...
@@ -29,4 +29,4 @@
<!ENTITY updated.text "You are using the latest version.">
<!ENTITY outdated.text "You are using an outdated version.">
<!ENTITY unreviewed.text "This version is being reviewed.">
-<!ENTITY version.number "1.14.3">
+<!ENTITY version.number "1.14.5">
@@ -6,4 +6,6 @@ overPrompt=保存先でもう一つがあります。 書き換えればいい
playFirst=このボタンを使うまえに、一つ歌を遣らなくちゃいけません。
multiWarn=It is HIGHLY recommended to turn off duplicate file prompts,\r\nas well as skipping the file select dialog.\r\nDo you still want to Continue?
prefsTitle=グルブシュレッダ設定
-onlyNewTab=
+onlyNewTab=Groove Shredder has acquired a new token, it won't work with older tabs.
+willDownload=songs will be downloaded.
+scanningSongs=Scanning songs. Please wait...
@@ -29,4 +29,4 @@
<!ENTITY updated.text "You are using the latest version.">
<!ENTITY outdated.text "You are using an outdated version.">
<!ENTITY unreviewed.text "This version is being reviewed.">
-<!ENTITY version.number "1.14.3">
+<!ENTITY version.number "1.14.5">
View
@@ -1,14 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#">
<Description about="urn:mozilla:install-manifest">
- <em:id>grooveshredder@code.argee.org</em:id>
- <em:type>2</em:type>
- <em:name>Groove Shredder</em:name>
- <em:version>1.14.3</em:version>
- <em:creator>Rohit Garg</em:creator>
- <em:contributor></em:contributor>
- <em:description>An extension to download mp3 files from Grooveshark.</em:description>
- <em:optionsURL>chrome://grooveshredder/content/options.xul</em:optionsURL>
+ <em:id>grooveshredder@code.argee.org</em:id>
+ <em:type>2</em:type>
+ <em:name>Groove Shredder</em:name>
+ <em:version>1.14.5</em:version>
+ <em:creator>Rohit Garg</em:creator>
+ <em:contributor></em:contributor>
+ <em:description>An extension to download mp3 files from Grooveshark</em:description>
+ <em:optionsURL>chrome://grooveshredder/content/options.xul</em:optionsURL>
<em:iconURL>chrome://grooveshredder/skin/shark.png</em:iconURL>
<em:localized>

0 comments on commit ac1bf38

Please sign in to comment.