Jump to content

Pandora Timeshifting App: Main Discussion Thread


irieb

Recommended Posts

Here's a bug (I think) for someone to look into. In Mp3Processor.java, in function joinMp3s, the accumulated file array might be wrong. The "for" loop exits with a 'LOG.debug("no more mp3 found in dir"); return;' when a non-directory, non-mp3, non-recent file is found. If that happens before the plugtmp (or plugtmp-x) directory is processed in the "for" loop, the function doesn't recurse and process that directory. That can be seen in the log file output when the same file is saved multiple times with the wrong filename and tagging. The determination of "non-recent" is in isFileRecent, where it appears that "recent" is within 3 hours. When you delete the plugtmp (and/or plugtmp-x) directory and start clean, you can see the problem happen 3 hours into the running of the program.

Until fixed, I think stopping the program, cleaning up, restarting, should eliminate that problem.

Comments? Am I all wet?

Actually that would explain a lot.

What if it deleted the files once it moved them? I mean really if it can't move them while they are playing then it won't remove anything being played, right?

Hi,

Carmen describes exactly my problem with the wrong MP3 file names.

Thanx for checking the sources.... (I can't do this...)

But that can also happens after 6 files ... That mean it bugs up in 30 minutes.... I've tested it and stopped recording after that.....

Any program fix for that ? Pandora 7.4 Omega ?

Without that fix I can't use the jar... :cry:

Folks .. Proof your recorded files !!! Often you'll find e.g. an Audioslave Track and in real it's Stereophonics or so.... Not so funny :cry:

Just have a look at the recorded files & listen to them..... You'll find the differences !!!

Link to comment
Share on other sites

  • Replies 1.4k
  • Created
  • Last Reply

Top Posters In This Topic

I'm having a problem with my install. The app loads, but the pandora player doesn't. I followed the install instructions 100%. though i had to re-install flash 8.

You downloaded the wrong version. Scroll down the N00bs guide to the SECOND set of download and install instructions and try again.

Thanks alot, that fixed things up. :D

Link to comment
Share on other sites

great program, excellent work, until...oops. i mistakenly upgraded to flash player 9, and realized too late this is a no-no. i read back thru the thread, uninstalled 9, reinstalled 8, reinstalled pandora's jar, etc. tried everyting i could think of, but when mozilla opens, no player opens. any suggestions? any chance program will be written for palyer 9?

Link to comment
Share on other sites

my thing says "unable to rip m make sure your using firefox"

i am using firefox, and i was using flash player 9, and i think that was the problem but ive been searching all f**king day for flash player 8 for foxfire and i cannot find it anywhere can some1 help me find it PLEASE!

thank you.

Link to comment
Share on other sites

my thing says "unable to rip m make sure your using firefox"

i am using firefox, and i was using flash player 9, and i think that was the problem but ive been searching all f**king day for flash player 8 for foxfire and i cannot find it anywhere can some1 help me find it PLEASE!

thank you.

See my post on the previous page.

http://www.hak5.org/forums/viewtopic.php?p=20958#20958

Link to comment
Share on other sites

You can download Flash Player 8 HERE

But first you have to unistall Flash Player 9 by downloading THIS

Hope this helps cuz this is a great little app :D Props to you MrDave2176!

I just maintain and try to debug what we got. The real props go to the folks who coded the original and have made verion-worthy leaps in the code.

Link to comment
Share on other sites

I figured out that last.FM has changed their sight ever so slightly . So that has broken all of the Picture, fan, and bio links.

I've got it fixed, but I'll be putting in some other fixes to the skins files and I am looking at this 'recent' file' thing.

you can look at that part for yourself. THis is in Mp3Processor.java

    public static void joinMp3s(List<File> mp3s, File lookinDir) throws IOException {

        LOG.debug("n***processing directory: " + lookinDir.getName() + "***n");

        File[] files = lookinDir.listFiles();

        sortFilesByLastModified(files);



        //uncomment to print files in each working directory

        //printFiles(files);



        for (File currentFile : files) {

            if (!currentFile.isDirectory()) {

                if (isMp3(currentFile)) {

                    LOG.debug("mp3 found adding currentFile: " + currentFile.getName());

                    mp3s.add(currentFile);

                } else {

                    if (isFileRecent(currentFile)) {

                        LOG.debug("recent non mp3 file found: " + currentFile.getName() + " - will continue to next file");

                        continue;

                    }

                    LOG.debug("non-recent non mp3 file found: " + currentFile.getName() + " - will continue to next file");

                    continue;

                }

            } else {

                joinMp3s(mp3s, currentFile);

            }

        }

        LOG.debug("n***Finished directory: " + lookinDir.getName() + "***n");

        return;

    }

What I've done is forced it to recurse through all of the directories before giving up. This is less than efficient, but until I hear a better idea, that's what I'm working with.

Link to comment
Share on other sites

I just cannot get this to finish working for the life of me. When I go to it, and have it on cruise control, it never seems to finish downloading a song. It just says "Fetching ID3 information and tagging MP3 for artist." and then never goes past that until that song ends and it goes into the next one.

Link to comment
Share on other sites

...

I am looking at this 'recent' file' thing.

you can look at that part for yourself. THis is in Mp3Processor.java

    public static void joinMp3s(List<File> mp3s, File lookinDir) throws IOException {

        LOG.debug("n***processing directory: " + lookinDir.getName() + "***n");

...

        return;

    }

What I've done is forced it to recurse through all of the directories before giving up. This is less than efficient, but until I hear a better idea, that's what I'm working with.

Here are some additional thoughts:

1-I "solved" the problem temporarily by creating another account under XP (pro version, don't know if it makes a difference), and running JUST this app there. (I.e., running just the jar and the firefox localhost page, no other programs, no other tabs/windows in firefox.) It gets its own temp dir and the "recent"-checking code should be OK there. The app continues to run even after switching back to another account.

2-I suspect that the reason the "recent" code was created was to speed up the search of the TEMP directory. I thought that shouldn't be too much of a problem. I looked at my TEMP directory and found almost 1000 files there. Even that many may not be much of a problem, I don't know the timings involved. But, it was very easy to delete most of the files there without affecting anything, reducing any potential problem. So, people might take a look at their TEMP directories and clean things up.

3-The orginal joinMp3s() might be OK with a slightly different isFileRecent() function. Instead of:

    private static boolean isFileRecent(File file) {

        Date now = new Date();

        Calendar calendar = Calendar.getInstance();

        calendar.setTime(new Date(file.lastModified()));

        calendar.add(Calendar.HOUR, 3);

        return now.before(calendar.getTime());

    }

How about something like:

    private static boolean isFileRecent(File file) {

         static Calendar calendar_to_compare = NULL;

        static Calendar calendar_this_file = Calendar.getInstance();

        boolean bool_return_value = TRUE;



        if ( calendar_to_compare == NULL ){

            calendar_to_compare = Calendar.getInstance();

            calendar_to_compare.add(Calendar.HOUR, -1);

         } else {

            calendar_this_file.setTime(new Date(file.lastModified()));

            bool_return_value = ( date_to_compare.compareTo(calendar_this_file) < 0 );

        }

        return bool_return_value;

    }

(My java's probably not correct, but hopefully you get the idea.) This will "break" if Pandora ever starts up and waits over an hour to create the plugtmp directory, but should limit the number of files inspected.

Link to comment
Share on other sites

I just cannot get this to finish working for the life of me. When I go to it, and have it on cruise control, it never seems to finish downloading a song. It just says "Fetching ID3 information and tagging MP3 for artist." and then never goes past that until that song ends and it goes into the next one.

same as mine and when i even pause the song so it dosent go to the next it will finally say it saved. When i go to play the song its a completely diffrerent song and its always 1.10 mb!!!!! pissing me off. i put cruise control off and do im manually around the middle/end of song. any ideas dave?

Link to comment
Share on other sites

I just cannot get this to finish working for the life of me. When I go to it, and have it on cruise control, it never seems to finish downloading a song. It just says "Fetching ID3 information and tagging MP3 for artist." and then never goes past that until that song ends and it goes into the next one.

same as mine and when i even pause the song so it dosent go to the next it will finally say it saved. When i go to play the song its a completely diffrerent song and its always 1.10 mb!!!!! pissing me off. i put cruise control off and do im manually around the middle/end of song. any ideas dave?

I am not having this problem, so it is tough to say why it it is happeneing to you. Try turning off the cddb lookup and see if it is still doing it. Then I'd know what is where the problem lies.

Link to comment
Share on other sites

Hi, I've been using this app for a couple days now, but just today it stopped working for me. Before that, except for a few occassional bugs it worked perfectly fine. Now I click on the batch file and everything on the page loads but the pandora player itself, making it useless. I have the latest version of java, and have flash 8, and the only changes I've made are switching from zonealarm to kaspersky and a few extra plugins and CSS changes on firefox. I thought it might be the kapersky that was doing it so I disabled it and tried it again a couple times but it still didnt work, so I have no idea what to do. Any help would be greatly appreciated. :)

Link to comment
Share on other sites

Guest t3chn0b0y

When installing the newer yahoo messenger be careful it seems to

want to install flash 9 even when version 8 is installed. I think that

is what caused my initial problem previously posted, when i had to

search for the removal and installation if flash 8. :?

Link to comment
Share on other sites

I am not having this problem, so it is tough to say why it it is happeneing to you. Try turning off the cddb lookup and see if it is still doing it. Then I'd know what is where the problem lies.

my cddb has always been off what is it exactly?

still only grabbing 1.10 mb of song and labeling wrong.

Link to comment
Share on other sites

When installing the newer yahoo messenger be careful it seems to

want to install flash 9 even when version 8 is installed. I think that

is what caused my initial problem previously posted, when i had to

search for the removal and installation if flash 8. :?

yeah. and myspace tries to do it too.

Link to comment
Share on other sites

unable to retrieve bio from last.fm: Script '(function(){ function m(b){return b!=null?'"'+b+'"':'""'} function B(b){if(typeof encodeURIComponent=="function"){return encodeURIComponent(b)}else{return escape(b)}} function c(b,a){if(a){window.google_ad_url+="&"+b+"="+a}} function f(b,a){if(a){c(b,B(a))}} function l(b,a,d){if(a&&typeof a=="object"){a=a[d%a.length]}c("color_"+b,a)} function D(b,a){var d=b.screen;var g=navigator.javaEnabled();var e=-a.getTimezoneOffset();if(d){c("u_h",d.height);c("u_w",d.width);c("u_ah",d.availHeight);c("u_aw",d.availWidth);c("u_cd",d.colorDepth)}c("u_tz",e);c("u_his",history.length);c("u_java",g);if(navigator.plugins){c("u_nplug",navigator.plugins.length)}if(navigator.mimeTypes){c("u_nmime",navigator.mimeTypes.length)}} function y(b){b=b.toLowerCase();if(b.substring(0,3)!="ca-"){b="ca-"+b}return b} function G(b,a,d){d=d.substring(0,1000);d=d.replace(/%w?$/,"");if(b.google_ad_output=="js"&&(b.google_ad_request_done||b.google_radlink_request_done)){a.write('

Link to comment
Share on other sites

Ok this is whats happening. No matter what song i try to timeshift/grab it always saves this song from lifehouse instead. even if i skip through a few songs and try to timeshift another its still saves that lifehouse song. and 1.10 mb everytime.

any ideas

Link to comment
Share on other sites

nanajeebus what version of are you using? It sounds like you are using an older version (below 7.3)? Find the latest and try that version

I wasn't sure, so I just 'uninstalled' my current version and installed the new one, 7.3.1, but i'm still having the same problem.

Link to comment
Share on other sites

everything is ok, i just report this error:

"unable to retrieve bio from last.fm: Connection timed out: connect"

i'm behind a firewall, does it matter? even if pandora is working?

there is a way to change the time out value for sending info to las.fm?

Link to comment
Share on other sites

everything is ok, i just report this error:

"unable to retrieve bio from last.fm: Connection timed out: connect"

i'm behind a firewall, does it matter? even if pandora is working?

there is a way to change the time out value for sending info to las.fm?

Last.fm has changed it's site and so until i get the newer version up the lastfm bio lookup stuff is not working.

here is the code for LastFmLookup.java with my corrections for the new last.fm for those who are self-compiling.

package util;



import org.xml.sax.SAXException;

import org.apache.commons.logging.Log;

import org.apache.commons.logging.LogFactory;

import org.dom4j.DocumentException;

import org.dom4j.Document;

import org.dom4j.Element;

import org.dom4j.io.SAXReader;



import java.io.IOException;

import java.io.UnsupportedEncodingException;

import java.net.URLEncoder;

import java.net.URL;

import java.security.NoSuchAlgorithmException;

import java.security.MessageDigest;

import java.util.Date;

import java.util.Iterator;

import java.text.DateFormat;

import java.text.SimpleDateFormat;



import com.meterware.httpunit.*;

import server.Request;



public class LastFmLookup {



    private static Log LOG = LogFactory.getLog(LastFmLookup.class);



    public static final String ERROR_BIO_NOT_FOUND = "band info not found";

    public static final String ERROR_NOT_FRIENDS_NOT_FOUND = "top friends not found";

    public static final String ERROR_SONG_STATS_NOT_FOUND = "No Stats found for song";

    public static final String ERROR_SONG_ART_NOT_FOUND = "No Album Art found for song";

    public static final String ERROR_SONG_LIKE_NOT_FOUND = "No Similar Artists found for song";



    public static String getBio(String artist) throws IOException, SAXException {

        WebConversation wc = new WebConversation();

        // Disable errors of javascript

        HttpUnitOptions.setExceptionsThrownOnScriptError( false );

        WebResponse   resp = wc.getResponse("http://last.fm/music/" + URLEncoder.encode(artist, "UTF-8") + "/+wiki");

        String text = resp.getText();

        

        int i = text.indexOf("View wiki recent changes page");

        if (i == -1) {

            throw new RuntimeException(ERROR_BIO_NOT_FOUND);

        }

        String startSearchString = "<div class="f">";

        String endSearchString = "<br style="clear:both;" />";

        int startBioIndex = text.indexOf(startSearchString) + startSearchString.length();

        if (startBioIndex < startSearchString.length()) {

            throw new RuntimeException(ERROR_BIO_NOT_FOUND);

        }

        int endBioIndex = text.indexOf(endSearchString, startBioIndex);

        if (endBioIndex == -1) {

            throw new RuntimeException(ERROR_BIO_NOT_FOUND);

        }

        return Util.addLastFmUrl(text.substring(startBioIndex, endBioIndex));

    }



    public static String getTopFans(String artist, String song) throws IOException, SAXException {

        LOG.info("looking up top fans");



        WebConversation wc = new WebConversation();

        HttpUnitOptions.setScriptingEnabled(false);

        HttpUnitOptions.setExceptionsThrownOnScriptError( false );

        String s = "http://www.last.fm/music/" + URLEncoder.encode(artist, "UTF-8") + "/_/" + URLEncoder.encode(song, "UTF-8");

        WebRequest req = new GetMethodWebRequest(s);

        WebResponse resp = wc.getResponse(req);

        String text = resp.getText();

        

        String startSearchString = "id="c_fanspanel" >";

        int startTopArtistIndex = text.indexOf(startSearchString)  + startSearchString.length();;

        if (startTopArtistIndex < startSearchString.length()) {

            throw new RuntimeException(ERROR_NOT_FRIENDS_NOT_FOUND);

        }

        int endTopArtistIndex = text.indexOf("<span class="mozillasucks">", startTopArtistIndex);

        return Util.addLastFmUrl(text.substring(startTopArtistIndex, endTopArtistIndex));

    }



    public static LastFmTrackStats getTrackStat(String artist, String song) throws IOException, SAXException {

        LastFmTrackStats lastFmTrackStats = new LastFmTrackStats();



        WebConversation wc = new WebConversation();

        HttpUnitOptions.setScriptingEnabled(false);

        HttpUnitOptions.setExceptionsThrownOnScriptError( false );

        String s = "http://www.last.fm/music/" + URLEncoder.encode(artist, "UTF-8") + "/_/" + URLEncoder.encode(song, "UTF-8");

        WebRequest req = new GetMethodWebRequest(s);

        LOG.info("fetching stats: " + s);

        WebResponse resp = wc.getResponse(req);

        String text = resp.getText();



        setTrackStats(text, lastFmTrackStats);



        setAlbumImageLocation(text, lastFmTrackStats);



        setSimilarArtist(text, lastFmTrackStats);



        return lastFmTrackStats;

    }



    private static void setSimilarArtist(String text, LastFmTrackStats lastFmTrackStats) {

        String startSearchString = "id="c_simpanel" >";

        int startSimilarIndex = text.indexOf(startSearchString) + startSearchString.length();

        if (startSimilarIndex < startSearchString.length()) {

            throw new RuntimeException(ERROR_SONG_LIKE_NOT_FOUND);

        }

        int endSimilarIndex = text.indexOf("<span class="mozillasucks">", startSimilarIndex);

        lastFmTrackStats.setSimilarArtist("<span>Similar Artists:</span> <br/>" + Util.addLastFmUrl(text.substring(startSimilarIndex, endSimilarIndex).trim()));

    }



    private static void setAlbumImageLocation(String text, LastFmTrackStats lastFmTrackStats) {

        String startSearchString = "<div class="cover">";

        String imgLoc = "";

        int endImageIndex = 0;

        int startImageIndex = text.indexOf(startSearchString) + startSearchString.length();

        if (startImageIndex < startSearchString.length()) {

               LOG.info("No Amazon image, gotta look for a LastFM image");

            startSearchString = "c_avatarPanel">";

            startImageIndex = text.indexOf(startSearchString) + startSearchString.length();

            if(startImageIndex < startSearchString.length()) {

                throw new RuntimeException(ERROR_SONG_ART_NOT_FOUND);

            }

            endImageIndex = text.indexOf("" border=", startImageIndex);

            imgLoc = text.substring(startImageIndex, endImageIndex).trim();

            imgLoc = imgLoc.substring(imgLoc.indexOf("src="") + 5, imgLoc.length());

            if(imgLoc == "http://static.last.fm/depth/sidebars/vw_view.gif") {

                throw new RuntimeException(ERROR_SONG_ART_NOT_FOUND);

            }

        } else {

            endImageIndex = text.indexOf("" alt", startImageIndex);

            imgLoc = text.substring(startImageIndex, endImageIndex).trim();

            imgLoc = imgLoc.substring(imgLoc.indexOf("src="") + 5, imgLoc.length());

        }

        lastFmTrackStats.setAlbumImageLocation(imgLoc);

        LOG.info("got image location:" + imgLoc);

    }



    private static void setTrackStats(String text, LastFmTrackStats lastFmTrackStats) {

        String startSearchString = "id="c_infoPanel">";

        int startStatIndex = text.indexOf(startSearchString) + startSearchString.length();

        if (startStatIndex < startSearchString.length()) {

            throw new RuntimeException(ERROR_SONG_STATS_NOT_FOUND);

        }

        int endStatIndex = text.indexOf("<div class="f"", startStatIndex);

        lastFmTrackStats.setTrackStats(Util.addLastFmUrl(text.substring(startStatIndex, endStatIndex).trim()));

    }



    public static void addTrack(Request request) throws IOException, SAXException, NoSuchAlgorithmException {



        SongInfo songInfo = (SongInfo) request.getSession().getAttribute(Constants.ATTR_SONG_INFO);



        if (songInfo == null) {

            throw new RuntimeException("illegal call encountered: song info does not exist");

        }



        String userName = request.getParamter(Constants.PARAM_LAST_FM_USER_NAME);

        String password = request.getParamter(Constants.PARAM_LAST_FM_PASSWORD);



        LOG.debug("password = " + password);

        LOG.debug("userName = " + userName);



        if (userName == null || password == null) {

            throw new RuntimeException("last.fm authentication impossible.");

        }



        WebConversation wc = new WebConversation();

        WebRequest req = new PostMethodWebRequest("http://post.audioscrobbler.com");

        req.setParameter("u", userName);

        req.setParameter("c", "pja");

        req.setParameter("hs", "true");

        req.setParameter("v", "0.1");

        req.setParameter("p", "1.1");

        WebResponse res = wc.getResponse(req);

        String text = res.getText();

        String key = "";

        String lastFMUrl = "http://62.216.251.200/protocol_1.1";

        String[] strings = text.split("n");

        LOG.debug(text);

        if (strings.length < 3 || strings[0].indexOf("UPTODATE") == -1) {

            String msg = "Unable to authenticate to last.fm";

            LOG.warn("Unable to authenticate to last.fm: " + text);

            throw new RuntimeException(msg);

        } else {

            key = strings[1];

            lastFMUrl = strings[2];

        }

        Date date = new Date();



        DateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

        req = new GetMethodWebRequest(lastFMUrl);

        req.setParameter("u", userName);

        String s = md5(md5(password) + key);

        LOG.debug("hex = " + s);

        req.setParameter("s", s);

        req.setParameter("a[0]", songInfo.getArtist());

        req.setParameter("t[0]", songInfo.getTitle());

        req.setParameter("b[0]", songInfo.getAlbum()!=null?songInfo.getAlbum():"");

        req.setParameter("m[0]", "");

        req.setParameter("l[0]", "255");

        req.setParameter("i[0]", simpleDateFormat.format(date));

        res = wc.getResponse(req);

        text = res.getText();

        if (text.indexOf("OK") == -1) {

            String msg = "a problem was encountered whille attempting to add track to last.fm: " + text;

            LOG.warn(msg);

            throw new RuntimeException(msg);

        }

        LOG.info("successfully added track to last.fm");



    }



    public static String getStationName(String pandoraUserName, String stationId) throws IOException, DocumentException {

        LOG.info("looking up station name for station with id: " + stationId + " user: " + pandoraUserName);

        URL url = new URL("http://feeds.pandora.com/feeds/people/" + pandoraUserName + "/stations.xml?max=100");

        Document document = parse(url);

        Iterator list = document.getRootElement().element("channel").elementIterator("item");



        while (list.hasNext()) {

            Element o = (Element) list.next();

            String value = o.element("link").getText();

            if (value.indexOf(stationId) != -1) {

                String stationName = o.element("title").getText();

                LOG.info("found station name: " + stationName);

                return stationName;

            }

        }

        throw new RuntimeException("station with id: " + stationId + " not found. user: " + pandoraUserName);

    }



    private static Document parse(URL url) throws DocumentException {

        SAXReader reader = new SAXReader();

        return reader.read(url);

    }



    private static String md5(String message) throws NoSuchAlgorithmException, UnsupportedEncodingException {

        MessageDigest md = MessageDigest.getInstance("MD5");

        return hex(md.digest(message.getBytes("CP1252")));

    }



    private static String hex(byte[] array) {

        StringBuffer sb = new StringBuffer();

        for (int i = 0; i < array.length; ++i) {

            sb.append(Integer.toHexString((array[i] & 0xFF) | 0x100).toLowerCase().substring(1, 3));

        }

        String s = sb.toString();

        LOG.debug("s = " + s);

        return s;

    }



}

I THINK this is the only file with changes, I could be wrong, but feel free to try it.

Link to comment
Share on other sites

running 7.3, with flash 8; have tried reinstalling several times...still run into same problem, which has only started happening recently.

run bat file, app loads. grab files sits in "fetching" mode until song is over and next song begins. sometimes "not running firefox" error appears, sometimes not. while second song is playing, either grabs first song listing first song as grab, or grabs first song listing second song as grab. in either case, song is only couple hundred kb, about 1 min.

even after running thru several songs, not always running properly.

anyone else get this? any suggestions?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...