Jump to content

Pandora Timeshifting App: Main Discussion Thread


Recommended Posts

  • Replies 1.4k
  • Created
  • Last Reply

Top Posters In This Topic

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?

I've had the problem, and I just let it go. Sometimes it starts working within two or three songs, other times it needs an hour. Don't know why, but time has its charms.

Link to post
Share on other sites
Mr MrDave2176, and for those who are not self-compiling? ;-)

Until this becomes a paying deal, it has to take a backseat to the job. There are still some things I'd like to get ironed out before a new release, and I've been trying to post them here.

I had never done any Java programming in my life until I started tackling this project. I had done programming, just not in Java so it has been a learning curve for me.

This is a ffairly easy project to work on since most of the hard stuff is done. Roll up you sleeves, and download the SDK and Ant. Plunge in with both feet. Trust me it has been educational and fun.

Link to post
Share on other sites

I could've sworn barley had resolved the problem with the mp3 files being put in plugtmp# folder and root of plugtmp folder? Remember when we were talking about putting the songs in another folder and sorting by date/time stamp. I know MrDave said that javascript can't do that. It looks like it's that problem again with it alternating the folders that it saves in. Sorry if this is a repeat.

MrDave,

That's extremely impressive for you to pick this up so quickly!

Link to post
Share on other sites
What happens when you use Flash 9 with Pandora's Jar? Because I just realized I have Flash 9. Is that why just about all of my songs have the wrong name associated with the song? I have 3 songs that have a diffent name yet play the same song. Is that what happens with flash 9?

Thanks for replying to my last question, MrDave :)

No problem.

Flash 9 doesn't cache the files in the same place so they cannot be found by Pandora. If you have not dumped your cache then Pandora just keeps copying the same song over and over and over.

Link to post
Share on other sites
Ask in the Sticky-ed thred. And ripping from Pandora is illegal, I think it was a bad decision to put it in the show.

I agree. That's why I use it as a timeshifting app. I shift a bunch of stuff while at work and then listen on the drive home and back on my ipod.

I then synch when I get home and the ipod dumps everything that was on it.

I am - admittedly - the likely exception to the rule.

But that is why I support this app like I do. I get to discover new music, keep my last.fm up to date and occasionally learn new things (like Java programming for instance.)

Even though I have never watched a single eppisode of the show (I know - sacreledge!) I am glad they did it since it brought me here.

Link to post
Share on other sites

I looked back to like page 31-32. I think Barley!! fixed the problem with the songs being saved to both temp and tempplugtmp# folders. Now it seems to only save songs from temp folder that's named plugtmp#-#. That's why it keeps saving the same song over and over. It doesn't recognize the files in plugtmp# folder that are named that long numeric thingy. Clearing out the temp folder doesn't seem to do it for me.

Maybe someone modified an old file and submit it as a new release?

Link to post
Share on other sites
this thread is so long its hard to understand.

So the current version doesn't work any more?

I have flash 8 but am using win 2000 should it work?

You can try to see if it works. You'll have to check the files that are ripped, it may not be the correct title. It may say Fleetwood Mac, but when you play it, it may be Neil Sedaka. I know, I'm an old foggie!

Link to post
Share on other sites
Guest t3chn0b0y
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.

thanks for the update.. :D Dave ya taking time to enjoy the sun, and a cold beer..?

Link to post
Share on other sites
Guest t3chn0b0y
someone should make a new thread for this, its too long to be useful anymore

Actually what it needs is a seperate "forum" for it.

I agree a whole forum would be the way to go :twisted:

Link to post
Share on other sites
Guest t3chn0b0y

Hmm compiled the code with that snippet and i have a

issue.. seems the page changes and tries to goto play

the videos on the last.fm pages.. saying it requires

IE etc... directing completely away from the pandora

radio.. i came to this conclusion when i disabled the last.fm settings

and the problem stopped.

Link to post
Share on other sites
Guest t3chn0b0y
I consistently get an error saying 'unable to rip MP3 unable to find file make sure you have Pandora running in a FIRFOX browser'

Anyone has a clue how to get through this error and record songs for timeshifting ? Thnx a lot,

Vallsigorri

As I and others have stated many time in previous posts.. when you are running

the jar. right click in the pandora window, where you give the thumbs up , thumbs down

and check which version of flash you got installed.. if its version 9 you need to remove

it and install version 8...

Link to post
Share on other sites
Hmm compiled the code with that snippet and i have a

issue.. seems the page changes and tries to goto play

the videos on the last.fm pages.. saying it requires

IE etc... directing completely away from the pandora

radio.. i came to this conclusion when i disabled the last.fm settings

and the problem stopped.

videos on last.fm? what?

Link to post
Share on other sites

I am having a problem with Pandora. My songs will save, but they aren't the same. Say I save Hypnotize by System of a Down, it will end up being B.B.K. by Korn.

I am using Win XP Pro, and Flash Player 8, so what can I do to fix this?

Link to post
Share on other sites

:!:

I'm not sure what what version everyone else is running but my local versions works great (7.2 pandora jar in the 7.3 dist).

A couple of things

this download is bad:

MIRROR: http://latenightgames.com/pandora/pandora.beta.7.3.zip

It does not have the correct version jar which might explain the inconsistent behavior accoss users - this version does not play nice with pandoras new cache saving methodology which span multable dir - wrong titles will be saved when using this version.

this download is better but still broken:

http://wildandbad.com/pandora.beta.7.3.1.zip

It has the updated logic to find the correct files but somehow the ITunes integration was broken.

The pandora station lookup does not work anymore as Pandora disabled the javascript callbacks. I am using this field for creating ITunes playlist / station dir

At some point I will attempt to integrate all updates into a single working dist - perhaps someone can volunteer to host

Link to post
Share on other sites

if it helps you guys to solve this, I tried pandoras jar last week and tried it today and everytime it saves a song. I go and listen and it is always the same song. I think this means that something is up with the code on saving the song, it never replaces the song it is saving. TIA

Link to post
Share on other sites

Hi,

I've stopped recording with Pandora's Jar caused of the wrong file names. :cry:

There is no use for me, cause often I buy new stuff from Amazon or Ebay. But if the names are currently wrong ?

Up to now I didn't test the 7.3.1 Version.

May 7.4 Omega Excellent version (hope to the future) could solve such probs ?

Link to post
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...