Jump to content

barley!!!

Active Members
  • Posts

    20
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

barley!!!'s Achievements

Newbie

Newbie (1/14)

  1. the last working version - not sure if it works anymore - havn't tried it in a while
  2. this issue was resolved a while back in the 7.4.1 realease. The add track logic was not using the UTC timezone when posting a track to last.fm. The code call now respects the expected timecode. cheers
  3. Cynagen This has been working for me, I only have problems when creating a new station, not sure why; pandora must mess with the cache when using this feature, to get around this I'll do a browsers reload when creating a station. The code is from the 7.4.1 release which includes the lyrics lookup. cheers package util; import org.blinkenlights.jid3.ID3Exception; import org.blinkenlights.jid3.MediaFile; import org.blinkenlights.jid3.MP3File; import org.blinkenlights.jid3.v2.ID3V2_3_0Tag; import org.blinkenlights.jid3.v2.APICID3V2Frame; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import java.io.*; import java.util.*; import enums.FileType; import properties.DefaultProperties; public class Mp3Processor { private static String ERR_TMP_NOT_FOUND = "unable to find file make sure you have Pandora running in a FIRFOX browser"; private static Log LOG = LogFactory.getLog(Mp3Processor.class); public static File findCurrentMP3() throws IOException { LOG.info("locating mp3"); File currentTmpMp3 = findCurrentTmpMp3(); LOG.debug("checking file integrity for file: " + currentTmpMp3.getName()); int loopCount = 0; while (true) { try { LOG.debug("sleeping for a second"); Thread.sleep(1000); } catch (InterruptedException e) { //ignore } File currentMp3Refetched = findCurrentTmpMp3(); if (currentMp3Refetched.getName().equals(currentTmpMp3.getName())) { LOG.debug("file integrity check complete"); break; } if (loopCount > 40) { throw new RuntimeException("File integrity could not be confirmed after 40 loops - process aborted"); } loopCount++; } return copyFile(currentTmpMp3, new File(currentTmpMp3.getParent(), "pandorasJarTmpFile.mp3")); } private static File findCurrentTmpMp3() { int retryCount = DefaultProperties.getTmpMp3RetryCount(); File[] mp3Files = new File[0]; for (int x = 0; x < retryCount; x++) { try { mp3Files = getJoinedPandoraMp3FilesInDecendingOrder(); break; } catch (Exception e) { if (x + 1 == retryCount) { throw new RuntimeException(e.getMessage()); } LOG.info("Mp3 file was not located retrying after 1 second. loop count: " + (x + 1)); try { Thread.sleep(1000); } catch (InterruptedException e1) { //ignore } } } return mp3Files[1]; } private static File[] getJoinedPandoraMp3FilesInDecendingOrder() throws IOException { List<File> mp3s = new ArrayList<File>(); File tempDir = findTempDir(); joinMp3s(mp3s, tempDir); File[] joinedMp3s = mp3s.toArray(new File[mp3s.size()]); sortFilesByLastModified(joinedMp3s); if (joinedMp3s.length < 2) { throw new RuntimeException(ERR_TMP_NOT_FOUND); } return joinedMp3s; } private static File findTempDir() { String tmpDir = System.getenv("TEMP"); if (tmpDir == null || tmpDir.length() == 0) { tmpDir = System.getenv("TMP"); } if (tmpDir == null) { throw new RuntimeException(ERR_TMP_NOT_FOUND); } return new File(tmpDir); } 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()); } 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 (currentFile.getName().toLowerCase().indexOf("plug") != -1) { joinMp3s(mp3s, currentFile); } } } LOG.debug("no more mp3 found in dir"); } private static void printFiles(File[] files) { LOG.debug("working with files"); for (File file : files) { LOG.debug(file.getName()); } } private static boolean isMp3(File file) { FileInputStream is = null; if (file.length() < (1000 * 1024)) { //LOG.debug("file: " + file.getName() + " too small"); return false; } try { is = new FileInputStream(file); byte[] buffer = new byte[32 * 1024]; is.read(buffer); String fragment = new String(buffer); if (fragment.indexOf("LAME") != -1) { LOG.debug("found mp3 file: " + file.getName() + " adding to list"); return true; } else { LOG.debug("file " + file.getName() + " is not an mp3"); return false; } } catch (IOException e) { LOG.debug("unable to parse file: " + file + " marking file as non-mp3"); return false; } finally { if (is != null) { try { is.close(); } catch (IOException e) { LOG.info("unable to close input stream: " + e.getMessage()); } } } } public static void sortFilesByLastModified(File[] files) { Arrays.sort(files, new Comparator() { public int compare(Object o1, Object o2) { if (((File) o1).lastModified() > ((File) o2).lastModified()) { return -1; } else if (((File) o1).lastModified() < ((File) o2).lastModified()) { return +1; } else { return 0; } } }); } public static File copyFile(File src, File dst) throws IOException { LOG.info("copying file[" + src.getAbsolutePath() + "] to temp[" + dst.getAbsolutePath() + "]"); InputStream in = new FileInputStream(src); OutputStream out = new FileOutputStream(dst); byte[] buf = new byte[1024]; int len; while ((len = in.read(buf)) > 0) { out.write(buf, 0, len); } in.close(); out.close(); return dst; } public static void addID3Tags(File currentMP3, File coverArt, String comment, SongInfo songInfo) throws ID3Exception, IOException { LOG.info("adding ID3 tags: " + songInfo.toString()); MediaFile oMediaFile = new MP3File(currentMP3); ID3V2_3_0Tag oID3V2_3_0Tag = new ID3V2_3_0Tag(); if (coverArt != null) { LOG.info("setting ID3 cover art"); byte[] buffer = new byte[32 * 1024]; BufferedInputStream bufferedInputStream = new BufferedInputStream(new FileInputStream(coverArt)); ByteArrayOutputStream imageBinary = new ByteArrayOutputStream(); while (bufferedInputStream.read(buffer) != -1) { imageBinary.write(buffer); } APICID3V2Frame apicid3V2Frame = new APICID3V2Frame("image/jpg", APICID3V2Frame.PictureType.Artist, songInfo.getAlbum() != null ? songInfo.getAlbum() : "unknown", imageBinary.toByteArray()); oID3V2_3_0Tag.addAPICFrame(apicid3V2Frame); } if (songInfo.getAlbum() != null) { oID3V2_3_0Tag.setAlbum(songInfo.getAlbum()); } if (songInfo.getArtist() != null) { oID3V2_3_0Tag.setArtist(songInfo.getArtist()); } if (comment != null) { if (songInfo.getStationName() != null) { oID3V2_3_0Tag.setComment(songInfo.getStationName()); } else { oID3V2_3_0Tag.setComment(comment); } } if (songInfo.getTrackNumber() != null) { Integer i = new Integer(songInfo.getTrackNumber()); oID3V2_3_0Tag.setTrackNumber(i); } if (songInfo.getGenre() != null) { oID3V2_3_0Tag.setGenre(songInfo.getGenre()); } if (songInfo.getTitle() != null) { oID3V2_3_0Tag.setTitle(songInfo.getTitle()); } if (songInfo.getYear() != null) { try { Integer y = new Integer(songInfo.getYear()); oID3V2_3_0Tag.setYear(y); } catch (NumberFormatException e) { //ignore } } oMediaFile.setID3Tag(oID3V2_3_0Tag); oMediaFile.sync(); } public static void saveMP3(SongInfo songInfo, File fileToSave, FileType fileType, DataOutputStream output, boolean addToItunes) throws IOException { File file = new File(Util.createSongHierarchy(songInfo), SafeString.getSafeFileName(songInfo.getArtist().trim() + "-" + songInfo.getTitle().trim()) + "." + fileType.toString().toLowerCase()); Mp3Processor.copyFile(fileToSave, file); String mp3Path = file.getAbsolutePath(); if (addToItunes) { ITunesManager.addTrackToItunes(mp3Path, songInfo.getStationName()); } LOG.info("nripped file to: " + mp3Path + "nyea baby!!!n"); if (fileType == FileType.MP3) { output.writeBytes("<span style="font: 12px arial">MP3 tagged and saved:</span><br/><span style="font: 12px arial">" + mp3Path + "</span>"); } } } [/code]
  4. you can get to the backstage popup from within the pandora player, click the arrow and you may choose between; artist, album, bio not sure what your doing, but the code will not download lyrics if the option is not selected - the code checks this option before attempting to go out and fetch the lyrics. the old versions have some problems with communicating with last.fm; last.fm updated there api, these have been resolved in the new version. also file scanning logic was optimized to not spike CPU Miramax I've observed that the album art is downloaded sometimes, it appears as there is a dependency on 2 conditions. 1) The album art work is found 2) The CDDB lookup is successfull I'm pretty sure this can be fixed; the lookup logic needs to be revised, maybe someone can take a crack at it.
  5. :!: 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
  6. I saw an example of this in the pandoras jar source code
  7. submission have been working fine for me with the 7.2 release - submission do not work with 7.3 unless the 7.2 jar is copied over.
  8. Arackis, trintha, Ukonjack copy the pandora.jar from the 7.2 release into the new 7.3 distribution :!: mrdave why not fix the 7.3 release - it seems kinda silly for noobs to have to go through these unnecessary steps to get the thing running? just add the versioning stuff to the right source in the 7.2 dist, compile and copy over to 7.3 sarah check your pandora log file - there may be some information inside to give you a better idea on whats going on
  9. slip 7.3 has an old version of pandora.jar - not sure why use the jar file in the 7.2 pandora.jar instead - just copy it over...
  10. I downloaded the 7.3 update and started to experience problems. 1) Last FM submissions not working 2) ITunes integration does not work 3) MP3's are not always synced with song titles 4) count down is not visable Upon inspecting the source the problem became obvious - the jar was compiled using an outdated codeline (7.1 I think) To correct the problems I replaced the new pandora.jar file with the one I had from the 7.2 release. Problems solve... mrdave u may want to update the 7.3 distribution with the correct jar/src..... also can you put the count down back in - I liked this feature as it let me know how much time I had left before deciding weather or not to abort a submission to last.fm
  11. I followed the instructions provided by Xellos and all works well for me. my system: Windows XP Service Pack2Firefox 1.5.0.4 Flash Payer 8 Pandoras Jar pandora.beta.7.2 with Xellos fix I heard there where some issues running pandoras jar using flash player 9
  12. As cooper said update the classpath in the build.xml, also you will need to update the build.default.properties my bad, i forgot to package these files in the last update :roll: I have included the corrections mrdave can you please update the files in the 7.2 dist with the changes - thanks!!! revised build.xml <?xml version="1.0" encoding="UTF-8"?> <project name="PANDORA" basedir="." default="help"> <target name="help"> <echo> This is the build script for the Pandora Timeshifting program. It is used to compile the pandora.jar file. To compile your own version of the pandora.jar file you need to have version 1.5 or later of the Sun java compiler installed on your system as well as a somewhat current version of ant. If you're seeing this, chances are you've already met that requirement. :) To get this script to compile a pandora.jar file for you, execute the following command: ant pandora If compilation succeeds succesfully, a new pandora.jar file can be found in the 'dist' directory. To create the javadoc documentation for this release (well, what little there is anyways), run the following command: ant build_docs On completion the assembled javadoc documentation can be found in the 'docs' directory. </echo> </target> <!--================================================================================ ===--> <!-- PARAMETERS --> <!--================================================================================ ===--> <property file="build.personal.properties"/> <property file="build.default.properties"/> <!--================================================================================ ===--> <!-- CLASSPATH --> <!--================================================================================ ===--> <path id="build-classpath"> <!-- The files that need to be in the classpath to build the application. --> <pathelement location="${lib.dir}/JID3.jar"/> <pathelement location="${lib.dir}/jacob.jar"/> <pathelement location="${lib.dir}/Tidy.jar"/> <pathelement location="${lib.dir}/activation-1.0.2_02.jar"/> <pathelement location="${lib.dir}/commons-logging-1.0.4.jar"/> <pathelement location="${lib.dir}/dom4j-1.6.1.jar"/> <pathelement location="${lib.dir}/httpunit.jar"/> <pathelement location="${lib.dir}/js.jar"/> <pathelement location="${lib.dir}/log4j-1.2.12.jar"/> <pathelement location="${lib.dir}/nekohtml.jar"/> <pathelement location="${lib.dir}/servlet.jar"/> <pathelement location="${lib.dir}/xercesImpl.jar"/> <pathelement location="${lib.dir}/xmlParserAPIs.jar"/> </path> <!--================================================================================ ===--> <!-- Target: clean --> <!-- Description: Remove the directories that hold the class- and jar-files. --> <!--================================================================================ ===--> <target name="clean" description="Clean the build and dist directory" > <!-- Clear out the directory that holds the compiled sources. --> <delete includeEmptyDirs="true" failonerror="false"> <fileset dir="${build.dir}" includes="**/*.*" /> </delete> <!-- Clear out the directory into which the jars are placed. --> <delete includeEmptyDirs="true" failonerror="false"> <fileset dir="${dist.dir}" includes="**/*.*" /> </delete> </target> <!--================================================================================ ===--> <!-- Target: init --> <!-- Description: Create the directories that we will put files in. --> <!--================================================================================ ===--> <target name="init" depends="clean"> <tstamp> <format property="TODAY" pattern="dd-MM-yyyy HH.mm.ss" /> </tstamp> <echo message="start init: ${TODAY} "/> <mkdir dir="${build.dir}" /> <mkdir dir="${dist.dir}" /> </target> <!--================================================================================ ===--> <!-- Target: compile --> <!-- Description: Compile all classes. --> <!--================================================================================ ===--> <target name="compile" description="Compile all classes" depends="init"> <javac debug="true" classpathref="build-classpath" destdir="${build.dir}"> <src path="${source.dir}"/> <include name="**/*.java"/> </javac> </target> <!--================================================================================ ===--> <!-- Target: pandora --> <!-- Description: Put together the pandora.jar file. --> <!--================================================================================ ===--> <target name="pandora" description="Put together the pandora.jar file." depends="compile"> <jar destfile="${dist.dir}/${app.filename}" > <fileset dir="${build.dir}" includes="**/*.*" /> <fileset dir="${source.dir}" includes="*.properties" /> <fileset dir="${source.dir}" includes="images/*.*" /> <manifest> <attribute name="Release" value="${app.release}"/> <attribute name="Client" value="${app.client}"/> <attribute name="Built-On" value="${TODAY}"/> <attribute name="Java-Version" value="${java.version}"/> <attribute name="Username" value="${user.name}"/> <attribute name="Class-Path" value="${app.classpath}"/> <attribute name="Main-Class" value="client.Client"/> </manifest> </jar> </target> <!--================================================================================ ===--> <!-- Target: docs --> <!-- Description: Create all Jars en WAR files necessary for the EAR-file. --> <!--================================================================================ ===--> <target name="docs" description="Generate JavaDoc documentation of all Java sources."> <echo message="Generate JavaDoc documentation"/> <delete dir="${doc.dir}" failonerror="false"/> <mkdir dir="${doc.dir}"/> <!-- additionalparam="-tag date:X -tag company:X -tag todo:X" --> <javadoc sourcepath="${source.dir}" destdir="${doc.dir}" classpathref="main-classpath" author="true" public="true" version="true" stylesheetfile="${resource.dir}/javadoc.css" use="true" windowtitle="${app.client} ${app.name} ${app.release}" doctitle="${app.name} ${app.release}" packagenames="nl.sscsp.*"> <link href="http://java.sun.com/j2se/1.5/docs/api/"/> <link href="http://jakarta.apache.org/log4j/docs/api/"/> </javadoc> <!-- Copy project specific content (HTML & CSS) --> <filter token="TITLE" value="${app.name} ${app.release}"/> <copy file="${resource.dir}/javadoc.css" tofile="${doc.dir}/javadoc.css" overwrite="true"/> </target> </project> revised build.default.properties ############################################################# # # Default global properties for this build. # # To override these settings, add a setting with the exact same # name but your personal value to the build.personal.properties # file. # ############################################################# #-------------------------------------------------------------------- # Workspace #-------------------------------------------------------------------- project.root.dir = . source.dir = ${project.root.dir}/src build.dir = ${project.root.dir}/build dist.dir = ${project.root.dir}/dist lib.dir = ${project.root.dir}/lib doc.dir = ${project.root.dir}/doc #-------------------------------------------------------------------- # Properties for the application #-------------------------------------------------------------------- app.classpath = lib/nekohtml.jar lib/log4j-1.2.12.jar lib/xmlParserAPIs.jar lib/JID3.jar lib/Tidy.jar lib/commons-logging-1.0.4.jar lib/activation-1.0.2_02.jar lib/httpunit.jar lib/servlet.jar lib/xercesImpl.jar lib/js.jar lib/dom4j-1.6.1.jar lib/jacob.jar app.filename = pandora.jar app.client = Pandora's Jar app.name = Pandora's Jar app.release = 6 #------------------------------------------------------------ # Javadoc options #------------------------------------------------------------ javadoc.author = true javadoc.private = true javadoc.use = true javadoc.version = true
  13. tnerb123, jordan pm me your log file and i will take a look. this could be related to the ITunes integration (the application will hang if ITunes is not installed) install ITunes copy the jacob.dll (from install/bin) to your system32 directory or turn the option off
×
×
  • Create New...